diff --git a/Seance5-6/seance/composer.json b/Seance5-6/seance/composer.json index bd4486d0150d855c9e56f42bebd5748e9ab3b6cb..f7ed310698e1a060517e266233b477df35d12c06 100644 --- a/Seance5-6/seance/composer.json +++ b/Seance5-6/seance/composer.json @@ -1,7 +1,10 @@ { "require":{ - "illuminate/database": "5.5.*", - "php": ">=7.3", + "illuminate/database": "7.1.*", + "illuminate/pagination": "7.1.*", + "illuminate/contracts": "7.0", + "illuminate/support": "7.0", + "php": ">=7.2.5", "slim/slim": "2.*" }, @@ -12,4 +15,4 @@ } -} +} \ No newline at end of file diff --git a/Seance5-6/seance/composer.lock b/Seance5-6/seance/composer.lock index 660535d623aaf3a036568a4c5479843fc606a952..2057ce78101f0dfd7e474a11d1a967cb6427d6bf 100644 --- a/Seance5-6/seance/composer.lock +++ b/Seance5-6/seance/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "918f4fadf2dea3d631fbcc42c7f1a70a", + "content-hash": "f51eb64861c93ebd4cc6bea90b84aa1c", "packages": [ { "name": "doctrine/inflector", @@ -75,27 +75,27 @@ }, { "name": "illuminate/container", - "version": "v5.5.44", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858" + "reference": "9108edffa95b34df94dc36721d92f380dd59bea3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858", + "url": "https://api.github.com/repos/illuminate/container/zipball/9108edffa95b34df94dc36721d92f380dd59bea3", + "reference": "9108edffa95b34df94dc36721d92f380dd59bea3", "shasum": "" }, "require": { - "illuminate/contracts": "5.5.*", - "php": ">=7.0", - "psr/container": "~1.0" + "illuminate/contracts": "^7.0", + "php": "^7.2.5", + "psr/container": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -115,31 +115,31 @@ ], "description": "The Illuminate Container package.", "homepage": "https://laravel.com", - "time": "2018-01-19T17:58:33+00:00" + "time": "2020-03-18T13:25:12+00:00" }, { "name": "illuminate/contracts", - "version": "v5.5.44", + "version": "v7.0.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528" + "reference": "4e885c85fba40946f75167a2b2ac7902aeb2f2d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/b2a62b4a85485fca9cf5fa61a933ad64006ff528", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/4e885c85fba40946f75167a2b2ac7902aeb2f2d7", + "reference": "4e885c85fba40946f75167a2b2ac7902aeb2f2d7", "shasum": "" }, "require": { - "php": ">=7.0", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" + "php": "^7.2.5", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -159,40 +159,42 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-03-20T15:34:35+00:00" + "time": "2020-02-28T16:28:59+00:00" }, { "name": "illuminate/database", - "version": "v5.5.44", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d" + "reference": "efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/f5403b3dd774eb89ff0ef5e633e57458c3dc537d", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d", + "url": "https://api.github.com/repos/illuminate/database/zipball/efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be", + "reference": "efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be", "shasum": "" }, "require": { - "illuminate/container": "5.5.*", - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*", - "php": ">=7.0" + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5", + "symfony/console": "^5.0" }, "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.5.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.5.*).", - "illuminate/filesystem": "Required to use the migrations (5.5.*).", - "illuminate/pagination": "Required to paginate the result set (5.5.*)." + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (^7.0).", + "illuminate/events": "Required to use the observers with Eloquent (^7.0).", + "illuminate/filesystem": "Required to use the migrations (^7.0).", + "illuminate/pagination": "Required to paginate the result set (^7.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -218,50 +220,38 @@ "orm", "sql" ], - "time": "2018-09-23T18:58:54+00:00" + "time": "2020-03-13T20:26:22+00:00" }, { - "name": "illuminate/support", - "version": "v5.5.44", + "name": "illuminate/pagination", + "version": "v7.1.3", "source": { "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4" + "url": "https://github.com/illuminate/pagination.git", + "reference": "2646cb7e386d10998221c44608297fa70b2fdb20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/5c405512d75dcaf5d37791badce02d86ed8e4bc4", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4", + "url": "https://api.github.com/repos/illuminate/pagination/zipball/2646cb7e386d10998221c44608297fa70b2fdb20", + "reference": "2646cb7e386d10998221c44608297fa70b2fdb20", "shasum": "" }, "require": { - "doctrine/inflector": "~1.1", - "ext-mbstring": "*", - "illuminate/contracts": "5.5.*", - "nesbot/carbon": "^1.24.1", - "php": ">=7.0" - }, - "replace": { - "tightenco/collect": "<5.5.33" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.5.*).", - "symfony/process": "Required to use the composer class (~3.3).", - "symfony/var-dumper": "Required to use the dd function (~3.3)." + "ext-json": "*", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] + "Illuminate\\Pagination\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -273,41 +263,57 @@ "email": "taylor@laravel.com" } ], - "description": "The Illuminate Support package.", + "description": "The Illuminate Pagination package.", "homepage": "https://laravel.com", - "time": "2018-08-10T19:40:01+00:00" + "time": "2020-02-29T19:38:32+00:00" }, { - "name": "kylekatarnls/update-helper", - "version": "1.2.0", + "name": "illuminate/support", + "version": "v7.0.0", "source": { "type": "git", - "url": "https://github.com/kylekatarnls/update-helper.git", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" + "url": "https://github.com/illuminate/support.git", + "reference": "d8bf90a3529cf7df395500bde3a9d458c278e2af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", + "url": "https://api.github.com/repos/illuminate/support/zipball/d8bf90a3529cf7df395500bde3a9d458c278e2af", + "reference": "d8bf90a3529cf7df395500bde3a9d458c278e2af", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0.0", - "php": ">=5.3.0" + "doctrine/inflector": "^1.1", + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/contracts": "^7.0", + "nesbot/carbon": "^2.17", + "php": "^7.2.5", + "voku/portable-ascii": "^1.4.8" }, - "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" + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (^7.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^5.0).", + "symfony/var-dumper": "Required to use the dd function (^5.0).", + "vlucas/phpdotenv": "Required to use the Env class and env helper (^4.0)." }, - "type": "composer-plugin", + "type": "library", "extra": { - "class": "UpdateHelper\\ComposerPlugin" + "branch-alias": { + "dev-master": "7.x-dev" + } }, "autoload": { - "psr-0": { - "UpdateHelper\\": "src/" - } + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -315,43 +321,50 @@ ], "authors": [ { - "name": "Kyle", - "email": "kylekatarnls@gmail.com" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Update helper", - "time": "2019-07-29T11:03:54+00:00" + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com", + "time": "2020-03-02T21:08:38+00:00" }, { "name": "nesbot/carbon", - "version": "1.39.1", + "version": "2.32.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", "shasum": "" }, "require": { - "kylekatarnls/update-helper": "^1.1", - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { - "composer/composer": "^1.2", - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "kylekatarnls/multi-tester": "^1.1", + "phpmd/phpmd": "^2.8", + "phpstan/phpstan": "^0.11", + "phpunit/phpunit": "^7.5 || ^8.0", + "squizlabs/php_codesniffer": "^3.4" }, "bin": [ - "bin/upgrade-carbon" + "bin/carbon" ], "type": "library", "extra": { - "update-helper": "Carbon\\Upgrade", + "branch-alias": { + "dev-master": "2.x-dev" + }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -360,7 +373,7 @@ }, "autoload": { "psr-4": { - "": "src/" + "Carbon\\": "src/Carbon/" } }, "notification-url": "https://packagist.org/downloads/", @@ -372,16 +385,20 @@ "name": "Brian Nesbitt", "email": "brian@nesbot.com", "homepage": "http://nesbot.com" + }, + { + "name": "kylekatarnls", + "homepage": "http://github.com/kylekatarnls" } ], - "description": "A simple API extension for DateTime.", + "description": "An API extension for DateTime that supports 281 different languages.", "homepage": "http://carbon.nesbot.com", "keywords": [ "date", "datetime", "time" ], - "time": "2019-10-14T05:51:36+00:00" + "time": "2020-03-26T13:04:10+00:00" }, { "name": "psr/container", @@ -527,18 +544,94 @@ ], "time": "2017-01-07T12:21:41+00:00" }, + { + "name": "symfony/console", + "version": "v5.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0085aec018950e1161bdf6bcb19fcb0828308cfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0085aec018950e1161bdf6bcb19fcb0828308cfc", + "reference": "0085aec018950e1161bdf6bcb19fcb0828308cfc", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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 Console Component", + "homepage": "https://symfony.com", + "time": "2020-03-16T13:02:39+00:00" + }, { "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", "shasum": "" }, "require": { @@ -550,7 +643,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -584,46 +677,163 @@ "portable", "shim" ], - "time": "2020-01-13T11:15:53+00:00" + "time": "2020-03-09T19:04:49+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "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 backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-02-27T09:26:54+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/translation", - "version": "v4.4.5", + "version": "v5.0.6", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "0a19a77fba20818a969ef03fdaf1602de0546353" + "reference": "91855689b557481ff2d3d97c535d74284e7b814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353", - "reference": "0a19a77fba20818a969ef03fdaf1602de0546353", + "url": "https://api.github.com/repos/symfony/translation/zipball/91855689b557481ff2d3d97c535d74284e7b814a", + "reference": "91855689b557481ff2d3d97c535d74284e7b814a", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6|^2" + "symfony/translation-contracts": "^2" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" }, "provide": { - "symfony/translation-implementation": "1.0" + "symfony/translation-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -633,7 +843,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -660,7 +870,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2020-02-04T09:32:40+00:00" + "time": "2020-03-18T08:00:37+00:00" }, { "name": "symfony/translation-contracts", @@ -718,6 +928,55 @@ "standards" ], "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "1.4.10", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "240e93829a5f985fab0984a6e55ae5e26b78a334" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/240e93829a5f985fab0984a6e55ae5e26b78a334", + "reference": "240e93829a5f985fab0984a6e55ae5e26b78a334", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/", + "voku\\tests\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "time": "2020-03-13T01:23:26+00:00" } ], "packages-dev": [], @@ -727,7 +986,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.3" + "php": ">=7.2.5" }, "platform-dev": [] } diff --git a/Seance5-6/seance/conf.ini b/Seance5-6/seance/conf.ini index 92721d47b0bb6174b0f1efd92df233dd3a6dc8f2..0feca793b8c43630b1bb67012a3c3486098daaa1 100644 --- a/Seance5-6/seance/conf.ini +++ b/Seance5-6/seance/conf.ini @@ -1,5 +1,5 @@ driver=mysql username=root -password= +password=root host=localhost -database=applibd \ No newline at end of file +database=gamepedia \ No newline at end of file diff --git a/Seance5-6/seance/index.php b/Seance5-6/seance/index.php index c028f9ccca3ceff6c304fde176f1d29cb90bf42d..24133e2352d2d70741a114604f931ce832642591 100644 --- a/Seance5-6/seance/index.php +++ b/Seance5-6/seance/index.php @@ -2,7 +2,7 @@ require 'vendor/autoload.php'; use seance\modele\Game; -use seance\controller\IndexController; +use seance\controller\IndexController; use Illuminate\Database\Capsule\Manager as DB; $file = parse_ini_file('conf.ini'); @@ -12,9 +12,9 @@ $db->setAsGlobal(); $db->bootEloquent(); $app = new \Slim\Slim(); - $app->get('/', function(){ echo "page index"; + IndexController::index(); })->name('testIndex'); $app->get('/api/games/:id', function($id){ diff --git a/Seance5-6/seance/src/controller/IndexController.php b/Seance5-6/seance/src/controller/IndexController.php index ee94bb7bc95543c8ef0b3af27afe7d4a428ad1e5..2ba177de5967971710b023d3c900ec27385bc07b 100644 --- a/Seance5-6/seance/src/controller/IndexController.php +++ b/Seance5-6/seance/src/controller/IndexController.php @@ -5,6 +5,10 @@ namespace seance\controller; use seance\modele\Game; use seance\view\VuePartie1; use seance\view\VuePartie2; +use seance\view\CQuestion2; +use App\Http\Controllers\Controller; +use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Pagination\Paginator; class IndexController { @@ -27,23 +31,20 @@ class IndexController $json = $json . json_encode($value) . ',},"links" :{"self": {"href":"/api/games/'.$value->id.'"}}'; } $json = $json . ']}'; - $cq2 = new CQuestion2($json); + $cq2 = new VuePartie2($json); $cq2->render(); /* $game = Game::select('id','name','alias','deck')->where('id','<=','200')->get(); // $game = Game::where('id','=',1)->get(); // $json = json_encode($game,JSON_FORCE_OBJECT); foreach($game as $key => $value) { -<<<<<<< HEAD $json = $json . json_encode($value) . ','; /*$json = $json . '{ "id": ' . $value->id . ', "name":' . $value->name . ', "deck":' . $value->deck . ', }, - ';*/ - if ($value->id == 200) { - $json = $json . json_encode($value);/* + ';*//* $json = $json . '{ "id": ' . $value->id . ', "name":' . $value->name . ', @@ -53,13 +54,12 @@ class IndexController } } $json = $json . ']}'; -======= $value->description = "..."; } $json = json_encode($game); ->>>>>>> e2c791070c5330916f63fb55c2b639a71a327bcb $cq2 = new VuePartie2($json); $cq2->render();*/ + } public static function partie5($id){ @@ -80,4 +80,19 @@ class IndexController $vue->render(); } + public static function index() { + $file = parse_ini_file('conf.ini'); + $db = new DB(); + $db->addConnection($file); + $db->setAsGlobal(); + $db->bootEloquent(); + $users = $db::table('game')->paginate(200); + $json = ''; + foreach($users as $value) { + $json = $json . $value->id . "<br>"; + } + $vue = new VuePartie2(json_encode($json)); + $vue->render(); +} + } \ No newline at end of file diff --git a/Seance5-6/seance/vendor/autoload.php b/Seance5-6/seance/vendor/autoload.php index ef976f56c8e36adbf5220b52677646327f139fe7..e9aa641f30e7295689a9f89a7e8bba4f7e8c3741 100644 --- a/Seance5-6/seance/vendor/autoload.php +++ b/Seance5-6/seance/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918::getLoader(); +return ComposerAutoloaderInit71c0403305ebd7f6d322793c9b46446c::getLoader(); diff --git a/Seance5-6/seance/vendor/bin/upgrade-carbon b/Seance5-6/seance/vendor/bin/upgrade-carbon deleted file mode 100644 index 00f27f40d67dc17abbb3e39d5628f6fe0a59e055..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/bin/upgrade-carbon +++ /dev/null @@ -1,14 +0,0 @@ -#!/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/Seance5-6/seance/vendor/bin/upgrade-carbon.bat b/Seance5-6/seance/vendor/bin/upgrade-carbon.bat deleted file mode 100644 index a6372b27d1f440349fb032ad19853eeaae1ad1ad..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/bin/upgrade-carbon.bat +++ /dev/null @@ -1,4 +0,0 @@ -@ECHO OFF -setlocal DISABLEDELAYEDEXPANSION -SET BIN_TARGET=%~dp0/../nesbot/carbon/bin/upgrade-carbon -php "%BIN_TARGET%" %* diff --git a/Seance5-6/seance/vendor/composer/autoload_classmap.php b/Seance5-6/seance/vendor/composer/autoload_classmap.php index 7a91153b0d8ea10bc693176a81d8a9eb96883a76..5db5c9773020f5c97a96b2be20c9dd954abb3458 100644 --- a/Seance5-6/seance/vendor/composer/autoload_classmap.php +++ b/Seance5-6/seance/vendor/composer/autoload_classmap.php @@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', ); diff --git a/Seance5-6/seance/vendor/composer/autoload_files.php b/Seance5-6/seance/vendor/composer/autoload_files.php index b9aeb221851cf9af7de2713ace04ba33c9f61019..8489120ea62938772f46567e8eb1ea20fda1f3e1 100644 --- a/Seance5-6/seance/vendor/composer/autoload_files.php +++ b/Seance5-6/seance/vendor/composer/autoload_files.php @@ -7,5 +7,6 @@ $baseDir = dirname($vendorDir); return array( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php', ); diff --git a/Seance5-6/seance/vendor/composer/autoload_namespaces.php b/Seance5-6/seance/vendor/composer/autoload_namespaces.php index e7b19d72684e34ca6fd896dce85767929271b38d..58e60b167352dcdf361d18e50a30ea717f4698b0 100644 --- a/Seance5-6/seance/vendor/composer/autoload_namespaces.php +++ b/Seance5-6/seance/vendor/composer/autoload_namespaces.php @@ -6,6 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'UpdateHelper\\' => array($vendorDir . '/kylekatarnls/update-helper/src'), 'Slim' => array($vendorDir . '/slim/slim'), ); diff --git a/Seance5-6/seance/vendor/composer/autoload_psr4.php b/Seance5-6/seance/vendor/composer/autoload_psr4.php index c4ed0685d4ab6ab7dca356c2d0a99459bd44028a..0448757d0b4fa09b3d10a9866b53c71a81e24bb6 100644 --- a/Seance5-6/seance/vendor/composer/autoload_psr4.php +++ b/Seance5-6/seance/vendor/composer/autoload_psr4.php @@ -6,16 +6,22 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'voku\\tests\\' => array($vendorDir . '/voku/portable-ascii/tests'), + 'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'), 'seance\\' => array($baseDir . '/src'), + 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), + 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'), + 'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'), 'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'), 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), 'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'), 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'), - '' => array($vendorDir . '/nesbot/carbon/src'), + 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), ); diff --git a/Seance5-6/seance/vendor/composer/autoload_real.php b/Seance5-6/seance/vendor/composer/autoload_real.php index ec342fc73a8f10ebd97f6deba0fae6ecefc8b4f2..7b328bc34e5acd9bb96107146478755f4ecf1921 100644 --- a/Seance5-6/seance/vendor/composer/autoload_real.php +++ b/Seance5-6/seance/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918 +class ComposerAutoloaderInit71c0403305ebd7f6d322793c9b46446c { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit71c0403305ebd7f6d322793c9b46446c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit71c0403305ebd7f6d322793c9b46446c', 'loadClassLoader')); $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'; - call_user_func(\Composer\Autoload\ComposerStaticInit2418a93e3afa2d154375a669cfc71918::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit2418a93e3afa2d154375a669cfc71918 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit2418a93e3afa2d154375a669cfc71918::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire2418a93e3afa2d154375a669cfc71918($fileIdentifier, $file); + composerRequire71c0403305ebd7f6d322793c9b46446c($fileIdentifier, $file); } return $loader; } } -function composerRequire2418a93e3afa2d154375a669cfc71918($fileIdentifier, $file) +function composerRequire71c0403305ebd7f6d322793c9b46446c($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/Seance5-6/seance/vendor/composer/autoload_static.php b/Seance5-6/seance/vendor/composer/autoload_static.php index edfca822df48c58ae2f8f18793b840c59eadf796..793cb96a115b2fbb52afa3283a05efcf20208482 100644 --- a/Seance5-6/seance/vendor/composer/autoload_static.php +++ b/Seance5-6/seance/vendor/composer/autoload_static.php @@ -4,23 +4,32 @@ namespace Composer\Autoload; -class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 +class ComposerStaticInit71c0403305ebd7f6d322793c9b46446c { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', '72579e7bd17821bb1321b87411366eae' => __DIR__ . '/..' . '/illuminate/support/helpers.php', ); public static $prefixLengthsPsr4 = array ( + 'v' => + array ( + 'voku\\tests\\' => 11, + 'voku\\' => 5, + ), 's' => array ( 'seance\\' => 7, ), 'S' => array ( + 'Symfony\\Polyfill\\Php73\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, 'Symfony\\Contracts\\Translation\\' => 30, + 'Symfony\\Contracts\\Service\\' => 26, 'Symfony\\Component\\Translation\\' => 30, + 'Symfony\\Component\\Console\\' => 26, ), 'P' => array ( @@ -30,6 +39,7 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 'I' => array ( 'Illuminate\\Support\\' => 19, + 'Illuminate\\Pagination\\' => 22, 'Illuminate\\Database\\' => 20, 'Illuminate\\Contracts\\' => 21, 'Illuminate\\Container\\' => 21, @@ -38,13 +48,29 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 array ( 'Doctrine\\Common\\Inflector\\' => 26, ), + 'C' => + array ( + 'Carbon\\' => 7, + ), ); public static $prefixDirsPsr4 = array ( + 'voku\\tests\\' => + array ( + 0 => __DIR__ . '/..' . '/voku/portable-ascii/tests', + ), + 'voku\\' => + array ( + 0 => __DIR__ . '/..' . '/voku/portable-ascii/src/voku', + ), 'seance\\' => array ( 0 => __DIR__ . '/../..' . '/src', ), + 'Symfony\\Polyfill\\Php73\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php73', + ), 'Symfony\\Polyfill\\Mbstring\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', @@ -53,10 +79,18 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 array ( 0 => __DIR__ . '/..' . '/symfony/translation-contracts', ), + 'Symfony\\Contracts\\Service\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/service-contracts', + ), 'Symfony\\Component\\Translation\\' => array ( 0 => __DIR__ . '/..' . '/symfony/translation', ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), 'Psr\\SimpleCache\\' => array ( 0 => __DIR__ . '/..' . '/psr/simple-cache/src', @@ -69,6 +103,10 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 array ( 0 => __DIR__ . '/..' . '/illuminate/support', ), + 'Illuminate\\Pagination\\' => + array ( + 0 => __DIR__ . '/..' . '/illuminate/pagination', + ), 'Illuminate\\Database\\' => array ( 0 => __DIR__ . '/..' . '/illuminate/database', @@ -85,20 +123,13 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 array ( 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector', ), - ); - - public static $fallbackDirsPsr4 = array ( - 0 => __DIR__ . '/..' . '/nesbot/carbon/src', + 'Carbon\\' => + array ( + 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', + ), ); public static $prefixesPsr0 = array ( - 'U' => - array ( - 'UpdateHelper\\' => - array ( - 0 => __DIR__ . '/..' . '/kylekatarnls/update-helper/src', - ), - ), 'S' => array ( 'Slim' => @@ -108,13 +139,17 @@ class ComposerStaticInit2418a93e3afa2d154375a669cfc71918 ), ); + public static $classMap = array ( + 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + ); + public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit2418a93e3afa2d154375a669cfc71918::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit2418a93e3afa2d154375a669cfc71918::$prefixDirsPsr4; - $loader->fallbackDirsPsr4 = ComposerStaticInit2418a93e3afa2d154375a669cfc71918::$fallbackDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit2418a93e3afa2d154375a669cfc71918::$prefixesPsr0; + $loader->prefixLengthsPsr4 = ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::$prefixesPsr0; + $loader->classMap = ComposerStaticInit71c0403305ebd7f6d322793c9b46446c::$classMap; }, null, ClassLoader::class); } diff --git a/Seance5-6/seance/vendor/composer/installed.json b/Seance5-6/seance/vendor/composer/installed.json index bb78a422d91cbb04a365d48ebcf5ed237ad09ab0..94a919d1e382cf8d08783a7a1df82f921c8d3e4f 100644 --- a/Seance5-6/seance/vendor/composer/installed.json +++ b/Seance5-6/seance/vendor/composer/installed.json @@ -70,29 +70,29 @@ }, { "name": "illuminate/container", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "version": "v7.3.0", + "version_normalized": "7.3.0.0", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858" + "reference": "9108edffa95b34df94dc36721d92f380dd59bea3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858", - "reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858", + "url": "https://api.github.com/repos/illuminate/container/zipball/9108edffa95b34df94dc36721d92f380dd59bea3", + "reference": "9108edffa95b34df94dc36721d92f380dd59bea3", "shasum": "" }, "require": { - "illuminate/contracts": "5.5.*", - "php": ">=7.0", - "psr/container": "~1.0" + "illuminate/contracts": "^7.0", + "php": "^7.2.5", + "psr/container": "^1.0" }, - "time": "2018-01-19T17:58:33+00:00", + "time": "2020-03-18T13:25:12+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "installation-source": "dist", @@ -116,29 +116,29 @@ }, { "name": "illuminate/contracts", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "version": "v7.0.0", + "version_normalized": "7.0.0.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528" + "reference": "4e885c85fba40946f75167a2b2ac7902aeb2f2d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/b2a62b4a85485fca9cf5fa61a933ad64006ff528", - "reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/4e885c85fba40946f75167a2b2ac7902aeb2f2d7", + "reference": "4e885c85fba40946f75167a2b2ac7902aeb2f2d7", "shasum": "" }, "require": { - "php": ">=7.0", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" + "php": "^7.2.5", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" }, - "time": "2018-03-20T15:34:35+00:00", + "time": "2020-02-28T16:28:59+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "installation-source": "dist", @@ -162,38 +162,40 @@ }, { "name": "illuminate/database", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "version": "v7.1.3", + "version_normalized": "7.1.3.0", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d" + "reference": "efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/f5403b3dd774eb89ff0ef5e633e57458c3dc537d", - "reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d", + "url": "https://api.github.com/repos/illuminate/database/zipball/efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be", + "reference": "efdc21abf1dfa1e0e8f8ec5c1ca63c62cbc830be", "shasum": "" }, "require": { - "illuminate/container": "5.5.*", - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*", - "php": ">=7.0" + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5", + "symfony/console": "^5.0" }, "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.5.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.5.*).", - "illuminate/filesystem": "Required to use the migrations (5.5.*).", - "illuminate/pagination": "Required to paginate the result set (5.5.*)." - }, - "time": "2018-09-23T18:58:54+00:00", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (^7.0).", + "illuminate/events": "Required to use the observers with Eloquent (^7.0).", + "illuminate/filesystem": "Required to use the migrations (^7.0).", + "illuminate/pagination": "Required to paginate the result set (^7.0)." + }, + "time": "2020-03-13T20:26:22+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "installation-source": "dist", @@ -222,50 +224,38 @@ ] }, { - "name": "illuminate/support", - "version": "v5.5.44", - "version_normalized": "5.5.44.0", + "name": "illuminate/pagination", + "version": "v7.1.3", + "version_normalized": "7.1.3.0", "source": { "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4" + "url": "https://github.com/illuminate/pagination.git", + "reference": "2646cb7e386d10998221c44608297fa70b2fdb20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/5c405512d75dcaf5d37791badce02d86ed8e4bc4", - "reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4", + "url": "https://api.github.com/repos/illuminate/pagination/zipball/2646cb7e386d10998221c44608297fa70b2fdb20", + "reference": "2646cb7e386d10998221c44608297fa70b2fdb20", "shasum": "" }, "require": { - "doctrine/inflector": "~1.1", - "ext-mbstring": "*", - "illuminate/contracts": "5.5.*", - "nesbot/carbon": "^1.24.1", - "php": ">=7.0" - }, - "replace": { - "tightenco/collect": "<5.5.33" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.5.*).", - "symfony/process": "Required to use the composer class (~3.3).", - "symfony/var-dumper": "Required to use the dd function (~3.3)." + "ext-json": "*", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5" }, - "time": "2018-08-10T19:40:01+00:00", + "time": "2020-02-29T19:38:32+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] + "Illuminate\\Pagination\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -277,43 +267,59 @@ "email": "taylor@laravel.com" } ], - "description": "The Illuminate Support package.", + "description": "The Illuminate Pagination package.", "homepage": "https://laravel.com" }, { - "name": "kylekatarnls/update-helper", - "version": "1.2.0", - "version_normalized": "1.2.0.0", + "name": "illuminate/support", + "version": "v7.0.0", + "version_normalized": "7.0.0.0", "source": { "type": "git", - "url": "https://github.com/kylekatarnls/update-helper.git", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" + "url": "https://github.com/illuminate/support.git", + "reference": "d8bf90a3529cf7df395500bde3a9d458c278e2af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", - "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", + "url": "https://api.github.com/repos/illuminate/support/zipball/d8bf90a3529cf7df395500bde3a9d458c278e2af", + "reference": "d8bf90a3529cf7df395500bde3a9d458c278e2af", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0.0", - "php": ">=5.3.0" + "doctrine/inflector": "^1.1", + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/contracts": "^7.0", + "nesbot/carbon": "^2.17", + "php": "^7.2.5", + "voku/portable-ascii": "^1.4.8" }, - "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" + "conflict": { + "tightenco/collect": "<5.5.33" }, - "time": "2019-07-29T11:03:54+00:00", - "type": "composer-plugin", + "suggest": { + "illuminate/filesystem": "Required to use the composer class (^7.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^5.0).", + "symfony/var-dumper": "Required to use the dd function (^5.0).", + "vlucas/phpdotenv": "Required to use the Env class and env helper (^4.0)." + }, + "time": "2020-03-02T21:08:38+00:00", + "type": "library", "extra": { - "class": "UpdateHelper\\ComposerPlugin" + "branch-alias": { + "dev-master": "7.x-dev" + } }, "installation-source": "dist", "autoload": { - "psr-0": { - "UpdateHelper\\": "src/" - } + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -321,44 +327,51 @@ ], "authors": [ { - "name": "Kyle", - "email": "kylekatarnls@gmail.com" + "name": "Taylor Otwell", + "email": "taylor@laravel.com" } ], - "description": "Update helper" + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com" }, { "name": "nesbot/carbon", - "version": "1.39.1", - "version_normalized": "1.39.1.0", + "version": "2.32.1", + "version_normalized": "2.32.1.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", - "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", "shasum": "" }, "require": { - "kylekatarnls/update-helper": "^1.1", - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { - "composer/composer": "^1.2", - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "time": "2019-10-14T05:51:36+00:00", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "kylekatarnls/multi-tester": "^1.1", + "phpmd/phpmd": "^2.8", + "phpstan/phpstan": "^0.11", + "phpunit/phpunit": "^7.5 || ^8.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2020-03-26T13:04:10+00:00", "bin": [ - "bin/upgrade-carbon" + "bin/carbon" ], "type": "library", "extra": { - "update-helper": "Carbon\\Upgrade", + "branch-alias": { + "dev-master": "2.x-dev" + }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -368,7 +381,7 @@ "installation-source": "dist", "autoload": { "psr-4": { - "": "src/" + "Carbon\\": "src/Carbon/" } }, "notification-url": "https://packagist.org/downloads/", @@ -380,9 +393,13 @@ "name": "Brian Nesbitt", "email": "brian@nesbot.com", "homepage": "http://nesbot.com" + }, + { + "name": "kylekatarnls", + "homepage": "http://github.com/kylekatarnls" } ], - "description": "A simple API extension for DateTime.", + "description": "An API extension for DateTime that supports 281 different languages.", "homepage": "http://carbon.nesbot.com", "keywords": [ "date", @@ -540,19 +557,97 @@ "router" ] }, + { + "name": "symfony/console", + "version": "v5.0.6", + "version_normalized": "5.0.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0085aec018950e1161bdf6bcb19fcb0828308cfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0085aec018950e1161bdf6bcb19fcb0828308cfc", + "reference": "0085aec018950e1161bdf6bcb19fcb0828308cfc", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "time": "2020-03-16T13:02:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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 Console Component", + "homepage": "https://symfony.com" + }, { "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", - "version_normalized": "1.14.0.0", + "version": "v1.15.0", + "version_normalized": "1.15.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", "shasum": "" }, "require": { @@ -561,11 +656,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2020-01-13T11:15:53+00:00", + "time": "2020-03-09T19:04:49+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.15-dev" } }, "installation-source": "dist", @@ -601,56 +696,177 @@ "shim" ] }, + { + "name": "symfony/polyfill-php73", + "version": "v1.15.0", + "version_normalized": "1.15.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2020-02-27T09:26:54+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "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 backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "time": "2019-11-18T17:27:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ] + }, { "name": "symfony/translation", - "version": "v4.4.5", - "version_normalized": "4.4.5.0", + "version": "v5.0.6", + "version_normalized": "5.0.6.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "0a19a77fba20818a969ef03fdaf1602de0546353" + "reference": "91855689b557481ff2d3d97c535d74284e7b814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353", - "reference": "0a19a77fba20818a969ef03fdaf1602de0546353", + "url": "https://api.github.com/repos/symfony/translation/zipball/91855689b557481ff2d3d97c535d74284e7b814a", + "reference": "91855689b557481ff2d3d97c535d74284e7b814a", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6|^2" + "symfony/translation-contracts": "^2" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" }, "provide": { - "symfony/translation-implementation": "1.0" + "symfony/translation-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, - "time": "2020-02-04T09:32:40+00:00", + "time": "2020-03-18T08:00:37+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } }, "installation-source": "dist", @@ -737,5 +953,56 @@ "interoperability", "standards" ] + }, + { + "name": "voku/portable-ascii", + "version": "1.4.10", + "version_normalized": "1.4.10.0", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "240e93829a5f985fab0984a6e55ae5e26b78a334" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/240e93829a5f985fab0984a6e55ae5e26b78a334", + "reference": "240e93829a5f985fab0984a6e55ae5e26b78a334", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "time": "2020-03-13T01:23:26+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "voku\\": "src/voku/", + "voku\\tests\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ] } ] diff --git a/Seance5-6/seance/vendor/illuminate/container/BoundMethod.php b/Seance5-6/seance/vendor/illuminate/container/BoundMethod.php index 0dfd6fdc5bd0b6cf071a629c4ecd9bf58d5a8aff..8501232621e7af5f85f0737b1b13fe9b4169118d 100644 --- a/Seance5-6/seance/vendor/illuminate/container/BoundMethod.php +++ b/Seance5-6/seance/vendor/illuminate/container/BoundMethod.php @@ -3,9 +3,9 @@ namespace Illuminate\Container; use Closure; -use ReflectionMethod; -use ReflectionFunction; use InvalidArgumentException; +use ReflectionFunction; +use ReflectionMethod; class BoundMethod { @@ -17,6 +17,9 @@ class BoundMethod * @param array $parameters * @param string|null $defaultMethod * @return mixed + * + * @throws \ReflectionException + * @throws \InvalidArgumentException */ public static function call($container, $callback, array $parameters = [], $defaultMethod = null) { @@ -49,7 +52,7 @@ class BoundMethod // We will assume an @ sign is used to delimit the class name from the method // name. We will split on this @ sign and then build a callable array that // we can pass right back into the "call" method for dependency binding. - $method = count($segments) == 2 + $method = count($segments) === 2 ? $segments[1] : $defaultMethod; if (is_null($method)) { @@ -72,7 +75,7 @@ class BoundMethod protected static function callBoundMethod($container, $callback, $default) { if (! is_array($callback)) { - return $default instanceof Closure ? $default() : $default; + return Util::unwrapIfClosure($default); } // Here we need to turn the array callable into a Class@method string we can use to @@ -84,7 +87,7 @@ class BoundMethod return $container->callMethodBinding($method, $callback[0]); } - return $default instanceof Closure ? $default() : $default; + return Util::unwrapIfClosure($default); } /** @@ -107,6 +110,8 @@ class BoundMethod * @param callable|string $callback * @param array $parameters * @return array + * + * @throws \ReflectionException */ protected static function getMethodDependencies($container, $callback, array $parameters = []) { @@ -124,11 +129,15 @@ class BoundMethod * * @param callable|string $callback * @return \ReflectionFunctionAbstract + * + * @throws \ReflectionException */ protected static function getCallReflector($callback) { if (is_string($callback) && strpos($callback, '::') !== false) { $callback = explode('::', $callback); + } elseif (is_object($callback) && ! $callback instanceof Closure) { + $callback = [$callback, '__invoke']; } return is_array($callback) @@ -143,7 +152,7 @@ class BoundMethod * @param \ReflectionParameter $parameter * @param array $parameters * @param array $dependencies - * @return mixed + * @return void */ protected static function addDependencyForCallParameter($container, $parameter, array &$parameters, &$dependencies) @@ -152,6 +161,10 @@ class BoundMethod $dependencies[] = $parameters[$parameter->name]; unset($parameters[$parameter->name]); + } elseif ($parameter->getClass() && array_key_exists($parameter->getClass()->name, $parameters)) { + $dependencies[] = $parameters[$parameter->getClass()->name]; + + unset($parameters[$parameter->getClass()->name]); } elseif ($parameter->getClass()) { $dependencies[] = $container->make($parameter->getClass()->name); } elseif ($parameter->isDefaultValueAvailable()) { diff --git a/Seance5-6/seance/vendor/illuminate/container/Container.php b/Seance5-6/seance/vendor/illuminate/container/Container.php index 61c2b5effc7281872f3f14c9ecf4d0bc4aa785ea..96204f6b2fe195cbf7bedd6d4b14b9eaab3b69d7 100644 --- a/Seance5-6/seance/vendor/illuminate/container/Container.php +++ b/Seance5-6/seance/vendor/illuminate/container/Container.php @@ -2,13 +2,15 @@ namespace Illuminate\Container; -use Closure; use ArrayAccess; +use Closure; +use Exception; +use Illuminate\Contracts\Container\BindingResolutionException; +use Illuminate\Contracts\Container\Container as ContainerContract; use LogicException; use ReflectionClass; +use ReflectionException; use ReflectionParameter; -use Illuminate\Contracts\Container\BindingResolutionException; -use Illuminate\Contracts\Container\Container as ContainerContract; class Container implements ArrayAccess, ContainerContract { @@ -22,124 +24,130 @@ class Container implements ArrayAccess, ContainerContract /** * An array of the types that have been resolved. * - * @var array + * @var bool[] */ protected $resolved = []; /** * The container's bindings. * - * @var array + * @var array[] */ protected $bindings = []; /** * The container's method bindings. * - * @var array + * @var \Closure[] */ protected $methodBindings = []; /** * The container's shared instances. * - * @var array + * @var object[] */ protected $instances = []; /** * The registered type aliases. * - * @var array + * @var string[] */ protected $aliases = []; /** * The registered aliases keyed by the abstract name. * - * @var array + * @var array[] */ protected $abstractAliases = []; /** * The extension closures for services. * - * @var array + * @var array[] */ protected $extenders = []; /** * All of the registered tags. * - * @var array + * @var array[] */ protected $tags = []; /** * The stack of concretions currently being built. * - * @var array + * @var array[] */ protected $buildStack = []; /** * The parameter override stack. * - * @var array + * @var array[] */ protected $with = []; /** * The contextual binding map. * - * @var array + * @var array[] */ public $contextual = []; /** * All of the registered rebound callbacks. * - * @var array + * @var array[] */ protected $reboundCallbacks = []; /** * All of the global resolving callbacks. * - * @var array + * @var \Closure[] */ protected $globalResolvingCallbacks = []; /** * All of the global after resolving callbacks. * - * @var array + * @var \Closure[] */ protected $globalAfterResolvingCallbacks = []; /** * All of the resolving callbacks by class type. * - * @var array + * @var array[] */ protected $resolvingCallbacks = []; /** * All of the after resolving callbacks by class type. * - * @var array + * @var array[] */ protected $afterResolvingCallbacks = []; /** * Define a contextual binding. * - * @param string $concrete + * @param array|string $concrete * @return \Illuminate\Contracts\Container\ContextualBindingBuilder */ public function when($concrete) { - return new ContextualBindingBuilder($this, $this->getAlias($concrete)); + $aliases = []; + + foreach (Util::arrayWrap($concrete) as $c) { + $aliases[] = $this->getAlias($c); + } + + return new ContextualBindingBuilder($this, $aliases); } /** @@ -188,7 +196,7 @@ class Container implements ArrayAccess, ContainerContract public function isShared($abstract) { return isset($this->instances[$abstract]) || - (isset($this->bindings[$abstract]['shared']) && + (isset($this->bindings[$abstract]['shared']) && $this->bindings[$abstract]['shared'] === true); } @@ -213,11 +221,11 @@ class Container implements ArrayAccess, ContainerContract */ public function bind($abstract, $concrete = null, $shared = false) { + $this->dropStaleInstances($abstract); + // If no concrete type was given, we will simply set the concrete type to the // abstract type. After that, the concrete type to be registered as shared // without being forced to state their classes in both of the parameters. - $this->dropStaleInstances($abstract); - if (is_null($concrete)) { $concrete = $abstract; } @@ -253,7 +261,9 @@ class Container implements ArrayAccess, ContainerContract return $container->build($concrete); } - return $container->make($concrete, $parameters); + return $container->resolve( + $concrete, $parameters, $raiseEvents = false + ); }; } @@ -271,13 +281,28 @@ class Container implements ArrayAccess, ContainerContract /** * Bind a callback to resolve with Container::call. * - * @param string $method + * @param array|string $method * @param \Closure $callback * @return void */ public function bindMethod($method, $callback) { - $this->methodBindings[$method] = $callback; + $this->methodBindings[$this->parseBindMethod($method)] = $callback; + } + + /** + * Get the method to be bound in class@method format. + * + * @param array|string $method + * @return string + */ + protected function parseBindMethod($method) + { + if (is_array($method)) { + return $method[0].'@'.$method[1]; + } + + return $method; } /** @@ -332,10 +357,24 @@ class Container implements ArrayAccess, ContainerContract $this->bind($abstract, $concrete, true); } + /** + * Register a shared binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singletonIf($abstract, $concrete = null) + { + if (! $this->bound($abstract)) { + $this->singleton($abstract, $concrete); + } + } + /** * "Extend" an abstract type in the container. * - * @param string $abstract + * @param string $abstract * @param \Closure $closure * @return void * @@ -362,7 +401,7 @@ class Container implements ArrayAccess, ContainerContract * Register an existing instance as shared in the container. * * @param string $abstract - * @param mixed $instance + * @param mixed $instance * @return mixed */ public function instance($abstract, $instance) @@ -410,7 +449,7 @@ class Container implements ArrayAccess, ContainerContract * Assign a set of tags to a given binding. * * @param array|string $abstracts - * @param array|mixed ...$tags + * @param array|mixed ...$tags * @return void */ public function tag($abstracts, $tags) @@ -432,19 +471,19 @@ class Container implements ArrayAccess, ContainerContract * Resolve all of the bindings for a given tag. * * @param string $tag - * @return array + * @return iterable */ public function tagged($tag) { - $results = []; + if (! isset($this->tags[$tag])) { + return []; + } - if (isset($this->tags[$tag])) { + return new RewindableGenerator(function () use ($tag) { foreach ($this->tags[$tag] as $abstract) { - $results[] = $this->make($abstract); + yield $this->make($abstract); } - } - - return $results; + }, count($this->tags[$tag])); } /** @@ -453,9 +492,15 @@ class Container implements ArrayAccess, ContainerContract * @param string $abstract * @param string $alias * @return void + * + * @throws \LogicException */ public function alias($abstract, $alias) { + if ($alias === $abstract) { + throw new LogicException("[{$abstract}] is aliased to itself."); + } + $this->aliases[$alias] = $abstract; $this->abstractAliases[$abstract][] = $alias; @@ -464,7 +509,7 @@ class Container implements ArrayAccess, ContainerContract /** * Bind a new callback to an abstract's rebind event. * - * @param string $abstract + * @param string $abstract * @param \Closure $callback * @return mixed */ @@ -481,7 +526,7 @@ class Container implements ArrayAccess, ContainerContract * Refresh an instance on the given target and method. * * @param string $abstract - * @param mixed $target + * @param mixed $target * @param string $method * @return mixed */ @@ -515,11 +560,7 @@ class Container implements ArrayAccess, ContainerContract */ protected function getReboundCallbacks($abstract) { - if (isset($this->reboundCallbacks[$abstract])) { - return $this->reboundCallbacks[$abstract]; - } - - return []; + return $this->reboundCallbacks[$abstract] ?? []; } /** @@ -540,9 +581,11 @@ class Container implements ArrayAccess, ContainerContract * Call the given Closure / class@method and inject its dependencies. * * @param callable|string $callback - * @param array $parameters + * @param array<string, mixed> $parameters * @param string|null $defaultMethod * @return mixed + * + * @throws \InvalidArgumentException */ public function call($callback, array $parameters = [], $defaultMethod = null) { @@ -568,6 +611,8 @@ class Container implements ArrayAccess, ContainerContract * @param string $abstract * @param array $parameters * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function makeWith($abstract, array $parameters = []) { @@ -580,6 +625,8 @@ class Container implements ArrayAccess, ContainerContract * @param string $abstract * @param array $parameters * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function make($abstract, array $parameters = []) { @@ -591,11 +638,15 @@ class Container implements ArrayAccess, ContainerContract */ public function get($id) { - if ($this->has($id)) { + try { return $this->resolve($id); - } + } catch (Exception $e) { + if ($this->has($id)) { + throw $e; + } - throw new EntryNotFoundException; + throw new EntryNotFoundException($id, $e->getCode(), $e); + } } /** @@ -603,9 +654,12 @@ class Container implements ArrayAccess, ContainerContract * * @param string $abstract * @param array $parameters + * @param bool $raiseEvents * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ - protected function resolve($abstract, $parameters = []) + protected function resolve($abstract, $parameters = [], $raiseEvents = true) { $abstract = $this->getAlias($abstract); @@ -647,7 +701,9 @@ class Container implements ArrayAccess, ContainerContract $this->instances[$abstract] = $object; } - $this->fireResolvingCallbacks($abstract, $object); + if ($raiseEvents) { + $this->fireResolvingCallbacks($abstract, $object); + } // Before returning, we will also set the resolved flag to "true" and pop off // the parameter overrides for this build. After those two things are done @@ -663,7 +719,7 @@ class Container implements ArrayAccess, ContainerContract * Get the concrete type for a given abstract. * * @param string $abstract - * @return mixed $concrete + * @return mixed */ protected function getConcrete($abstract) { @@ -685,7 +741,7 @@ class Container implements ArrayAccess, ContainerContract * Get the contextual concrete binding for the given abstract. * * @param string $abstract - * @return string|null + * @return \Closure|string|null */ protected function getContextualConcrete($abstract) { @@ -711,19 +767,17 @@ class Container implements ArrayAccess, ContainerContract * Find the concrete binding for the given abstract in the contextual binding array. * * @param string $abstract - * @return string|null + * @return \Closure|string|null */ protected function findInContextualBindings($abstract) { - if (isset($this->contextual[end($this->buildStack)][$abstract])) { - return $this->contextual[end($this->buildStack)][$abstract]; - } + return $this->contextual[end($this->buildStack)][$abstract] ?? null; } /** * Determine if the given concrete is buildable. * - * @param mixed $concrete + * @param mixed $concrete * @param string $abstract * @return bool */ @@ -735,7 +789,7 @@ class Container implements ArrayAccess, ContainerContract /** * Instantiate a concrete instance of the given type. * - * @param string $concrete + * @param \Closure|string $concrete * @return mixed * * @throws \Illuminate\Contracts\Container\BindingResolutionException @@ -749,10 +803,14 @@ class Container implements ArrayAccess, ContainerContract return $concrete($this, $this->getLastParameterOverride()); } - $reflector = new ReflectionClass($concrete); + try { + $reflector = new ReflectionClass($concrete); + } catch (ReflectionException $e) { + throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); + } // 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 + // an abstract type such as an Interface or Abstract Class and there is // no binding registered for the abstractions so we need to bail out. if (! $reflector->isInstantiable()) { return $this->notInstantiable($concrete); @@ -776,9 +834,13 @@ class Container implements ArrayAccess, ContainerContract // 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. - $instances = $this->resolveDependencies( - $dependencies - ); + try { + $instances = $this->resolveDependencies($dependencies); + } catch (BindingResolutionException $e) { + array_pop($this->buildStack); + + throw $e; + } array_pop($this->buildStack); @@ -790,6 +852,8 @@ class Container implements ArrayAccess, ContainerContract * * @param array $dependencies * @return array + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function resolveDependencies(array $dependencies) { @@ -977,7 +1041,7 @@ class Container implements ArrayAccess, ContainerContract * Fire all of the resolving callbacks. * * @param string $abstract - * @param mixed $object + * @param mixed $object * @return void */ protected function fireResolvingCallbacks($abstract, $object) @@ -995,7 +1059,7 @@ class Container implements ArrayAccess, ContainerContract * Fire all of the after resolving callbacks. * * @param string $abstract - * @param mixed $object + * @param mixed $object * @return void */ protected function fireAfterResolvingCallbacks($abstract, $object) @@ -1012,7 +1076,7 @@ class Container implements ArrayAccess, ContainerContract * * @param string $abstract * @param object $object - * @param array $callbacksPerType + * @param array $callbacksPerType * * @return array */ @@ -1058,8 +1122,6 @@ class Container implements ArrayAccess, ContainerContract * * @param string $abstract * @return string - * - * @throws \LogicException */ public function getAlias($abstract) { @@ -1067,10 +1129,6 @@ class Container implements ArrayAccess, ContainerContract return $abstract; } - if ($this->aliases[$abstract] === $abstract) { - throw new LogicException("[{$abstract}] is aliased to itself."); - } - return $this->getAlias($this->aliases[$abstract]); } @@ -1084,11 +1142,7 @@ class Container implements ArrayAccess, ContainerContract { $abstract = $this->getAlias($abstract); - if (isset($this->extenders[$abstract])) { - return $this->extenders[$abstract]; - } - - return []; + return $this->extenders[$abstract] ?? []; } /** @@ -1149,7 +1203,7 @@ class Container implements ArrayAccess, ContainerContract } /** - * Set the globally available instance of the container. + * Get the globally available instance of the container. * * @return static */ @@ -1166,7 +1220,7 @@ class Container implements ArrayAccess, ContainerContract * Set the shared instance of the container. * * @param \Illuminate\Contracts\Container\Container|null $container - * @return static + * @return \Illuminate\Contracts\Container\Container|static */ public static function setInstance(ContainerContract $container = null) { @@ -1199,7 +1253,7 @@ class Container implements ArrayAccess, ContainerContract * Set the value at a given offset. * * @param string $key - * @param mixed $value + * @param mixed $value * @return void */ public function offsetSet($key, $value) @@ -1235,7 +1289,7 @@ class Container implements ArrayAccess, ContainerContract * Dynamically set container services. * * @param string $key - * @param mixed $value + * @param mixed $value * @return void */ public function __set($key, $value) diff --git a/Seance5-6/seance/vendor/illuminate/container/ContextualBindingBuilder.php b/Seance5-6/seance/vendor/illuminate/container/ContextualBindingBuilder.php index 58b70cee4bdaf3cabfcf97839d8979f13f876155..a52db5d5047c5478fd2db197cb5add4f23a70138 100644 --- a/Seance5-6/seance/vendor/illuminate/container/ContextualBindingBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/container/ContextualBindingBuilder.php @@ -2,6 +2,7 @@ namespace Illuminate\Container; +use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Container\ContextualBindingBuilder as ContextualBindingBuilderContract; class ContextualBindingBuilder implements ContextualBindingBuilderContract @@ -9,14 +10,14 @@ class ContextualBindingBuilder implements ContextualBindingBuilderContract /** * The underlying container instance. * - * @var \Illuminate\Container\Container + * @var \Illuminate\Contracts\Container\Container */ protected $container; /** * The concrete instance. * - * @var string + * @var string|array */ protected $concrete; @@ -30,8 +31,8 @@ class ContextualBindingBuilder implements ContextualBindingBuilderContract /** * Create a new contextual binding builder. * - * @param \Illuminate\Container\Container $container - * @param string $concrete + * @param \Illuminate\Contracts\Container\Container $container + * @param string|array $concrete * @return void */ public function __construct(Container $container, $concrete) @@ -61,8 +62,8 @@ class ContextualBindingBuilder implements ContextualBindingBuilderContract */ public function give($implementation) { - $this->container->addContextualBinding( - $this->concrete, $this->needs, $implementation - ); + foreach (Util::arrayWrap($this->concrete) as $concrete) { + $this->container->addContextualBinding($concrete, $this->needs, $implementation); + } } } diff --git a/Seance5-6/seance/vendor/illuminate/container/composer.json b/Seance5-6/seance/vendor/illuminate/container/composer.json index 7347da14a73fa73b7893a542e78eba560707603e..ddc03cfd0e1cd373713a2114b031639601b1c20f 100644 --- a/Seance5-6/seance/vendor/illuminate/container/composer.json +++ b/Seance5-6/seance/vendor/illuminate/container/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=7.0", - "illuminate/contracts": "5.5.*", - "psr/container": "~1.0" + "php": "^7.2.5", + "illuminate/contracts": "^7.0", + "psr/container": "^1.0" }, "autoload": { "psr-4": { @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "config": { diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Auth/Access/Gate.php b/Seance5-6/seance/vendor/illuminate/contracts/Auth/Access/Gate.php index 2021b573e6c106ffe0821f4341627df240aa01bd..b88ab17965ed1be96b303c49022f39e8537f6122 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Auth/Access/Gate.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Auth/Access/Gate.php @@ -21,6 +21,16 @@ interface Gate */ public function define($ability, $callback); + /** + * Define abilities for a resource. + * + * @param string $name + * @param string $class + * @param array|null $abilities + * @return $this + */ + public function resource($name, $class, array $abilities = null); + /** * Define a policy class for a given class type. * @@ -93,6 +103,26 @@ interface Gate */ public function authorize($ability, $arguments = []); + /** + * Inspect the user for the given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return \Illuminate\Auth\Access\Response + */ + public function inspect($ability, $arguments = []); + + /** + * Get the raw result from the authorization callback. + * + * @param string $ability + * @param array|mixed $arguments + * @return mixed + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function raw($ability, $arguments = []); + /** * Get a policy instance for a given class. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Auth/Guard.php b/Seance5-6/seance/vendor/illuminate/contracts/Auth/Guard.php index 2a2ed3d9a5e40563c738c30ba6eb4e9c2b49144c..2a27fb5f507eaaee014bac96d61657fc98ca8c51 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Auth/Guard.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Auth/Guard.php @@ -28,7 +28,7 @@ interface Guard /** * Get the ID for the currently authenticated user. * - * @return int|null + * @return int|string|null */ public function id(); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Auth/PasswordBroker.php b/Seance5-6/seance/vendor/illuminate/contracts/Auth/PasswordBroker.php index e8ac0c0949d66df54e4f0724315041c1460b004e..6bca9f36be0508ad97b88a99fa4bcaa81a99cc76 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Auth/PasswordBroker.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Auth/PasswordBroker.php @@ -28,18 +28,18 @@ interface PasswordBroker const INVALID_USER = 'passwords.user'; /** - * Constant representing an invalid password. + * Constant representing an invalid token. * * @var string */ - const INVALID_PASSWORD = 'passwords.password'; + const INVALID_TOKEN = 'passwords.token'; /** - * Constant representing an invalid token. + * Constant representing a throttled reset attempt. * * @var string */ - const INVALID_TOKEN = 'passwords.token'; + const RESET_THROTTLED = 'passwords.throttled'; /** * Send a password reset link to a user. @@ -52,25 +52,9 @@ interface PasswordBroker /** * Reset the password for the given token. * - * @param array $credentials + * @param array $credentials * @param \Closure $callback * @return mixed */ public function reset(array $credentials, Closure $callback); - - /** - * Set a custom password validator. - * - * @param \Closure $callback - * @return void - */ - public function validator(Closure $callback); - - /** - * Determine if the passwords match for the request. - * - * @param array $credentials - * @return bool - */ - public function validateNewPassword(array $credentials); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Auth/StatefulGuard.php b/Seance5-6/seance/vendor/illuminate/contracts/Auth/StatefulGuard.php index cfd623dac0c581a677e1a8a97da64a0ee51225c0..961d2f6f56b67ad76eedff63cef3f6fdefa6eac0 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Auth/StatefulGuard.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Auth/StatefulGuard.php @@ -8,7 +8,7 @@ interface StatefulGuard extends Guard * Attempt to authenticate a user using the given credentials. * * @param array $credentials - * @param bool $remember + * @param bool $remember * @return bool */ public function attempt(array $credentials = [], $remember = false); @@ -34,7 +34,7 @@ interface StatefulGuard extends Guard * Log the given user ID into the application. * * @param mixed $id - * @param bool $remember + * @param bool $remember * @return \Illuminate\Contracts\Auth\Authenticatable */ public function loginUsingId($id, $remember = false); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Auth/UserProvider.php b/Seance5-6/seance/vendor/illuminate/contracts/Auth/UserProvider.php index a12aa3de5e2a8b54b8c85ab0652a85901066f7d1..a2ab122718c6d383639bc012b9b5449c550f2bd9 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Auth/UserProvider.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Auth/UserProvider.php @@ -15,7 +15,7 @@ interface UserProvider /** * Retrieve a user by their unique identifier and "remember me" token. * - * @param mixed $identifier + * @param mixed $identifier * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/Factory.php index 1d3a7374e88d7e8b889601c6905cff29a427ffe2..384c2d02dc692c25d012544df775c226d77237b4 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/Factory.php @@ -7,7 +7,7 @@ interface Factory /** * Get a broadcaster implementation by name. * - * @param string $name + * @param string|null $name * @return void */ public function connection($name = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php b/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php index b051e3be3c05940a9415b7d736b69e78c0688280..a4802fe40ebb820c13f9f713f2bd3fc815358e44 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Broadcasting/ShouldBroadcast.php @@ -2,14 +2,12 @@ namespace Illuminate\Contracts\Broadcasting; -use Illuminate\Broadcasting\Channel; - interface ShouldBroadcast { /** * Get the channels the event should broadcast on. * - * @return Channel|Channel[] + * @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[] */ public function broadcastOn(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Bus/Dispatcher.php b/Seance5-6/seance/vendor/illuminate/contracts/Bus/Dispatcher.php index 3370ad3daf8d461713673b06d2158e3160fd4890..12ed2226b416f36e905300a8f96a5894d1aa0aae 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Bus/Dispatcher.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Bus/Dispatcher.php @@ -21,6 +21,22 @@ interface Dispatcher */ public function dispatchNow($command, $handler = null); + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command); + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return bool|mixed + */ + public function getCommandHandler($command); + /** * Set the pipes commands should be piped through before dispatching. * @@ -28,4 +44,12 @@ interface Dispatcher * @return $this */ public function pipeThrough(array $pipes); + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Lock.php b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Lock.php index ee7dddc18765ae8404bde7a454b8fa2f8d5c3c2c..4f98d68d9301e47f7e01f2dfcd9f05ce29f39d74 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Lock.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Lock.php @@ -8,7 +8,7 @@ interface Lock * Attempt to acquire the lock. * * @param callable|null $callback - * @return bool + * @return mixed */ public function get($callback = null); @@ -27,4 +27,18 @@ interface Lock * @return void */ public function release(); + + /** + * Returns the current owner of the lock. + * + * @return string + */ + public function owner(); + + /** + * Releases this lock in disregard of ownership. + * + * @return void + */ + public function forceRelease(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cache/LockProvider.php b/Seance5-6/seance/vendor/illuminate/contracts/Cache/LockProvider.php index d7e18b2c6752f1c33461bf031d438df208e73122..37d4ef68a5d62f8703abb13c1d9c672ca6ea1292 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cache/LockProvider.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cache/LockProvider.php @@ -9,7 +9,17 @@ interface LockProvider * * @param string $name * @param int $seconds + * @param string|null $owner * @return \Illuminate\Contracts\Cache\Lock */ - public function lock($name, $seconds = 0); + public function lock($name, $seconds = 0, $owner = null); + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Repository.php b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Repository.php index 7820fbf7af89b34b12c444a57760f1b00e6cd4eb..5b78af57e4b09eb007abd08d5b8bb9610fe5f151 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Repository.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Repository.php @@ -7,28 +7,11 @@ use Psr\SimpleCache\CacheInterface; interface Repository extends CacheInterface { - /** - * Determine if an item exists in the cache. - * - * @param string $key - * @return bool - */ - public function has($key); - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null); - /** * Retrieve an item from the cache and delete it. * * @param string $key - * @param mixed $default + * @param mixed $default * @return mixed */ public function pull($key, $default = null); @@ -37,21 +20,21 @@ interface Repository extends CacheInterface * Store an item in the cache. * * @param string $key - * @param mixed $value - * @param \DateTimeInterface|\DateInterval|float|int $minutes - * @return void + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool */ - public function put($key, $value, $minutes); + public function put($key, $value, $ttl = null); /** * Store an item in the cache if the key does not exist. * * @param string $key - * @param mixed $value - * @param \DateTimeInterface|\DateInterval|float|int $minutes + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl * @return bool */ - public function add($key, $value, $minutes); + public function add($key, $value, $ttl = null); /** * Increment the value of an item in the cache. @@ -75,34 +58,34 @@ interface Repository extends CacheInterface * Store an item in the cache indefinitely. * * @param string $key - * @param mixed $value - * @return void + * @param mixed $value + * @return bool */ public function forever($key, $value); /** - * Get an item from the cache, or store the default value. + * Get an item from the cache, or execute the given Closure and store the result. * * @param string $key - * @param \DateTimeInterface|\DateInterval|float|int $minutes + * @param \DateTimeInterface|\DateInterval|int|null $ttl * @param \Closure $callback * @return mixed */ - public function remember($key, $minutes, Closure $callback); + public function remember($key, $ttl, Closure $callback); /** - * Get an item from the cache, or store the default value forever. + * Get an item from the cache, or execute the given Closure and store the result forever. * - * @param string $key + * @param string $key * @param \Closure $callback * @return mixed */ public function sear($key, Closure $callback); /** - * Get an item from the cache, or store the default value forever. + * Get an item from the cache, or execute the given Closure and store the result forever. * - * @param string $key + * @param string $key * @param \Closure $callback * @return mixed */ @@ -111,7 +94,7 @@ interface Repository extends CacheInterface /** * Remove an item from the cache. * - * @param string $key + * @param string $key * @return bool */ public function forget($key); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Store.php b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Store.php index 5615762b8c129b804b0457a384b01fb46459ee33..133bc43e9f1bd8f29e3c1cb0831e764b246d3d00 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cache/Store.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cache/Store.php @@ -23,29 +23,29 @@ interface Store public function many(array $keys); /** - * Store an item in the cache for a given number of minutes. + * Store an item in the cache for a given number of seconds. * * @param string $key - * @param mixed $value - * @param float|int $minutes - * @return void + * @param mixed $value + * @param int $seconds + * @return bool */ - public function put($key, $value, $minutes); + public function put($key, $value, $seconds); /** - * Store multiple items in the cache for a given number of minutes. + * Store multiple items in the cache for a given number of seconds. * * @param array $values - * @param float|int $minutes - * @return void + * @param int $seconds + * @return bool */ - public function putMany(array $values, $minutes); + public function putMany(array $values, $seconds); /** * Increment the value of an item in the cache. * * @param string $key - * @param mixed $value + * @param mixed $value * @return int|bool */ public function increment($key, $value = 1); @@ -54,7 +54,7 @@ interface Store * Decrement the value of an item in the cache. * * @param string $key - * @param mixed $value + * @param mixed $value * @return int|bool */ public function decrement($key, $value = 1); @@ -63,8 +63,8 @@ interface Store * Store an item in the cache indefinitely. * * @param string $key - * @param mixed $value - * @return void + * @param mixed $value + * @return bool */ public function forever($key, $value); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Config/Repository.php b/Seance5-6/seance/vendor/illuminate/contracts/Config/Repository.php index 17c1d5f283afe205c9c04649ad7ff02cef910477..a4f0ac86bfb4e33fd53aeea7d49c8ef1cc57a824 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Config/Repository.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Config/Repository.php @@ -16,7 +16,7 @@ interface Repository * Get the specified configuration value. * * @param array|string $key - * @param mixed $default + * @param mixed $default * @return mixed */ public function get($key, $default = null); @@ -32,7 +32,7 @@ interface Repository * Set a given configuration value. * * @param array|string $key - * @param mixed $value + * @param mixed $value * @return void */ public function set($key, $value = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Console/Application.php b/Seance5-6/seance/vendor/illuminate/contracts/Console/Application.php index a59e4312c0aa2fa2a1c1ccee8799fce569c7971d..ba628c9f215d2976cc74d6beaf100071fc25bce7 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Console/Application.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Console/Application.php @@ -5,13 +5,14 @@ namespace Illuminate\Contracts\Console; interface Application { /** - * Call a console application command. + * Run an Artisan console command by name. * * @param string $command * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer * @return int */ - public function call($command, array $parameters = []); + public function call($command, array $parameters = [], $outputBuffer = null); /** * Get the output from the last command. diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Console/Kernel.php b/Seance5-6/seance/vendor/illuminate/contracts/Console/Kernel.php index 4cf7986991327afdf552c1c54a5fc8629a15c088..a7423af3a6c1af032173eeee120d70d314ab3d56 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Console/Kernel.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Console/Kernel.php @@ -8,7 +8,7 @@ interface Kernel * Handle an incoming console command. * * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Symfony\Component\Console\Output\OutputInterface|null $output * @return int */ public function handle($input, $output = null); @@ -18,9 +18,10 @@ interface Kernel * * @param string $command * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer * @return int */ - public function call($command, array $parameters = []); + public function call($command, array $parameters = [], $outputBuffer = null); /** * Queue an Artisan console command by name. @@ -44,4 +45,13 @@ interface Kernel * @return string */ public function output(); + + /** + * Terminate the application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $status + * @return void + */ + public function terminate($input, $status); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Container/Container.php b/Seance5-6/seance/vendor/illuminate/contracts/Container/Container.php index c68c645fcd128b75203166657ba8b9bf928411fe..1b8bb6407934ac0e5424a62e462b921e085e0986 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Container/Container.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Container/Container.php @@ -21,6 +21,8 @@ interface Container extends ContainerInterface * @param string $abstract * @param string $alias * @return void + * + * @throws \LogicException */ public function alias($abstract, $alias); @@ -28,7 +30,7 @@ interface Container extends ContainerInterface * Assign a set of tags to a given binding. * * @param array|string $abstracts - * @param array|mixed ...$tags + * @param array|mixed ...$tags * @return void */ public function tag($abstracts, $tags); @@ -37,7 +39,7 @@ interface Container extends ContainerInterface * Resolve all of the bindings for a given tag. * * @param string $tag - * @return array + * @return iterable */ public function tagged($tag); @@ -70,10 +72,19 @@ interface Container extends ContainerInterface */ public function singleton($abstract, $concrete = null); + /** + * Register a shared binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singletonIf($abstract, $concrete = null); + /** * "Extend" an abstract type in the container. * - * @param string $abstract + * @param string $abstract * @param \Closure $closure * @return void * @@ -85,15 +96,25 @@ interface Container extends ContainerInterface * Register an existing instance as shared in the container. * * @param string $abstract - * @param mixed $instance + * @param mixed $instance * @return mixed */ public function instance($abstract, $instance); /** - * Define a contextual binding. + * 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); + + /** + * Define a contextual binding. + * + * @param string|array $concrete * @return \Illuminate\Contracts\Container\ContextualBindingBuilder */ public function when($concrete); @@ -106,12 +127,21 @@ interface Container extends ContainerInterface */ public function factory($abstract); + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush(); + /** * Resolve the given type from the container. * * @param string $abstract * @param array $parameters * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function make($abstract, array $parameters = []); @@ -128,7 +158,7 @@ interface Container extends ContainerInterface /** * Determine if the given abstract type has been resolved. * - * @param string $abstract + * @param string $abstract * @return bool */ public function resolved($abstract); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cookie/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Cookie/Factory.php index 6124397658ea608b476cf2d7948eac5294e21b29..6f950219c1c0e320ddbfe8d8a8b9658a593567cd 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cookie/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cookie/Factory.php @@ -9,34 +9,38 @@ interface Factory * * @param string $name * @param string $value - * @param int $minutes - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly + * @param int $minutes + * @param string|null $path + * @param string|null $domain + * @param bool|null $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite * @return \Symfony\Component\HttpFoundation\Cookie */ - public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true); + public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null); /** * 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 + * @param string|null $path + * @param string|null $domain + * @param bool|null $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite * @return \Symfony\Component\HttpFoundation\Cookie */ - public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true); + public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null); /** * Expire the given cookie. * * @param string $name - * @param string $path - * @param string $domain + * @param string|null $path + * @param string|null $domain * @return \Symfony\Component\HttpFoundation\Cookie */ public function forget($name, $path = null, $domain = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Cookie/QueueingFactory.php b/Seance5-6/seance/vendor/illuminate/contracts/Cookie/QueueingFactory.php index e8fa3e2783ef1a3f55d82f777b833b674549df41..d6c74b8f95452ca0107471675d7b96a01dce3303 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Cookie/QueueingFactory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Cookie/QueueingFactory.php @@ -16,8 +16,10 @@ interface QueueingFactory extends Factory * Remove a cookie from the queue. * * @param string $name + * @param string|null $path + * @return void */ - public function unqueue($name); + public function unqueue($name, $path = null); /** * Get the cookies which have been queued for the next request. diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Database/ModelIdentifier.php b/Seance5-6/seance/vendor/illuminate/contracts/Database/ModelIdentifier.php index 587044a8dab326c022b99a903ceccea13fc866be..9893d280ef692b2470a9f174dd9a93ca1e3a6364 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Database/ModelIdentifier.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Database/ModelIdentifier.php @@ -20,6 +20,13 @@ class ModelIdentifier */ public $id; + /** + * The relationships loaded on the model. + * + * @var array + */ + public $relations; + /** * The connection name of the model. * @@ -32,13 +39,15 @@ class ModelIdentifier * * @param string $class * @param mixed $id + * @param array $relations * @param mixed $connection * @return void */ - public function __construct($class, $id, $connection) + public function __construct($class, $id, array $relations, $connection) { $this->id = $id; $this->class = $class; + $this->relations = $relations; $this->connection = $connection; } } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Debug/ExceptionHandler.php b/Seance5-6/seance/vendor/illuminate/contracts/Debug/ExceptionHandler.php index e3f18a598beb8f09dd36abe161b0cfd2253096dd..05efd702191760eb37c710a40eeb6a70c8244ccf 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Debug/ExceptionHandler.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Debug/ExceptionHandler.php @@ -2,33 +2,45 @@ namespace Illuminate\Contracts\Debug; -use Exception; +use Throwable; interface ExceptionHandler { /** * Report or log an exception. * - * @param \Exception $e + * @param \Throwable $e * @return void + * + * @throws \Exception + */ + public function report(Throwable $e); + + /** + * Determine if the exception should be reported. + * + * @param \Throwable $e + * @return bool */ - public function report(Exception $e); + public function shouldReport(Throwable $e); /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Exception $e + * @param \Throwable $e * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Throwable */ - public function render($request, Exception $e); + public function render($request, Throwable $e); /** * Render an exception to the console. * * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Exception $e + * @param \Throwable $e * @return void */ - public function renderForConsole($output, Exception $e); + public function renderForConsole($output, Throwable $e); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Encryption/Encrypter.php b/Seance5-6/seance/vendor/illuminate/contracts/Encryption/Encrypter.php index 11e0b45a2de7d04430b339bc85fbf0ab90259b13..4747b68ad00ed5566e8ffd5a257836def5671e1e 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Encryption/Encrypter.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Encryption/Encrypter.php @@ -7,9 +7,11 @@ interface Encrypter /** * Encrypt the given value. * - * @param string $value + * @param mixed $value * @param bool $serialize * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function encrypt($value, $serialize = true); @@ -18,7 +20,9 @@ interface Encrypter * * @param string $payload * @param bool $unserialize - * @return string + * @return mixed + * + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function decrypt($payload, $unserialize = true); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Events/Dispatcher.php b/Seance5-6/seance/vendor/illuminate/contracts/Events/Dispatcher.php index a533e7d2b8aa99f0b01585a48d7ed98d6fd8584d..866080dac7f3671de69acbf040f9cacd93b5ca69 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Events/Dispatcher.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Events/Dispatcher.php @@ -8,7 +8,7 @@ interface Dispatcher * Register an event listener with the dispatcher. * * @param string|array $events - * @param mixed $listener + * @param \Closure|string $listener * @return void */ public function listen($events, $listener); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Factory.php index 7a861380753dc23856416b6a25928bc132dcd8af..d0f9cd2bbfaee244b83c89424d096bdc3e705978 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Factory.php @@ -7,7 +7,7 @@ interface Factory /** * Get a filesystem implementation. * - * @param string $name + * @param string|null $name * @return \Illuminate\Contracts\Filesystem\Filesystem */ public function disk($name = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Filesystem.php b/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Filesystem.php index 69a189c125b865fab0ed53ebd33c3033a53696f9..e8b0dd4e6144fc5ccca3f7a5a58a9796824786ff 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Filesystem.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Filesystem/Filesystem.php @@ -36,6 +36,16 @@ interface Filesystem */ public function get($path); + /** + * Get a resource to read the file. + * + * @param string $path + * @return resource|null The path resource or null on failure. + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function readStream($path); + /** * Write the contents of a file. * @@ -46,6 +56,19 @@ interface Filesystem */ public function put($path, $contents, $options = []); + /** + * Write a new file using a stream. + * + * @param string $path + * @param resource $resource + * @param array $options + * @return bool + * + * @throws \InvalidArgumentException If $resource is not a file handle. + * @throws \Illuminate\Contracts\Filesystem\FileExistsException + */ + public function writeStream($path, $resource, array $options = []); + /** * Get the visibility for the given path. * @@ -59,7 +82,7 @@ interface Filesystem * * @param string $path * @param string $visibility - * @return void + * @return bool */ public function setVisibility($path, $visibility); @@ -68,7 +91,7 @@ interface Filesystem * * @param string $path * @param string $data - * @return int + * @return bool */ public function prepend($path, $data); @@ -77,7 +100,7 @@ interface Filesystem * * @param string $path * @param string $data - * @return int + * @return bool */ public function append($path, $data); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Foundation/Application.php b/Seance5-6/seance/vendor/illuminate/contracts/Foundation/Application.php index a7d643b15acea0b1e41cc99825e89660e666fee4..8ae0a31f267db78b9060a6c3d6b2e50f9f1b97d3 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Foundation/Application.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Foundation/Application.php @@ -16,24 +16,72 @@ interface Application extends Container /** * Get the base path of the Laravel installation. * + * @param string $path * @return string */ - public function basePath(); + public function basePath($path = ''); /** - * Get or check the current application environment. + * Get the path to the bootstrap directory. + * + * @param string $path Optionally, a path to append to the bootstrap path + * @return string + */ + public function bootstrapPath($path = ''); + + /** + * Get the path to the application configuration files. * + * @param string $path Optionally, a path to append to the config path * @return string */ - public function environment(); + public function configPath($path = ''); /** - * Determine if we are running in the console. + * Get the path to the database directory. + * + * @param string $path Optionally, a path to append to the database path + * @return string + */ + public function databasePath($path = ''); + + /** + * Get the path to the resources directory. + * + * @param string $path + * @return string + */ + public function resourcePath($path = ''); + + /** + * Get the path to the storage directory. + * + * @return string + */ + public function storagePath(); + + /** + * Get or check the current application environment. + * + * @param string|array $environments + * @return string|bool + */ + public function environment(...$environments); + + /** + * Determine if the application is running in the console. * * @return bool */ public function runningInConsole(); + /** + * Determine if the application is running unit tests. + * + * @return bool + */ + public function runningUnitTests(); + /** * Determine if the application is currently down for maintenance. * @@ -52,11 +100,10 @@ interface Application extends Container * Register a service provider with the application. * * @param \Illuminate\Support\ServiceProvider|string $provider - * @param array $options - * @param bool $force + * @param bool $force * @return \Illuminate\Support\ServiceProvider */ - public function register($provider, $options = [], $force = false); + public function register($provider, $force = false); /** * Register a deferred provider and service. @@ -67,6 +114,14 @@ interface Application extends Container */ public function registerDeferredProvider($provider, $service = null); + /** + * Resolve a service provider instance from the class name. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function resolveProvider($provider); + /** * Boot the application's service providers. * @@ -77,7 +132,7 @@ interface Application extends Container /** * Register a new boot listener. * - * @param mixed $callback + * @param callable $callback * @return void */ public function booting($callback); @@ -85,22 +140,76 @@ interface Application extends Container /** * Register a new "booted" listener. * - * @param mixed $callback + * @param callable $callback * @return void */ public function booted($callback); /** - * Get the path to the cached services.php file. + * Run the given array of bootstrap classes. + * + * @param array $bootstrappers + * @return void + */ + public function bootstrapWith(array $bootstrappers); + + /** + * Get the current application locale. * * @return string */ - public function getCachedServicesPath(); + public function getLocale(); /** - * Get the path to the cached packages.php file. + * Get the application namespace. * * @return string + * + * @throws \RuntimeException + */ + public function getNamespace(); + + /** + * Get the registered service provider instances if any exist. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return array + */ + public function getProviders($provider); + + /** + * Determine if the application has been bootstrapped before. + * + * @return bool + */ + public function hasBeenBootstrapped(); + + /** + * Load and boot all of the remaining deferred providers. + * + * @return void + */ + public function loadDeferredProviders(); + + /** + * Set the current application locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale); + + /** + * Determine if middleware has been disabled for the application. + * + * @return bool + */ + public function shouldSkipMiddleware(); + + /** + * Terminate the application. + * + * @return void */ - public function getCachedPackagesPath(); + public function terminate(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Hashing/Hasher.php b/Seance5-6/seance/vendor/illuminate/contracts/Hashing/Hasher.php index 3310136e52bc6340612101cccaf2cdebf6ecf83f..b5e4d4c8a8230aa1db3b2a7f17dc02868e78365c 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Hashing/Hasher.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Hashing/Hasher.php @@ -4,11 +4,19 @@ namespace Illuminate\Contracts\Hashing; interface Hasher { + /** + * Get information about the given hashed value. + * + * @param string $hashedValue + * @return array + */ + public function info($hashedValue); + /** * Hash the given value. * * @param string $value - * @param array $options + * @param array $options * @return string */ public function make($value, array $options = []); @@ -18,7 +26,7 @@ interface Hasher * * @param string $value * @param string $hashedValue - * @param array $options + * @param array $options * @return bool */ public function check($value, $hashedValue, array $options = []); @@ -27,7 +35,7 @@ interface Hasher * Check if the given hash has been hashed using the given options. * * @param string $hashedValue - * @param array $options + * @param array $options * @return bool */ public function needsRehash($hashedValue, array $options = []); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Logging/Log.php b/Seance5-6/seance/vendor/illuminate/contracts/Logging/Log.php deleted file mode 100644 index 5ecb9f8bdcf45044fe58a2c4f8b42fc2223ab5b8..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/contracts/Logging/Log.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -namespace Illuminate\Contracts\Logging; - -interface Log -{ - /** - * Log an alert message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function alert($message, array $context = []); - - /** - * Log a critical message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function critical($message, array $context = []); - - /** - * Log an error message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function error($message, array $context = []); - - /** - * Log a warning message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function warning($message, array $context = []); - - /** - * Log a notice to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function notice($message, array $context = []); - - /** - * Log an informational message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function info($message, array $context = []); - - /** - * Log a debug message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function debug($message, array $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 = []); - - /** - * Register a file log handler. - * - * @param string $path - * @param string $level - * @return void - */ - public function useFiles($path, $level = 'debug'); - - /** - * 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'); -} diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Mail/MailQueue.php b/Seance5-6/seance/vendor/illuminate/contracts/Mail/MailQueue.php index 1019b05de694d075ccee5c952d4e2791536ec59a..d0d90b88dce0d7cfa61e3aab85196a6fe0ae377a 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Mail/MailQueue.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Mail/MailQueue.php @@ -7,8 +7,8 @@ interface MailQueue /** * Queue a new e-mail message for sending. * - * @param string|array|MailableContract $view - * @param string $queue + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string|null $queue * @return mixed */ public function queue($view, $queue = null); @@ -17,8 +17,8 @@ interface MailQueue * Queue a new e-mail message for sending after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay - * @param string|array|MailableContract $view - * @param string $queue + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string|null $queue * @return mixed */ public function later($delay, $view, $queue = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailable.php b/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailable.php index 261207001168b859cd3d3fd5e126cce8dc839ead..bfdf4ef865609dcba46a8b298927bae811b7b4f8 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailable.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailable.php @@ -9,10 +9,10 @@ interface Mailable /** * Send the message using the given mailer. * - * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param \Illuminate\Contracts\Mail\Factory|\Illuminate\Contracts\Mail\Mailer $mailer * @return void */ - public function send(Mailer $mailer); + public function send($mailer); /** * Queue the given message. @@ -25,9 +25,52 @@ interface Mailable /** * Deliver the queued message after the given delay. * - * @param \DateTime|int $delay + * @param \DateTimeInterface|\DateInterval|int $delay * @param \Illuminate\Contracts\Queue\Factory $queue * @return mixed */ public function later($delay, Queue $queue); + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return self + */ + public function cc($address, $name = null); + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null); + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function to($address, $name = null); + + /** + * Set the locale of the message. + * + * @param string $locale + * @return $this + */ + public function locale($locale); + + /** + * Set the name of the mailer that should be used to send the message. + * + * @param string $mailer + * @return $this + */ + public function mailer($mailer); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailer.php b/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailer.php index 559adfcf97a32a9709d9c0696613559e6128c8e6..255b6789da82b8666220e1469e8d00c65b4442e3 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailer.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Mail/Mailer.php @@ -21,7 +21,7 @@ interface Mailer public function bcc($users); /** - * Send a new message when only a raw text part. + * Send a new message with only a raw text part. * * @param string $text * @param mixed $callback @@ -32,9 +32,9 @@ interface Mailer /** * Send a new message using a view. * - * @param string|array|MailableContract $view + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view * @param array $data - * @param \Closure|string $callback + * @param \Closure|string|null $callback * @return void */ public function send($view, array $data = [], $callback = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Pagination/Paginator.php b/Seance5-6/seance/vendor/illuminate/contracts/Pagination/Paginator.php index a4301ef26078a751920d1a347c00d4e77eb42951..f6bd6c0ee19f8ceb889358c9952a264a8ca5e649 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Pagination/Paginator.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Pagination/Paginator.php @@ -92,6 +92,13 @@ interface Paginator */ public function hasMorePages(); + /** + * Get the base path for paginator generated URLs. + * + * @return string|null + */ + public function path(); + /** * Determine if the list of items is empty or not. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Factory.php index 3c21575a03cb8312678a293f2464da75cccf72f5..9a0bdeb125777d56dc5f6f475bb1f057e4d72de5 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Factory.php @@ -7,7 +7,7 @@ interface Factory /** * Resolve a queue connection instance. * - * @param string $name + * @param string|null $name * @return \Illuminate\Contracts\Queue\Queue */ public function connection($name = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Job.php b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Job.php index 8a907987a35ce01f6deca05265341835948e970a..933e7fb66b5a2a20e1607e7036c2143bbcc715b9 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Job.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Job.php @@ -4,6 +4,27 @@ namespace Illuminate\Contracts\Queue; interface Job { + /** + * Get the UUID of the job. + * + * @return string|null + */ + public function uuid(); + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId(); + + /** + * Get the decoded body of the job. + * + * @return array + */ + public function payload(); + /** * Fire the job. * @@ -14,11 +35,20 @@ interface Job /** * Release the job back into the queue. * - * @param int $delay - * @return mixed + * Accepts a delay specified in seconds. + * + * @param int $delay + * @return void */ public function release($delay = 0); + /** + * Determine if the job was released back into the queue. + * + * @return bool + */ + public function isReleased(); + /** * Delete the job from the queue. * @@ -48,12 +78,26 @@ interface Job public function attempts(); /** - * Process an exception that caused the job to fail. + * Determine if the job has been marked as a failure. + * + * @return bool + */ + public function hasFailed(); + + /** + * Mark the job as "failed". * - * @param \Throwable $e * @return void */ - public function failed($e); + public function markAsFailed(); + + /** + * Delete the job, call the "failed" method, and raise the failed job event. + * + * @param \Throwable|null $e + * @return void + */ + public function fail($e = null); /** * Get the number of times to attempt a job. @@ -62,6 +106,13 @@ interface Job */ public function maxTries(); + /** + * Get the maximum number of exceptions allowed, regardless of attempts. + * + * @return int|null + */ + public function maxExceptions(); + /** * Get the number of seconds the job can run. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Queue.php b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Queue.php index 52fb1a79adf26d635513be290ba49b5770db38ef..073b3c1d19c9d2448f5722a3bd98aee23e932cf5 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Queue/Queue.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Queue/Queue.php @@ -7,7 +7,7 @@ interface Queue /** * Get the size of the queue. * - * @param string $queue + * @param string|null $queue * @return int */ public function size($queue = null); @@ -16,8 +16,8 @@ interface Queue * Push a new job onto the queue. * * @param string|object $job - * @param mixed $data - * @param string $queue + * @param mixed $data + * @param string|null $queue * @return mixed */ public function push($job, $data = '', $queue = null); @@ -27,7 +27,7 @@ interface Queue * * @param string $queue * @param string|object $job - * @param mixed $data + * @param mixed $data * @return mixed */ public function pushOn($queue, $job, $data = ''); @@ -36,8 +36,8 @@ interface Queue * Push a raw payload onto the queue. * * @param string $payload - * @param string $queue - * @param array $options + * @param string|null $queue + * @param array $options * @return mixed */ public function pushRaw($payload, $queue = null, array $options = []); @@ -47,8 +47,8 @@ interface Queue * * @param \DateTimeInterface|\DateInterval|int $delay * @param string|object $job - * @param mixed $data - * @param string $queue + * @param mixed $data + * @param string|null $queue * @return mixed */ public function later($delay, $job, $data = '', $queue = null); @@ -59,7 +59,7 @@ interface Queue * @param string $queue * @param \DateTimeInterface|\DateInterval|int $delay * @param string|object $job - * @param mixed $data + * @param mixed $data * @return mixed */ public function laterOn($queue, $delay, $job, $data = ''); @@ -67,9 +67,9 @@ interface Queue /** * Push an array of jobs onto the queue. * - * @param array $jobs - * @param mixed $data - * @param string $queue + * @param array $jobs + * @param mixed $data + * @param string|null $queue * @return mixed */ public function bulk($jobs, $data = '', $queue = null); @@ -77,7 +77,7 @@ interface Queue /** * Pop the next job off of the queue. * - * @param string $queue + * @param string|null $queue * @return \Illuminate\Contracts\Queue\Job|null */ public function pop($queue = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableCollection.php b/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableCollection.php index 0331b814f04b1a52f094fcd461a1c0fd9cf71a02..7f1ea19c543657e79ea64025445b09efb1520595 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableCollection.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableCollection.php @@ -18,6 +18,13 @@ interface QueueableCollection */ public function getQueueableIds(); + /** + * Get the relationships of the entities being queued. + * + * @return array + */ + public function getQueueableRelations(); + /** * Get the connection of the entities being queued. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableEntity.php b/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableEntity.php index 00e28f8a070f87b68eec26d372cbf85a2c04c9b0..366f0c84fab6c620e2b46c1b3428f38a7b5ee992 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableEntity.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Queue/QueueableEntity.php @@ -11,6 +11,13 @@ interface QueueableEntity */ public function getQueueableId(); + /** + * Get the relationships for the entity. + * + * @return array + */ + public function getQueueableRelations(); + /** * Get the connection of the entity. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Redis/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Redis/Factory.php index 8a10e254f7a8229c30d14ec468ad33aa7992d0bf..c2bfe81f9888327f29a2a375679f14d9f19c4ffd 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Redis/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Redis/Factory.php @@ -7,7 +7,7 @@ interface Factory /** * Get a Redis connection by name. * - * @param string $name + * @param string|null $name * @return \Illuminate\Redis\Connections\Connection */ public function connection($name = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Routing/Registrar.php b/Seance5-6/seance/vendor/illuminate/contracts/Routing/Registrar.php index 38e188b5f080c5d7e920bf0d3ac424b2a14d78e5..5b3790c589eb9b07b5af5d751a17e8766cf5b97b 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Routing/Registrar.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Routing/Registrar.php @@ -8,7 +8,7 @@ interface Registrar * Register a new GET route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function get($uri, $action); @@ -17,7 +17,7 @@ interface Registrar * Register a new POST route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function post($uri, $action); @@ -26,7 +26,7 @@ interface Registrar * Register a new PUT route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function put($uri, $action); @@ -35,7 +35,7 @@ interface Registrar * Register a new DELETE route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function delete($uri, $action); @@ -44,7 +44,7 @@ interface Registrar * Register a new PATCH route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function patch($uri, $action); @@ -53,7 +53,7 @@ interface Registrar * Register a new OPTIONS route with the router. * * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function options($uri, $action); @@ -63,7 +63,7 @@ interface Registrar * * @param array|string $methods * @param string $uri - * @param \Closure|array|string $action + * @param \Closure|array|string|callable $action * @return \Illuminate\Routing\Route */ public function match($methods, $uri, $action); @@ -73,7 +73,7 @@ interface Registrar * * @param string $name * @param string $controller - * @param array $options + * @param array $options * @return \Illuminate\Routing\PendingResourceRegistration */ public function resource($name, $controller, array $options = []); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Routing/ResponseFactory.php b/Seance5-6/seance/vendor/illuminate/contracts/Routing/ResponseFactory.php index 5dd4ee08c955f13a5ad969e8cdde0079ed207b19..5b8f22c0f7afd6fe7417171d091b10e94e85d0ad 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Routing/ResponseFactory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Routing/ResponseFactory.php @@ -5,7 +5,7 @@ namespace Illuminate\Contracts\Routing; interface ResponseFactory { /** - * Return a new response from the application. + * Create a new response instance. * * @param string $content * @param int $status @@ -15,9 +15,18 @@ interface ResponseFactory public function make($content = '', $status = 200, array $headers = []); /** - * Return a new view response from the application. + * Create a new "no content" response. * - * @param string $view + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function noContent($status = 204, array $headers = []); + + /** + * Create a new response for a given view. + * + * @param string|array $view * @param array $data * @param int $status * @param array $headers @@ -26,9 +35,9 @@ interface ResponseFactory public function view($view, $data = [], $status = 200, array $headers = []); /** - * Return a new JSON response from the application. + * Create a new JSON response instance. * - * @param string|array $data + * @param string|array|object $data * @param int $status * @param array $headers * @param int $options @@ -37,10 +46,10 @@ interface ResponseFactory public function json($data = [], $status = 200, array $headers = [], $options = 0); /** - * Return a new JSONP response from the application. + * Create a new JSONP response instance. * * @param string $callback - * @param string|array $data + * @param string|array|object $data * @param int $status * @param array $headers * @param int $options @@ -49,7 +58,7 @@ interface ResponseFactory public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0); /** - * Return a new streamed response from the application. + * Create a new streamed response instance. * * @param \Closure $callback * @param int $status @@ -58,17 +67,37 @@ interface ResponseFactory */ public function stream($callback, $status = 200, array $headers = []); + /** + * Create a new streamed response instance as a file download. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment'); + /** * Create a new file download response. * * @param \SplFileInfo|string $file - * @param string $name + * @param string|null $name * @param array $headers * @param string|null $disposition * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function download($file, $name = null, array $headers = [], $disposition = 'attachment'); + /** + * Return the raw contents of a binary file. + * + * @param \SplFileInfo|string $file + * @param array $headers + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function file($file, array $headers = []); + /** * Create a new redirect response to the given path. * diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlGenerator.php b/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlGenerator.php index d77b3af9b4202a4711288e51f550661fbc482db1..e576dda19e9e355abb7c94698c4ccfd50a03f8b9 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlGenerator.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlGenerator.php @@ -11,12 +11,20 @@ interface UrlGenerator */ public function current(); + /** + * Get the URL for the previous request. + * + * @param mixed $fallback + * @return string + */ + public function previous($fallback = false); + /** * Generate an absolute URL to the given path. * * @param string $path * @param mixed $extra - * @param bool $secure + * @param bool|null $secure * @return string */ public function to($path, $extra = [], $secure = null); @@ -25,7 +33,7 @@ interface UrlGenerator * Generate a secure, absolute URL to the given path. * * @param string $path - * @param array $parameters + * @param array $parameters * @return string */ public function secure($path, $parameters = []); @@ -34,7 +42,7 @@ interface UrlGenerator * Generate the URL to an application asset. * * @param string $path - * @param bool $secure + * @param bool|null $secure * @return string */ public function asset($path, $secure = null); @@ -43,7 +51,7 @@ interface UrlGenerator * Get the URL to a named route. * * @param string $name - * @param mixed $parameters + * @param mixed $parameters * @param bool $absolute * @return string * @@ -54,9 +62,9 @@ interface UrlGenerator /** * Get the URL to a controller action. * - * @param string $action - * @param mixed $parameters - * @param bool $absolute + * @param string|array $action + * @param mixed $parameters + * @param bool $absolute * @return string */ public function action($action, $parameters = [], $absolute = true); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlRoutable.php b/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlRoutable.php index d1dd94cc700aa0d0d5fd7cfce37b749854e2f101..0212a83da4b3fa144d19f00e8717449450afa6e4 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlRoutable.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Routing/UrlRoutable.php @@ -21,8 +21,19 @@ interface UrlRoutable /** * Retrieve the model for a bound value. * - * @param mixed $value + * @param mixed $value + * @param string|null $field * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value); + public function resolveRouteBinding($value, $field = null); + + /** + * Retrieve the child model for a bound value. + * + * @param string $childType + * @param mixed $value + * @param string|null $field + * @return \Illuminate\Database\Eloquent\Model|null + */ + public function resolveChildRouteBinding($childType, $value, $field); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Session/Session.php b/Seance5-6/seance/vendor/illuminate/contracts/Session/Session.php index 57c75509fd6e1595e56514a1b9365edbf82922c2..0b429537e7ba8ac5000bfd90669e3cf1f774fb11 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Session/Session.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Session/Session.php @@ -36,7 +36,7 @@ interface Session /** * Save the session data to storage. * - * @return bool + * @return void */ public function save(); @@ -76,7 +76,7 @@ interface Session * Put a key / value pair or array of key / value pairs in the session. * * @param string|array $key - * @param mixed $value + * @param mixed $value * @return void */ public function put($key, $value = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Support/MessageBag.php b/Seance5-6/seance/vendor/illuminate/contracts/Support/MessageBag.php index 512ba0e72e094d9fd668c827fe131c69c82a02a5..78bd8a00fc75b9d79f3cc9cba0024594ada6673c 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Support/MessageBag.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Support/MessageBag.php @@ -39,8 +39,8 @@ interface MessageBag extends Arrayable /** * Get the first message from the bag for a given key. * - * @param string $key - * @param string $format + * @param string|null $key + * @param string|null $format * @return string */ public function first($key = null, $format = null); @@ -49,7 +49,7 @@ interface MessageBag extends Arrayable * Get all of the messages from the bag for a given key. * * @param string $key - * @param string $format + * @param string|null $format * @return array */ public function get($key, $format = null); @@ -57,7 +57,7 @@ interface MessageBag extends Arrayable /** * Get all of the messages for every key in the bag. * - * @param string $format + * @param string|null $format * @return array */ public function all($format = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Support/Responsable.php b/Seance5-6/seance/vendor/illuminate/contracts/Support/Responsable.php index e20d6581c9f7e5ca37e8af2d076649536e493310..1738ec064f70c0db141d7ffc8e0c7f542313e6bc 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Support/Responsable.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Support/Responsable.php @@ -8,7 +8,7 @@ interface Responsable * Create an HTTP response that represents the object. * * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response + * @return \Symfony\Component\HttpFoundation\Response */ public function toResponse($request); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Translation/Loader.php b/Seance5-6/seance/vendor/illuminate/contracts/Translation/Loader.php index 807f0b63cae58cce9c041de1a960a4807c50a696..b08418d1366552d992717017c0a5c727c5c84c05 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Translation/Loader.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Translation/Loader.php @@ -9,7 +9,7 @@ interface Loader * * @param string $locale * @param string $group - * @param string $namespace + * @param string|null $namespace * @return array */ public function load($locale, $group, $namespace = null); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Translation/Translator.php b/Seance5-6/seance/vendor/illuminate/contracts/Translation/Translator.php index 2fdd84f0af36d1cb7f405b83cfce227b3adb0d8a..6eae4915d5a16b6e9941adb01cb53f8e2430ff81 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Translation/Translator.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Translation/Translator.php @@ -8,22 +8,22 @@ interface Translator * Get the translation for a given key. * * @param string $key - * @param array $replace - * @param string $locale + * @param array $replace + * @param string|null $locale * @return mixed */ - public function trans($key, array $replace = [], $locale = null); + public function get($key, array $replace = [], $locale = null); /** * Get a translation according to an integer value. * * @param string $key - * @param int|array|\Countable $number - * @param array $replace - * @param string $locale + * @param \Countable|int|array $number + * @param array $replace + * @param string|null $locale * @return string */ - public function transChoice($key, $number, array $replace = [], $locale = null); + public function choice($key, $number, array $replace = [], $locale = null); /** * Get the default locale being used. diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Factory.php index 33f27bb6662cca682e8c410cae01dba1ea54585c..104675a4dc2faa4269b8f148b7712b6d0d888ae9 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Factory.php @@ -20,7 +20,7 @@ interface Factory * * @param string $rule * @param \Closure|string $extension - * @param string $message + * @param string|null $message * @return void */ public function extend($rule, $extension, $message = null); @@ -28,9 +28,9 @@ interface Factory /** * Register a custom implicit validator extension. * - * @param string $rule + * @param string $rule * @param \Closure|string $extension - * @param string $message + * @param string|null $message * @return void */ public function extendImplicit($rule, $extension, $message = null); @@ -38,7 +38,7 @@ interface Factory /** * Register a custom implicit validator message replacer. * - * @param string $rule + * @param string $rule * @param \Closure|string $replacer * @return void */ diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Rule.php b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Rule.php index 709b620554c7119931f3d559dbbb80747f8810b0..cc03777af784dc7614c0856e6448aaf0f1f72026 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Rule.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Rule.php @@ -16,7 +16,7 @@ interface Rule /** * Get the validation error message. * - * @return string + * @return string|array */ public function message(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php b/Seance5-6/seance/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php index 4c33629a7311fd330c2b8bad25bf63b2440d8b2e..4e6b7577b2a3da97e42f3d6083bcf464a97b0c87 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php @@ -9,5 +9,5 @@ interface ValidatesWhenResolved * * @return void */ - public function validate(); + public function validateResolved(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Validator.php b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Validator.php index 3404df2a51269d0306c11ffd69589f3bb276d4c0..f389d03e5080064c545b0b843c297d8329afb0dc 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/Validation/Validator.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/Validation/Validator.php @@ -6,6 +6,20 @@ use Illuminate\Contracts\Support\MessageProvider; interface Validator extends MessageProvider { + /** + * Run the validator's rules against its data. + * + * @return array + */ + public function validate(); + + /** + * Get the attributes and values that were validated. + * + * @return array + */ + public function validated(); + /** * Determine if the data fails the validation rules. * @@ -23,7 +37,7 @@ interface Validator extends MessageProvider /** * Add conditions to a given field based on a Closure. * - * @param string $attribute + * @param string|array $attribute * @param string|array $rules * @param callable $callback * @return $this @@ -31,7 +45,7 @@ interface Validator extends MessageProvider public function sometimes($attribute, $rules, callable $callback); /** - * After an after validation callback. + * Add an after validation callback. * * @param callable|string $callback * @return $this diff --git a/Seance5-6/seance/vendor/illuminate/contracts/View/Engine.php b/Seance5-6/seance/vendor/illuminate/contracts/View/Engine.php index 4d0b268c1df9fdc068d1aa34e7457abcc11ddf54..be4795d387f89d6bc3c4c4894c32b575834d99ef 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/View/Engine.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/View/Engine.php @@ -8,7 +8,7 @@ interface Engine * Get the evaluated contents of the view. * * @param string $path - * @param array $data + * @param array $data * @return string */ public function get($path, array $data = []); diff --git a/Seance5-6/seance/vendor/illuminate/contracts/View/Factory.php b/Seance5-6/seance/vendor/illuminate/contracts/View/Factory.php index dc9b19a2676c0b711846622ec9eef5a1c5883908..562ee799802e66cfeb1ed2f19b9465bdca048318 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/View/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/View/Factory.php @@ -16,7 +16,7 @@ interface Factory * Get the evaluated view contents for the given path. * * @param string $path - * @param array $data + * @param \Illuminate\Contracts\Support\Arrayable|array $data * @param array $mergeData * @return \Illuminate\Contracts\View\View */ @@ -26,7 +26,7 @@ interface Factory * Get the evaluated view contents for the given view. * * @param string $view - * @param array $data + * @param \Illuminate\Contracts\Support\Arrayable|array $data * @param array $mergeData * @return \Illuminate\Contracts\View\View */ diff --git a/Seance5-6/seance/vendor/illuminate/contracts/View/View.php b/Seance5-6/seance/vendor/illuminate/contracts/View/View.php index ba03d163388d5872b1c155550901087a8213e937..4b0b7f9034f21abeb449966a56edca89098edff0 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/View/View.php +++ b/Seance5-6/seance/vendor/illuminate/contracts/View/View.php @@ -17,8 +17,15 @@ interface View extends Renderable * Add a piece of data to the view. * * @param string|array $key - * @param mixed $value + * @param mixed $value * @return $this */ public function with($key, $value = null); + + /** + * Get the array of view data. + * + * @return array + */ + public function getData(); } diff --git a/Seance5-6/seance/vendor/illuminate/contracts/composer.json b/Seance5-6/seance/vendor/illuminate/contracts/composer.json index c97fc256a5ca98e4b553e7a2e541cfa4bd288270..4424cf6baaf6b80eff0b9f6cf541f5176c9560f0 100644 --- a/Seance5-6/seance/vendor/illuminate/contracts/composer.json +++ b/Seance5-6/seance/vendor/illuminate/contracts/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=7.0", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" + "php": "^7.2.5", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" }, "autoload": { "psr-4": { @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "config": { diff --git a/Seance5-6/seance/vendor/illuminate/database/Capsule/Manager.php b/Seance5-6/seance/vendor/illuminate/database/Capsule/Manager.php index b82a792ce7d2815da0479abc1cc23352b332b88a..b877e7c6d20dc3b7bb605302a546f0b5d105239c 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Capsule/Manager.php +++ b/Seance5-6/seance/vendor/illuminate/database/Capsule/Manager.php @@ -2,13 +2,13 @@ namespace Illuminate\Database\Capsule; -use PDO; use Illuminate\Container\Container; -use Illuminate\Database\DatabaseManager; use Illuminate\Contracts\Events\Dispatcher; -use Illuminate\Support\Traits\CapsuleManagerTrait; -use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Database\Connectors\ConnectionFactory; +use Illuminate\Database\DatabaseManager; +use Illuminate\Database\Eloquent\Model as Eloquent; +use Illuminate\Support\Traits\CapsuleManagerTrait; +use PDO; class Manager { @@ -66,7 +66,7 @@ class Manager /** * Get a connection instance from the global manager. * - * @param string $connection + * @param string|null $connection * @return \Illuminate\Database\Connection */ public static function connection($connection = null) @@ -77,19 +77,20 @@ class Manager /** * Get a fluent query builder instance. * - * @param string $table - * @param string $connection + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as + * @param string|null $connection * @return \Illuminate\Database\Query\Builder */ - public static function table($table, $connection = null) + public static function table($table, $as = null, $connection = null) { - return static::$instance->connection($connection)->table($table); + return static::$instance->connection($connection)->table($table, $as); } /** * Get a schema builder instance. * - * @param string $connection + * @param string|null $connection * @return \Illuminate\Database\Schema\Builder */ public static function schema($connection = null) @@ -100,7 +101,7 @@ class Manager /** * Get a registered connection instance. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\Connection */ public function getConnection($name = null) @@ -111,7 +112,7 @@ class Manager /** * Register a connection with the manager. * - * @param array $config + * @param array $config * @param string $name * @return void */ @@ -191,7 +192,7 @@ class Manager * Dynamically pass methods to the default connection. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed */ public static function __callStatic($method, $parameters) diff --git a/Seance5-6/seance/vendor/illuminate/database/Concerns/BuildsQueries.php b/Seance5-6/seance/vendor/illuminate/database/Concerns/BuildsQueries.php index 1051f2c91c857c1ae7bba15d892c801fc266ac89..a43b9befc1e12c3d5f1c8fada085a6219648922b 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Concerns/BuildsQueries.php +++ b/Seance5-6/seance/vendor/illuminate/database/Concerns/BuildsQueries.php @@ -3,8 +3,8 @@ namespace Illuminate\Database\Concerns; use Illuminate\Container\Container; -use Illuminate\Pagination\Paginator; use Illuminate\Pagination\LengthAwarePaginator; +use Illuminate\Pagination\Paginator; trait BuildsQueries { @@ -66,10 +66,76 @@ trait BuildsQueries }); } + /** + * Chunk the results of a query by comparing IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $column = $column ?? $this->defaultKeyName(); + + $alias = $alias ?? $column; + + $lastId = null; + + do { + $clone = clone $this; + + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $clone->forPageAfterId($count, $lastId, $column)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // 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 ($callback($results) === false) { + return false; + } + + $lastId = $results->last()->{$alias}; + + unset($results); + } while ($countResults == $count); + + return true; + } + + /** + * Execute a callback over each item while chunking by id. + * + * @param callable $callback + * @param int $count + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function eachById(callable $callback, $count = 1000, $column = null, $alias = null) + { + return $this->chunkById($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }, $column, $alias); + } + /** * Execute the query and get the first result. * - * @param array $columns + * @param array|string $columns * @return \Illuminate\Database\Eloquent\Model|object|static|null */ public function first($columns = ['*']) @@ -82,8 +148,8 @@ trait BuildsQueries * * @param mixed $value * @param callable $callback - * @param callable $default - * @return mixed + * @param callable|null $default + * @return mixed|$this */ public function when($value, $callback, $default = null) { @@ -99,7 +165,7 @@ trait BuildsQueries /** * Pass the query to a given callback. * - * @param \Closure $callback + * @param callable $callback * @return \Illuminate\Database\Query\Builder */ public function tap($callback) @@ -112,8 +178,8 @@ trait BuildsQueries * * @param mixed $value * @param callable $callback - * @param callable $default - * @return mixed + * @param callable|null $default + * @return mixed|$this */ public function unless($value, $callback, $default = null) { @@ -147,8 +213,8 @@ trait BuildsQueries * Create a new simple paginator instance. * * @param \Illuminate\Support\Collection $items - * @param int $perPage - * @param int $currentPage + * @param int $perPage + * @param int $currentPage * @param array $options * @return \Illuminate\Pagination\Paginator */ diff --git a/Seance5-6/seance/vendor/illuminate/database/Concerns/ManagesTransactions.php b/Seance5-6/seance/vendor/illuminate/database/Concerns/ManagesTransactions.php index ec979f4edfd774509cd42e27f2b9b6b667a52316..aa4357b3e3da4e62ca9e66923a1556a91d148048 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Concerns/ManagesTransactions.php +++ b/Seance5-6/seance/vendor/illuminate/database/Concerns/ManagesTransactions.php @@ -3,7 +3,6 @@ namespace Illuminate\Database\Concerns; use Closure; -use Exception; use Throwable; trait ManagesTransactions @@ -15,7 +14,7 @@ trait ManagesTransactions * @param int $attempts * @return mixed * - * @throws \Exception|\Throwable + * @throws \Throwable */ public function transaction(Closure $callback, $attempts = 1) { @@ -26,42 +25,50 @@ trait ManagesTransactions // catch any exception we can rollback this transaction so that none of this // gets actually persisted to a database or stored in a permanent fashion. try { - return tap($callback($this), function ($result) { - $this->commit(); - }); + $callbackResult = $callback($this); } // If we catch an exception we'll rollback this transaction and try again if we // are not out of attempts. If we are out of attempts we will just throw the // exception back out and let the developer handle an uncaught exceptions. - catch (Exception $e) { + catch (Throwable $e) { $this->handleTransactionException( $e, $currentAttempt, $attempts ); + + continue; + } + + try { + $this->commit(); } catch (Throwable $e) { - $this->rollBack(); + $this->handleCommitTransactionException( + $e, $currentAttempt, $attempts + ); - throw $e; + continue; } + + return $callbackResult; } } /** * Handle an exception encountered when running a transacted statement. * - * @param \Exception $e + * @param \Throwable $e * @param int $currentAttempt * @param int $maxAttempts * @return void * - * @throws \Exception + * @throws \Throwable */ - protected function handleTransactionException($e, $currentAttempt, $maxAttempts) + protected function handleTransactionException(Throwable $e, $currentAttempt, $maxAttempts) { // On a deadlock, MySQL rolls back the entire transaction so we can't just // retry the query. We have to throw this exception all the way out and // let the developer handle it in another way. We will decrement too. - if ($this->causedByDeadlock($e) && + if ($this->causedByConcurrencyError($e) && $this->transactions > 1) { $this->transactions--; @@ -73,7 +80,7 @@ trait ManagesTransactions // if we haven't we will return and try this query again in our loop. $this->rollBack(); - if ($this->causedByDeadlock($e) && + if ($this->causedByConcurrencyError($e) && $currentAttempt < $maxAttempts) { return; } @@ -85,7 +92,8 @@ trait ManagesTransactions * Start a new database transaction. * * @return void - * @throws \Exception + * + * @throws \Throwable */ public function beginTransaction() { @@ -100,13 +108,17 @@ trait ManagesTransactions * Create a transaction within the database. * * @return void + * + * @throws \Throwable */ protected function createTransaction() { if ($this->transactions == 0) { + $this->reconnectIfMissingConnection(); + try { $this->getPdo()->beginTransaction(); - } catch (Exception $e) { + } catch (Throwable $e) { $this->handleBeginTransactionException($e); } } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) { @@ -118,6 +130,8 @@ trait ManagesTransactions * Create a save point within the database. * * @return void + * + * @throws \Throwable */ protected function createSavepoint() { @@ -129,17 +143,17 @@ trait ManagesTransactions /** * Handle an exception from a transaction beginning. * - * @param \Exception $e + * @param \Throwable $e * @return void * - * @throws \Exception + * @throws \Throwable */ - protected function handleBeginTransactionException($e) + protected function handleBeginTransactionException(Throwable $e) { if ($this->causedByLostConnection($e)) { $this->reconnect(); - $this->pdo->beginTransaction(); + $this->getPdo()->beginTransaction(); } else { throw $e; } @@ -149,6 +163,8 @@ trait ManagesTransactions * Commit the active database transaction. * * @return void + * + * @throws \Throwable */ public function commit() { @@ -161,11 +177,39 @@ trait ManagesTransactions $this->fireConnectionEvent('committed'); } + /** + * Handle an exception encountered when committing a transaction. + * + * @param \Throwable $e + * @param int $currentAttempt + * @param int $maxAttempts + * @return void + * + * @throws \Throwable + */ + protected function handleCommitTransactionException(Throwable $e, $currentAttempt, $maxAttempts) + { + $this->transactions--; + + if ($this->causedByConcurrencyError($e) && + $currentAttempt < $maxAttempts) { + return; + } + + if ($this->causedByLostConnection($e)) { + $this->transactions = 0; + } + + throw $e; + } + /** * Rollback the active database transaction. * * @param int|null $toLevel * @return void + * + * @throws \Throwable */ public function rollBack($toLevel = null) { @@ -183,7 +227,11 @@ trait ManagesTransactions // Next, we will actually perform this rollback within this database and fire the // rollback event. We will also set the current transaction level to the given // level that was passed into this method so it will be right from here out. - $this->performRollBack($toLevel); + try { + $this->performRollBack($toLevel); + } catch (Throwable $e) { + $this->handleRollBackException($e); + } $this->transactions = $toLevel; @@ -195,6 +243,8 @@ trait ManagesTransactions * * @param int $toLevel * @return void + * + * @throws \Throwable */ protected function performRollBack($toLevel) { @@ -207,6 +257,23 @@ trait ManagesTransactions } } + /** + * Handle an exception from a rollback. + * + * @param \Throwable $e + * @return void + * + * @throws \Throwable + */ + protected function handleRollBackException(Throwable $e) + { + if ($this->causedByLostConnection($e)) { + $this->transactions = 0; + } + + throw $e; + } + /** * Get the number of active transactions. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Connection.php b/Seance5-6/seance/vendor/illuminate/database/Connection.php index a55776c69cae45bfab8c9279c01ae0d4e18eebad..7c688fdbe5a259f16c69cd53114f812322885a3c 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connection.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connection.php @@ -2,25 +2,29 @@ namespace Illuminate\Database; -use PDO; use Closure; -use Exception; -use PDOStatement; -use LogicException; use DateTimeInterface; -use Illuminate\Support\Arr; -use Illuminate\Database\Query\Expression; +use Doctrine\DBAL\Connection as DoctrineConnection; +use Exception; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Database\Events\QueryExecuted; -use Doctrine\DBAL\Connection as DoctrineConnection; -use Illuminate\Database\Query\Processors\Processor; +use Illuminate\Database\Events\StatementPrepared; +use Illuminate\Database\Events\TransactionBeginning; +use Illuminate\Database\Events\TransactionCommitted; +use Illuminate\Database\Events\TransactionRolledBack; use Illuminate\Database\Query\Builder as QueryBuilder; -use Illuminate\Database\Schema\Builder as SchemaBuilder; +use Illuminate\Database\Query\Expression; use Illuminate\Database\Query\Grammars\Grammar as QueryGrammar; +use Illuminate\Database\Query\Processors\Processor; +use Illuminate\Database\Schema\Builder as SchemaBuilder; +use Illuminate\Support\Arr; +use LogicException; +use PDO; +use PDOStatement; class Connection implements ConnectionInterface { - use DetectsDeadlocks, + use DetectsConcurrencyErrors, DetectsLostConnections, Concerns\ManagesTransactions; @@ -153,10 +157,10 @@ class Connection implements ConnectionInterface /** * Create a new database connection instance. * - * @param \PDO|\Closure $pdo - * @param string $database - * @param string $tablePrefix - * @param array $config + * @param \PDO|\Closure $pdo + * @param string $database + * @param string $tablePrefix + * @param array $config * @return void */ public function __construct($pdo, $database = '', $tablePrefix = '', array $config = []) @@ -257,12 +261,13 @@ class Connection implements ConnectionInterface /** * Begin a fluent query against a database table. * - * @param string $table + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as * @return \Illuminate\Database\Query\Builder */ - public function table($table) + public function table($table, $as = null) { - return $this->query()->from($table); + return $this->query()->from($table, $as); } /** @@ -281,7 +286,7 @@ class Connection implements ConnectionInterface * Run a select statement and return a single result. * * @param string $query - * @param array $bindings + * @param array $bindings * @param bool $useReadPdo * @return mixed */ @@ -296,7 +301,7 @@ class Connection implements ConnectionInterface * Run a select statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return array */ public function selectFromWriteConnection($query, $bindings = []) @@ -381,7 +386,7 @@ class Connection implements ConnectionInterface { $statement->setFetchMode($this->fetchMode); - $this->event(new Events\StatementPrepared( + $this->event(new StatementPrepared( $this, $statement )); @@ -403,7 +408,7 @@ class Connection implements ConnectionInterface * Run an insert statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return bool */ public function insert($query, $bindings = []) @@ -415,7 +420,7 @@ class Connection implements ConnectionInterface * Run an update statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function update($query, $bindings = []) @@ -427,7 +432,7 @@ class Connection implements ConnectionInterface * Run a delete statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function delete($query, $bindings = []) @@ -439,7 +444,7 @@ class Connection implements ConnectionInterface * Execute an SQL statement and return the boolean result. * * @param string $query - * @param array $bindings + * @param array $bindings * @return bool */ public function statement($query, $bindings = []) @@ -463,7 +468,7 @@ class Connection implements ConnectionInterface * Run an SQL statement and get the number of rows affected. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function affectingStatement($query, $bindings = []) @@ -504,7 +509,7 @@ class Connection implements ConnectionInterface } $this->recordsHaveBeenModified( - $change = ($this->getPdo()->exec($query) === false ? false : true) + $change = $this->getPdo()->exec($query) !== false ); return $change; @@ -552,7 +557,7 @@ class Connection implements ConnectionInterface // Now we'll execute this callback and capture the result. Once it has been // executed we will restore the value of query logging and give back the - // value of hte callback so the original callers can have the results. + // value of the callback so the original callers can have the results. $result = $callback(); $this->loggingQueries = $loggingQueries; @@ -563,7 +568,7 @@ class Connection implements ConnectionInterface /** * Bind values to their parameters in the given statement. * - * @param \PDOStatement $statement + * @param \PDOStatement $statement * @param array $bindings * @return void */ @@ -604,8 +609,8 @@ class Connection implements ConnectionInterface /** * Run a SQL statement and log its execution context. * - * @param string $query - * @param array $bindings + * @param string $query + * @param array $bindings * @param \Closure $callback * @return mixed * @@ -641,8 +646,8 @@ class Connection implements ConnectionInterface /** * Run a SQL statement. * - * @param string $query - * @param array $bindings + * @param string $query + * @param array $bindings * @param \Closure $callback * @return mixed * @@ -673,7 +678,7 @@ class Connection implements ConnectionInterface * Log a query in the connection's query log. * * @param string $query - * @param array $bindings + * @param array $bindings * @param float|null $time * @return void */ @@ -689,7 +694,7 @@ class Connection implements ConnectionInterface /** * Get the elapsed time since a given starting point. * - * @param int $start + * @param int $start * @return float */ protected function getElapsedTime($start) @@ -700,14 +705,15 @@ class Connection implements ConnectionInterface /** * Handle a query exception. * - * @param \Exception $e + * @param \Illuminate\Database\QueryException $e * @param string $query * @param array $bindings * @param \Closure $callback * @return mixed - * @throws \Exception + * + * @throws \Illuminate\Database\QueryException */ - protected function handleQueryException($e, $query, $bindings, Closure $callback) + protected function handleQueryException(QueryException $e, $query, $bindings, Closure $callback) { if ($this->transactions >= 1) { throw $e; @@ -722,8 +728,8 @@ class Connection implements ConnectionInterface * Handle a query exception that occurred during query execution. * * @param \Illuminate\Database\QueryException $e - * @param string $query - * @param array $bindings + * @param string $query + * @param array $bindings * @param \Closure $callback * @return mixed * @@ -750,6 +756,8 @@ class Connection implements ConnectionInterface public function reconnect() { if (is_callable($this->reconnector)) { + $this->doctrineConnection = null; + return call_user_func($this->reconnector, $this); } @@ -805,11 +813,11 @@ class Connection implements ConnectionInterface switch ($event) { case 'beganTransaction': - return $this->events->dispatch(new Events\TransactionBeginning($this)); + return $this->events->dispatch(new TransactionBeginning($this)); case 'committed': - return $this->events->dispatch(new Events\TransactionCommitted($this)); + return $this->events->dispatch(new TransactionCommitted($this)); case 'rollingBack': - return $this->events->dispatch(new Events\TransactionRolledBack($this)); + return $this->events->dispatch(new TransactionRolledBack($this)); } } @@ -894,11 +902,12 @@ class Connection implements ConnectionInterface if (is_null($this->doctrineConnection)) { $driver = $this->getDoctrineDriver(); - $this->doctrineConnection = new DoctrineConnection([ + $this->doctrineConnection = new DoctrineConnection(array_filter([ 'pdo' => $this->getPdo(), - 'dbname' => $this->getConfig('database'), + 'dbname' => $this->getDatabaseName(), 'driver' => $driver->getName(), - ], $driver); + 'serverVersion' => $this->getConfig('server_version'), + ]), $driver); } return $this->doctrineConnection; @@ -918,6 +927,16 @@ class Connection implements ConnectionInterface return $this->pdo; } + /** + * Get the current PDO connection parameter without executing any reconnect logic. + * + * @return \PDO|\Closure|null + */ + public function getRawPdo() + { + return $this->pdo; + } + /** * Get the current PDO connection used for reading. * @@ -929,7 +948,7 @@ class Connection implements ConnectionInterface return $this->getPdo(); } - if ($this->getConfig('sticky') && $this->recordsModified) { + if ($this->recordsModified && $this->getConfig('sticky')) { return $this->getPdo(); } @@ -940,6 +959,16 @@ class Connection implements ConnectionInterface return $this->readPdo ?: $this->getPdo(); } + /** + * Get the current read PDO connection parameter without executing any reconnect logic. + * + * @return \PDO|\Closure|null + */ + public function getRawReadPdo() + { + return $this->readPdo; + } + /** * Set the PDO connection. * @@ -958,7 +987,7 @@ class Connection implements ConnectionInterface /** * Set the PDO connection used for reading. * - * @param \PDO||\Closure|null $pdo + * @param \PDO|\Closure|null $pdo * @return $this */ public function setReadPdo($pdo) @@ -1026,11 +1055,13 @@ class Connection implements ConnectionInterface * Set the query grammar used by the connection. * * @param \Illuminate\Database\Query\Grammars\Grammar $grammar - * @return void + * @return $this */ public function setQueryGrammar(Query\Grammars\Grammar $grammar) { $this->queryGrammar = $grammar; + + return $this; } /** @@ -1047,11 +1078,13 @@ class Connection implements ConnectionInterface * Set the schema grammar used by the connection. * * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return void + * @return $this */ public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) { $this->schemaGrammar = $grammar; + + return $this; } /** @@ -1068,11 +1101,13 @@ class Connection implements ConnectionInterface * Set the query post processor used by the connection. * * @param \Illuminate\Database\Query\Processors\Processor $processor - * @return void + * @return $this */ public function setPostProcessor(Processor $processor) { $this->postProcessor = $processor; + + return $this; } /** @@ -1089,15 +1124,27 @@ class Connection implements ConnectionInterface * Set the event dispatcher instance on the connection. * * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void + * @return $this */ public function setEventDispatcher(Dispatcher $events) { $this->events = $events; + + return $this; } /** - * Determine if the connection in a "dry run". + * Unset the event dispatcher for this connection. + * + * @return void + */ + public function unsetEventDispatcher() + { + $this->events = null; + } + + /** + * Determine if the connection is in a "dry run". * * @return bool */ @@ -1170,11 +1217,13 @@ class Connection implements ConnectionInterface * Set the name of the connected database. * * @param string $database - * @return string + * @return $this */ public function setDatabaseName($database) { $this->database = $database; + + return $this; } /** @@ -1191,13 +1240,15 @@ class Connection implements ConnectionInterface * Set the table prefix in use by the connection. * * @param string $prefix - * @return void + * @return $this */ public function setTablePrefix($prefix) { $this->tablePrefix = $prefix; $this->getQueryGrammar()->setTablePrefix($prefix); + + return $this; } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/ConnectionInterface.php b/Seance5-6/seance/vendor/illuminate/database/ConnectionInterface.php index 9262d6fdfe3edff415ad079cdd0f0019f3fb4357..c7e24b1ab70f67c02f6620c31515cdd6c0225960 100644 --- a/Seance5-6/seance/vendor/illuminate/database/ConnectionInterface.php +++ b/Seance5-6/seance/vendor/illuminate/database/ConnectionInterface.php @@ -9,10 +9,11 @@ interface ConnectionInterface /** * Begin a fluent query against a database table. * - * @param string $table + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as * @return \Illuminate\Database\Query\Builder */ - public function table($table); + public function table($table, $as = null); /** * Get a new raw query expression. @@ -26,25 +27,37 @@ interface ConnectionInterface * Run a select statement and return a single result. * * @param string $query - * @param array $bindings + * @param array $bindings + * @param bool $useReadPdo * @return mixed */ - public function selectOne($query, $bindings = []); + public function selectOne($query, $bindings = [], $useReadPdo = true); /** * Run a select statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings + * @param bool $useReadPdo * @return array */ - public function select($query, $bindings = []); + public function select($query, $bindings = [], $useReadPdo = true); + + /** + * Run a select statement against the database and returns a generator. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return \Generator + */ + public function cursor($query, $bindings = [], $useReadPdo = true); /** * Run an insert statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return bool */ public function insert($query, $bindings = []); @@ -53,7 +66,7 @@ interface ConnectionInterface * Run an update statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function update($query, $bindings = []); @@ -62,7 +75,7 @@ interface ConnectionInterface * Run a delete statement against the database. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function delete($query, $bindings = []); @@ -71,7 +84,7 @@ interface ConnectionInterface * Execute an SQL statement and return the boolean result. * * @param string $query - * @param array $bindings + * @param array $bindings * @return bool */ public function statement($query, $bindings = []); @@ -80,7 +93,7 @@ interface ConnectionInterface * Run an SQL statement and get the number of rows affected. * * @param string $query - * @param array $bindings + * @param array $bindings * @return int */ public function affectingStatement($query, $bindings = []); diff --git a/Seance5-6/seance/vendor/illuminate/database/ConnectionResolver.php b/Seance5-6/seance/vendor/illuminate/database/ConnectionResolver.php index 425ab6bce6d0eb9abcd819110b61beb66d631aa2..ebfc15c94dfe25330ba848c89afe09206d7b1bcb 100644 --- a/Seance5-6/seance/vendor/illuminate/database/ConnectionResolver.php +++ b/Seance5-6/seance/vendor/illuminate/database/ConnectionResolver.php @@ -34,7 +34,7 @@ class ConnectionResolver implements ConnectionResolverInterface /** * Get a database connection instance. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\ConnectionInterface */ public function connection($name = null) diff --git a/Seance5-6/seance/vendor/illuminate/database/ConnectionResolverInterface.php b/Seance5-6/seance/vendor/illuminate/database/ConnectionResolverInterface.php index eb0397a5d7ed1ab3feb901127154c3c74e988bd5..b31e5a792565824063b8b079b8ce813378afc381 100644 --- a/Seance5-6/seance/vendor/illuminate/database/ConnectionResolverInterface.php +++ b/Seance5-6/seance/vendor/illuminate/database/ConnectionResolverInterface.php @@ -7,7 +7,7 @@ interface ConnectionResolverInterface /** * Get a database connection instance. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\ConnectionInterface */ public function connection($name = null); diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/ConnectionFactory.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/ConnectionFactory.php index 0462c7b60fdfdaa6938f71652fb4b4660a2aacd4..1a2e37ec4e7abd54d52f136e60cbc2f7002c9ccc 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/ConnectionFactory.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/ConnectionFactory.php @@ -2,16 +2,15 @@ namespace Illuminate\Database\Connectors; -use PDOException; -use Illuminate\Support\Arr; -use InvalidArgumentException; +use Illuminate\Contracts\Container\Container; use Illuminate\Database\Connection; use Illuminate\Database\MySqlConnection; -use Illuminate\Database\SQLiteConnection; use Illuminate\Database\PostgresConnection; +use Illuminate\Database\SQLiteConnection; use Illuminate\Database\SqlServerConnection; -use Illuminate\Contracts\Container\Container; -use Illuminate\Contracts\Debug\ExceptionHandler; +use Illuminate\Support\Arr; +use InvalidArgumentException; +use PDOException; class ConnectionFactory { @@ -36,8 +35,8 @@ class ConnectionFactory /** * Establish a PDO connection based on the configuration. * - * @param array $config - * @param string $name + * @param array $config + * @param string|null $name * @return \Illuminate\Database\Connection */ public function make(array $config, $name = null) @@ -54,7 +53,7 @@ class ConnectionFactory /** * Parse and prepare the database configuration. * - * @param array $config + * @param array $config * @param string $name * @return array */ @@ -131,7 +130,7 @@ class ConnectionFactory /** * Get a read / write level configuration. * - * @param array $config + * @param array $config * @param string $type * @return array */ @@ -182,9 +181,7 @@ class ConnectionFactory try { return $this->createConnector($config)->connect($config); } catch (PDOException $e) { - if (count($hosts) - 1 === $key && $this->container->bound(ExceptionHandler::class)) { - $this->container->make(ExceptionHandler::class)->report($e); - } + continue; } } @@ -197,6 +194,8 @@ class ConnectionFactory * * @param array $config * @return array + * + * @throws \InvalidArgumentException */ protected function parseHosts(array $config) { @@ -257,11 +256,11 @@ class ConnectionFactory /** * Create a new connection instance. * - * @param string $driver - * @param \PDO|\Closure $connection - * @param string $database - * @param string $prefix - * @param array $config + * @param string $driver + * @param \PDO|\Closure $connection + * @param string $database + * @param string $prefix + * @param array $config * @return \Illuminate\Database\Connection * * @throws \InvalidArgumentException @@ -283,6 +282,6 @@ class ConnectionFactory return new SqlServerConnection($connection, $database, $prefix, $config); } - throw new InvalidArgumentException("Unsupported driver [$driver]"); + throw new InvalidArgumentException("Unsupported driver [{$driver}]"); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/Connector.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/Connector.php index b772f521252754ad7a11f901d9f1fe90b7f2aac1..0fecfb5e26a1c30730ec0d7d6a374db97e3456ab 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/Connector.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/Connector.php @@ -2,10 +2,11 @@ namespace Illuminate\Database\Connectors; -use PDO; -use Exception; use Doctrine\DBAL\Driver\PDOConnection; +use Exception; use Illuminate\Database\DetectsLostConnections; +use PDO; +use Throwable; class Connector { @@ -28,13 +29,15 @@ class Connector * Create a new PDO connection. * * @param string $dsn - * @param array $config - * @param array $options + * @param array $config + * @param array $options * @return \PDO + * + * @throws \Exception */ public function createConnection($dsn, array $config, array $options) { - list($username, $password) = [ + [$username, $password] = [ $config['username'] ?? null, $config['password'] ?? null, ]; @@ -82,16 +85,16 @@ class Connector /** * Handle an exception that occurred during connect execution. * - * @param \Exception $e + * @param \Throwable $e * @param string $dsn * @param string $username * @param string $password - * @param array $options + * @param array $options * @return \PDO * * @throws \Exception */ - protected function tryAgainIfCausedByLostConnection(Exception $e, $dsn, $username, $password, $options) + protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) { if ($this->causedByLostConnection($e)) { return $this->createPdoConnection($dsn, $username, $password, $options); diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/MySqlConnector.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/MySqlConnector.php index ed341aa45c1c0317c92f80515029ec229e5abe47..b1885a220203aadae4af128392a5864442bdde05 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/MySqlConnector.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/MySqlConnector.php @@ -87,7 +87,7 @@ class MySqlConnector extends Connector implements ConnectorInterface * * Chooses socket or host/port based on the 'unix_socket' config value. * - * @param array $config + * @param array $config * @return string */ protected function getDsn(array $config) @@ -172,7 +172,6 @@ class MySqlConnector extends Connector implements ConnectorInterface * Get the query to enable strict mode. * * @param \PDO $connection - * * @return string */ protected function strictMode(PDO $connection) diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/PostgresConnector.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/PostgresConnector.php index 5129b4b4474d7b1f6605de7a7bcf315cacb6211d..c40369d75f94b25deac868112629c8ac1e6e451d 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/PostgresConnector.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/PostgresConnector.php @@ -59,9 +59,11 @@ class PostgresConnector extends Connector implements ConnectorInterface */ protected function configureEncoding($connection, $config) { - $charset = $config['charset']; + if (! isset($config['charset'])) { + return; + } - $connection->prepare("set names '$charset'")->execute(); + $connection->prepare("set names '{$config['charset']}'")->execute(); } /** @@ -130,7 +132,7 @@ class PostgresConnector extends Connector implements ConnectorInterface /** * Create a DSN string from a configuration. * - * @param array $config + * @param array $config * @return string */ protected function getDsn(array $config) diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/SQLiteConnector.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/SQLiteConnector.php index 28f90915b525e59fd65c62c617fa4824b856f907..90dc16be24cc7ad921adb4d59523247f615969c1 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/SQLiteConnector.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/SQLiteConnector.php @@ -21,7 +21,7 @@ class SQLiteConnector extends Connector implements ConnectorInterface // 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:') { + if ($config['database'] === ':memory:') { return $this->createConnection('sqlite::memory:', $config, $options); } @@ -31,7 +31,7 @@ class SQLiteConnector extends Connector implements ConnectorInterface // 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."); + throw new InvalidArgumentException("Database ({$config['database']}) does not exist."); } return $this->createConnection("sqlite:{$path}", $config, $options); diff --git a/Seance5-6/seance/vendor/illuminate/database/Connectors/SqlServerConnector.php b/Seance5-6/seance/vendor/illuminate/database/Connectors/SqlServerConnector.php index 87525d121b66f99e6da49524b2b1d83fd9b48327..0424642e238571d28ae2c4ab9cba4238dc87c79d 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Connectors/SqlServerConnector.php +++ b/Seance5-6/seance/vendor/illuminate/database/Connectors/SqlServerConnector.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Connectors; -use PDO; use Illuminate\Support\Arr; +use PDO; class SqlServerConnector extends Connector implements ConnectorInterface { @@ -35,7 +35,7 @@ class SqlServerConnector extends Connector implements ConnectorInterface /** * Create a DSN string from a configuration. * - * @param array $config + * @param array $config * @return string */ protected function getDsn(array $config) @@ -43,13 +43,15 @@ class SqlServerConnector extends Connector implements ConnectorInterface // 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); - } elseif ($this->prefersOdbc($config)) { + if ($this->prefersOdbc($config)) { return $this->getOdbcDsn($config); } - return $this->getSqlSrvDsn($config); + if (in_array('sqlsrv', $this->getAvailableDrivers())) { + return $this->getSqlSrvDsn($config); + } else { + return $this->getDblibDsn($config); + } } /** @@ -138,6 +140,22 @@ class SqlServerConnector extends Connector implements ConnectorInterface $arguments['MultiSubnetFailover'] = $config['multi_subnet_failover']; } + if (isset($config['column_encryption'])) { + $arguments['ColumnEncryption'] = $config['column_encryption']; + } + + if (isset($config['key_store_authentication'])) { + $arguments['KeyStoreAuthentication'] = $config['key_store_authentication']; + } + + if (isset($config['key_store_principal_id'])) { + $arguments['KeyStorePrincipalId'] = $config['key_store_principal_id']; + } + + if (isset($config['key_store_secret'])) { + $arguments['KeyStoreSecret'] = $config['key_store_secret']; + } + return $this->buildConnectString('sqlsrv', $arguments); } @@ -164,11 +182,11 @@ class SqlServerConnector extends Connector implements ConnectorInterface */ protected function buildHostString(array $config, $separator) { - if (isset($config['port']) && ! empty($config['port'])) { - return $config['host'].$separator.$config['port']; - } else { + if (empty($config['port'])) { return $config['host']; } + + return $config['host'].$separator.$config['port']; } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Factories/FactoryMakeCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Factories/FactoryMakeCommand.php index 86341594d133fca35a7e97253a6d527f60531c0e..725a69ccceebbcd1dd213fe46358c5b8847c48ae 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Factories/FactoryMakeCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Factories/FactoryMakeCommand.php @@ -46,12 +46,22 @@ class FactoryMakeCommand extends GeneratorCommand */ protected function buildClass($name) { - $model = $this->option('model') + $namespaceModel = $this->option('model') ? $this->qualifyClass($this->option('model')) - : 'Model'; + : trim($this->rootNamespace(), '\\').'\\Model'; + + $model = class_basename($namespaceModel); return str_replace( - 'DummyModel', $model, parent::buildClass($name) + [ + 'NamespacedDummyModel', + 'DummyModel', + ], + [ + $namespaceModel, + $model, + ], + parent::buildClass($name) ); } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Factories/stubs/factory.stub b/Seance5-6/seance/vendor/illuminate/database/Console/Factories/stubs/factory.stub index 9e3f90b60f34dc8c7bcab2ff86390b33502f032d..74ac7c52612128c8242a7fc8ace8aabcc66099ac 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Factories/stubs/factory.stub +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Factories/stubs/factory.stub @@ -1,6 +1,9 @@ <?php +/** @var \Illuminate\Database\Eloquent\Factory $factory */ + use Faker\Generator as Faker; +use NamespacedDummyModel; $factory->define(DummyModel::class, function (Faker $faker) { return [ diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/BaseCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/BaseCommand.php index 81ca3cc75e6d370cb2591b3e2262a34d2d4d5e94..6c4f25507078f538383a0a6231b75583208bca16 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/BaseCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/BaseCommand.php @@ -18,15 +18,27 @@ class BaseCommand extends Command // migrations may be run for any customized path from within the application. if ($this->input->hasOption('path') && $this->option('path')) { return collect($this->option('path'))->map(function ($path) { - return $this->laravel->basePath().'/'.$path; + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$path + : $path; })->all(); } return array_merge( - [$this->getMigrationPath()], $this->migrator->paths() + $this->migrator->paths(), [$this->getMigrationPath()] ); } + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } + /** * Get the path to the migration directory. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/FreshCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/FreshCommand.php index a9779a795f39cd522514b36435d6ef503d3b24f0..29021e0c3dd65a1256a46b5907bc2d2ea0a16daa 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/FreshCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/FreshCommand.php @@ -27,42 +27,36 @@ class FreshCommand extends Command /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } - $this->dropAllTables( - $database = $this->input->getOption('database') - ); + $database = $this->input->getOption('database'); - $this->info('Dropped all tables successfully.'); + $this->call('db:wipe', array_filter([ + '--database' => $database, + '--drop-views' => $this->option('drop-views'), + '--drop-types' => $this->option('drop-types'), + '--force' => true, + ])); - $this->call('migrate', [ + $this->call('migrate', array_filter([ '--database' => $database, '--path' => $this->input->getOption('path'), + '--realpath' => $this->input->getOption('realpath'), '--force' => true, - ]); + '--step' => $this->option('step'), + ])); if ($this->needsSeeding()) { $this->runSeeder($database); } - } - /** - * Drop all of the database tables. - * - * @param string $database - * @return void - */ - protected function dropAllTables($database) - { - $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllTables(); + return 0; } /** @@ -83,11 +77,11 @@ class FreshCommand extends Command */ protected function runSeeder($database) { - $this->call('db:seed', [ + $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'DatabaseSeeder', - '--force' => $this->option('force'), - ]); + '--force' => true, + ])); } /** @@ -98,15 +92,15 @@ class FreshCommand extends Command 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.'], + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], + ['drop-types', null, InputOption::VALUE_NONE, 'Drop all tables and types (Postgres only)'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ['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'], + ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/InstallCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/InstallCommand.php index d9200240bea4a1b95813d3447d7140d05e3ff42d..d69c2ab6b5aa83fe28a8de3ff5dd3afb3ce45ab0 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/InstallCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/InstallCommand.php @@ -3,8 +3,8 @@ namespace Illuminate\Database\Console\Migrations; use Illuminate\Console\Command; -use Symfony\Component\Console\Input\InputOption; use Illuminate\Database\Migrations\MigrationRepositoryInterface; +use Symfony\Component\Console\Input\InputOption; class InstallCommand extends Command { @@ -64,7 +64,7 @@ class InstallCommand extends Command protected function getOptions() { return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateCommand.php index 12fe90af9911ee6aa050c1c5bbb710eb9ced6830..688b67da8bfda474a0aac419a6cabe22eca6fb20 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateCommand.php @@ -14,12 +14,13 @@ class MigrateCommand extends BaseCommand * * @var string */ - protected $signature = 'migrate {--database= : The database connection to use.} - {--force : Force the operation to run when in production.} - {--path= : The path of migrations files to be executed.} - {--pretend : Dump the SQL queries that would be run.} - {--seed : Indicates if the seed task should be re-run.} - {--step : Force the migrations to be run so they can be rolled back individually.}'; + protected $signature = 'migrate {--database= : The database connection to use} + {--force : Force the operation to run when in production} + {--path=* : The path(s) to the migrations files to be executed} + {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths} + {--pretend : Dump the SQL queries that would be run} + {--seed : Indicates if the seed task should be re-run} + {--step : Force the migrations to be run so they can be rolled back individually}'; /** * The console command description. @@ -51,37 +52,35 @@ class MigrateCommand extends BaseCommand /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } - $this->prepareDatabase(); + $this->migrator->usingConnection($this->option('database'), function () { + $this->prepareDatabase(); - // 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. - $this->migrator->run($this->getMigrationPaths(), [ - 'pretend' => $this->option('pretend'), - 'step' => $this->option('step'), - ]); + // 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. + $this->migrator->setOutput($this->output) + ->run($this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => $this->option('step'), + ]); - // 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->option('seed') && ! $this->option('pretend')) { + $this->call('db:seed', ['--force' => true]); + } + }); - // 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->option('seed')) { - $this->call('db:seed', ['--force' => true]); - } + return 0; } /** @@ -91,12 +90,10 @@ class MigrateCommand extends BaseCommand */ protected function prepareDatabase() { - $this->migrator->setConnection($this->option('database')); - if (! $this->migrator->repositoryExists()) { - $this->call( - 'migrate:install', ['--database' => $this->option('database')] - ); + $this->call('migrate:install', array_filter([ + '--database' => $this->option('database'), + ])); } } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateMakeCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateMakeCommand.php index 03995de99d2ea08d578e3e9c5e6fdbe4a9fb9060..2c2a71155ff7223da17ab9e5fb801618620f589e 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateMakeCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/MigrateMakeCommand.php @@ -2,9 +2,9 @@ namespace Illuminate\Database\Console\Migrations; -use Illuminate\Support\Str; -use Illuminate\Support\Composer; use Illuminate\Database\Migrations\MigrationCreator; +use Illuminate\Support\Composer; +use Illuminate\Support\Str; class MigrateMakeCommand extends BaseCommand { @@ -13,10 +13,12 @@ class MigrateMakeCommand extends BaseCommand * * @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.}'; + 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} + {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths} + {--fullpath : Output the full path of the migration}'; /** * The console command description. @@ -83,11 +85,7 @@ class MigrateMakeCommand extends BaseCommand // "create" in the name. This will allow us to provide a convenient way // of creating migrations that create new tables for the application. if (! $table) { - if (preg_match('/^create_(\w+)_table$/', $name, $matches)) { - $table = $matches[1]; - - $create = true; - } + [$table, $create] = TableGuesser::guess($name); } // Now we are ready to write the migration out to disk. Once we've written @@ -103,14 +101,18 @@ class MigrateMakeCommand extends BaseCommand * * @param string $name * @param string $table - * @param bool $create + * @param bool $create * @return string */ protected function writeMigration($name, $table, $create) { - $file = pathinfo($this->creator->create( + $file = $this->creator->create( $name, $this->getMigrationPath(), $table, $create - ), PATHINFO_FILENAME); + ); + + if (! $this->option('fullpath')) { + $file = pathinfo($file, PATHINFO_FILENAME); + } $this->line("<info>Created Migration:</info> {$file}"); } @@ -123,9 +125,21 @@ class MigrateMakeCommand extends BaseCommand protected function getMigrationPath() { if (! is_null($targetPath = $this->input->getOption('path'))) { - return $this->laravel->basePath().'/'.$targetPath; + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$targetPath + : $targetPath; } return parent::getMigrationPath(); } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RefreshCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RefreshCommand.php index dc89091c1ebac23441f01e500682199e58fdce9d..9a799c521e45efea29f97cc15621bc4855e04dd4 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RefreshCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RefreshCommand.php @@ -27,12 +27,12 @@ class RefreshCommand extends Command /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } // Next we'll gather some of the options so that we can have the right options @@ -42,31 +42,32 @@ class RefreshCommand extends Command $path = $this->input->getOption('path'); - $force = $this->input->getOption('force'); - // If the "step" option is specified it means we only want to rollback a small // number of migrations before migrating again. For example, the user might // only rollback and remigrate the latest four migrations instead of all. $step = $this->input->getOption('step') ?: 0; if ($step > 0) { - $this->runRollback($database, $path, $step, $force); + $this->runRollback($database, $path, $step); } else { - $this->runReset($database, $path, $force); + $this->runReset($database, $path); } // 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', [ + $this->call('migrate', array_filter([ '--database' => $database, '--path' => $path, - '--force' => $force, - ]); + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + ])); if ($this->needsSeeding()) { $this->runSeeder($database); } + + return 0; } /** @@ -74,18 +75,18 @@ class RefreshCommand extends Command * * @param string $database * @param string $path - * @param bool $step - * @param bool $force + * @param int $step * @return void */ - protected function runRollback($database, $path, $step, $force) + protected function runRollback($database, $path, $step) { - $this->call('migrate:rollback', [ + $this->call('migrate:rollback', array_filter([ '--database' => $database, '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), '--step' => $step, - '--force' => $force, - ]); + '--force' => true, + ])); } /** @@ -93,16 +94,16 @@ class RefreshCommand extends Command * * @param string $database * @param string $path - * @param bool $force * @return void */ - protected function runReset($database, $path, $force) + protected function runReset($database, $path) { - $this->call('migrate:reset', [ + $this->call('migrate:reset', array_filter([ '--database' => $database, '--path' => $path, - '--force' => $force, - ]); + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + ])); } /** @@ -123,11 +124,11 @@ class RefreshCommand extends Command */ protected function runSeeder($database) { - $this->call('db:seed', [ + $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'DatabaseSeeder', - '--force' => $this->option('force'), - ]); + '--force' => true, + ])); } /** @@ -138,17 +139,13 @@ class RefreshCommand extends Command 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.'], - - ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run.'], + ['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 | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ['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'], + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/ResetCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/ResetCommand.php index c2efdfa68954e418ae37e9444b8d86151b4de13d..21b5329791491b01a611602e0d262582d505f8ed 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/ResetCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/ResetCommand.php @@ -47,33 +47,28 @@ class ResetCommand extends BaseCommand /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } - $this->migrator->setConnection($this->option('database')); - - // First, we'll make sure that the migration table actually exists before we - // start trying to rollback and re-run all of the migrations. If it's not - // present we'll just bail out with an info message for the developers. - if (! $this->migrator->repositoryExists()) { - return $this->comment('Migration table not found.'); - } + return $this->migrator->usingConnection($this->option('database'), function () { + // First, we'll make sure that the migration table actually exists before we + // start trying to rollback and re-run all of the migrations. If it's not + // present we'll just bail out with an info message for the developers. + if (! $this->migrator->repositoryExists()) { + return $this->comment('Migration table not found.'); + } - $this->migrator->reset( - $this->getMigrationPaths(), $this->option('pretend') - ); + $this->migrator->setOutput($this->output)->reset( + $this->getMigrationPaths(), $this->option('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); - } + return 0; } /** @@ -84,13 +79,15 @@ class ResetCommand extends BaseCommand protected function getOptions() { return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) of migrations files to be executed.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RollbackCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RollbackCommand.php index 3315d643a898a439230712cb101cc22d64cbb798..c851360f75245a2a68401ef72b16f505f4b6d1fb 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RollbackCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/RollbackCommand.php @@ -47,29 +47,24 @@ class RollbackCommand extends BaseCommand /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } - $this->migrator->setConnection($this->option('database')); - - $this->migrator->rollback( - $this->getMigrationPaths(), [ - 'pretend' => $this->option('pretend'), - 'step' => (int) $this->option('step'), - ] - ); + $this->migrator->usingConnection($this->option('database'), function () { + $this->migrator->setOutput($this->output)->rollback( + $this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => (int) $this->option('step'), + ] + ); + }); - // 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); - } + return 0; } /** @@ -80,15 +75,17 @@ class RollbackCommand extends BaseCommand protected function getOptions() { return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], - ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted.'], + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/StatusCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/StatusCommand.php index df065423b7bebe6cd3d66be01398c738322d6680..2cf82f96f06b20578b224b5b13da410b561c172e 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/StatusCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Migrations/StatusCommand.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Console\Migrations; -use Illuminate\Support\Collection; use Illuminate\Database\Migrations\Migrator; +use Illuminate\Support\Collection; use Symfony\Component\Console\Input\InputOption; class StatusCommand extends BaseCommand @@ -32,7 +32,7 @@ class StatusCommand extends BaseCommand /** * Create a new migration rollback command instance. * - * @param \Illuminate\Database\Migrations\Migrator $migrator + * @param \Illuminate\Database\Migrations\Migrator $migrator * @return void */ public function __construct(Migrator $migrator) @@ -45,40 +45,45 @@ class StatusCommand extends BaseCommand /** * Execute the console command. * - * @return void + * @return int|null */ public function handle() { - $this->migrator->setConnection($this->option('database')); + return $this->migrator->usingConnection($this->option('database'), function () { + if (! $this->migrator->repositoryExists()) { + $this->error('Migration table not found.'); - if (! $this->migrator->repositoryExists()) { - return $this->error('No migrations found.'); - } + return 1; + } - $ran = $this->migrator->getRepository()->getRan(); + $ran = $this->migrator->getRepository()->getRan(); - if (count($migrations = $this->getStatusFor($ran)) > 0) { - $this->table(['Ran?', 'Migration'], $migrations); - } else { - $this->error('No migrations found'); - } + $batches = $this->migrator->getRepository()->getMigrationBatches(); + + if (count($migrations = $this->getStatusFor($ran, $batches)) > 0) { + $this->table(['Ran?', 'Migration', 'Batch'], $migrations); + } else { + $this->error('No migrations found'); + } + }); } /** * Get the status for the given ran migrations. * * @param array $ran + * @param array $batches * @return \Illuminate\Support\Collection */ - protected function getStatusFor(array $ran) + protected function getStatusFor(array $ran, array $batches) { return Collection::make($this->getAllMigrationFiles()) - ->map(function ($migration) use ($ran) { + ->map(function ($migration) use ($ran, $batches) { $migrationName = $this->migrator->getMigrationName($migration); return in_array($migrationName, $ran) - ? ['<info>Y</info>', $migrationName] - : ['<fg=red>N</fg=red>', $migrationName]; + ? ['<info>Yes</info>', $migrationName, $batches[$migrationName]] + : ['<fg=red>No</fg=red>', $migrationName]; }); } @@ -100,9 +105,11 @@ class StatusCommand extends BaseCommand protected function getOptions() { return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to use'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to use.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeedCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeedCommand.php index 248987320b966733404ce462b61f0184e15aebd5..2e4fdd709b34c3ff94e7675872514acc2d162022 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeedCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeedCommand.php @@ -3,10 +3,10 @@ namespace Illuminate\Database\Console\Seeds; use Illuminate\Console\Command; -use Illuminate\Database\Eloquent\Model; use Illuminate\Console\ConfirmableTrait; -use Symfony\Component\Console\Input\InputOption; use Illuminate\Database\ConnectionResolverInterface as Resolver; +use Illuminate\Database\Eloquent\Model; +use Symfony\Component\Console\Input\InputOption; class SeedCommand extends Command { @@ -49,19 +49,29 @@ class SeedCommand extends Command /** * Execute the console command. * - * @return void + * @return int */ public function handle() { if (! $this->confirmToProceed()) { - return; + return 1; } + $previousConnection = $this->resolver->getDefaultConnection(); + $this->resolver->setDefaultConnection($this->getDatabase()); Model::unguarded(function () { $this->getSeeder()->__invoke(); }); + + if ($previousConnection) { + $this->resolver->setDefaultConnection($previousConnection); + } + + $this->info('Database seeding completed successfully.'); + + return 0; } /** @@ -100,7 +110,7 @@ class SeedCommand extends Command ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], ]; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeederMakeCommand.php b/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeederMakeCommand.php index 6e85e3e43f3c7c111b6399d17922f57b35f0d0c7..f25c9ab81fed6722b9607bb679a679d00a7c5758 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeederMakeCommand.php +++ b/Seance5-6/seance/vendor/illuminate/database/Console/Seeds/SeederMakeCommand.php @@ -2,9 +2,9 @@ namespace Illuminate\Database\Console\Seeds; -use Illuminate\Support\Composer; -use Illuminate\Filesystem\Filesystem; use Illuminate\Console\GeneratorCommand; +use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Composer; class SeederMakeCommand extends GeneratorCommand { diff --git a/Seance5-6/seance/vendor/illuminate/database/DatabaseManager.php b/Seance5-6/seance/vendor/illuminate/database/DatabaseManager.php index 11af5a53116d6e497c8df5856fa8c7399944b9c7..386f072689cfa4deb8a7d875a86be1a58efaf7b3 100644 --- a/Seance5-6/seance/vendor/illuminate/database/DatabaseManager.php +++ b/Seance5-6/seance/vendor/illuminate/database/DatabaseManager.php @@ -2,11 +2,12 @@ namespace Illuminate\Database; -use PDO; +use Illuminate\Database\Connectors\ConnectionFactory; use Illuminate\Support\Arr; +use Illuminate\Support\ConfigurationUrlParser; use Illuminate\Support\Str; use InvalidArgumentException; -use Illuminate\Database\Connectors\ConnectionFactory; +use PDO; /** * @mixin \Illuminate\Database\Connection @@ -16,7 +17,7 @@ class DatabaseManager implements ConnectionResolverInterface /** * The application instance. * - * @var \Illuminate\Foundation\Application + * @var \Illuminate\Contracts\Foundation\Application */ protected $app; @@ -41,10 +42,17 @@ class DatabaseManager implements ConnectionResolverInterface */ protected $extensions = []; + /** + * The callback to be executed to reconnect to a database. + * + * @var callable + */ + protected $reconnector; + /** * Create a new database manager instance. * - * @param \Illuminate\Foundation\Application $app + * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Database\Connectors\ConnectionFactory $factory * @return void */ @@ -52,17 +60,21 @@ class DatabaseManager implements ConnectionResolverInterface { $this->app = $app; $this->factory = $factory; + + $this->reconnector = function ($connection) { + $this->reconnect($connection->getName()); + }; } /** * Get a database connection instance. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\Connection */ public function connection($name = null) { - list($database, $type) = $this->parseConnectionName($name); + [$database, $type] = $this->parseConnectionName($name); $name = $name ?: $database; @@ -137,10 +149,11 @@ class DatabaseManager implements ConnectionResolverInterface $connections = $this->app['config']['database.connections']; if (is_null($config = Arr::get($connections, $name))) { - throw new InvalidArgumentException("Database [$name] not configured."); + throw new InvalidArgumentException("Database connection [{$name}] not configured."); } - return $config; + return (new ConfigurationUrlParser) + ->parseConfiguration($config); } /** @@ -164,9 +177,7 @@ class DatabaseManager implements ConnectionResolverInterface // 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()); - }); + $connection->setReconnector($this->reconnector); return $connection; } @@ -175,14 +186,14 @@ class DatabaseManager implements ConnectionResolverInterface * Prepare the read / write mode for database connection instance. * * @param \Illuminate\Database\Connection $connection - * @param string $type + * @param string|null $type * @return \Illuminate\Database\Connection */ protected function setPdoForType(Connection $connection, $type = null) { - if ($type == 'read') { + if ($type === 'read') { $connection->setPdo($connection->getReadPdo()); - } elseif ($type == 'write') { + } elseif ($type === 'write') { $connection->setReadPdo($connection->getPdo()); } @@ -192,7 +203,7 @@ class DatabaseManager implements ConnectionResolverInterface /** * Disconnect from the given database and remove from local cache. * - * @param string $name + * @param string|null $name * @return void */ public function purge($name = null) @@ -207,7 +218,7 @@ class DatabaseManager implements ConnectionResolverInterface /** * Disconnect from the given database. * - * @param string $name + * @param string|null $name * @return void */ public function disconnect($name = null) @@ -220,7 +231,7 @@ class DatabaseManager implements ConnectionResolverInterface /** * Reconnect to the given database. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\Connection */ public function reconnect($name = null) @@ -245,8 +256,8 @@ class DatabaseManager implements ConnectionResolverInterface $fresh = $this->makeConnection($name); return $this->connections[$name] - ->setPdo($fresh->getPdo()) - ->setReadPdo($fresh->getReadPdo()); + ->setPdo($fresh->getRawPdo()) + ->setReadPdo($fresh->getRawReadPdo()); } /** @@ -296,7 +307,7 @@ class DatabaseManager implements ConnectionResolverInterface /** * Register an extension connection resolver. * - * @param string $name + * @param string $name * @param callable $resolver * @return void */ @@ -315,11 +326,22 @@ class DatabaseManager implements ConnectionResolverInterface return $this->connections; } + /** + * Set the database reconnector callback. + * + * @param callable $reconnector + * @return void + */ + public function setReconnector(callable $reconnector) + { + $this->reconnector = $reconnector; + } + /** * Dynamically pass methods to the default connection. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed */ public function __call($method, $parameters) diff --git a/Seance5-6/seance/vendor/illuminate/database/DatabaseServiceProvider.php b/Seance5-6/seance/vendor/illuminate/database/DatabaseServiceProvider.php index a8ee7b030b785b213470d36e8363aee7062aa228..fa0eb0dcbe6130145cf7905c73458ac4d707c585 100644 --- a/Seance5-6/seance/vendor/illuminate/database/DatabaseServiceProvider.php +++ b/Seance5-6/seance/vendor/illuminate/database/DatabaseServiceProvider.php @@ -4,12 +4,12 @@ namespace Illuminate\Database; use Faker\Factory as FakerFactory; use Faker\Generator as FakerGenerator; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\ServiceProvider; use Illuminate\Contracts\Queue\EntityResolver; use Illuminate\Database\Connectors\ConnectionFactory; -use Illuminate\Database\Eloquent\QueueEntityResolver; use Illuminate\Database\Eloquent\Factory as EloquentFactory; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\QueueEntityResolver; +use Illuminate\Support\ServiceProvider; class DatabaseServiceProvider extends ServiceProvider { @@ -74,8 +74,8 @@ class DatabaseServiceProvider extends ServiceProvider */ protected function registerEloquentFactory() { - $this->app->singleton(FakerGenerator::class, function ($app) { - return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US')); + $this->app->singleton(FakerGenerator::class, function ($app, $parameters) { + return FakerFactory::create($parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US')); }); $this->app->singleton(EloquentFactory::class, function ($app) { diff --git a/Seance5-6/seance/vendor/illuminate/database/DetectsDeadlocks.php b/Seance5-6/seance/vendor/illuminate/database/DetectsDeadlocks.php deleted file mode 100644 index a8193eeb915bd1ad7764066a14460d4c1ed9f2ff..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/database/DetectsDeadlocks.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Illuminate\Database; - -use Exception; -use Illuminate\Support\Str; - -trait DetectsDeadlocks -{ - /** - * Determine if the given exception was caused by a deadlock. - * - * @param \Exception $e - * @return bool - */ - protected function causedByDeadlock(Exception $e) - { - $message = $e->getMessage(); - - return Str::contains($message, [ - 'Deadlock found when trying to get lock', - 'deadlock detected', - 'The database file is locked', - 'database is locked', - 'database table is locked', - 'A table in the database is locked', - 'has been chosen as the deadlock victim', - 'Lock wait timeout exceeded; try restarting transaction', - 'WSREP detected deadlock/conflict and aborted the transaction. Try restarting the transaction', - ]); - } -} diff --git a/Seance5-6/seance/vendor/illuminate/database/DetectsLostConnections.php b/Seance5-6/seance/vendor/illuminate/database/DetectsLostConnections.php index 0ce39ddb82fbf57f4138f11e8eb00aa8f3caaa09..63b3b297b163a1472d0b5890dcafd8e27fb3377b 100644 --- a/Seance5-6/seance/vendor/illuminate/database/DetectsLostConnections.php +++ b/Seance5-6/seance/vendor/illuminate/database/DetectsLostConnections.php @@ -2,18 +2,18 @@ namespace Illuminate\Database; -use Exception; use Illuminate\Support\Str; +use Throwable; trait DetectsLostConnections { /** * Determine if the given exception was caused by a lost connection. * - * @param \Exception $e + * @param \Throwable $e * @return bool */ - protected function causedByLostConnection(Exception $e) + protected function causedByLostConnection(Throwable $e) { $message = $e->getMessage(); @@ -34,7 +34,15 @@ trait DetectsLostConnections 'reset by peer', 'Physical connection is not usable', 'TCP Provider: Error code 0x68', - 'Name or service not known', + 'ORA-03114', + 'Packets out of order. Expected', + 'Adaptive Server connection failed', + 'Communication link failure', + 'connection is no longer usable', + 'Login timeout expired', + 'Connection refused', + 'running with the --read-only option so it cannot execute this statement', + 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', ]); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Builder.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Builder.php index fd9919ef05ef01751ff00f919a4b2cae6831226f..92cff3992b1c3a3406f8b083bbef4454362473f0 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Builder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Builder.php @@ -2,22 +2,28 @@ namespace Illuminate\Database\Eloquent; -use Closure; use BadMethodCallException; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use Illuminate\Pagination\Paginator; +use Closure; +use Exception; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Concerns\BuildsQueries; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Query\Builder as QueryBuilder; +use Illuminate\Pagination\Paginator; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; +use Illuminate\Support\Traits\ForwardsCalls; +use ReflectionClass; +use ReflectionMethod; /** + * @property-read HigherOrderBuilderProxy $orWhere + * * @mixin \Illuminate\Database\Query\Builder */ class Builder { - use BuildsQueries, Concerns\QueriesRelationships; + use BuildsQueries, Concerns\QueriesRelationships, ForwardsCalls; /** * The base query builder instance. @@ -67,8 +73,8 @@ class Builder * @var array */ protected $passthru = [ - 'insert', 'insertGetId', 'getBindings', 'toSql', - 'exists', 'doesntExist', 'count', 'min', 'max', 'avg', 'sum', 'getConnection', + 'insert', 'insertOrIgnore', 'insertGetId', 'insertUsing', 'getBindings', 'toSql', 'dump', 'dd', + 'exists', 'doesntExist', 'count', 'min', 'max', 'avg', 'average', 'sum', 'getConnection', 'raw', ]; /** @@ -100,7 +106,7 @@ class Builder * Create and return an un-saved model instance. * * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function make(array $attributes = []) { @@ -152,12 +158,12 @@ class Builder */ public function withoutGlobalScopes(array $scopes = null) { - if (is_array($scopes)) { - foreach ($scopes as $scope) { - $this->withoutGlobalScope($scope); - } - } else { - $this->scopes = []; + if (! is_array($scopes)) { + $scopes = array_keys($this->scopes); + } + + foreach ($scopes as $scope) { + $this->withoutGlobalScope($scope); } return $this; @@ -210,16 +216,16 @@ class Builder /** * Add a basic where clause to the query. * - * @param string|array|\Closure $column - * @param string $operator + * @param \Closure|string|array $column + * @param mixed $operator * @param mixed $value * @param string $boolean * @return $this */ public function where($column, $operator = null, $value = null, $boolean = 'and') { - if ($column instanceof Closure) { - $column($query = $this->model->newModelQuery()); + if ($column instanceof Closure && is_null($operator)) { + $column($query = $this->model->newQueryWithoutRelationships()); $this->query->addNestedWhereQuery($query->getQuery(), $boolean); } else { @@ -229,23 +235,71 @@ class Builder return $this; } + /** + * Add a basic where clause to the query, and return the first result. + * + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') + { + return $this->where($column, $operator, $value, $boolean)->first(); + } + /** * Add an "or where" clause to the query. * * @param \Closure|array|string $column - * @param string $operator + * @param mixed $operator * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static + * @return $this */ public function orWhere($column, $operator = null, $value = null) { - list($value, $operator) = $this->query->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->query->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); return $this->where($column, $operator, $value, 'or'); } + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function latest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->latest($column); + + return $this; + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function oldest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->oldest($column); + + return $this; + } + /** * Create a collection of models from plain arrays. * @@ -300,6 +354,8 @@ class Builder */ public function findMany($ids, $columns = ['*']) { + $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; + if (empty($ids)) { return $this->model->newCollection(); } @@ -312,7 +368,7 @@ class Builder * * @param mixed $id * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ @@ -320,8 +376,10 @@ class Builder { $result = $this->find($id, $columns); + $id = $id instanceof Arrayable ? $id->toArray() : $id; + if (is_array($id)) { - if (count($result) == count(array_unique($id))) { + if (count($result) === count(array_unique($id))) { return $result; } } elseif (! is_null($result)) { @@ -338,7 +396,7 @@ class Builder * * @param mixed $id * @param array $columns - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function findOrNew($id, $columns = ['*']) { @@ -354,9 +412,9 @@ class Builder * * @param array $attributes * @param array $values - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ - public function firstOrNew(array $attributes, array $values = []) + public function firstOrNew(array $attributes = [], array $values = []) { if (! is_null($instance = $this->where($attributes)->first())) { return $instance; @@ -370,7 +428,7 @@ class Builder * * @param array $attributes * @param array $values - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function firstOrCreate(array $attributes, array $values = []) { @@ -388,7 +446,7 @@ class Builder * * @param array $attributes * @param array $values - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function updateOrCreate(array $attributes, array $values = []) { @@ -433,7 +491,7 @@ class Builder return $model; } - return call_user_func($callback); + return $callback(); } /** @@ -452,7 +510,7 @@ class Builder /** * Execute the query as a "select" statement. * - * @param array $columns + * @param array|string $columns * @return \Illuminate\Database\Eloquent\Collection|static[] */ public function get($columns = ['*']) @@ -472,8 +530,8 @@ class Builder /** * Get the hydrated models without eager loading. * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model[] + * @param array|string $columns + * @return \Illuminate\Database\Eloquent\Model[]|static[] */ public function getModels($columns = ['*']) { @@ -596,61 +654,15 @@ class Builder } /** - * Get a generator for the given query. + * Get a lazy collection for the given query. * - * @return \Generator + * @return \Illuminate\Support\LazyCollection */ public function cursor() { - foreach ($this->applyScopes()->query->cursor() as $record) { - yield $this->model->newFromBuilder($record); - } - } - - /** - * Chunk the results of a query by comparing numeric IDs. - * - * @param int $count - * @param callable $callback - * @param string $column - * @param string|null $alias - * @return bool - */ - public function chunkById($count, callable $callback, $column = null, $alias = null) - { - $column = is_null($column) ? $this->getModel()->getKeyName() : $column; - - $alias = is_null($alias) ? $column : $alias; - - $lastId = 0; - - do { - $clone = clone $this; - - // We'll execute the query for the given page and get the results. If there are - // no results we can just break and return from here. When there are results - // we will call the callback with the current chunk of these results here. - $results = $clone->forPageAfterId($count, $lastId, $column)->get(); - - $countResults = $results->count(); - - if ($countResults == 0) { - break; - } - - // 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 ($callback($results) === false) { - return false; - } - - $lastId = $results->last()->{$alias}; - - unset($results); - } while ($countResults == $count); - - return true; + return $this->applyScopes()->query->cursor()->map(function ($record) { + return $this->newModelInstance()->newFromBuilder($record); + }); } /** @@ -693,7 +705,7 @@ class Builder /** * Paginate the given query. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -720,7 +732,7 @@ class Builder /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -784,7 +796,7 @@ class Builder * Increment a column's value by a given amount. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @return int */ @@ -799,7 +811,7 @@ class Builder * Decrement a column's value by a given amount. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @return int */ @@ -818,14 +830,27 @@ class Builder */ protected function addUpdatedAtColumn(array $values) { - if (! $this->model->usesTimestamps()) { + if (! $this->model->usesTimestamps() || + is_null($this->model->getUpdatedAtColumn())) { return $values; } - return Arr::add( - $values, $this->model->getUpdatedAtColumn(), - $this->model->freshTimestampString() + $column = $this->model->getUpdatedAtColumn(); + + $values = array_merge( + [$column => $this->model->freshTimestampString()], + $values ); + + $segments = preg_split('/\s+as\s+/i', $this->query->from); + + $qualifiedColumn = end($segments).'.'.$column; + + $values[$qualifiedColumn] = $values[$column]; + + unset($values[$column]); + + return $values; } /** @@ -868,19 +893,19 @@ class Builder /** * Call the given local model scopes. * - * @param array $scopes - * @return mixed + * @param array|string $scopes + * @return static|mixed */ - public function scopes(array $scopes) + public function scopes($scopes) { $builder = $this; - foreach ($scopes as $scope => $parameters) { + foreach (Arr::wrap($scopes) as $scope => $parameters) { // If the scope key is an integer, then the scope was passed as the value and // the parameter list is empty, so we will format the scope name and these // parameters here. Then, we'll be ready to call the scope on the model. if (is_int($scope)) { - list($scope, $parameters) = [$parameters, []]; + [$scope, $parameters] = [$parameters, []]; } // Next we'll pass the scope callback to the callScope method which will take @@ -898,7 +923,7 @@ class Builder /** * Apply the scopes to the Eloquent builder instance and return it. * - * @return \Illuminate\Database\Eloquent\Builder|static + * @return static */ public function applyScopes() { @@ -913,7 +938,7 @@ class Builder continue; } - $builder->callScope(function (Builder $builder) use ($scope) { + $builder->callScope(function (self $builder) use ($scope) { // If the scope is a Closure we will just go ahead and call the scope with the // builder instance. The "callScope" method will properly group the clauses // that are added to this query so "where" clauses maintain proper logic. @@ -1059,7 +1084,7 @@ class Builder * Create a new instance of the model being queried. * * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function newModelInstance($attributes = []) { @@ -1079,22 +1104,22 @@ class Builder $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 the "name" value is a numeric key, we can assume that no constraints + // have been specified. We will just put an empty Closure there so that + // we can treat these all the same while we are looping through them. if (is_numeric($name)) { $name = $constraints; - list($name, $constraints) = Str::contains($name, ':') + [$name, $constraints] = Str::contains($name, ':') ? $this->createSelectWithConstraint($name) - : [$name, function () { + : [$name, static function () { // }]; } - // We need to separate out any nested includes. Which allows the developers + // 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. + // the relationship with its own key in the array of eager-load names. $results = $this->addNestedWiths($name, $results); $results[$name] = $constraints; @@ -1111,7 +1136,7 @@ class Builder */ protected function createSelectWithConstraint($name) { - return [explode(':', $name)[0], function ($query) use ($name) { + return [explode(':', $name)[0], static function ($query) use ($name) { $query->select(explode(',', explode(':', $name)[1])); }]; } @@ -1134,7 +1159,7 @@ class Builder $progress[] = $segment; if (! isset($results[$last = implode('.', $progress)])) { - $results[$last] = function () { + $results[$last] = static function () { // }; } @@ -1143,6 +1168,19 @@ class Builder return $results; } + /** + * Apply query-time casts to the model instance. + * + * @param array $casts + * @return $this + */ + public function withCasts($casts) + { + $this->model->mergeCasts($casts); + + return $this; + } + /** * Get the underlying query builder instance. * @@ -1199,10 +1237,20 @@ class Builder return $this; } + /** + * Get the default key name of the table. + * + * @return string + */ + protected function defaultKeyName() + { + return $this->getModel()->getKeyName(); + } + /** * Get the model instance being queried. * - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|static */ public function getModel() { @@ -1246,6 +1294,56 @@ class Builder return Arr::get($this->localMacros, $name); } + /** + * Checks if a macro is registered. + * + * @param string $name + * @return bool + */ + public function hasMacro($name) + { + return isset($this->localMacros[$name]); + } + + /** + * Get the given global macro by name. + * + * @param string $name + * @return \Closure + */ + public static function getGlobalMacro($name) + { + return Arr::get(static::$macros, $name); + } + + /** + * Checks if a global macro is registered. + * + * @param string $name + * @return bool + */ + public static function hasGlobalMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Dynamically access builder proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception + */ + public function __get($key) + { + if ($key === 'orWhere') { + return new HigherOrderBuilderProxy($this, $key); + } + + throw new Exception("Property [{$key}] does not exist on the Eloquent builder instance."); + } + /** * Dynamically handle calls into the query instance. * @@ -1261,13 +1359,13 @@ class Builder return; } - if (isset($this->localMacros[$method])) { + if ($this->hasMacro($method)) { array_unshift($parameters, $this); return $this->localMacros[$method](...$parameters); } - if (isset(static::$macros[$method])) { + if (static::hasGlobalMacro($method)) { if (static::$macros[$method] instanceof Closure) { return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters); } @@ -1283,7 +1381,7 @@ class Builder return $this->toBase()->{$method}(...$parameters); } - $this->query->{$method}(...$parameters); + $this->forwardCallTo($this->query, $method, $parameters); return $this; } @@ -1305,8 +1403,12 @@ class Builder return; } - if (! isset(static::$macros[$method])) { - throw new BadMethodCallException("Method {$method} does not exist."); + if ($method === 'mixin') { + return static::registerMixin($parameters[0], $parameters[1] ?? true); + } + + if (! static::hasGlobalMacro($method)) { + static::throwBadMethodCallException($method); } if (static::$macros[$method] instanceof Closure) { @@ -1316,6 +1418,28 @@ class Builder return call_user_func_array(static::$macros[$method], $parameters); } + /** + * Register the given mixin with the builder. + * + * @param string $mixin + * @param bool $replace + * @return void + */ + protected static function registerMixin($mixin, $replace) + { + $methods = (new ReflectionClass($mixin))->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + if ($replace || ! static::hasGlobalMacro($method->name)) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + } + /** * Force a clone of the underlying query builder when cloning. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Collection.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Collection.php index bb2789a43ef5ce05569068d49b11e06da4302b04..77b2ec2651987f322f1b79fcbdf0f505c5e92b02 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Collection.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Collection.php @@ -2,11 +2,13 @@ namespace Illuminate\Database\Eloquent; -use LogicException; -use Illuminate\Support\Arr; -use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Queue\QueueableCollection; +use Illuminate\Contracts\Queue\QueueableEntity; +use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Support\Arr; use Illuminate\Support\Collection as BaseCollection; +use Illuminate\Support\Str; +use LogicException; class Collection extends BaseCollection implements QueueableCollection { @@ -15,7 +17,7 @@ class Collection extends BaseCollection implements QueueableCollection * * @param mixed $key * @param mixed $default - * @return \Illuminate\Database\Eloquent\Model|static + * @return \Illuminate\Database\Eloquent\Model|static|null */ public function find($key, $default = null) { @@ -43,7 +45,7 @@ class Collection extends BaseCollection implements QueueableCollection /** * Load a set of relationships onto the collection. * - * @param mixed $relations + * @param array|string $relations * @return $this */ public function load($relations) @@ -62,14 +64,127 @@ class Collection extends BaseCollection implements QueueableCollection } /** - * Add an item to the collection. + * Load a set of relationship counts onto the collection. * - * @param mixed $item + * @param array|string $relations * @return $this */ - public function add($item) + public function loadCount($relations) { - $this->items[] = $item; + if ($this->isEmpty()) { + return $this; + } + + $models = $this->first()->newModelQuery() + ->whereKey($this->modelKeys()) + ->select($this->first()->getKeyName()) + ->withCount(...func_get_args()) + ->get(); + + $attributes = Arr::except( + array_keys($models->first()->getAttributes()), + $models->first()->getKeyName() + ); + + $models->each(function ($model) use ($attributes) { + $this->find($model->getKey())->forceFill( + Arr::only($model->getAttributes(), $attributes) + )->syncOriginalAttributes($attributes); + }); + + return $this; + } + + /** + * Load a set of relationships onto the collection if they are not already eager loaded. + * + * @param array|string $relations + * @return $this + */ + public function loadMissing($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + foreach ($relations as $key => $value) { + if (is_numeric($key)) { + $key = $value; + } + + $segments = explode('.', explode(':', $key)[0]); + + if (Str::contains($key, ':')) { + $segments[count($segments) - 1] .= ':'.explode(':', $key)[1]; + } + + $path = []; + + foreach ($segments as $segment) { + $path[] = [$segment => $segment]; + } + + if (is_callable($value)) { + $path[count($segments) - 1][end($segments)] = $value; + } + + $this->loadMissingRelation($this, $path); + } + + return $this; + } + + /** + * Load a relationship path if it is not already eager loaded. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @param array $path + * @return void + */ + protected function loadMissingRelation(self $models, array $path) + { + $relation = array_shift($path); + + $name = explode(':', key($relation))[0]; + + if (is_string(reset($relation))) { + $relation = reset($relation); + } + + $models->filter(function ($model) use ($name) { + return ! is_null($model) && ! $model->relationLoaded($name); + })->load($relation); + + if (empty($path)) { + return; + } + + $models = $models->pluck($name); + + if ($models->first() instanceof BaseCollection) { + $models = $models->collapse(); + } + + $this->loadMissingRelation(new static($models), $path); + } + + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->pluck($relation) + ->filter() + ->groupBy(function ($model) { + return get_class($model); + }) + ->each(function ($models, $className) use ($relations) { + static::make($models)->load($relations[$className] ?? []); + }); return $this; } @@ -200,6 +315,10 @@ class Collection extends BaseCollection implements QueueableCollection { $intersect = new static; + if (empty($items)) { + return $intersect; + } + $dictionary = $this->getDictionary($items); foreach ($this->items as $item) { @@ -265,9 +384,7 @@ class Collection extends BaseCollection implements QueueableCollection */ public function makeHidden($attributes) { - return $this->each(function ($model) use ($attributes) { - $model->addHidden($attributes); - }); + return $this->each->makeHidden($attributes); } /** @@ -278,9 +395,7 @@ class Collection extends BaseCollection implements QueueableCollection */ public function makeVisible($attributes) { - return $this->each(function ($model) use ($attributes) { - $model->makeVisible($attributes); - }); + return $this->each->makeVisible($attributes); } /** @@ -374,7 +489,7 @@ class Collection extends BaseCollection implements QueueableCollection * Pad collection to the specified length with a value. * * @param int $size - * @param mixed $value + * @param mixed $value * @return \Illuminate\Support\Collection */ public function pad($size, $value) @@ -382,10 +497,24 @@ class Collection extends BaseCollection implements QueueableCollection return $this->toBase()->pad($size, $value); } + /** + * Get the comparison function to detect duplicates. + * + * @param bool $strict + * @return \Closure + */ + protected function duplicateComparator($strict) + { + return function ($a, $b) { + return $a->is($b); + }; + } + /** * Get the type of the entities being queued. * * @return string|null + * * @throws \LogicException */ public function getQueueableClass() @@ -412,13 +541,30 @@ class Collection extends BaseCollection implements QueueableCollection */ public function getQueueableIds() { - return $this->modelKeys(); + if ($this->isEmpty()) { + return []; + } + + return $this->first() instanceof QueueableEntity + ? $this->map->getQueueableId()->all() + : $this->modelKeys(); + } + + /** + * Get the relationships of the entities being queued. + * + * @return array + */ + public function getQueueableRelations() + { + return $this->isNotEmpty() ? $this->first()->getQueueableRelations() : []; } /** * Get the connection of the entities being queued. * * @return string|null + * * @throws \LogicException */ public function getQueueableConnection() diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php index 96317cf571bf142ffcbbc93281c94ba2368f1d6f..b9095c0480c7e4589327c76736f9907b6f3687b1 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/GuardsAttributes.php @@ -173,7 +173,7 @@ trait GuardsAttributes */ public function totallyGuarded() { - return count($this->getFillable()) == 0 && $this->getGuarded() == ['*']; + return count($this->getFillable()) === 0 && $this->getGuarded() == ['*']; } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php index 2893495cbfd58f898c23de12d8a9a8e22288385a..3d453a2b8ecbb385ef9dc8b5096a4f44fa94c9c2 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php @@ -2,15 +2,18 @@ namespace Illuminate\Database\Eloquent\Concerns; -use LogicException; +use Carbon\CarbonInterface; use DateTimeInterface; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use Illuminate\Support\Carbon; +use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes; use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Database\Eloquent\JsonEncodingException; use Illuminate\Database\Eloquent\Relations\Relation; +use Illuminate\Support\Arr; +use Illuminate\Support\Carbon; use Illuminate\Support\Collection as BaseCollection; -use Illuminate\Database\Eloquent\JsonEncodingException; +use Illuminate\Support\Facades\Date; +use Illuminate\Support\Str; +use LogicException; trait HasAttributes { @@ -36,12 +39,44 @@ trait HasAttributes protected $changes = []; /** - * The attributes that should be cast to native types. + * The attributes that should be cast. * * @var array */ protected $casts = []; + /** + * The attributes that have been cast using custom classes. + * + * @var array + */ + protected $classCastCache = []; + + /** + * The built-in, primitive cast types supported by Eloquent. + * + * @var array + */ + protected static $primitiveCastTypes = [ + 'array', + 'bool', + 'boolean', + 'collection', + 'custom_datetime', + 'date', + 'datetime', + 'decimal', + 'double', + 'float', + 'int', + 'integer', + 'json', + 'object', + 'real', + 'string', + 'timestamp', + ]; + /** * The attributes that should be mutated to dates. * @@ -171,7 +206,8 @@ trait HasAttributes protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) { foreach ($this->getCasts() as $key => $value) { - if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { + if (! array_key_exists($key, $attributes) || + in_array($key, $mutatedAttributes)) { continue; } @@ -189,6 +225,14 @@ trait HasAttributes ($value === 'date' || $value === 'datetime')) { $attributes[$key] = $this->serializeDate($attributes[$key]); } + + if ($attributes[$key] && $this->isCustomDateTimeCast($value)) { + $attributes[$key] = $attributes[$key]->format(explode(':', $value, 2)[1]); + } + + if ($attributes[$key] instanceof Arrayable) { + $attributes[$key] = $attributes[$key]->toArray(); + } } return $attributes; @@ -201,7 +245,7 @@ trait HasAttributes */ protected function getArrayableAttributes() { - return $this->getArrayableItems($this->attributes); + return $this->getArrayableItems($this->getAttributes()); } /** @@ -308,8 +352,9 @@ trait HasAttributes // If the attribute exists in the attribute array or has a "get" mutator we will // get the attribute's value. Otherwise, we will proceed as if the developers // are asking for a relationship's value. This covers both types of values. - if (array_key_exists($key, $this->attributes) || - $this->hasGetMutator($key)) { + if (array_key_exists($key, $this->getAttributes()) || + $this->hasGetMutator($key) || + $this->isClassCastable($key)) { return $this->getAttributeValue($key); } @@ -331,31 +376,7 @@ trait HasAttributes */ 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)) { - return $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. - if (in_array($key, $this->getDates()) && - ! is_null($value)) { - return $this->asDateTime($value); - } - - return $value; + return $this->transformModelValue($key, $this->getAttributeFromArray($key)); } /** @@ -366,9 +387,7 @@ trait HasAttributes */ protected function getAttributeFromArray($key) { - if (isset($this->attributes[$key])) { - return $this->attributes[$key]; - } + return $this->getAttributes()[$key] ?? null; } /** @@ -407,7 +426,15 @@ trait HasAttributes $relation = $this->$method(); if (! $relation instanceof Relation) { - throw new LogicException(get_class($this).'::'.$method.' must return a relationship instance.'); + if (is_null($relation)) { + throw new LogicException(sprintf( + '%s::%s must return a relationship instance, but "null" was returned. Was the "return" keyword used?', static::class, $method + )); + } + + throw new LogicException(sprintf( + '%s::%s must return a relationship instance.', static::class, $method + )); } return tap($relation->getResults(), function ($results) use ($method) { @@ -447,11 +474,24 @@ trait HasAttributes */ protected function mutateAttributeForArray($key, $value) { - $value = $this->mutateAttribute($key, $value); + $value = $this->isClassCastable($key) + ? $this->getClassCastableAttributeValue($key) + : $this->mutateAttribute($key, $value); return $value instanceof Arrayable ? $value->toArray() : $value; } + /** + * Merge new casts with existing casts on the model. + * + * @param array $casts + * @return void + */ + public function mergeCasts($casts) + { + $this->casts = array_merge($this->casts, $casts); + } + /** * Cast an attribute to a native PHP type. * @@ -461,18 +501,22 @@ trait HasAttributes */ protected function castAttribute($key, $value) { - if (is_null($value)) { + $castType = $this->getCastType($key); + + if (is_null($value) && in_array($castType, static::$primitiveCastTypes)) { return $value; } - switch ($this->getCastType($key)) { + switch ($castType) { case 'int': case 'integer': return (int) $value; case 'real': case 'float': case 'double': - return (float) $value; + return $this->fromFloat($value); + case 'decimal': + return $this->asDecimal($value, explode(':', $this->getCasts()[$key], 2)[1]); case 'string': return (string) $value; case 'bool': @@ -488,11 +532,35 @@ trait HasAttributes case 'date': return $this->asDate($value); case 'datetime': + case 'custom_datetime': return $this->asDateTime($value); case 'timestamp': return $this->asTimestamp($value); - default: - return $value; + } + + if ($this->isClassCastable($key)) { + return $this->getClassCastableAttributeValue($key); + } + + return $value; + } + + /** + * Cast the given attribute using a custom cast class. + * + * @param string $key + * @return mixed + */ + protected function getClassCastableAttributeValue($key) + { + if (isset($this->classCastCache[$key])) { + return $this->classCastCache[$key]; + } else { + $caster = $this->resolveCasterClass($key); + + return $this->classCastCache[$key] = $caster instanceof CastsInboundAttributes + ? $this->attributes[$key] + : $caster->get($this, $key, $this->attributes[$key] ?? null, $this->attributes); } } @@ -504,15 +572,46 @@ trait HasAttributes */ protected function getCastType($key) { + if ($this->isCustomDateTimeCast($this->getCasts()[$key])) { + return 'custom_datetime'; + } + + if ($this->isDecimalCast($this->getCasts()[$key])) { + return 'decimal'; + } + return trim(strtolower($this->getCasts()[$key])); } + /** + * Determine if the cast type is a custom date time cast. + * + * @param string $cast + * @return bool + */ + protected function isCustomDateTimeCast($cast) + { + return strncmp($cast, 'date:', 5) === 0 || + strncmp($cast, 'datetime:', 9) === 0; + } + + /** + * Determine if the cast type is a decimal cast. + * + * @param string $cast + * @return bool + */ + protected function isDecimalCast($cast) + { + return strncmp($cast, 'decimal:', 8) === 0; + } + /** * Set a given attribute on the model. * * @param string $key * @param mixed $value - * @return $this + * @return mixed */ public function setAttribute($key, $value) { @@ -520,9 +619,7 @@ trait HasAttributes // 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); + return $this->setMutatedAttributeValue($key, $value); } // If an attribute is listed as a "date", we'll convert it from a DateTime @@ -532,6 +629,12 @@ trait HasAttributes $value = $this->fromDateTime($value); } + if ($this->isClassCastable($key)) { + $this->setClassCastableAttribute($key, $value); + + return $this; + } + if ($this->isJsonCastable($key) && ! is_null($value)) { $value = $this->castAttributeAsJson($key, $value); } @@ -559,6 +662,18 @@ trait HasAttributes return method_exists($this, 'set'.Str::studly($key).'Attribute'); } + /** + * Set the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function setMutatedAttributeValue($key, $value) + { + return $this->{'set'.Str::studly($key).'Attribute'}($value); + } + /** * Determine if the given attribute is a date or date castable. * @@ -567,7 +682,7 @@ trait HasAttributes */ protected function isDateAttribute($key) { - return in_array($key, $this->getDates()) || + return in_array($key, $this->getDates(), true) || $this->isDateCastable($key); } @@ -580,7 +695,7 @@ trait HasAttributes */ public function fillJsonAttribute($key, $value) { - list($key, $path) = explode('->', $key, 2); + [$key, $path] = explode('->', $key, 2); $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( $path, $key, $value @@ -589,6 +704,41 @@ trait HasAttributes return $this; } + /** + * Set the value of a class castable attribute. + * + * @param string $key + * @param mixed $value + * @return void + */ + protected function setClassCastableAttribute($key, $value) + { + $caster = $this->resolveCasterClass($key); + + if (is_null($value)) { + $this->attributes = array_merge($this->attributes, array_map( + function () { + }, + $this->normalizeCastClassResponse($key, $caster->set( + $this, $key, $this->{$key}, $this->attributes + )) + )); + } else { + $this->attributes = array_merge( + $this->attributes, + $this->normalizeCastClassResponse($key, $caster->set( + $this, $key, $value, $this->attributes + )) + ); + } + + if ($caster instanceof CastsInboundAttributes || ! is_object($value)) { + unset($this->classCastCache[$key]); + } else { + $this->classCastCache[$key] = $value; + } + } + /** * Get an array attribute with the given key and value set. * @@ -659,6 +809,38 @@ trait HasAttributes return json_decode($value, ! $asObject); } + /** + * Decode the given float. + * + * @param mixed $value + * @return mixed + */ + public function fromFloat($value) + { + switch ((string) $value) { + case 'Infinity': + return INF; + case '-Infinity': + return -INF; + case 'NaN': + return NAN; + default: + return (float) $value; + } + } + + /** + * Return a decimal as string. + * + * @param float $value + * @param int $decimals + * @return string + */ + protected function asDecimal($value, $decimals) + { + return number_format($value, $decimals, '.', ''); + } + /** * Return a timestamp as DateTime object with time set to 00:00:00. * @@ -681,15 +863,15 @@ trait HasAttributes // If this value is already a Carbon instance, we shall just return it as is. // This prevents us having to re-instantiate 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 ($value instanceof CarbonInterface) { + return Date::instance($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 DateTimeInterface) { - return new Carbon( + return Date::parse( $value->format('Y-m-d H:i:s.u'), $value->getTimezone() ); } @@ -698,22 +880,26 @@ trait HasAttributes // 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); + return Date::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 ($this->isStandardDateFormat($value)) { - return Carbon::createFromFormat('Y-m-d', $value)->startOfDay(); + return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->startOfDay()); } + $format = $this->getDateFormat(); + // 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( - str_replace('.v', '.u', $this->getDateFormat()), $value - ); + if (Date::hasFormat($value, $format)) { + return Date::createFromFormat($format, $value); + } + + return Date::parse($value); } /** @@ -730,8 +916,8 @@ trait HasAttributes /** * Convert a DateTime to a storable string. * - * @param \DateTime|int $value - * @return string + * @param mixed $value + * @return string|null */ public function fromDateTime($value) { @@ -759,7 +945,7 @@ trait HasAttributes */ protected function serializeDate(DateTimeInterface $date) { - return $date->format($this->getDateFormat()); + return Carbon::instance($date)->toJSON(); } /** @@ -769,7 +955,10 @@ trait HasAttributes */ public function getDates() { - $defaults = [static::CREATED_AT, static::UPDATED_AT]; + $defaults = [ + $this->getCreatedAtColumn(), + $this->getUpdatedAtColumn(), + ]; return $this->usesTimestamps() ? array_unique(array_merge($this->dates, $defaults)) @@ -781,7 +970,7 @@ trait HasAttributes * * @return string */ - protected function getDateFormat() + public function getDateFormat() { return $this->dateFormat ?: $this->getConnection()->getQueryGrammar()->getDateFormat(); } @@ -851,6 +1040,80 @@ trait HasAttributes return $this->hasCast($key, ['array', 'json', 'object', 'collection']); } + /** + * Determine if the given key is cast using a custom class. + * + * @param string $key + * @return bool + */ + protected function isClassCastable($key) + { + return array_key_exists($key, $this->getCasts()) && + class_exists($class = $this->parseCasterClass($this->getCasts()[$key])) && + ! in_array($class, static::$primitiveCastTypes); + } + + /** + * Resolve the custom caster class for a given key. + * + * @param string $key + * @return mixed + */ + protected function resolveCasterClass($key) + { + if (strpos($castType = $this->getCasts()[$key], ':') === false) { + return new $castType; + } + + $segments = explode(':', $castType, 2); + + return new $segments[0](...explode(',', $segments[1])); + } + + /** + * Parse the given caster class, removing any arguments. + * + * @param string $class + * @return string + */ + protected function parseCasterClass($class) + { + return strpos($class, ':') === false + ? $class + : explode(':', $class, 2)[0]; + } + + /** + * Merge the cast class attributes back into the model. + * + * @return void + */ + protected function mergeAttributesFromClassCasts() + { + foreach ($this->classCastCache as $key => $value) { + $caster = $this->resolveCasterClass($key); + + $this->attributes = array_merge( + $this->attributes, + $caster instanceof CastsInboundAttributes + ? [$key => $value] + : $this->normalizeCastClassResponse($key, $caster->set($this, $key, $value, $this->attributes)) + ); + } + } + + /** + * Normalize the response from a custom class caster. + * + * @param string $key + * @param mixed $value + * @return array + */ + protected function normalizeCastClassResponse($key, $value) + { + return is_array($value) ? $value : [$key => $value]; + } + /** * Get all of the current attributes on the model. * @@ -858,6 +1121,8 @@ trait HasAttributes */ public function getAttributes() { + $this->mergeAttributesFromClassCasts(); + return $this->attributes; } @@ -876,6 +1141,8 @@ trait HasAttributes $this->syncOriginal(); } + $this->classCastCache = []; + return $this; } @@ -887,6 +1154,26 @@ trait HasAttributes * @return mixed|array */ public function getOriginal($key = null, $default = null) + { + if ($key) { + return $this->transformModelValue( + $key, Arr::get($this->original, $key, $default) + ); + } + + return collect($this->original)->mapWithKeys(function ($value, $key) { + return [$key => $this->transformModelValue($key, $value)]; + })->all(); + } + + /** + * Get the model's raw original attribute values. + * + * @param string|null $key + * @param mixed $default + * @return mixed|array + */ + public function getRawOriginal($key = null, $default = null) { return Arr::get($this->original, $key, $default); } @@ -915,7 +1202,7 @@ trait HasAttributes */ public function syncOriginal() { - $this->original = $this->attributes; + $this->original = $this->getAttributes(); return $this; } @@ -928,7 +1215,24 @@ trait HasAttributes */ public function syncOriginalAttribute($attribute) { - $this->original[$attribute] = $this->attributes[$attribute]; + return $this->syncOriginalAttributes($attribute); + } + + /** + * Sync multiple original attribute with their current values. + * + * @param array|string $attributes + * @return $this + */ + public function syncOriginalAttributes($attributes) + { + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + $modelAttributes = $this->getAttributes(); + + foreach ($attributes as $attribute) { + $this->original[$attribute] = $modelAttributes[$attribute]; + } return $this; } @@ -946,7 +1250,7 @@ trait HasAttributes } /** - * Determine if the model or given attribute(s) have been modified. + * Determine if the model or any of the given attribute(s) have been modified. * * @param array|string|null $attributes * @return bool @@ -959,7 +1263,7 @@ trait HasAttributes } /** - * Determine if the model or given attribute(s) have remained the same. + * Determine if the model and all the given attribute(s) have remained the same. * * @param array|string|null $attributes * @return bool @@ -970,7 +1274,7 @@ trait HasAttributes } /** - * Determine if the model or given attribute(s) have been modified. + * Determine if the model or any of the given attribute(s) have been modified. * * @param array|string|null $attributes * @return bool @@ -983,7 +1287,7 @@ trait HasAttributes } /** - * Determine if the given attributes were changed. + * Determine if any of the given attributes were changed. * * @param array $changes * @param array|string|null $attributes @@ -1020,7 +1324,7 @@ trait HasAttributes $dirty = []; foreach ($this->getAttributes() as $key => $value) { - if (! $this->originalIsEquivalent($key, $value)) { + if (! $this->originalIsEquivalent($key)) { $dirty[$key] = $value; } } @@ -1041,32 +1345,69 @@ trait HasAttributes /** * Determine if the new and old values for a given key are equivalent. * - * @param string $key - * @param mixed $current + * @param string $key * @return bool */ - protected function originalIsEquivalent($key, $current) + public function originalIsEquivalent($key) { if (! array_key_exists($key, $this->original)) { return false; } - $original = $this->getOriginal($key); + $attribute = Arr::get($this->attributes, $key); + $original = Arr::get($this->original, $key); - if ($current === $original) { + if ($attribute === $original) { return true; - } elseif (is_null($current)) { + } elseif (is_null($attribute)) { return false; } elseif ($this->isDateAttribute($key)) { - return $this->fromDateTime($current) === + return $this->fromDateTime($attribute) === $this->fromDateTime($original); - } elseif ($this->hasCast($key)) { - return $this->castAttribute($key, $current) === + } elseif ($this->hasCast($key, ['object', 'collection'])) { + return $this->castAttribute($key, $attribute) == + $this->castAttribute($key, $original); + } elseif ($this->hasCast($key, static::$primitiveCastTypes)) { + return $this->castAttribute($key, $attribute) === $this->castAttribute($key, $original); } - return is_numeric($current) && is_numeric($original) - && strcmp((string) $current, (string) $original) === 0; + return is_numeric($attribute) && is_numeric($original) + && strcmp((string) $attribute, (string) $original) === 0; + } + + /** + * Transform a raw model value using mutators, casts, etc. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function transformModelValue($key, $value) + { + // 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)) { + return $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. + if ($value !== null + && \in_array($key, $this->getDates(), false)) { + return $this->asDateTime($value); + } + + return $value; } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasEvents.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasEvents.php index 0972bd6fec33f4b64dcc77a64099250494753066..96ed62334d49dca99b0ba541be6fb4fd080ffc4f 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasEvents.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasEvents.php @@ -3,6 +3,8 @@ namespace Illuminate\Database\Eloquent\Concerns; use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Support\Arr; +use InvalidArgumentException; trait HasEvents { @@ -25,27 +27,65 @@ trait HasEvents protected $observables = []; /** - * Register an observer with the Model. + * Register observers with the model. * - * @param object|string $class + * @param object|array|string $classes * @return void + * + * @throws \RuntimeException */ - public static function observe($class) + public static function observe($classes) { $instance = new static; - $className = is_string($class) ? $class : get_class($class); + foreach (Arr::wrap($classes) as $class) { + $instance->registerObserver($class); + } + } + + /** + * Register a single observer with the model. + * + * @param object|string $class + * @return void + * + * @throws \RuntimeException + */ + protected function registerObserver($class) + { + $className = $this->resolveObserverClassName($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) { + foreach ($this->getObservableEvents() as $event) { if (method_exists($class, $event)) { static::registerModelEvent($event, $className.'@'.$event); } } } + /** + * Resolve the observer's class name from an object or string. + * + * @param object|string $class + * @return string + * + * @throws \InvalidArgumentException + */ + private function resolveObserverClassName($class) + { + if (is_object($class)) { + return get_class($class); + } + + if (class_exists($class)) { + return $class; + } + + throw new InvalidArgumentException('Unable to find observer: '.$class); + } + /** * Get the observable event names. * @@ -55,9 +95,9 @@ trait HasEvents { return array_merge( [ - 'retrieved', 'creating', 'created', 'updating', - 'updated', 'deleting', 'deleted', 'saving', - 'saved', 'restoring', 'restored', + 'retrieved', 'creating', 'created', 'updating', 'updated', + 'saving', 'saved', 'restoring', 'restored', 'replicating', + 'deleting', 'deleted', 'forceDeleted', ], $this->observables ); @@ -134,7 +174,7 @@ trait HasEvents // First, we will get the proper method to call on the event dispatcher, and then we // will attempt to fire a custom, object based event for the given event. If that // returns a result we can return that result, or we'll call the string events. - $method = $halt ? 'until' : 'fire'; + $method = $halt ? 'until' : 'dispatch'; $result = $this->filterModelEventResults( $this->fireCustomModelEvent($event, $method) @@ -263,6 +303,17 @@ trait HasEvents static::registerModelEvent('created', $callback); } + /** + * Register a replicating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function replicating($callback) + { + static::registerModelEvent('replicating', $callback); + } + /** * Register a deleting model event with the dispatcher. * @@ -337,4 +388,25 @@ trait HasEvents { static::$dispatcher = null; } + + /** + * Execute a callback without firing any model events for any model type. + * + * @param callable $callback + * @return mixed + */ + public static function withoutEvents(callable $callback) + { + $dispatcher = static::getEventDispatcher(); + + static::unsetEventDispatcher(); + + try { + return $callback(); + } finally { + if ($dispatcher) { + static::setEventDispatcher($dispatcher); + } + } + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasGlobalScopes.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasGlobalScopes.php index 97a549f6c73bea7dd8d210a822df0c6d3bc09848..1742679c5a308e89f8c24149bdf766e819492203 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasGlobalScopes.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasGlobalScopes.php @@ -3,9 +3,9 @@ namespace Illuminate\Database\Eloquent\Concerns; use Closure; +use Illuminate\Database\Eloquent\Scope; use Illuminate\Support\Arr; use InvalidArgumentException; -use Illuminate\Database\Eloquent\Scope; trait HasGlobalScopes { diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasRelationships.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasRelationships.php index c6affcd36b48ea05b22af1e51201da372d8833ce..31662eb1d1d017f145378355c9a939096bd2dd82 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasRelationships.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasRelationships.php @@ -2,21 +2,22 @@ namespace Illuminate\Database\Eloquent\Concerns; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Relations\HasOne; -use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Eloquent\Relations\MorphTo; -use Illuminate\Database\Eloquent\Relations\MorphOne; -use Illuminate\Database\Eloquent\Relations\Relation; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Relations\MorphMany; -use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasManyThrough; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasOneThrough; +use Illuminate\Database\Eloquent\Relations\MorphMany; +use Illuminate\Database\Eloquent\Relations\MorphOne; +use Illuminate\Database\Eloquent\Relations\MorphTo; +use Illuminate\Database\Eloquent\Relations\MorphToMany; +use Illuminate\Database\Eloquent\Relations\Relation; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; trait HasRelationships { @@ -41,15 +42,14 @@ trait HasRelationships */ public static $manyMethods = [ 'belongsToMany', 'morphToMany', 'morphedByMany', - 'guessBelongsToManyRelation', 'findFirstMethodThatIsntRelation', ]; /** * Define a one-to-one relationship. * * @param string $related - * @param string $foreignKey - * @param string $localKey + * @param string|null $foreignKey + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function hasOne($related, $foreignKey = null, $localKey = null) @@ -77,21 +77,64 @@ trait HasRelationships return new HasOne($query, $parent, $foreignKey, $localKey); } + /** + * Define a has-one-through relationship. + * + * @param string $related + * @param string $through + * @param string|null $firstKey + * @param string|null $secondKey + * @param string|null $localKey + * @param string|null $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough + */ + public function hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) + { + $through = new $through; + + $firstKey = $firstKey ?: $this->getForeignKey(); + + $secondKey = $secondKey ?: $through->getForeignKey(); + + return $this->newHasOneThrough( + $this->newRelatedInstance($related)->newQuery(), $this, $through, + $firstKey, $secondKey, $localKey ?: $this->getKeyName(), + $secondLocalKey ?: $through->getKeyName() + ); + } + + /** + * Instantiate a new HasOneThrough relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $farParent + * @param \Illuminate\Database\Eloquent\Model $throughParent + * @param string $firstKey + * @param string $secondKey + * @param string $localKey + * @param string $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough + */ + protected function newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) + { + return new HasOneThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); + } + /** * Define a polymorphic one-to-one relationship. * * @param string $related * @param string $name - * @param string $type - * @param string $id - * @param string $localKey + * @param string|null $type + * @param string|null $id + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\MorphOne */ public function morphOne($related, $name, $type = null, $id = null, $localKey = null) { $instance = $this->newRelatedInstance($related); - list($type, $id) = $this->getMorphs($name, $type, $id); + [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); @@ -119,9 +162,9 @@ trait HasRelationships * Define an inverse one-to-one or many relationship. * * @param string $related - * @param string $foreignKey - * @param string $ownerKey - * @param string $relation + * @param string|null $foreignKey + * @param string|null $ownerKey + * @param string|null $relation * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) @@ -170,19 +213,20 @@ trait HasRelationships /** * Define a polymorphic, inverse one-to-one or many relationship. * - * @param string $name - * @param string $type - * @param string $id + * @param string|null $name + * @param string|null $type + * @param string|null $id + * @param string|null $ownerKey * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ - public function morphTo($name = null, $type = null, $id = null) + public function morphTo($name = null, $type = null, $id = null, $ownerKey = 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. $name = $name ?: $this->guessBelongsToRelation(); - list($type, $id) = $this->getMorphs( + [$type, $id] = $this->getMorphs( Str::snake($name), $type, $id ); @@ -190,8 +234,8 @@ trait HasRelationships // 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. return empty($class = $this->{$type}) - ? $this->morphEagerTo($name, $type, $id) - : $this->morphInstanceTo($class, $name, $type, $id); + ? $this->morphEagerTo($name, $type, $id, $ownerKey) + : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); } /** @@ -200,12 +244,13 @@ trait HasRelationships * @param string $name * @param string $type * @param string $id + * @param string $ownerKey * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ - protected function morphEagerTo($name, $type, $id) + protected function morphEagerTo($name, $type, $id, $ownerKey) { return $this->newMorphTo( - $this->newQuery()->setEagerLoads([]), $this, $id, null, $type, $name + $this->newQuery()->setEagerLoads([]), $this, $id, $ownerKey, $type, $name ); } @@ -216,16 +261,17 @@ trait HasRelationships * @param string $name * @param string $type * @param string $id + * @param string $ownerKey * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ - protected function morphInstanceTo($target, $name, $type, $id) + protected function morphInstanceTo($target, $name, $type, $id, $ownerKey) { $instance = $this->newRelatedInstance( static::getActualClassNameForMorph($target) ); return $this->newMorphTo( - $instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name + $instance->newQuery(), $this, $id, $ownerKey ?? $instance->getKeyName(), $type, $name ); } @@ -263,7 +309,7 @@ trait HasRelationships */ protected function guessBelongsToRelation() { - list($one, $two, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); return $caller['function']; } @@ -272,8 +318,8 @@ trait HasRelationships * Define a one-to-many relationship. * * @param string $related - * @param string $foreignKey - * @param string $localKey + * @param string|null $foreignKey + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function hasMany($related, $foreignKey = null, $localKey = null) @@ -351,9 +397,9 @@ trait HasRelationships * * @param string $related * @param string $name - * @param string $type - * @param string $id - * @param string $localKey + * @param string|null $type + * @param string|null $id + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function morphMany($related, $name, $type = null, $id = null, $localKey = null) @@ -363,7 +409,7 @@ trait HasRelationships // 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); + [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); @@ -391,12 +437,12 @@ trait HasRelationships * Define a many-to-many relationship. * * @param string $related - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey - * @param string $relation + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey + * @param string|null $relation * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, @@ -422,7 +468,7 @@ trait HasRelationships // 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); + $table = $this->joiningTable($related, $instance); } return $this->newBelongsToMany( @@ -442,7 +488,7 @@ trait HasRelationships * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, @@ -456,11 +502,11 @@ trait HasRelationships * * @param string $related * @param string $name - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey * @param bool $inverse * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ @@ -482,7 +528,13 @@ trait HasRelationships // 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. - $table = $table ?: Str::plural($name); + if (! $table) { + $words = preg_split('/(_)/u', $name, -1, PREG_SPLIT_DELIM_CAPTURE); + + $lastWord = array_pop($words); + + $table = implode('', $words).Str::plural($lastWord); + } return $this->newMorphToMany( $instance->newQuery(), $this, $name, $table, @@ -492,7 +544,7 @@ trait HasRelationships } /** - * Instantiate a new HasManyThrough relationship. + * Instantiate a new MorphToMany relationship. * * @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Model $parent @@ -502,7 +554,7 @@ trait HasRelationships * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @param bool $inverse * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ @@ -519,11 +571,11 @@ trait HasRelationships * * @param string $related * @param string $name - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null, @@ -543,14 +595,17 @@ trait HasRelationships } /** - * Get the relationship name of the belongs to many. + * Get the relationship name of the belongsToMany relationship. * - * @return string + * @return string|null */ protected function guessBelongsToManyRelation() { $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($trace) { - return ! in_array($trace['function'], Model::$manyMethods); + return ! in_array( + $trace['function'], + array_merge(static::$manyMethods, ['guessBelongsToManyRelation']) + ); }); return ! is_null($caller) ? $caller['function'] : null; @@ -560,24 +615,36 @@ trait HasRelationships * Get the joining table name for a many-to-many relation. * * @param string $related + * @param \Illuminate\Database\Eloquent\Model|null $instance * @return string */ - public function joiningTable($related) + public function joiningTable($related, $instance = null) { // 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. - $models = [ - Str::snake(class_basename($related)), - Str::snake(class_basename($this)), + $segments = [ + $instance ? $instance->joiningTableSegment() + : Str::snake(class_basename($related)), + $this->joiningTableSegment(), ]; // 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); + sort($segments); + + return strtolower(implode('_', $segments)); + } - return strtolower(implode('_', $models)); + /** + * Get this model's half of the intermediate table name for belongsToMany relationships. + * + * @return string + */ + public function joiningTableSegment() + { + return Str::snake(class_basename($this)); } /** @@ -606,9 +673,7 @@ trait HasRelationships $this->$relation->touchOwners(); } elseif ($this->$relation instanceof Collection) { - $this->$relation->each(function (Model $relation) { - $relation->touchOwners(); - }); + $this->$relation->each->touchOwners(); } } } @@ -690,7 +755,7 @@ trait HasRelationships } /** - * Set the specific relationship in the model. + * Set the given relationship on the model. * * @param string $relation * @param mixed $value @@ -703,6 +768,19 @@ trait HasRelationships return $this; } + /** + * Unset a loaded relationship. + * + * @param string $relation + * @return $this + */ + public function unsetRelation($relation) + { + unset($this->relations[$relation]); + + return $this; + } + /** * Set the entire relations array on the model. * @@ -716,6 +794,30 @@ trait HasRelationships return $this; } + /** + * Duplicate the instance and unset all the loaded relations. + * + * @return $this + */ + public function withoutRelations() + { + $model = clone $this; + + return $model->unsetRelations(); + } + + /** + * Unset all the loaded relations for the instance. + * + * @return $this + */ + public function unsetRelations() + { + $this->relations = []; + + return $this; + } + /** * Get the relationships that are touched on save. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasTimestamps.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasTimestamps.php index ce3e0801dee6f68fa49c16d91195b36203864d19..8de099c998cdce8905e32077b54ad388d20beb60 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasTimestamps.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HasTimestamps.php @@ -2,7 +2,7 @@ namespace Illuminate\Database\Eloquent\Concerns; -use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Date; trait HasTimestamps { @@ -38,11 +38,15 @@ trait HasTimestamps { $time = $this->freshTimestamp(); - if (! is_null(static::UPDATED_AT) && ! $this->isDirty(static::UPDATED_AT)) { + $updatedAtColumn = $this->getUpdatedAtColumn(); + + if (! is_null($updatedAtColumn) && ! $this->isDirty($updatedAtColumn)) { $this->setUpdatedAt($time); } - if (! $this->exists && ! $this->isDirty(static::CREATED_AT)) { + $createdAtColumn = $this->getCreatedAtColumn(); + + if (! $this->exists && ! is_null($createdAtColumn) && ! $this->isDirty($createdAtColumn)) { $this->setCreatedAt($time); } } @@ -55,7 +59,7 @@ trait HasTimestamps */ public function setCreatedAt($value) { - $this->{static::CREATED_AT} = $value; + $this->{$this->getCreatedAtColumn()} = $value; return $this; } @@ -68,7 +72,7 @@ trait HasTimestamps */ public function setUpdatedAt($value) { - $this->{static::UPDATED_AT} = $value; + $this->{$this->getUpdatedAtColumn()} = $value; return $this; } @@ -80,7 +84,7 @@ trait HasTimestamps */ public function freshTimestamp() { - return new Carbon; + return Date::now(); } /** @@ -122,4 +126,24 @@ trait HasTimestamps { return static::UPDATED_AT; } + + /** + * Get the fully qualified "created at" column. + * + * @return string + */ + public function getQualifiedCreatedAtColumn() + { + return $this->qualifyColumn($this->getCreatedAtColumn()); + } + + /** + * Get the fully qualified "updated at" column. + * + * @return string + */ + public function getQualifiedUpdatedAtColumn() + { + return $this->qualifyColumn($this->getUpdatedAtColumn()); + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HidesAttributes.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HidesAttributes.php index 7bd9ef9344a2ce3f27f6e4bc3a6ebd938cb6d57c..d0d5b83629ab567b3d14b639d7a1cf568ce67495 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HidesAttributes.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/HidesAttributes.php @@ -41,19 +41,6 @@ trait HidesAttributes return $this; } - /** - * Add hidden attributes for the model. - * - * @param array|string|null $attributes - * @return void - */ - public function addHidden($attributes = null) - { - $this->hidden = array_merge( - $this->hidden, is_array($attributes) ? $attributes : func_get_args() - ); - } - /** * Get the visible attributes for the model. * @@ -77,31 +64,20 @@ trait HidesAttributes return $this; } - /** - * Add visible attributes for the model. - * - * @param array|string|null $attributes - * @return void - */ - public function addVisible($attributes = null) - { - $this->visible = array_merge( - $this->visible, is_array($attributes) ? $attributes : func_get_args() - ); - } - /** * Make the given, typically hidden, attributes visible. * - * @param array|string $attributes + * @param array|string|null $attributes * @return $this */ public function makeVisible($attributes) { - $this->hidden = array_diff($this->hidden, (array) $attributes); + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + $this->hidden = array_diff($this->hidden, $attributes); if (! empty($this->visible)) { - $this->addVisible($attributes); + $this->visible = array_merge($this->visible, $attributes); } return $this; @@ -110,16 +86,14 @@ trait HidesAttributes /** * Make the given, typically visible, attributes hidden. * - * @param array|string $attributes + * @param array|string|null $attributes * @return $this */ public function makeHidden($attributes) { - $attributes = (array) $attributes; - - $this->visible = array_diff($this->visible, $attributes); - - $this->hidden = array_unique(array_merge($this->hidden, $attributes)); + $this->hidden = array_merge( + $this->hidden, is_array($attributes) ? $attributes : func_get_args() + ); return $this; } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/QueriesRelationships.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/QueriesRelationships.php index 289770375f94fbca3395dd5e5bcc223f87bd69e9..ab0e0dc4009ca158211d51f23e2811ca64485a69 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/QueriesRelationships.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Concerns/QueriesRelationships.php @@ -3,31 +3,41 @@ namespace Illuminate\Database\Eloquent\Concerns; use Closure; -use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Query\Expression; +use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Query\Builder as QueryBuilder; +use Illuminate\Database\Query\Expression; +use Illuminate\Support\Str; +use RuntimeException; trait QueriesRelationships { /** * Add a relationship count / exists condition to the query. * - * @param string $relation + * @param \Illuminate\Database\Eloquent\Relations\Relation|string $relation * @param string $operator - * @param int $count + * @param int $count * @param string $boolean * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static + * + * @throws \RuntimeException */ public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) { - if (strpos($relation, '.') !== false) { - return $this->hasNested($relation, $operator, $count, $boolean, $callback); + if (is_string($relation)) { + if (strpos($relation, '.') !== false) { + return $this->hasNested($relation, $operator, $count, $boolean, $callback); + } + + $relation = $this->getRelationWithoutConstraints($relation); } - $relation = $this->getRelationWithoutConstraints($relation); + if ($relation instanceof MorphTo) { + throw new RuntimeException('Please use whereHasMorph() for MorphTo relationships.'); + } // If we only need to check for the existence of the relation, then we can optimize // the subquery to only run a "where exists" clause instead of this full "count" @@ -37,7 +47,7 @@ trait QueriesRelationships : 'getRelationExistenceCountQuery'; $hasQuery = $relation->{$method}( - $relation->getRelated()->newQuery(), $this + $relation->getRelated()->newQueryWithoutRelationships(), $this ); // Next we will call any given callback as an "anonymous" scope so they can get the @@ -59,7 +69,7 @@ trait QueriesRelationships * * @param string $relations * @param string $operator - * @param int $count + * @param int $count * @param string $boolean * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static @@ -68,6 +78,13 @@ trait QueriesRelationships { $relations = explode('.', $relations); + $doesntHave = $operator === '<' && $count === 1; + + if ($doesntHave) { + $operator = '>='; + $count = 1; + } + $closure = function ($q) use (&$closure, &$relations, $operator, $count, $callback) { // 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 @@ -77,7 +94,7 @@ trait QueriesRelationships : $q->has(array_shift($relations), $operator, $count, 'and', $callback); }; - return $this->has(array_shift($relations), '>=', 1, $boolean, $closure); + return $this->has(array_shift($relations), $doesntHave ? '<' : '>=', 1, $boolean, $closure); } /** @@ -85,7 +102,7 @@ trait QueriesRelationships * * @param string $relation * @param string $operator - * @param int $count + * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ public function orHas($relation, $operator = '>=', $count = 1) @@ -123,7 +140,7 @@ trait QueriesRelationships * @param string $relation * @param \Closure|null $callback * @param string $operator - * @param int $count + * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) @@ -134,10 +151,10 @@ trait QueriesRelationships /** * Add a relationship count / exists condition to the query with where clauses and an "or". * - * @param string $relation - * @param \Closure $callback - * @param string $operator - * @param int $count + * @param string $relation + * @param \Closure|null $callback + * @param string $operator + * @param int $count * @return \Illuminate\Database\Eloquent\Builder|static */ public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) @@ -160,8 +177,8 @@ trait QueriesRelationships /** * Add a relationship count / exists condition to the query with where clauses and an "or". * - * @param string $relation - * @param \Closure $callback + * @param string $relation + * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ public function orWhereDoesntHave($relation, Closure $callback = null) @@ -169,6 +186,167 @@ trait QueriesRelationships return $this->doesntHave($relation, 'or', $callback); } + /** + * Add a polymorphic relationship count / exists condition to the query. + * + * @param string $relation + * @param string|array $types + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) + { + $relation = $this->getRelationWithoutConstraints($relation); + + $types = (array) $types; + + if ($types === ['*']) { + $types = $this->model->newModelQuery()->distinct()->pluck($relation->getMorphType())->all(); + + foreach ($types as &$type) { + $type = Relation::getMorphedModel($type) ?? $type; + } + } + + return $this->where(function ($query) use ($relation, $callback, $operator, $count, $types) { + foreach ($types as $type) { + $query->orWhere(function ($query) use ($relation, $callback, $operator, $count, $type) { + $belongsTo = $this->getBelongsToRelation($relation, $type); + + if ($callback) { + $callback = function ($query) use ($callback, $type) { + return $callback($query, $type); + }; + } + + $query->where($this->query->from.'.'.$relation->getMorphType(), '=', (new $type)->getMorphClass()) + ->whereHas($belongsTo, $callback, $operator, $count); + }); + } + }, null, null, $boolean); + } + + /** + * Get the BelongsTo relationship for a single polymorphic type. + * + * @param \Illuminate\Database\Eloquent\Relations\MorphTo $relation + * @param string $type + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + protected function getBelongsToRelation(MorphTo $relation, $type) + { + $belongsTo = Relation::noConstraints(function () use ($relation, $type) { + return $this->model->belongsTo( + $type, + $relation->getForeignKeyName(), + $relation->getOwnerKeyName() + ); + }); + + $belongsTo->getQuery()->mergeConstraintsFrom($relation->getQuery()); + + return $belongsTo; + } + + /** + * Add a polymorphic relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string|array $types + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orHasMorph($relation, $types, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'or'); + } + + /** + * Add a polymorphic relationship count / exists condition to the query. + * + * @param string $relation + * @param string|array $types + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function doesntHaveMorph($relation, $types, $boolean = 'and', Closure $callback = null) + { + return $this->hasMorph($relation, $types, '<', 1, $boolean, $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string|array $types + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orDoesntHaveMorph($relation, $types) + { + return $this->doesntHaveMorph($relation, $types, 'or'); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'and', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->hasMorph($relation, $types, $operator, $count, 'or', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereDoesntHaveMorph($relation, $types, Closure $callback = null) + { + return $this->doesntHaveMorph($relation, $types, 'and', $callback); + } + + /** + * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param string|array $types + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereDoesntHaveMorph($relation, $types, Closure $callback = null) + { + return $this->doesntHaveMorph($relation, $types, 'or', $callback); + } + /** * Add subselect queries to count the relations. * @@ -195,8 +373,8 @@ trait QueriesRelationships unset($alias); - if (count($segments) == 3 && Str::lower($segments[1]) == 'as') { - list($name, $alias) = [$segments[0], $segments[2]]; + if (count($segments) === 3 && Str::lower($segments[1]) === 'as') { + [$name, $alias] = [$segments[0], $segments[2]]; } $relation = $this->getRelationWithoutConstraints($name); @@ -210,14 +388,24 @@ trait QueriesRelationships $query->callScope($constraints); - $query->mergeConstraintsFrom($relation->getQuery()); + $query = $query->mergeConstraintsFrom($relation->getQuery())->toBase(); + + $query->orders = null; + + $query->setBindings([], 'order'); + + if (count($query->columns) > 1) { + $query->columns = [$query->columns[0]]; + + $query->bindings['select'] = []; + } // Finally we will add the proper result column alias to the query and run the subselect // statement against the query builder. Then we will return the builder instance back // to the developer for further constraint chaining that needs to take place on it. $column = $alias ?? Str::snake($name.'_count'); - $this->selectSub($query->toBase(), $column); + $this->selectSub($query, $column); } return $this; @@ -265,7 +453,7 @@ trait QueriesRelationships /** * Add a sub-query count clause to this query. * - * @param \Illuminate\Database\Query\Builder $query + * @param \Illuminate\Database\Query\Builder $query * @param string $operator * @param int $count * @param string $boolean diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Factory.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Factory.php index 8b6104c3de0b7407281c778b4bd64cdab236179b..6c41bac589f8cbfc0aac3e7ea07e40eed207679b 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Factory.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Factory.php @@ -22,6 +22,20 @@ class Factory implements ArrayAccess */ protected $states = []; + /** + * The registered after making callbacks. + * + * @var array + */ + protected $afterMaking = []; + + /** + * The registered after creating callbacks. + * + * @var array + */ + protected $afterCreating = []; + /** * The Faker instance for the builder. * @@ -55,109 +69,112 @@ class Factory implements ArrayAccess } /** - * Define a class with a given short-name. + * Define a class with a given set of attributes. * * @param string $class - * @param string $name * @param callable $attributes * @return $this */ - public function defineAs($class, $name, callable $attributes) + public function define($class, callable $attributes) { - return $this->define($class, $attributes, $name); + $this->definitions[$class] = $attributes; + + return $this; } /** - * Define a class with a given set of attributes. + * Define a state with a given set of attributes. * * @param string $class - * @param callable $attributes - * @param string $name + * @param string $state + * @param callable|array $attributes * @return $this */ - public function define($class, callable $attributes, $name = 'default') + public function state($class, $state, $attributes) { - $this->definitions[$class][$name] = $attributes; + $this->states[$class][$state] = $attributes; return $this; } /** - * Define a state with a given set of attributes. + * Define a callback to run after making a model. * * @param string $class - * @param string $state - * @param callable|array $attributes + * @param callable $callback + * @param string $name * @return $this */ - public function state($class, $state, $attributes) + public function afterMaking($class, callable $callback, $name = 'default') { - $this->states[$class][$state] = $attributes; + $this->afterMaking[$class][$name][] = $callback; return $this; } /** - * Create an instance of the given model and persist it to the database. + * Define a callback to run after making a model with given state. * * @param string $class - * @param array $attributes - * @return mixed + * @param string $state + * @param callable $callback + * @return $this */ - public function create($class, array $attributes = []) + public function afterMakingState($class, $state, callable $callback) { - return $this->of($class)->create($attributes); + return $this->afterMaking($class, $callback, $state); } /** - * Create an instance of the given model and type and persist it to the database. + * Define a callback to run after creating a model. * * @param string $class + * @param callable $callback * @param string $name - * @param array $attributes - * @return mixed + * @return $this */ - public function createAs($class, $name, array $attributes = []) + public function afterCreating($class, callable $callback, $name = 'default') { - return $this->of($class, $name)->create($attributes); + $this->afterCreating[$class][$name][] = $callback; + + return $this; } /** - * Create an instance of the given model. + * Define a callback to run after creating a model with given state. * * @param string $class - * @param array $attributes - * @return mixed + * @param string $state + * @param callable $callback + * @return $this */ - public function make($class, array $attributes = []) + public function afterCreatingState($class, $state, callable $callback) { - return $this->of($class)->make($attributes); + return $this->afterCreating($class, $callback, $state); } /** - * Create an instance of the given model and type. + * Create an instance of the given model and persist it to the database. * * @param string $class - * @param string $name * @param array $attributes * @return mixed */ - public function makeAs($class, $name, array $attributes = []) + public function create($class, array $attributes = []) { - return $this->of($class, $name)->make($attributes); + return $this->of($class)->create($attributes); } /** - * Get the raw attribute array for a given named model. + * Create an instance of the given model. * * @param string $class - * @param string $name * @param array $attributes - * @return array + * @return mixed */ - public function rawOf($class, $name, array $attributes = []) + public function make($class, array $attributes = []) { - return $this->raw($class, $attributes, $name); + return $this->of($class)->make($attributes); } /** @@ -165,13 +182,12 @@ class Factory implements ArrayAccess * * @param string $class * @param array $attributes - * @param string $name * @return array */ - public function raw($class, array $attributes = [], $name = 'default') + public function raw($class, array $attributes = []) { return array_merge( - call_user_func($this->definitions[$class][$name], $this->faker), $attributes + call_user_func($this->definitions[$class], $this->faker), $attributes ); } @@ -179,12 +195,14 @@ class Factory implements ArrayAccess * Create a builder for the given model. * * @param string $class - * @param string $name * @return \Illuminate\Database\Eloquent\FactoryBuilder */ - public function of($class, $name = 'default') + public function of($class) { - return new FactoryBuilder($class, $name, $this->definitions, $this->states, $this->faker); + return new FactoryBuilder( + $class, $this->definitions, $this->states, + $this->afterMaking, $this->afterCreating, $this->faker + ); } /** @@ -237,7 +255,7 @@ class Factory implements ArrayAccess */ public function offsetSet($offset, $value) { - return $this->define($offset, $value); + $this->define($offset, $value); } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/FactoryBuilder.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/FactoryBuilder.php index 7a3b0230610dd531995fafb63c2592ff0eb611ab..ccd82bf157f3e87af550f48498abe31b7a11bbbe 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/FactoryBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/FactoryBuilder.php @@ -3,8 +3,8 @@ namespace Illuminate\Database\Eloquent; use Faker\Generator as Faker; -use InvalidArgumentException; use Illuminate\Support\Traits\Macroable; +use InvalidArgumentException; class FactoryBuilder { @@ -24,13 +24,6 @@ class FactoryBuilder */ protected $class; - /** - * The name of the model being built. - * - * @var string - */ - protected $name = 'default'; - /** * The database connection on which the model instance should be persisted. * @@ -45,6 +38,20 @@ class FactoryBuilder */ protected $states; + /** + * The model after making callbacks. + * + * @var array + */ + protected $afterMaking = []; + + /** + * The model after creating callbacks. + * + * @var array + */ + protected $afterCreating = []; + /** * The states to apply. * @@ -70,19 +77,22 @@ class FactoryBuilder * Create an new builder instance. * * @param string $class - * @param string $name * @param array $definitions * @param array $states + * @param array $afterMaking + * @param array $afterCreating * @param \Faker\Generator $faker * @return void */ - public function __construct($class, $name, array $definitions, array $states, Faker $faker) + public function __construct($class, array $definitions, array $states, + array $afterMaking, array $afterCreating, Faker $faker) { - $this->name = $name; $this->class = $class; $this->faker = $faker; $this->states = $states; $this->definitions = $definitions; + $this->afterMaking = $afterMaking; + $this->afterCreating = $afterCreating; } /** @@ -98,6 +108,17 @@ class FactoryBuilder return $this; } + /** + * Set the state to be applied to the model. + * + * @param string $state + * @return $this + */ + public function state($state) + { + return $this->states([$state]); + } + /** * Set the states to be applied to the model. * @@ -141,7 +162,7 @@ class FactoryBuilder * Create a collection of models and persist them to the database. * * @param array $attributes - * @return mixed + * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed */ public function create(array $attributes = []) { @@ -149,13 +170,30 @@ class FactoryBuilder if ($results instanceof Model) { $this->store(collect([$results])); + + $this->callAfterCreating(collect([$results])); } else { $this->store($results); + + $this->callAfterCreating($results); } return $results; } + /** + * Create a collection of models and persist them to the database. + * + * @param iterable $records + * @return \Illuminate\Database\Eloquent\Collection|mixed + */ + public function createMany(iterable $records) + { + return (new $this->class)->newCollection(array_map(function ($attribute) { + return $this->create($attribute); + }, $records)); + } + /** * Set the connection name on the results and store them. * @@ -177,21 +215,27 @@ class FactoryBuilder * Create a collection of models. * * @param array $attributes - * @return mixed + * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed */ public function make(array $attributes = []) { if ($this->amount === null) { - return $this->makeInstance($attributes); + return tap($this->makeInstance($attributes), function ($instance) { + $this->callAfterMaking(collect([$instance])); + }); } if ($this->amount < 1) { return (new $this->class)->newCollection(); } - return (new $this->class)->newCollection(array_map(function () use ($attributes) { + $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { return $this->makeInstance($attributes); }, range(1, $this->amount))); + + $this->callAfterMaking($instances); + + return $instances; } /** @@ -220,11 +264,17 @@ class FactoryBuilder * * @param array $attributes * @return mixed + * + * @throws \InvalidArgumentException */ protected function getRawAttributes(array $attributes = []) { + if (! isset($this->definitions[$this->class])) { + throw new InvalidArgumentException("Unable to locate factory for [{$this->class}]."); + } + $definition = call_user_func( - $this->definitions[$this->class][$this->name], + $this->definitions[$this->class], $this->faker, $attributes ); @@ -238,16 +288,10 @@ class FactoryBuilder * * @param array $attributes * @return \Illuminate\Database\Eloquent\Model - * - * @throws \InvalidArgumentException */ 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}]."); - } - $instance = new $this->class( $this->getRawAttributes($attributes) ); @@ -266,11 +310,17 @@ class FactoryBuilder * @param array $definition * @param array $attributes * @return array + * + * @throws \InvalidArgumentException */ protected function applyStates(array $definition, array $attributes = []) { foreach ($this->activeStates as $state) { if (! isset($this->states[$this->class][$state])) { + if ($this->stateHasAfterCallback($state)) { + continue; + } + throw new InvalidArgumentException("Unable to locate [{$state}] state for [{$this->class}]."); } @@ -298,10 +348,7 @@ class FactoryBuilder return $stateAttributes; } - return call_user_func( - $stateAttributes, - $this->faker, $attributes - ); + return $stateAttributes($this->faker, $attributes); } /** @@ -313,7 +360,7 @@ class FactoryBuilder protected function expandAttributes(array $attributes) { foreach ($attributes as &$attribute) { - if (is_callable($attribute) && ! is_string($attribute)) { + if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { $attribute = $attribute($attributes); } @@ -328,4 +375,75 @@ class FactoryBuilder return $attributes; } + + /** + * Run after making callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterMaking($models) + { + $this->callAfter($this->afterMaking, $models); + } + + /** + * Run after creating callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterCreating($models) + { + $this->callAfter($this->afterCreating, $models); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Support\Collection $models + * @return void + */ + protected function callAfter(array $afterCallbacks, $models) + { + $states = array_merge(['default'], $this->activeStates); + + $models->each(function ($model) use ($states, $afterCallbacks) { + foreach ($states as $state) { + $this->callAfterCallbacks($afterCallbacks, $model, $state); + } + }); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $state + * @return void + */ + protected function callAfterCallbacks(array $afterCallbacks, $model, $state) + { + if (! isset($afterCallbacks[$this->class][$state])) { + return; + } + + foreach ($afterCallbacks[$this->class][$state] as $callback) { + $callback($model, $this->faker); + } + } + + /** + * Determine if the given state has an "after" callback. + * + * @param string $state + * @return bool + */ + protected function stateHasAfterCallback($state) + { + return isset($this->afterMaking[$this->class][$state]) || + isset($this->afterCreating[$this->class][$state]); + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/JsonEncodingException.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/JsonEncodingException.php index 5878b0f7b7e3cf61f19f173536f1f4e38f50a0d2..f62abd469555399eb152872e820fa701913c18a1 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/JsonEncodingException.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/JsonEncodingException.php @@ -18,12 +18,26 @@ class JsonEncodingException extends RuntimeException return new static('Error encoding model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); } + /** + * Create a new JSON encoding exception for the resource. + * + * @param \Illuminate\Http\Resources\Json\JsonResource $resource + * @param string $message + * @return static + */ + public static function forResource($resource, $message) + { + $model = $resource->resource; + + return new static('Error encoding resource ['.get_class($resource).'] with model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); + } + /** * Create a new JSON encoding exception for an attribute. * * @param mixed $model * @param mixed $key - * @param string $message + * @param string $message * @return static */ public static function forAttribute($model, $key, $message) diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Model.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Model.php index 600eda80c64be960c96786d907642ee1aff52f6c..fb3c7c6894b61898c718e9224c166f60a7d5772f 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Model.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Model.php @@ -2,20 +2,22 @@ namespace Illuminate\Database\Eloquent; -use Exception; use ArrayAccess; -use JsonSerializable; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use Illuminate\Contracts\Support\Jsonable; -use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Contracts\Routing\UrlRoutable; +use Exception; +use Illuminate\Contracts\Queue\QueueableCollection; use Illuminate\Contracts\Queue\QueueableEntity; -use Illuminate\Database\Eloquent\Relations\Pivot; -use Illuminate\Database\Query\Builder as QueryBuilder; +use Illuminate\Contracts\Routing\UrlRoutable; +use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Contracts\Support\Jsonable; use Illuminate\Database\ConnectionResolverInterface as Resolver; +use Illuminate\Database\Eloquent\Relations\Pivot; +use Illuminate\Support\Arr; +use Illuminate\Support\Collection as BaseCollection; +use Illuminate\Support\Str; +use Illuminate\Support\Traits\ForwardsCalls; +use JsonSerializable; -abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable +abstract class Model implements Arrayable, ArrayAccess, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable { use Concerns\HasAttributes, Concerns\HasEvents, @@ -23,12 +25,13 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab Concerns\HasRelationships, Concerns\HasTimestamps, Concerns\HidesAttributes, - Concerns\GuardsAttributes; + Concerns\GuardsAttributes, + ForwardsCalls; /** * The connection name for the model. * - * @var string + * @var string|null */ protected $connection; @@ -47,7 +50,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab protected $primaryKey = 'id'; /** - * The "type" of the auto-incrementing ID. + * The "type" of the primary key ID. * * @var string */ @@ -116,6 +119,13 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ protected static $booted = []; + /** + * The array of trait initializers that will be called on each new instance. + * + * @var array + */ + protected static $traitInitializers = []; + /** * The array of global scopes on the model. * @@ -123,6 +133,13 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ protected static $globalScopes = []; + /** + * The list of models classes that should not be affected with touch. + * + * @var array + */ + protected static $ignoreOnTouch = []; + /** * The name of the "created at" column. * @@ -147,6 +164,8 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab { $this->bootIfNotBooted(); + $this->initializeTraits(); + $this->syncOriginal(); $this->fill($attributes); @@ -164,14 +183,26 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab $this->fireModelEvent('booting', false); + static::booting(); static::boot(); + static::booted(); $this->fireModelEvent('booted', false); } } /** - * The "booting" method of the model. + * Perform any actions required before the model boots. + * + * @return void + */ + protected static function booting() + { + // + } + + /** + * Bootstrap the model and its traits. * * @return void */ @@ -189,13 +220,51 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab { $class = static::class; + $booted = []; + + static::$traitInitializers[$class] = []; + foreach (class_uses_recursive($class) as $trait) { - if (method_exists($class, $method = 'boot'.class_basename($trait))) { + $method = 'boot'.class_basename($trait); + + if (method_exists($class, $method) && ! in_array($method, $booted)) { forward_static_call([$class, $method]); + + $booted[] = $method; + } + + if (method_exists($class, $method = 'initialize'.class_basename($trait))) { + static::$traitInitializers[$class][] = $method; + + static::$traitInitializers[$class] = array_unique( + static::$traitInitializers[$class] + ); } } } + /** + * Initialize any initializable traits on the model. + * + * @return void + */ + protected function initializeTraits() + { + foreach (static::$traitInitializers[static::class] as $method) { + $this->{$method}(); + } + } + + /** + * Perform any actions required after the model boots. + * + * @return void + */ + protected static function booted() + { + // + } + /** * Clear the list of booted models so they will be re-booted. * @@ -208,6 +277,58 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab static::$globalScopes = []; } + /** + * Disables relationship model touching for the current class during given callback scope. + * + * @param callable $callback + * @return void + */ + public static function withoutTouching(callable $callback) + { + static::withoutTouchingOn([static::class], $callback); + } + + /** + * Disables relationship model touching for the given model classes during given callback scope. + * + * @param array $models + * @param callable $callback + * @return void + */ + public static function withoutTouchingOn(array $models, callable $callback) + { + static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); + + try { + $callback(); + } finally { + static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); + } + } + + /** + * Determine if the given model is ignoring touches. + * + * @param string|null $class + * @return bool + */ + public static function isIgnoringTouch($class = null) + { + $class = $class ?: static::class; + + if (! get_class_vars($class)['timestamps'] || ! $class::UPDATED_AT) { + return true; + } + + foreach (static::$ignoreOnTouch as $ignoredClass) { + if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) { + return true; + } + } + + return false; + } + /** * Fill the model with an array of attributes. * @@ -229,7 +350,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab if ($this->isFillable($key)) { $this->setAttribute($key, $value); } elseif ($totallyGuarded) { - throw new MassAssignmentException($key); + throw new MassAssignmentException(sprintf( + 'Add [%s] to fillable property to allow mass assignment on [%s].', + $key, get_class($this) + )); } } @@ -295,6 +419,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab $this->getConnectionName() ); + $model->setTable($this->getTable()); + + $model->mergeCasts($this->casts); + return $model; } @@ -326,9 +454,9 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ 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. + // 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 used for the queries we execute, as well + // as being set on every relation we retrieve without a custom connection name. $instance = new static; $instance->setConnection($connection); @@ -343,9 +471,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public static function onWriteConnection() { - $instance = new static; - - return $instance->newQuery()->useWritePdo(); + return static::query()->useWritePdo(); } /** @@ -356,7 +482,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public static function all($columns = ['*']) { - return (new static)->newQuery()->get( + return static::query()->get( is_array($columns) ? $columns : func_get_args() ); } @@ -365,11 +491,11 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Begin querying a model with eager loading. * * @param array|string $relations - * @return \Illuminate\Database\Eloquent\Builder|static + * @return \Illuminate\Database\Eloquent\Builder */ public static function with($relations) { - return (new static)->newQuery()->with( + return static::query()->with( is_string($relations) ? func_get_args() : $relations ); } @@ -401,16 +527,31 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab { $relations = is_string($relations) ? func_get_args() : $relations; - return $this->load(array_filter($relations, function ($relation) { - return ! $this->relationLoaded($relation); - })); + $this->newCollection([$this])->loadMissing($relations); + + return $this; + } + + /** + * Eager load relation counts on the model. + * + * @param array|string $relations + * @return $this + */ + public function loadCount($relations) + { + $relations = is_string($relations) ? func_get_args() : $relations; + + $this->newCollection([$this])->loadCount($relations); + + return $this; } /** * Increment a column's value by a given amount. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @return int */ @@ -423,7 +564,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Decrement a column's value by a given amount. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @return int */ @@ -436,14 +577,14 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Run the increment or decrement method on the model. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @param string $method * @return int */ protected function incrementOrDecrement($column, $amount, $extra, $method) { - $query = $this->newQuery(); + $query = $this->newQueryWithoutRelationships(); if (! $this->exists) { return $query->{$method}($column, $amount, $extra); @@ -460,14 +601,14 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Increment the underlying attribute value and sync with original. * * @param string $column - * @param int $amount + * @param float|int $amount * @param array $extra * @param string $method * @return void */ protected function incrementOrDecrementAttributeValue($column, $amount, $extra, $method) { - $this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1); + $this->{$column} = $this->{$column} + ($method === 'increment' ? $amount : $amount * -1); $this->forceFill($extra); @@ -526,6 +667,8 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function save(array $options = []) { + $this->mergeAttributesFromClassCasts(); + $query = $this->newModelQuery(); // If the "saving" event returns false we'll bail out of the save and return @@ -627,9 +770,9 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab if (count($dirty) > 0) { $this->setKeysForSaveQuery($query)->update($dirty); - $this->fireModelEvent('updated', false); - $this->syncChanges(); + + $this->fireModelEvent('updated', false); } return true; @@ -727,7 +870,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab /** * Destroy the models for the given IDs. * - * @param array|int $ids + * @param \Illuminate\Support\Collection|array|int $ids * @return int */ public static function destroy($ids) @@ -737,6 +880,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab // type value or get this total count of records deleted for logging, etc. $count = 0; + if ($ids instanceof BaseCollection) { + $ids = $ids->all(); + } + $ids = is_array($ids) ? $ids : func_get_args(); // We will actually pull the models from the database table and call delete on @@ -762,6 +909,8 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function delete() { + $this->mergeAttributesFromClassCasts(); + if (is_null($this->getKeyName())) { throw new Exception('No primary key defined on model.'); } @@ -855,9 +1004,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function newQueryWithoutRelationships() { - return $this->registerGlobalScopes( - $this->newEloquentBuilder($this->newBaseQueryBuilder())->setModel($this) - ); + return $this->registerGlobalScopes($this->newModelQuery()); } /** @@ -895,9 +1042,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function newQueryWithoutScope($scope) { - $builder = $this->newQuery(); - - return $builder->withoutGlobalScope($scope); + return $this->newQuery()->withoutGlobalScope($scope); } /** @@ -908,11 +1053,9 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function newQueryForRestoration($ids) { - if (is_array($ids)) { - return $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids); - } - - return $this->newQueryWithoutScopes()->whereKey($ids); + return is_array($ids) + ? $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids) + : $this->newQueryWithoutScopes()->whereKey($ids); } /** @@ -933,11 +1076,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ protected function newBaseQueryBuilder() { - $connection = $this->getConnection(); - - return new QueryBuilder( - $connection, $connection->getQueryGrammar(), $connection->getPostProcessor() - ); + return $this->getConnection()->query(); } /** @@ -1039,7 +1178,11 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes ); - $this->load(collect($this->relations)->except('pivot')->keys()->toArray()); + $this->load(collect($this->relations)->reject(function ($relation) { + return $relation instanceof Pivot; + })->keys()->all()); + + $this->syncOriginal(); return $this; } @@ -1048,7 +1191,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Clone the model into a new, non-existing instance. * * @param array|null $except - * @return \Illuminate\Database\Eloquent\Model + * @return static */ public function replicate(array $except = null) { @@ -1059,13 +1202,15 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab ]; $attributes = Arr::except( - $this->attributes, $except ? array_unique(array_merge($except, $defaults)) : $defaults + $this->getAttributes(), $except ? array_unique(array_merge($except, $defaults)) : $defaults ); return tap(new static, function ($instance) use ($attributes) { $instance->setRawAttributes($attributes); $instance->setRelations($this->relations); + + $instance->fireModelEvent('replicating', false); }); } @@ -1107,7 +1252,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab /** * Get the current connection name for the model. * - * @return string + * @return string|null */ public function getConnectionName() { @@ -1117,7 +1262,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab /** * Set the connection associated with the model. * - * @param string $name + * @param string|null $name * @return $this */ public function setConnection($name) @@ -1176,13 +1321,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab */ public function getTable() { - if (! isset($this->table)) { - return str_replace( - '\\', '', Str::snake(Str::plural(class_basename($this))) - ); - } - - return $this->table; + return $this->table ?? Str::snake(Str::pluralStudly(class_basename($this))); } /** @@ -1297,10 +1436,42 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab return $this->getKey(); } + /** + * Get the queueable relationships for the entity. + * + * @return array + */ + public function getQueueableRelations() + { + $relations = []; + + foreach ($this->getRelations() as $key => $relation) { + if (! method_exists($this, $key)) { + continue; + } + + $relations[] = $key; + + if ($relation instanceof QueueableCollection) { + foreach ($relation->getQueueableRelations() as $collectionValue) { + $relations[] = $key.'.'.$collectionValue; + } + } + + if ($relation instanceof QueueableEntity) { + foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) { + $relations[] = $key.'.'.$entityValue; + } + } + } + + return array_unique($relations); + } + /** * Get the queueable connection for the entity. * - * @return mixed + * @return string|null */ public function getQueueableConnection() { @@ -1331,11 +1502,25 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab * Retrieve the model for a bound value. * * @param mixed $value + * @param string|null $field + * @return \Illuminate\Database\Eloquent\Model|null + */ + public function resolveRouteBinding($value, $field = null) + { + return $this->where($field ?? $this->getRouteKeyName(), $value)->first(); + } + + /** + * Retrieve the child model for a bound value. + * + * @param string $childType + * @param mixed $value + * @param string|null $field * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value) + public function resolveChildRouteBinding($childType, $value, $field) { - return $this->where($this->getRouteKeyName(), $value)->first(); + return $this->{Str::plural($childType)}()->where($field, $value)->first(); } /** @@ -1474,7 +1659,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab return $this->$method(...$parameters); } - return $this->newQuery()->$method(...$parameters); + return $this->forwardCallTo($this->newQuery(), $method, $parameters); } /** @@ -1499,6 +1684,20 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab return $this->toJson(); } + /** + * Prepare the object for serialization. + * + * @return array + */ + public function __sleep() + { + $this->mergeAttributesFromClassCasts(); + + $this->classCastCache = []; + + return array_keys(get_object_vars($this)); + } + /** * When a model is being unserialized, check if it needs to be booted. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/ModelNotFoundException.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/ModelNotFoundException.php index c3db8242fd0a1fb6c8d51c4fb1f458537abc2472..2795b934bb7438aa6ba10aba648fb25045778c6f 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/ModelNotFoundException.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/ModelNotFoundException.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Eloquent; -use RuntimeException; use Illuminate\Support\Arr; +use RuntimeException; class ModelNotFoundException extends RuntimeException { diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsTo.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsTo.php index 7ba395bb7aff4c4be6c594f4a7ea5ed1585f54b1..894f72a838349ac381e7ff0d9561fe8941f94431 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsTo.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsTo.php @@ -2,14 +2,11 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels; -/** - * @mixin \Illuminate\Database\Eloquent\Builder - */ class BelongsTo extends Relation { use SupportsDefaultModels; @@ -38,7 +35,7 @@ class BelongsTo extends Relation * * @var string */ - protected $relation; + protected $relationName; /** * The count of self joins. @@ -54,13 +51,14 @@ class BelongsTo extends Relation * @param \Illuminate\Database\Eloquent\Model $child * @param string $foreignKey * @param string $ownerKey - * @param string $relation + * @param string $relationName + * * @return void */ - public function __construct(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) + public function __construct(Builder $query, Model $child, $foreignKey, $ownerKey, $relationName) { $this->ownerKey = $ownerKey; - $this->relation = $relation; + $this->relationName = $relationName; $this->foreignKey = $foreignKey; // In the underlying base relationship class, this variable is referred to as @@ -78,6 +76,10 @@ class BelongsTo extends Relation */ public function getResults() { + if (is_null($this->child->{$this->foreignKey})) { + return $this->getDefaultFor($this->parent); + } + return $this->query->first() ?: $this->getDefaultFor($this->parent); } @@ -111,7 +113,9 @@ class BelongsTo extends Relation // our eagerly loading query so it returns the proper models from execution. $key = $this->related->getTable().'.'.$this->ownerKey; - $this->query->whereIn($key, $this->getEagerModelKeys($models)); + $whereIn = $this->whereInMethod($this->related, $this->ownerKey); + + $this->query->{$whereIn}($key, $this->getEagerModelKeys($models)); } /** @@ -133,13 +137,6 @@ class BelongsTo extends Relation } } - // If there are no keys that were not null we will just return an array with null - // so this query wont fail plus returns zero results, which should be what the - // developer expects to happen in this situation. Otherwise we'll sort them. - if (count($keys) === 0) { - return [null]; - } - sort($keys); return array_values(array_unique($keys)); @@ -148,7 +145,7 @@ class BelongsTo extends Relation /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -164,7 +161,7 @@ class BelongsTo extends Relation /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -196,17 +193,6 @@ class BelongsTo extends Relation return $models; } - /** - * Update the parent model on the relationship. - * - * @param array $attributes - * @return mixed - */ - public function update(array $attributes) - { - return $this->getResults()->fill($attributes)->save(); - } - /** * Associate the model instance to the given parent. * @@ -220,7 +206,9 @@ class BelongsTo extends Relation $this->child->setAttribute($this->foreignKey, $ownerKey); if ($model instanceof Model) { - $this->child->setRelation($this->relation, $model); + $this->child->setRelation($this->relationName, $model); + } else { + $this->child->unsetRelation($this->relationName); } return $this->child; @@ -235,7 +223,7 @@ class BelongsTo extends Relation { $this->child->setAttribute($this->foreignKey, null); - return $this->child->setRelation($this->relation, null); + return $this->child->setRelation($this->relationName, null); } /** @@ -253,7 +241,7 @@ class BelongsTo extends Relation } return $query->select($columns)->whereColumn( - $this->getQualifiedForeignKey(), '=', $query->qualifyColumn($this->ownerKey) + $this->getQualifiedForeignKeyName(), '=', $query->qualifyColumn($this->ownerKey) ); } @@ -274,7 +262,7 @@ class BelongsTo extends Relation $query->getModel()->setTable($hash); return $query->whereColumn( - $hash.'.'.$query->getModel()->getKeyName(), '=', $this->getQualifiedForeignKey() + $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKeyName() ); } @@ -296,7 +284,7 @@ class BelongsTo extends Relation protected function relationHasIncrementingId() { return $this->related->getIncrementing() && - $this->related->getKeyType() === 'int'; + in_array($this->related->getKeyType(), ['int', 'integer']); } /** @@ -310,12 +298,22 @@ class BelongsTo extends Relation return $this->related->newInstance(); } + /** + * Get the child of the relationship. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getChild() + { + return $this->child; + } + /** * Get the foreign key of the relationship. * * @return string */ - public function getForeignKey() + public function getForeignKeyName() { return $this->foreignKey; } @@ -325,7 +323,7 @@ class BelongsTo extends Relation * * @return string */ - public function getQualifiedForeignKey() + public function getQualifiedForeignKeyName() { return $this->child->qualifyColumn($this->foreignKey); } @@ -335,7 +333,7 @@ class BelongsTo extends Relation * * @return string */ - public function getOwnerKey() + public function getOwnerKeyName() { return $this->ownerKey; } @@ -355,8 +353,8 @@ class BelongsTo extends Relation * * @return string */ - public function getRelation() + public function getRelationName() { - return $this->relation; + return $this->relationName; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php index 7a1652e583bf22e6e78187285011663f19c3e896..2500bd36adf3b724526c90acac1282ed2a8ff6e7 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php @@ -2,11 +2,13 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Support\Str; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Support\Str; +use InvalidArgumentException; class BelongsToMany extends Relation { @@ -75,6 +77,13 @@ class BelongsToMany extends Relation */ protected $pivotWhereIns = []; + /** + * The default values for the pivot columns. + * + * @var array + */ + protected $pivotValues = []; + /** * Indicates if timestamps are available on the pivot table. * @@ -127,22 +136,47 @@ class BelongsToMany extends Relation * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @return void */ public function __construct(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName = null) { - $this->table = $table; $this->parentKey = $parentKey; $this->relatedKey = $relatedKey; $this->relationName = $relationName; $this->relatedPivotKey = $relatedPivotKey; $this->foreignPivotKey = $foreignPivotKey; + $this->table = $this->resolveTableName($table); parent::__construct($query, $parent); } + /** + * Attempt to resolve the intermediate table name from the given string. + * + * @param string $table + * @return string + */ + protected function resolveTableName($table) + { + if (! Str::contains($table, '\\') || ! class_exists($table)) { + return $table; + } + + $model = new $table; + + if (! $model instanceof Model) { + return $table; + } + + if ($model instanceof Pivot) { + $this->using($table); + } + + return $model->getTable(); + } + /** * Set the base constraints on the relation query. * @@ -201,13 +235,18 @@ class BelongsToMany extends Relation */ public function addEagerConstraints(array $models) { - $this->query->whereIn($this->getQualifiedForeignPivotKeyName(), $this->getKeys($models, $this->parentKey)); + $whereIn = $this->whereInMethod($this->parent, $this->parentKey); + + $this->query->{$whereIn}( + $this->getQualifiedForeignPivotKeyName(), + $this->getKeys($models, $this->parentKey) + ); } /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -223,7 +262,7 @@ class BelongsToMany extends Relation /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -266,11 +305,21 @@ class BelongsToMany extends Relation return $dictionary; } + /** + * Get the class being used for pivot models. + * + * @return string + */ + public function getPivotClass() + { + return $this->using ?? Pivot::class; + } + /** * Specify the custom pivot model to use for the relationship. * * @param string $class - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return $this */ public function using($class) { @@ -283,7 +332,7 @@ class BelongsToMany extends Relation * Specify the custom pivot accessor to use for the relationship. * * @param string $accessor - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return $this */ public function as($accessor) { @@ -296,10 +345,10 @@ class BelongsToMany extends Relation * Set a where clause for a pivot table column. * * @param string $column - * @param string $operator - * @param mixed $value + * @param string|null $operator + * @param mixed $value * @param string $boolean - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return $this */ public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') { @@ -312,10 +361,10 @@ class BelongsToMany extends Relation * Set a "where in" clause for a pivot table column. * * @param string $column - * @param mixed $values + * @param mixed $values * @param string $boolean - * @param bool $not - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @param bool $not + * @return $this */ public function wherePivotIn($column, $values, $boolean = 'and', $not = false) { @@ -328,27 +377,82 @@ class BelongsToMany extends Relation * 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 + * @param string|null $operator + * @param mixed $value + * @return $this */ public function orWherePivot($column, $operator = null, $value = null) { return $this->wherePivot($column, $operator, $value, 'or'); } + /** + * Set a where clause for a pivot table column. + * + * In addition, new pivot records will receive this value. + * + * @param string|array $column + * @param mixed $value + * @return $this + * + * @throws \InvalidArgumentException + */ + public function withPivotValue($column, $value = null) + { + if (is_array($column)) { + foreach ($column as $name => $value) { + $this->withPivotValue($name, $value); + } + + return $this; + } + + if (is_null($value)) { + throw new InvalidArgumentException('The provided value may not be null.'); + } + + $this->pivotValues[] = compact('column', 'value'); + + return $this->wherePivot($column, '=', $value); + } + /** * Set an "or where in" clause for a pivot table column. * * @param string $column - * @param mixed $values - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @param mixed $values + * @return $this */ public function orWherePivotIn($column, $values) { return $this->wherePivotIn($column, $values, 'or'); } + /** + * Set a "where not in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @return $this + */ + public function wherePivotNotIn($column, $values, $boolean = 'and') + { + return $this->wherePivotIn($column, $values, $boolean, true); + } + + /** + * Set an "or where not in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @return $this + */ + public function orWherePivotNotIn($column, $values) + { + return $this->wherePivotNotIn($column, $values, 'or'); + } + /** * Find a related model by its primary key or return new instance of the related model. * @@ -385,7 +489,7 @@ class BelongsToMany extends Relation * * @param array $attributes * @param array $joining - * @param bool $touch + * @param bool $touch * @return \Illuminate\Database\Eloquent\Model */ public function firstOrCreate(array $attributes, array $joining = [], $touch = true) @@ -403,7 +507,7 @@ class BelongsToMany extends Relation * @param array $attributes * @param array $values * @param array $joining - * @param bool $touch + * @param bool $touch * @return \Illuminate\Database\Eloquent\Model */ public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) @@ -428,22 +532,32 @@ class BelongsToMany extends Relation */ public function find($id, $columns = ['*']) { - return is_array($id) ? $this->findMany($id, $columns) : $this->where( - $this->getRelated()->getQualifiedKeyName(), '=', $id + if (is_array($id) || $id instanceof Arrayable) { + return $this->findMany($id, $columns); + } + + return $this->where( + $this->getRelated()->getQualifiedKeyName(), '=', $this->parseId($id) )->first($columns); } /** * Find multiple related models by their primary keys. * - * @param mixed $ids + * @param \Illuminate\Contracts\Support\Arrayable|array $ids * @param array $columns * @return \Illuminate\Database\Eloquent\Collection */ public function findMany($ids, $columns = ['*']) { - return empty($ids) ? $this->getRelated()->newCollection() : $this->whereIn( - $this->getRelated()->getQualifiedKeyName(), $ids + $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; + + if (empty($ids)) { + return $this->getRelated()->newCollection(); + } + + return $this->whereIn( + $this->getRelated()->getQualifiedKeyName(), $this->parseIds($ids) )->get($columns); } @@ -460,21 +574,23 @@ class BelongsToMany extends Relation { $result = $this->find($id, $columns); + $id = $id instanceof Arrayable ? $id->toArray() : $id; + if (is_array($id)) { - if (count($result) == count(array_unique($id))) { + if (count($result) === count(array_unique($id))) { return $result; } } elseif (! is_null($result)) { return $result; } - throw (new ModelNotFoundException)->setModel(get_class($this->related)); + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); } /** * Execute the query and get the first result. * - * @param array $columns + * @param array $columns * @return mixed */ public function first($columns = ['*']) @@ -508,7 +624,9 @@ class BelongsToMany extends Relation */ public function getResults() { - return $this->get(); + return ! is_null($this->parent->{$this->parentKey}) + ? $this->get() + : $this->related->newCollection(); } /** @@ -522,10 +640,10 @@ class BelongsToMany extends Relation // 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; - $builder = $this->query->applyScopes(); + $columns = $builder->getQuery()->columns ? [] : $columns; + $models = $builder->addSelect( $this->shouldSelect($columns) )->getModels(); @@ -546,7 +664,7 @@ class BelongsToMany extends Relation * Get the select columns for the relation query. * * @param array $columns - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return array */ protected function shouldSelect(array $columns = ['*']) { @@ -576,7 +694,7 @@ class BelongsToMany extends Relation /** * Get a paginator for the "select" statement. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -594,7 +712,7 @@ class BelongsToMany extends Relation /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -627,6 +745,66 @@ class BelongsToMany extends Relation }); } + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $this->query->addSelect($this->shouldSelect()); + + $column = $column ?? $this->getRelated()->qualifyColumn( + $this->getRelatedKeyName() + ); + + $alias = $alias ?? $this->getRelatedKeyName(); + + return $this->query->chunkById($count, function ($results) use ($callback) { + $this->hydratePivotRelation($results->all()); + + return $callback($results); + }, $column, $alias); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Get a lazy collection for the given query. + * + * @return \Illuminate\Support\LazyCollection + */ + public function cursor() + { + $this->query->addSelect($this->shouldSelect()); + + return $this->query->cursor()->map(function ($model) { + $this->hydratePivotRelation([$model]); + + return $model; + }); + } + /** * Hydrate the pivot table relationship on the models. * @@ -702,7 +880,7 @@ class BelongsToMany extends Relation */ protected function guessInverseRelation() { - return Str::camel(Str::plural(class_basename($this->getParent()))); + return Str::camel(Str::pluralStudly(class_basename($this->getParent()))); } /** @@ -724,7 +902,7 @@ class BelongsToMany extends Relation // 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. if (count($ids = $this->allRelatedIds()) > 0) { - $this->getRelated()->newQuery()->whereIn($key, $ids)->update($columns); + $this->getRelated()->newQueryWithoutRelationships()->whereIn($key, $ids)->update($columns); } } @@ -743,7 +921,7 @@ class BelongsToMany extends Relation * * @param \Illuminate\Database\Eloquent\Model $model * @param array $pivotAttributes - * @param bool $touch + * @param bool $touch * @return \Illuminate\Database\Eloquent\Model */ public function save(Model $model, array $pivotAttributes = [], $touch = true) @@ -778,7 +956,7 @@ class BelongsToMany extends Relation * * @param array $attributes * @param array $joining - * @param bool $touch + * @param bool $touch * @return \Illuminate\Database\Eloquent\Model */ public function create(array $attributes = [], array $joining = [], $touch = true) @@ -798,11 +976,11 @@ class BelongsToMany extends Relation /** * Create an array of new instances of the related models. * - * @param array $records + * @param iterable $records * @param array $joinings * @return array */ - public function createMany(array $records, array $joinings = []) + public function createMany(iterable $records, array $joinings = []) { $instances = []; @@ -880,7 +1058,7 @@ class BelongsToMany extends Relation * * @param mixed $createdAt * @param mixed $updatedAt - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + * @return $this */ public function withTimestamps($createdAt = null, $updatedAt = null) { @@ -952,6 +1130,16 @@ class BelongsToMany extends Relation return $this->table.'.'.$this->relatedPivotKey; } + /** + * Get the parent key for the relationship. + * + * @return string + */ + public function getParentKeyName() + { + return $this->parentKey; + } + /** * Get the fully qualified parent key name for the relation. * @@ -962,6 +1150,16 @@ class BelongsToMany extends Relation return $this->parent->qualifyColumn($this->parentKey); } + /** + * Get the related key for the relationship. + * + * @return string + */ + public function getRelatedKeyName() + { + return $this->relatedKey; + } + /** * Get the intermediate table for the relationship. * @@ -991,4 +1189,14 @@ class BelongsToMany extends Relation { return $this->accessor; } + + /** + * Get the pivot columns for this relationship. + * + * @return array + */ + public function getPivotColumns() + { + return $this->pivotColumns; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index 0a6f7cf13cedb6a2d4efb14eb3f8fbeb151e60c6..82233fa30ec29472f3373f0dd80b20238c880884 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -2,8 +2,9 @@ namespace Illuminate\Database\Eloquent\Relations\Concerns; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Support\Collection as BaseCollection; trait InteractsWithPivotTable @@ -14,7 +15,7 @@ trait InteractsWithPivotTable * Each existing model is detached, and non existing ones are attached. * * @param mixed $ids - * @param bool $touch + * @param bool $touch * @return array */ public function toggle($ids, $touch = true) @@ -64,7 +65,7 @@ trait InteractsWithPivotTable /** * Sync the intermediate tables with a list of IDs without detaching. * - * @param \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array $ids + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids * @return array */ public function syncWithoutDetaching($ids) @@ -75,8 +76,8 @@ trait InteractsWithPivotTable /** * Sync the intermediate tables with a list of IDs or collection of models. * - * @param \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array $ids - * @param bool $detaching + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @param bool $detaching * @return array */ public function sync($ids, $detaching = true) @@ -88,9 +89,8 @@ trait InteractsWithPivotTable // 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()->pluck( - $this->relatedPivotKey - )->all(); + $current = $this->getCurrentlyAttachedPivots() + ->pluck($this->relatedPivotKey)->all(); $detach = array_diff($current, array_keys( $records = $this->formatRecordsList($this->parseIds($ids)) @@ -133,7 +133,7 @@ trait InteractsWithPivotTable { return collect($records)->mapWithKeys(function ($attributes, $id) { if (! is_array($attributes)) { - list($id, $attributes) = [$attributes, []]; + [$id, $attributes] = [$attributes, []]; } return [$id => $attributes]; @@ -145,7 +145,7 @@ trait InteractsWithPivotTable * * @param array $records * @param array $current - * @param bool $touch + * @param bool $touch * @return array */ protected function attachNew(array $records, array $current, $touch = true) @@ -179,16 +179,20 @@ trait InteractsWithPivotTable * * @param mixed $id * @param array $attributes - * @param bool $touch + * @param bool $touch * @return int */ public function updateExistingPivot($id, array $attributes, $touch = true) { + if ($this->using && empty($this->pivotWheres) && empty($this->pivotWhereIns)) { + return $this->updateExistingPivotUsingCustomClass($id, $attributes, $touch); + } + if (in_array($this->updatedAt(), $this->pivotColumns)) { $attributes = $this->addTimestampsToAttachment($attributes, true); } - $updated = $this->newPivotStatementForId($id)->update( + $updated = $this->newPivotStatementForId($this->parseId($id))->update( $this->castAttributes($attributes) ); @@ -199,28 +203,78 @@ trait InteractsWithPivotTable return $updated; } + /** + * Update an existing pivot record on the table via a custom class. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return int + */ + protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch) + { + $pivot = $this->getCurrentlyAttachedPivots() + ->where($this->foreignPivotKey, $this->parent->{$this->parentKey}) + ->where($this->relatedPivotKey, $this->parseId($id)) + ->first(); + + $updated = $pivot ? $pivot->fill($attributes)->isDirty() : false; + + if ($updated) { + $pivot->save(); + } + + if ($touch) { + $this->touchIfTouching(); + } + + return (int) $updated; + } + /** * Attach a model to the parent. * * @param mixed $id * @param array $attributes - * @param bool $touch + * @param bool $touch * @return void */ public function attach($id, array $attributes = [], $touch = true) { - // Here we will insert the attachment records into the pivot table. Once we have - // inserted the records, we will touch the relationships if necessary and the - // function will return. We can parse the IDs before inserting the records. - $this->newPivotStatement()->insert($this->formatAttachRecords( - $this->parseIds($id), $attributes - )); + if ($this->using) { + $this->attachUsingCustomClass($id, $attributes); + } else { + // Here we will insert the attachment records into the pivot table. Once we have + // inserted the records, we will touch the relationships if necessary and the + // function will return. We can parse the IDs before inserting the records. + $this->newPivotStatement()->insert($this->formatAttachRecords( + $this->parseIds($id), $attributes + )); + } if ($touch) { $this->touchIfTouching(); } } + /** + * Attach a model to the parent using a custom class. + * + * @param mixed $id + * @param array $attributes + * @return void + */ + protected function attachUsingCustomClass($id, array $attributes) + { + $records = $this->formatAttachRecords( + $this->parseIds($id), $attributes + ); + + foreach ($records as $record) { + $this->newPivot($record, false)->save(); + } + } + /** * Create an array of records to insert into the pivot table. * @@ -250,15 +304,15 @@ trait InteractsWithPivotTable /** * Create a full attachment record payload. * - * @param int $key + * @param int $key * @param mixed $value * @param array $attributes - * @param bool $hasTimestamps + * @param bool $hasTimestamps * @return array */ protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) { - list($id, $attributes) = $this->extractAttachIdAndAttributes($key, $value, $attributes); + [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); return array_merge( $this->baseAttachRecord($id, $hasTimestamps), $this->castAttributes($attributes) @@ -283,7 +337,7 @@ trait InteractsWithPivotTable /** * Create a new pivot attachment record. * - * @param int $id + * @param int $id * @param bool $timed * @return array */ @@ -300,6 +354,10 @@ trait InteractsWithPivotTable $record = $this->addTimestampsToAttachment($record); } + foreach ($this->pivotValues as $value) { + $record[$value['column']] = $value['value']; + } + return $record; } @@ -307,13 +365,19 @@ trait InteractsWithPivotTable * Set the creation and update timestamps on an attach record. * * @param array $record - * @param bool $exists + * @param bool $exists * @return array */ protected function addTimestampsToAttachment(array $record, $exists = false) { $fresh = $this->parent->freshTimestamp(); + if ($this->using) { + $pivotModel = new $this->using; + + $fresh = $fresh->format($pivotModel->getDateFormat()); + } + if (! $exists && $this->hasPivotColumn($this->createdAt())) { $record[$this->createdAt()] = $fresh; } @@ -331,7 +395,7 @@ trait InteractsWithPivotTable * @param string $column * @return bool */ - protected function hasPivotColumn($column) + public function hasPivotColumn($column) { return in_array($column, $this->pivotColumns); } @@ -345,26 +409,30 @@ trait InteractsWithPivotTable */ public function detach($ids = null, $touch = true) { - $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. - if (! is_null($ids)) { - $ids = $this->parseIds($ids); - - if (empty($ids)) { - return 0; + if ($this->using && ! empty($ids) && empty($this->pivotWheres) && empty($this->pivotWhereIns)) { + $results = $this->detachUsingCustomClass($ids); + } else { + $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. + if (! is_null($ids)) { + $ids = $this->parseIds($ids); + + if (empty($ids)) { + return 0; + } + + $query->whereIn($this->relatedPivotKey, (array) $ids); } - $query->whereIn($this->relatedPivotKey, (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(); } - // 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(); } @@ -372,11 +440,47 @@ trait InteractsWithPivotTable return $results; } + /** + * Detach models from the relationship using a custom class. + * + * @param mixed $ids + * @return int + */ + protected function detachUsingCustomClass($ids) + { + $results = 0; + + foreach ($this->parseIds($ids) as $id) { + $results += $this->newPivot([ + $this->foreignPivotKey => $this->parent->{$this->parentKey}, + $this->relatedPivotKey => $id, + ], true)->delete(); + } + + return $results; + } + + /** + * Get the pivot models that are currently attached. + * + * @return \Illuminate\Support\Collection + */ + protected function getCurrentlyAttachedPivots() + { + return $this->newPivotQuery()->get()->map(function ($record) { + $class = $this->using ? $this->using : Pivot::class; + + $pivot = $class::fromRawAttributes($this->parent, (array) $record, $this->getTable(), true); + + return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); + }); + } + /** * Create a new pivot model instance. * * @param array $attributes - * @param bool $exists + * @param bool $exists * @return \Illuminate\Database\Eloquent\Relations\Pivot */ public function newPivot(array $attributes = [], $exists = false) @@ -417,7 +521,7 @@ trait InteractsWithPivotTable */ public function newPivotStatementForId($id) { - return $this->newPivotQuery()->where($this->relatedPivotKey, $id); + return $this->newPivotQuery()->whereIn($this->relatedPivotKey, $this->parseIds($id)); } /** @@ -425,7 +529,7 @@ trait InteractsWithPivotTable * * @return \Illuminate\Database\Query\Builder */ - protected function newPivotQuery() + public function newPivotQuery() { $query = $this->newPivotStatement(); @@ -478,6 +582,17 @@ trait InteractsWithPivotTable return (array) $value; } + /** + * Get the ID from the given mixed value. + * + * @param mixed $value + * @return mixed + */ + protected function parseId($value) + { + return $value instanceof Model ? $value->{$this->relatedKey} : $value; + } + /** * Cast the given keys to integers if they are numeric and string otherwise. * @@ -486,26 +601,29 @@ trait InteractsWithPivotTable */ protected function castKeys(array $keys) { - return (array) array_map(function ($v) { + return array_map(function ($v) { return $this->castKey($v); }, $keys); } /** - * Cast the given key to an integer if it is numeric. + * Cast the given key to convert to primary key type. * * @param mixed $key * @return mixed */ protected function castKey($key) { - return is_numeric($key) ? (int) $key : (string) $key; + return $this->getTypeSwapValue( + $this->related->getKeyType(), + $key + ); } /** * Cast the given pivot attributes. * - * @param array $attributes + * @param array $attributes * @return array */ protected function castAttributes($attributes) @@ -514,4 +632,28 @@ trait InteractsWithPivotTable ? $this->newPivot()->fill($attributes)->getAttributes() : $attributes; } + + /** + * Converts a given value to a given type value. + * + * @param string $type + * @param mixed $value + * @return mixed + */ + protected function getTypeSwapValue($type, $value) + { + switch (strtolower($type)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return (float) $value; + case 'string': + return (string) $value; + default: + return $value; + } + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/SupportsDefaultModels.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/SupportsDefaultModels.php index 00efd507edb4be38e2f0286b1d087b5a50c888f5..74e758f585710c22a7e47c5173960739255fa947 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/SupportsDefaultModels.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Concerns/SupportsDefaultModels.php @@ -51,7 +51,7 @@ trait SupportsDefaultModels $instance = $this->newRelatedInstanceFor($parent); if (is_callable($this->withDefault)) { - return call_user_func($this->withDefault, $instance) ?: $instance; + return call_user_func($this->withDefault, $instance, $parent) ?: $instance; } if (is_array($this->withDefault)) { diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasMany.php index 6149e475ab33b20c414cc201fa811d2d82a89ecd..b005d4ff128414a5a48005aad1f055858ffbdde0 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasMany.php @@ -13,13 +13,15 @@ class HasMany extends HasOneOrMany */ public function getResults() { - return $this->query->get(); + return ! is_null($this->getParentKey()) + ? $this->query->get() + : $this->related->newCollection(); } /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -35,7 +37,7 @@ class HasMany extends HasOneOrMany /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasManyThrough.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasManyThrough.php index 408e42fc7a50eb2919604296abd829e47472c423..bb5a46229dcbb933355b5d96ccbaa5a70e5b5e84 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasManyThrough.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasManyThrough.php @@ -2,11 +2,12 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Database\Eloquent\SoftDeletes; class HasManyThrough extends Relation { @@ -135,9 +136,7 @@ class HasManyThrough extends Relation */ public function throughParentSoftDeletes() { - return in_array(SoftDeletes::class, class_uses_recursive( - get_class($this->throughParent) - )); + return in_array(SoftDeletes::class, class_uses_recursive($this->throughParent)); } /** @@ -148,7 +147,9 @@ class HasManyThrough extends Relation */ public function addEagerConstraints(array $models) { - $this->query->whereIn( + $whereIn = $this->whereInMethod($this->farParent, $this->localKey); + + $this->query->{$whereIn}( $this->getQualifiedFirstKeyName(), $this->getKeys($models, $this->localKey) ); } @@ -156,7 +157,7 @@ class HasManyThrough extends Relation /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -172,7 +173,7 @@ class HasManyThrough extends Relation /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -209,7 +210,7 @@ class HasManyThrough extends Relation // 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->{$this->firstKey}][] = $result; + $dictionary[$result->laravel_through_key][] = $result; } return $dictionary; @@ -249,7 +250,7 @@ class HasManyThrough extends Relation /** * Execute the query and get the first related model. * - * @param array $columns + * @param array $columns * @return mixed */ public function first($columns = ['*']) @@ -285,7 +286,7 @@ class HasManyThrough extends Relation */ public function find($id, $columns = ['*']) { - if (is_array($id)) { + if (is_array($id) || $id instanceof Arrayable) { return $this->findMany($id, $columns); } @@ -297,12 +298,14 @@ class HasManyThrough extends Relation /** * Find multiple related models by their primary keys. * - * @param mixed $ids + * @param \Illuminate\Contracts\Support\Arrayable|array $ids * @param array $columns * @return \Illuminate\Database\Eloquent\Collection */ public function findMany($ids, $columns = ['*']) { + $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; + if (empty($ids)) { return $this->getRelated()->newCollection(); } @@ -325,15 +328,17 @@ class HasManyThrough extends Relation { $result = $this->find($id, $columns); + $id = $id instanceof Arrayable ? $id->toArray() : $id; + if (is_array($id)) { - if (count($result) == count(array_unique($id))) { + if (count($result) === count(array_unique($id))) { return $result; } } elseif (! is_null($result)) { return $result; } - throw (new ModelNotFoundException)->setModel(get_class($this->related)); + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); } /** @@ -343,7 +348,9 @@ class HasManyThrough extends Relation */ public function getResults() { - return $this->get(); + return ! is_null($this->farParent->{$this->localKey}) + ? $this->get() + : $this->related->newCollection(); } /** @@ -354,16 +361,9 @@ class HasManyThrough extends Relation */ 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; - - $builder = $this->query->applyScopes(); + $builder = $this->prepareQueryBuilder($columns); - $models = $builder->addSelect( - $this->shouldSelect($columns) - )->getModels(); + $models = $builder->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 @@ -378,7 +378,7 @@ class HasManyThrough extends Relation /** * Get a paginator for the "select" statement. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int $page @@ -394,7 +394,7 @@ class HasManyThrough extends Relation /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -419,7 +419,80 @@ class HasManyThrough extends Relation $columns = [$this->related->getTable().'.*']; } - return array_merge($columns, [$this->getQualifiedFirstKeyName()]); + return array_merge($columns, [$this->getQualifiedFirstKeyName().' as laravel_through_key']); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + return $this->prepareQueryBuilder()->chunk($count, $callback); + } + + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $column = $column ?? $this->getRelated()->getQualifiedKeyName(); + + $alias = $alias ?? $this->getRelated()->getKeyName(); + + return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias); + } + + /** + * Get a generator for the given query. + * + * @return \Generator + */ + public function cursor() + { + return $this->prepareQueryBuilder()->cursor(); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Prepare the query builder for query execution. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function prepareQueryBuilder($columns = ['*']) + { + $builder = $this->query->applyScopes(); + + return $builder->addSelect( + $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) + ); } /** @@ -432,10 +505,14 @@ class HasManyThrough extends Relation */ public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) { - if ($parentQuery->getQuery()->from == $query->getQuery()->from) { + if ($parentQuery->getQuery()->from === $query->getQuery()->from) { return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); } + if ($parentQuery->getQuery()->from === $this->throughParent->getTable()) { + return $this->getRelationExistenceQueryForThroughSelfRelation($query, $parentQuery, $columns); + } + $this->performJoin($query); return $query->select($columns)->whereColumn( @@ -455,7 +532,7 @@ class HasManyThrough extends Relation { $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); - $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondLocalKey); + $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); if ($this->throughParentSoftDeletes()) { $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); @@ -464,7 +541,30 @@ class HasManyThrough extends Relation $query->getModel()->setTable($hash); return $query->select($columns)->whereColumn( - $parentQuery->getQuery()->from.'.'.$query->getModel()->getKeyName(), '=', $this->getQualifiedFirstKeyName() + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() + ); + } + + /** + * Add the constraints for a relationship query on the same table as the through parent. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash(); + + $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName()); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn()); + } + + return $query->select($columns)->whereColumn( + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey ); } @@ -488,6 +588,16 @@ class HasManyThrough extends Relation return $this->getQualifiedForeignKeyName(); } + /** + * Get the foreign key on the "through" model. + * + * @return string + */ + public function getFirstKeyName() + { + return $this->firstKey; + } + /** * Get the qualified foreign key on the "through" model. * @@ -498,6 +608,16 @@ class HasManyThrough extends Relation return $this->throughParent->qualifyColumn($this->firstKey); } + /** + * Get the foreign key on the related model. + * + * @return string + */ + public function getForeignKeyName() + { + return $this->secondKey; + } + /** * Get the qualified foreign key on the related model. * @@ -508,6 +628,16 @@ class HasManyThrough extends Relation return $this->related->qualifyColumn($this->secondKey); } + /** + * Get the local key on the far parent model. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } + /** * Get the qualified local key on the far parent model. * @@ -517,4 +647,14 @@ class HasManyThrough extends Relation { return $this->farParent->qualifyColumn($this->localKey); } + + /** + * Get the local key on the intermediary model. + * + * @return string + */ + public function getSecondLocalKeyName() + { + return $this->secondLocalKey; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOne.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOne.php index 858e5d07052e63f3f7994b98603d9280163860ab..1d9e008fd23125f3b160c99a4513f7fffe76db55 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOne.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOne.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels; class HasOne extends HasOneOrMany @@ -17,13 +17,17 @@ class HasOne extends HasOneOrMany */ public function getResults() { + if (is_null($this->getParentKey())) { + return $this->getDefaultFor($this->parent); + } + return $this->query->first() ?: $this->getDefaultFor($this->parent); } /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOneOrMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOneOrMany.php index 54850fa33b24d3fcaf5ca2aa83c3d7575e897e91..bc547702aa7adeb3ed3a07446d604a6ee4bad4a7 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOneOrMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/HasOneOrMany.php @@ -2,9 +2,9 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; abstract class HasOneOrMany extends Relation { @@ -81,7 +81,9 @@ abstract class HasOneOrMany extends Relation */ public function addEagerConstraints(array $models) { - $this->query->whereIn( + $whereIn = $this->whereInMethod($this->parent, $this->localKey); + + $this->query->{$whereIn}( $this->foreignKey, $this->getKeys($models, $this->localKey) ); } @@ -89,7 +91,7 @@ abstract class HasOneOrMany extends Relation /** * Match the eagerly loaded results to their single parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -102,7 +104,7 @@ abstract class HasOneOrMany extends Relation /** * Match the eagerly loaded results to their many parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -115,7 +117,7 @@ abstract class HasOneOrMany extends Relation /** * Match the eagerly loaded results to their many parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @param string $type @@ -142,7 +144,7 @@ abstract class HasOneOrMany extends Relation /** * Get the value of a relationship by one or many type. * - * @param array $dictionary + * @param array $dictionary * @param string $key * @param string $type * @return mixed @@ -151,7 +153,7 @@ abstract class HasOneOrMany extends Relation { $value = $dictionary[$key]; - return $type == 'one' ? reset($value) : $this->related->newCollection($value); + return $type === 'one' ? reset($value) : $this->related->newCollection($value); } /** @@ -253,8 +255,8 @@ abstract class HasOneOrMany extends Relation /** * Attach a collection of models to the parent instance. * - * @param \Traversable|array $models - * @return \Traversable|array + * @param iterable $models + * @return iterable */ public function saveMany($models) { @@ -283,10 +285,10 @@ abstract class HasOneOrMany extends Relation /** * Create a Collection of new instances of the related model. * - * @param array $records + * @param iterable $records * @return \Illuminate\Database\Eloquent\Collection */ - public function createMany(array $records) + public function createMany(iterable $records) { $instances = $this->related->newCollection(); @@ -308,21 +310,6 @@ abstract class HasOneOrMany extends Relation $model->setAttribute($this->getForeignKeyName(), $this->getParentKey()); } - /** - * 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); - } - /** * Add the constraints for a relationship query. * @@ -420,4 +407,14 @@ abstract class HasOneOrMany extends Relation { return $this->foreignKey; } + + /** + * Get the local key for the relationship. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphMany.php index e2a5c5a37cd2eda4c721b908984998f430f2a784..12b06502632971931687558cfc0e0616640a008e 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphMany.php @@ -13,13 +13,15 @@ class MorphMany extends MorphOneOrMany */ public function getResults() { - return $this->query->get(); + return ! is_null($this->getParentKey()) + ? $this->query->get() + : $this->related->newCollection(); } /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -35,7 +37,7 @@ class MorphMany extends MorphOneOrMany /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOne.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOne.php index 520a7ec9421621612515d9f075f5b4e9f1bc1bfe..5f8da14f1f46092396e6c93c299a126fa4c94e20 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOne.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOne.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels; class MorphOne extends MorphOneOrMany @@ -17,13 +17,17 @@ class MorphOne extends MorphOneOrMany */ public function getResults() { + if (is_null($this->getParentKey())) { + return $this->getDefaultFor($this->parent); + } + return $this->query->first() ?: $this->getDefaultFor($this->parent); } /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -39,7 +43,7 @@ class MorphOne extends MorphOneOrMany /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOneOrMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOneOrMany.php index 7e300543360e3ec038f1e0e875f4f93786680847..887ebe2476b14005a67b3244a0125d8f09dded71 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOneOrMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphOneOrMany.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; abstract class MorphOneOrMany extends HasOneOrMany { @@ -67,19 +67,6 @@ abstract class MorphOneOrMany extends HasOneOrMany $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->getMorphType(), $this->morphClass); - - return parent::save($model); - } - /** * Set the foreign ID and type for creating a related model. * @@ -104,7 +91,7 @@ abstract class MorphOneOrMany extends HasOneOrMany public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) { return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( - $this->morphType, $this->morphClass + $query->qualifyColumn($this->getMorphType()), $this->morphClass ); } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphPivot.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphPivot.php index b7a2f34195b850c557b1928f7ebfdd6726de309c..ce36ea5c2feea2f62c8f12b55c2cce37ce67d11d 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphPivot.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphPivot.php @@ -3,6 +3,7 @@ namespace Illuminate\Database\Eloquent\Relations; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Support\Str; class MorphPivot extends Pivot { @@ -44,11 +45,17 @@ class MorphPivot extends Pivot */ public function delete() { + if ($this->fireModelEvent('deleting') === false) { + return 0; + } + $query = $this->getDeleteQuery(); $query->where($this->morphType, $this->morphClass); - return $query->delete(); + return tap($query->delete(), function () { + $this->fireModelEvent('deleted', false); + }); } /** @@ -76,4 +83,74 @@ class MorphPivot extends Pivot return $this; } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + if (isset($this->attributes[$this->getKeyName()])) { + return $this->getKey(); + } + + return sprintf( + '%s:%s:%s:%s:%s:%s', + $this->foreignKey, $this->getAttribute($this->foreignKey), + $this->relatedKey, $this->getAttribute($this->relatedKey), + $this->morphType, $this->morphClass + ); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + if (is_array($ids)) { + return $this->newQueryForCollectionRestoration($ids); + } + + if (! Str::contains($ids, ':')) { + return parent::newQueryForRestoration($ids); + } + + $segments = explode(':', $ids); + + return $this->newQueryWithoutScopes() + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + } + + /** + * Get a new query to restore multiple models by their queueable IDs. + * + * @param array $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newQueryForCollectionRestoration(array $ids) + { + if (! Str::contains($ids[0], ':')) { + return parent::newQueryForRestoration($ids); + } + + $query = $this->newQueryWithoutScopes(); + + foreach ($ids as $id) { + $segments = explode(':', $id); + + $query->orWhere(function ($query) use ($segments) { + return $query->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + }); + } + + return $query; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphTo.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphTo.php index 0b5375b3229eab637cb575e18d20b3f124e2a94c..354627f3f449f9419b753b66d6b734977fd87310 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphTo.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphTo.php @@ -3,13 +3,10 @@ namespace Illuminate\Database\Eloquent\Relations; use BadMethodCallException; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; -/** - * @mixin \Illuminate\Database\Eloquent\Builder - */ class MorphTo extends BelongsTo { /** @@ -40,6 +37,13 @@ class MorphTo extends BelongsTo */ protected $macroBuffer = []; + /** + * A map of relations to load for each individual morph type. + * + * @var array + */ + protected $morphableEagerLoads = []; + /** * Create a new morph to relationship instance. * @@ -84,16 +88,6 @@ class MorphTo extends BelongsTo } } - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return $this->ownerKey ? $this->query->first() : null; - } - /** * Get the results of the relationship. * @@ -120,12 +114,19 @@ class MorphTo extends BelongsTo { $instance = $this->createModelByType($type); + $ownerKey = $this->ownerKey ?? $instance->getKeyName(); + $query = $this->replayMacros($instance->newQuery()) ->mergeConstraintsFrom($this->getQuery()) - ->with($this->getQuery()->getEagerLoads()); + ->with(array_merge( + $this->getQuery()->getEagerLoads(), + (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) + )); + + $whereIn = $this->whereInMethod($instance, $ownerKey); - return $query->whereIn( - $instance->getTable().'.'.$instance->getKeyName(), $this->gatherKeysByType($type) + return $query->{$whereIn}( + $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) )->get(); } @@ -137,9 +138,7 @@ class MorphTo extends BelongsTo */ protected function gatherKeysByType($type) { - return collect($this->dictionary[$type])->map(function ($models) { - return head($models)->{$this->foreignKey}; - })->values()->unique()->all(); + return array_keys($this->dictionary[$type]); } /** @@ -158,7 +157,7 @@ class MorphTo extends BelongsTo /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -178,9 +177,11 @@ class MorphTo extends BelongsTo 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); + $ownerKey = ! is_null($this->ownerKey) ? $result->{$this->ownerKey} : $result->getKey(); + + if (isset($this->dictionary[$type][$ownerKey])) { + foreach ($this->dictionary[$type][$ownerKey] as $model) { + $model->setRelation($this->relationName, $result); } } } @@ -202,7 +203,7 @@ class MorphTo extends BelongsTo $this->morphType, $model instanceof Model ? $model->getMorphClass() : null ); - return $this->parent->setRelation($this->relation, $model); + return $this->parent->setRelation($this->relationName, $model); } /** @@ -216,7 +217,30 @@ class MorphTo extends BelongsTo $this->parent->setAttribute($this->morphType, null); - return $this->parent->setRelation($this->relation, null); + return $this->parent->setRelation($this->relationName, null); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + if (! is_null($this->child->{$this->foreignKey})) { + parent::touch(); + } + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + protected function newRelatedInstanceFor(Model $parent) + { + return $parent->{$this->getRelationName()}()->getRelated()->newInstance(); } /** @@ -239,6 +263,21 @@ class MorphTo extends BelongsTo return $this->dictionary; } + /** + * Specify which relations to load for a given morph type. + * + * @param array $with + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function morphWith(array $with) + { + $this->morphableEagerLoads = array_merge( + $this->morphableEagerLoads, $with + ); + + return $this; + } + /** * Replay stored macro calls on the actual related instance. * @@ -258,13 +297,19 @@ class MorphTo extends BelongsTo * Handle dynamic method calls to the relationship. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed */ public function __call($method, $parameters) { try { - return parent::__call($method, $parameters); + $result = parent::__call($method, $parameters); + + if (in_array($method, ['select', 'selectRaw', 'selectSub', 'addSelect', 'withoutGlobalScopes'])) { + $this->macroBuffer[] = compact('method', 'parameters'); + } + + return $result; } // If we tried to call a method that does not exist on the parent Builder instance, diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphToMany.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphToMany.php index 15f5cfd028c495513d88bfbf78da74a176ae354a..79a052af1a617eb28a7d2cce715e9ce9d20c3f7a 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphToMany.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/MorphToMany.php @@ -2,9 +2,9 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Support\Arr; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Arr; class MorphToMany extends BelongsToMany { @@ -42,7 +42,7 @@ class MorphToMany extends BelongsToMany * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @param bool $inverse * @return void */ @@ -89,7 +89,7 @@ class MorphToMany extends BelongsToMany /** * Create a new pivot attachment record. * - * @param int $id + * @param int $id * @param bool $timed * @return array */ @@ -120,7 +120,7 @@ class MorphToMany extends BelongsToMany * * @return \Illuminate\Database\Query\Builder */ - protected function newPivotQuery() + public function newPivotQuery() { return parent::newPivotQuery()->where($this->morphType, $this->morphClass); } @@ -129,7 +129,7 @@ class MorphToMany extends BelongsToMany * Create a new pivot model instance. * * @param array $attributes - * @param bool $exists + * @param bool $exists * @return \Illuminate\Database\Eloquent\Relations\Pivot */ public function newPivot(array $attributes = [], $exists = false) @@ -146,6 +146,22 @@ class MorphToMany extends BelongsToMany return $pivot; } + /** + * Get the pivot columns for the relation. + * + * "pivot_" is prefixed at each column for easy removal later. + * + * @return array + */ + protected function aliasedPivotColumns() + { + $defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType]; + + return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { + return $this->table.'.'.$column.' as pivot_'.$column; + })->unique()->all(); + } + /** * Get the foreign key "type" name. * @@ -165,4 +181,14 @@ class MorphToMany extends BelongsToMany { return $this->morphClass; } + + /** + * Get the indicator for a reverse relationship. + * + * @return bool + */ + public function getInverse() + { + return $this->inverse; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Pivot.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Pivot.php index 3223051926a14cd1cdb1b03b764d8db7f4880bc5..a65ecdea6633614e7fd887de711cf76a78016e7a 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Pivot.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Pivot.php @@ -2,32 +2,19 @@ namespace Illuminate\Database\Eloquent\Relations; -use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Relations\Concerns\AsPivot; class Pivot extends Model { - /** - * The parent model of the relationship. - * - * @var \Illuminate\Database\Eloquent\Model - */ - public $pivotParent; - - /** - * The name of the foreign key column. - * - * @var string - */ - protected $foreignKey; + use AsPivot; /** - * The name of the "other key" column. + * Indicates if the IDs are auto-incrementing. * - * @var string + * @var bool */ - protected $relatedKey; + public $incrementing = false; /** * The attributes that aren't mass assignable. @@ -35,201 +22,4 @@ class Pivot extends Model * @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 static - */ - public static function fromAttributes(Model $parent, $attributes, $table, $exists = false) - { - $instance = new static; - - // 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. - $instance->setConnection($parent->getConnectionName()) - ->setTable($table) - ->forceFill($attributes) - ->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. - $instance->pivotParent = $parent; - - $instance->exists = $exists; - - $instance->timestamps = $instance->hasTimestampAttributes(); - - return $instance; - } - - /** - * Create a new pivot model from raw values returned from a query. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @param array $attributes - * @param string $table - * @param bool $exists - * @return static - */ - public static function fromRawAttributes(Model $parent, $attributes, $table, $exists = false) - { - $instance = static::fromAttributes($parent, [], $table, $exists); - - $instance->setRawAttributes($attributes, true); - - $instance->timestamps = $instance->hasTimestampAttributes(); - - return $instance; - } - - /** - * Set the keys for a save update query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSaveQuery(Builder $query) - { - if (isset($this->attributes[$this->getKeyName()])) { - return parent::setKeysForSaveQuery($query); - } - - $query->where($this->foreignKey, $this->getOriginal( - $this->foreignKey, $this->getAttribute($this->foreignKey) - )); - - return $query->where($this->relatedKey, $this->getOriginal( - $this->relatedKey, $this->getAttribute($this->relatedKey) - )); - } - - /** - * Delete the pivot model record from the database. - * - * @return int - */ - public function delete() - { - if (isset($this->attributes[$this->getKeyName()])) { - return parent::delete(); - } - - return $this->getDeleteQuery()->delete(); - } - - /** - * Get the query builder for a delete operation on the pivot. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getDeleteQuery() - { - return $this->newQuery()->where([ - $this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)), - $this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)), - ]); - } - - /** - * Get the table associated with the model. - * - * @return string - */ - public function getTable() - { - if (! isset($this->table)) { - $this->setTable(str_replace( - '\\', '', Str::snake(Str::singular(class_basename($this))) - )); - } - - return $this->table; - } - - /** - * Get the foreign key column name. - * - * @return string - */ - public function getForeignKey() - { - return $this->foreignKey; - } - - /** - * Get the "related key" column name. - * - * @return string - */ - public function getRelatedKey() - { - return $this->relatedKey; - } - - /** - * Get the "related key" column name. - * - * @return string - */ - public function getOtherKey() - { - return $this->getRelatedKey(); - } - - /** - * Set the key names for the pivot model instance. - * - * @param string $foreignKey - * @param string $relatedKey - * @return $this - */ - public function setPivotKeys($foreignKey, $relatedKey) - { - $this->foreignKey = $foreignKey; - - $this->relatedKey = $relatedKey; - - 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->pivotParent) - ? $this->pivotParent->getCreatedAtColumn() - : parent::getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function getUpdatedAtColumn() - { - return ($this->pivotParent) - ? $this->pivotParent->getUpdatedAtColumn() - : parent::getUpdatedAtColumn(); - } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Relation.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Relation.php index c46dc358c1cec048f1820324f6a801072a6624fc..6bdb6f7a7487710eb9941f30ebeb7e2f16e06266 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Relation.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/Relations/Relation.php @@ -3,19 +3,20 @@ namespace Illuminate\Database\Eloquent\Relations; use Closure; -use Illuminate\Support\Arr; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Traits\Macroable; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Query\Expression; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Query\Expression; +use Illuminate\Support\Arr; +use Illuminate\Support\Traits\ForwardsCalls; +use Illuminate\Support\Traits\Macroable; /** * @mixin \Illuminate\Database\Eloquent\Builder */ abstract class Relation { - use Macroable { + use ForwardsCalls, Macroable { __call as macroCall; } @@ -86,7 +87,7 @@ abstract class Relation // off of the bindings, leaving only the constraints that the developers put // as "extra" on the relationships, and not original relation constraints. try { - return call_user_func($callback); + return $callback(); } finally { static::$constraints = $previous; } @@ -110,7 +111,7 @@ abstract class Relation /** * Initialize the relation on a set of models. * - * @param array $models + * @param array $models * @param string $relation * @return array */ @@ -119,7 +120,7 @@ abstract class Relation /** * Match the eagerly loaded results to their parents. * - * @param array $models + * @param array $models * @param \Illuminate\Database\Eloquent\Collection $results * @param string $relation * @return array @@ -161,9 +162,13 @@ abstract class Relation */ public function touch() { - $column = $this->getRelated()->getUpdatedAtColumn(); + $model = $this->getRelated(); - $this->rawUpdate([$column => $this->getRelated()->freshTimestampString()]); + if (! $model::isIgnoringTouch()) { + $this->rawUpdate([ + $model->getUpdatedAtColumn() => $model->freshTimestampString(), + ]); + } } /** @@ -198,7 +203,7 @@ abstract class Relation * * @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns + * @param array|mixed $columns * @return \Illuminate\Database\Eloquent\Builder */ public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) @@ -211,15 +216,15 @@ abstract class Relation /** * Get all of the primary keys for an array of models. * - * @param array $models - * @param string $key + * @param array $models + * @param string|null $key * @return array */ protected function getKeys(array $models, $key = null) { return collect($models)->map(function ($value) use ($key) { return $key ? $value->getAttribute($key) : $value->getKey(); - })->values()->unique()->sort()->all(); + })->values()->unique(null, true)->sort()->all(); } /** @@ -302,6 +307,21 @@ abstract class Relation return $this->related->getUpdatedAtColumn(); } + /** + * Get the name of the "where in" method for eager loading. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $key + * @return string + */ + protected function whereInMethod(Model $model, $key) + { + return $model->getKeyName() === last(explode('.', $key)) + && in_array($model->getKeyType(), ['int', 'integer']) + ? 'whereIntegerInRaw' + : 'whereIn'; + } + /** * Set or get the morph map for polymorphic relations. * @@ -346,16 +366,14 @@ abstract class Relation */ public static function getMorphedModel($alias) { - return array_key_exists($alias, self::$morphMap) - ? self::$morphMap[$alias] - : null; + return static::$morphMap[$alias] ?? null; } /** * Handle dynamic method calls to the relationship. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed */ public function __call($method, $parameters) @@ -364,7 +382,7 @@ abstract class Relation return $this->macroCall($method, $parameters); } - $result = $this->query->{$method}(...$parameters); + $result = $this->forwardCallTo($this->query, $method, $parameters); if ($result === $this->query) { return $this; diff --git a/Seance5-6/seance/vendor/illuminate/database/Eloquent/SoftDeletes.php b/Seance5-6/seance/vendor/illuminate/database/Eloquent/SoftDeletes.php index a2c38c87962cecf69a0828ef6e8de21c923aeaa1..6784f70309719f8de9e05e2d5bc4ed7c15425181 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Eloquent/SoftDeletes.php +++ b/Seance5-6/seance/vendor/illuminate/database/Eloquent/SoftDeletes.php @@ -2,6 +2,11 @@ namespace Illuminate\Database\Eloquent; +/** + * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed() + * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder onlyTrashed() + * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withoutTrashed() + */ trait SoftDeletes { /** @@ -21,6 +26,16 @@ trait SoftDeletes static::addGlobalScope(new SoftDeletingScope); } + /** + * Initialize the soft deleting trait for an instance. + * + * @return void + */ + public function initializeSoftDeletes() + { + $this->dates[] = $this->getDeletedAtColumn(); + } + /** * Force a hard delete on a soft deleted model. * @@ -30,11 +45,13 @@ trait SoftDeletes { $this->forceDeleting = true; - $deleted = $this->delete(); + return tap($this->delete(), function ($deleted) { + $this->forceDeleting = false; - $this->forceDeleting = false; - - return $deleted; + if ($deleted) { + $this->fireModelEvent('forceDeleted', false); + } + }); } /** @@ -47,7 +64,7 @@ trait SoftDeletes if ($this->forceDeleting) { $this->exists = false; - return $this->newModelQuery()->where($this->getKeyName(), $this->getKey())->forceDelete(); + return $this->setKeysForSaveQuery($this->newModelQuery())->forceDelete(); } return $this->runSoftDelete(); @@ -60,7 +77,7 @@ trait SoftDeletes */ protected function runSoftDelete() { - $query = $this->newModelQuery()->where($this->getKeyName(), $this->getKey()); + $query = $this->setKeysForSaveQuery($this->newModelQuery()); $time = $this->freshTimestamp(); @@ -75,6 +92,8 @@ trait SoftDeletes } $query->update($columns); + + $this->syncOriginalAttributes(array_keys($columns)); } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Grammar.php b/Seance5-6/seance/vendor/illuminate/database/Grammar.php index 243f07c30c07edf6f85561c382adda022413db69..cc1e0b9469400f5a446d8e90b2779c39eeb78b91 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Grammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Grammar.php @@ -3,9 +3,12 @@ namespace Illuminate\Database; use Illuminate\Database\Query\Expression; +use Illuminate\Support\Traits\Macroable; abstract class Grammar { + use Macroable; + /** * The grammar table prefix. * @@ -43,7 +46,7 @@ abstract class Grammar * Wrap a value in keyword identifiers. * * @param \Illuminate\Database\Query\Expression|string $value - * @param bool $prefixAlias + * @param bool $prefixAlias * @return string */ public function wrap($value, $prefixAlias = false) @@ -53,9 +56,9 @@ abstract class Grammar } // 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) { + // the pieces so we can wrap each of the segments of the expression on its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { return $this->wrapAliasedValue($value, $prefixAlias); } @@ -80,9 +83,7 @@ abstract class Grammar $segments[1] = $this->tablePrefix.$segments[1]; } - return $this->wrap( - $segments[0]).' as '.$this->wrapValue($segments[1] - ); + return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[1]); } /** @@ -118,7 +119,7 @@ abstract class Grammar /** * Convert an array of column names into a delimited string. * - * @param array $columns + * @param array $columns * @return string */ public function columnize(array $columns) @@ -129,7 +130,7 @@ abstract class Grammar /** * Create query parameter place-holders for an array. * - * @param array $values + * @param array $values * @return string */ public function parameterize(array $values) @@ -140,7 +141,7 @@ abstract class Grammar /** * Get the appropriate query parameter place-holder for a value. * - * @param mixed $value + * @param mixed $value * @return string */ public function parameter($value) @@ -148,6 +149,21 @@ abstract class Grammar return $this->isExpression($value) ? $this->getValue($value) : '?'; } + /** + * Quote the given string literal. + * + * @param string|array $value + * @return string + */ + public function quoteString($value) + { + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "'$value'"; + } + /** * Determine if the given value is a raw expression. * diff --git a/Seance5-6/seance/vendor/illuminate/database/MigrationServiceProvider.php b/Seance5-6/seance/vendor/illuminate/database/MigrationServiceProvider.php index a8b92ab6e48122222c7f8331e4af59bd6bf4d6ea..3ccc4517eafd53a0b42129ff2fbe42a9653f1a37 100644 --- a/Seance5-6/seance/vendor/illuminate/database/MigrationServiceProvider.php +++ b/Seance5-6/seance/vendor/illuminate/database/MigrationServiceProvider.php @@ -2,19 +2,37 @@ namespace Illuminate\Database; -use Illuminate\Support\ServiceProvider; -use Illuminate\Database\Migrations\Migrator; -use Illuminate\Database\Migrations\MigrationCreator; +use Illuminate\Contracts\Support\DeferrableProvider; +use Illuminate\Database\Console\Migrations\FreshCommand; +use Illuminate\Database\Console\Migrations\InstallCommand; +use Illuminate\Database\Console\Migrations\MigrateCommand; +use Illuminate\Database\Console\Migrations\MigrateMakeCommand; +use Illuminate\Database\Console\Migrations\RefreshCommand; +use Illuminate\Database\Console\Migrations\ResetCommand; +use Illuminate\Database\Console\Migrations\RollbackCommand; +use Illuminate\Database\Console\Migrations\StatusCommand; use Illuminate\Database\Migrations\DatabaseMigrationRepository; +use Illuminate\Database\Migrations\MigrationCreator; +use Illuminate\Database\Migrations\Migrator; +use Illuminate\Support\ServiceProvider; -class MigrationServiceProvider extends ServiceProvider +class MigrationServiceProvider extends ServiceProvider implements DeferrableProvider { /** - * Indicates if loading of the provider is deferred. + * The commands to be registered. * - * @var bool + * @var array */ - protected $defer = true; + protected $commands = [ + 'Migrate' => 'command.migrate', + 'MigrateFresh' => 'command.migrate.fresh', + 'MigrateInstall' => 'command.migrate.install', + 'MigrateRefresh' => 'command.migrate.refresh', + 'MigrateReset' => 'command.migrate.reset', + 'MigrateRollback' => 'command.migrate.rollback', + 'MigrateStatus' => 'command.migrate.status', + 'MigrateMake' => 'command.migrate.make', + ]; /** * Register the service provider. @@ -28,6 +46,8 @@ class MigrationServiceProvider extends ServiceProvider $this->registerMigrator(); $this->registerCreator(); + + $this->registerCommands($this->commands); } /** @@ -57,7 +77,7 @@ class MigrationServiceProvider extends ServiceProvider $this->app->singleton('migrator', function ($app) { $repository = $app['migration.repository']; - return new Migrator($repository, $app['db'], $app['files']); + return new Migrator($repository, $app['db'], $app['files'], $app['events']); }); } @@ -69,7 +89,125 @@ class MigrationServiceProvider extends ServiceProvider protected function registerCreator() { $this->app->singleton('migration.creator', function ($app) { - return new MigrationCreator($app['files']); + return new MigrationCreator($app['files'], $app->basePath('stubs')); + }); + } + + /** + * Register the given commands. + * + * @param array $commands + * @return void + */ + protected function registerCommands(array $commands) + { + foreach (array_keys($commands) as $command) { + call_user_func_array([$this, "register{$command}Command"], []); + } + + $this->commands(array_values($commands)); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateCommand() + { + $this->app->singleton('command.migrate', function ($app) { + return new MigrateCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateFreshCommand() + { + $this->app->singleton('command.migrate.fresh', function () { + return new FreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateInstallCommand() + { + $this->app->singleton('command.migrate.install', function ($app) { + return new InstallCommand($app['migration.repository']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateMakeCommand() + { + $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 command. + * + * @return void + */ + protected function registerMigrateRefreshCommand() + { + $this->app->singleton('command.migrate.refresh', function () { + return new RefreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateResetCommand() + { + $this->app->singleton('command.migrate.reset', function ($app) { + return new ResetCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRollbackCommand() + { + $this->app->singleton('command.migrate.rollback', function ($app) { + return new RollbackCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateStatusCommand() + { + $this->app->singleton('command.migrate.status', function ($app) { + return new StatusCommand($app['migrator']); }); } @@ -80,8 +218,8 @@ class MigrationServiceProvider extends ServiceProvider */ public function provides() { - return [ + return array_merge([ 'migrator', 'migration.repository', 'migration.creator', - ]; + ], array_values($this->commands)); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/DatabaseMigrationRepository.php b/Seance5-6/seance/vendor/illuminate/database/Migrations/DatabaseMigrationRepository.php index b1685ffa35244c596aec524baf3ce8756879e231..1ace1a6ff7e3fa680dbfc9265245368f39a67bd8 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/DatabaseMigrationRepository.php +++ b/Seance5-6/seance/vendor/illuminate/database/Migrations/DatabaseMigrationRepository.php @@ -41,7 +41,7 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface } /** - * Get the ran migrations. + * Get the completed migrations. * * @return array */ @@ -80,11 +80,24 @@ class DatabaseMigrationRepository implements MigrationRepositoryInterface return $query->orderBy('migration', 'desc')->get()->all(); } + /** + * Get the completed migrations with their batch numbers. + * + * @return array + */ + public function getMigrationBatches() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('batch', 'migration')->all(); + } + /** * Log that a migration was run. * * @param string $file - * @param int $batch + * @param int $batch * @return void */ public function log($file, $batch) diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/Migration.php b/Seance5-6/seance/vendor/illuminate/database/Migrations/Migration.php index ac1b9e7f1d0ff7bd8ac68476d4161f315d1f2e29..a58f7848a7e15e5386a88cd8116de030c4c07c6f 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/Migration.php +++ b/Seance5-6/seance/vendor/illuminate/database/Migrations/Migration.php @@ -7,7 +7,7 @@ abstract class Migration /** * The name of the database connection to use. * - * @var string + * @var string|null */ protected $connection; @@ -21,7 +21,7 @@ abstract class Migration /** * Get the migration connection name. * - * @return string + * @return string|null */ public function getConnection() { diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationCreator.php b/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationCreator.php index 719fbf106c3de4bf8eb3cf9098728911d2752e32..fca9ed81b8d93c386a9ee7cebb5d6166c13859ce 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationCreator.php +++ b/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationCreator.php @@ -3,9 +3,9 @@ namespace Illuminate\Database\Migrations; use Closure; +use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Str; use InvalidArgumentException; -use Illuminate\Filesystem\Filesystem; class MigrationCreator { @@ -16,6 +16,13 @@ class MigrationCreator */ protected $files; + /** + * The custom app stubs directory. + * + * @var string + */ + protected $customStubPath; + /** * The registered post create hooks. * @@ -27,11 +34,13 @@ class MigrationCreator * Create a new migration creator instance. * * @param \Illuminate\Filesystem\Filesystem $files + * @param string $customStubPath * @return void */ - public function __construct(Filesystem $files) + public function __construct(Filesystem $files, $customStubPath) { $this->files = $files; + $this->customStubPath = $customStubPath; } /** @@ -39,14 +48,15 @@ class MigrationCreator * * @param string $name * @param string $path - * @param string $table - * @param bool $create + * @param string|null $table + * @param bool $create * @return string + * * @throws \Exception */ public function create($name, $path, $table = null, $create = false) { - $this->ensureMigrationDoesntAlreadyExist($name); + $this->ensureMigrationDoesntAlreadyExist($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 @@ -61,7 +71,7 @@ class MigrationCreator // Next, we will fire any hooks that are supposed to fire after a migration is // created. Once that is done we'll be ready to return the full path to the // migration file so it can be used however it's needed by the developer. - $this->firePostCreateHooks(); + $this->firePostCreateHooks($table); return $path; } @@ -70,12 +80,21 @@ class MigrationCreator * Ensure that a migration with the given name doesn't already exist. * * @param string $name + * @param string $migrationPath * @return void * * @throws \InvalidArgumentException */ - protected function ensureMigrationDoesntAlreadyExist($name) + protected function ensureMigrationDoesntAlreadyExist($name, $migrationPath = null) { + if (! empty($migrationPath)) { + $migrationFiles = $this->files->glob($migrationPath.'/*.php'); + + foreach ($migrationFiles as $migrationFile) { + $this->files->requireOnce($migrationFile); + } + } + if (class_exists($className = $this->getClassName($name))) { throw new InvalidArgumentException("A {$className} class already exists."); } @@ -84,22 +103,27 @@ class MigrationCreator /** * Get the migration stub file. * - * @param string $table - * @param bool $create + * @param string|null $table + * @param bool $create * @return string */ protected function getStub($table, $create) { if (is_null($table)) { - return $this->files->get($this->stubPath().'/blank.stub'); + $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.stub') + ? $customPath + : $this->stubPath().'/migration.stub'; + } elseif ($create) { + $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.create.stub') + ? $customPath + : $this->stubPath().'/migration.create.stub'; + } else { + $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.update.stub') + ? $customPath + : $this->stubPath().'/migration.update.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. - $stub = $create ? 'create.stub' : 'update.stub'; - - return $this->files->get($this->stubPath()."/{$stub}"); + return $this->files->get($stub); } /** @@ -107,18 +131,24 @@ class MigrationCreator * * @param string $name * @param string $stub - * @param string $table + * @param string|null $table * @return string */ protected function populateStub($name, $stub, $table) { - $stub = str_replace('DummyClass', $this->getClassName($name), $stub); + $stub = str_replace( + ['DummyClass', '{{ class }}', '{{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('DummyTable', $table, $stub); + $stub = str_replace( + ['DummyTable', '{{ table }}', '{{table}}'], + $table, $stub + ); } return $stub; @@ -150,12 +180,13 @@ class MigrationCreator /** * Fire the registered post create hooks. * + * @param string|null $table * @return void */ - protected function firePostCreateHooks() + protected function firePostCreateHooks($table) { foreach ($this->postCreate as $callback) { - call_user_func($callback); + $callback($table); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationRepositoryInterface.php b/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationRepositoryInterface.php index 60bc921f893108db17d309dcfdf47537ff8ea1e5..410326a9bd6841d40a11bfaebb3dc8a8a100236f 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationRepositoryInterface.php +++ b/Seance5-6/seance/vendor/illuminate/database/Migrations/MigrationRepositoryInterface.php @@ -5,7 +5,7 @@ namespace Illuminate\Database\Migrations; interface MigrationRepositoryInterface { /** - * Get the ran migrations for a given package. + * Get the completed migrations. * * @return array */ @@ -26,11 +26,18 @@ interface MigrationRepositoryInterface */ public function getLast(); + /** + * Get the completed migrations with their batch numbers. + * + * @return array + */ + public function getMigrationBatches(); + /** * Log that a migration was run. * * @param string $file - * @param int $batch + * @param int $batch * @return void */ public function log($file, $batch); diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/Migrator.php b/Seance5-6/seance/vendor/illuminate/database/Migrations/Migrator.php index d55046dab47fb46c29e1a197eff768609527d12d..d334e0b563102a339da4ee7bb586c15652f67521 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/Migrator.php +++ b/Seance5-6/seance/vendor/illuminate/database/Migrations/Migrator.php @@ -2,14 +2,28 @@ namespace Illuminate\Database\Migrations; +use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Database\ConnectionResolverInterface as Resolver; +use Illuminate\Database\Events\MigrationEnded; +use Illuminate\Database\Events\MigrationsEnded; +use Illuminate\Database\Events\MigrationsStarted; +use Illuminate\Database\Events\MigrationStarted; +use Illuminate\Database\Events\NoPendingMigrations; +use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Arr; -use Illuminate\Support\Str; use Illuminate\Support\Collection; -use Illuminate\Filesystem\Filesystem; -use Illuminate\Database\ConnectionResolverInterface as Resolver; +use Illuminate\Support\Str; +use Symfony\Component\Console\Output\OutputInterface; class Migrator { + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + /** * The migration repository implementation. * @@ -39,18 +53,18 @@ class Migrator protected $connection; /** - * The notes for the current operation. + * The paths to all of the migration files. * * @var array */ - protected $notes = []; + protected $paths = []; /** - * The paths to all of the migration files. + * The output interface implementation. * - * @var array + * @var \Symfony\Component\Console\Output\OutputInterface */ - protected $paths = []; + protected $output; /** * Create a new migrator instance. @@ -58,13 +72,16 @@ class Migrator * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository * @param \Illuminate\Database\ConnectionResolverInterface $resolver * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher * @return void */ public function __construct(MigrationRepositoryInterface $repository, Resolver $resolver, - Filesystem $files) + Filesystem $files, + Dispatcher $dispatcher = null) { $this->files = $files; + $this->events = $dispatcher; $this->resolver = $resolver; $this->repository = $repository; } @@ -78,8 +95,6 @@ class Migrator */ public function run($paths = [], array $options = []) { - $this->notes = []; - // 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. @@ -124,7 +139,9 @@ class Migrator // 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) { + if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoPendingMigrations('up')); + $this->note('<info>Nothing to migrate.</info>'); return; @@ -139,6 +156,8 @@ class Migrator $step = $options['step'] ?? false; + $this->fireMigrationEvent(new MigrationsStarted); + // 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. @@ -149,14 +168,16 @@ class Migrator $batch++; } } + + $this->fireMigrationEvent(new MigrationsEnded); } /** * Run "up" a migration instance. * * @param string $file - * @param int $batch - * @param bool $pretend + * @param int $batch + * @param bool $pretend * @return void */ protected function runUp($file, $batch, $pretend) @@ -174,33 +195,37 @@ class Migrator $this->note("<comment>Migrating:</comment> {$name}"); + $startTime = microtime(true); + $this->runMigration($migration, 'up'); + $runTime = round(microtime(true) - $startTime, 2); + // 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($name, $batch); - $this->note("<info>Migrated:</info> {$name}"); + $this->note("<info>Migrated:</info> {$name} ({$runTime} seconds)"); } /** * Rollback the last migration operation. * - * @param array|string $paths + * @param array|string $paths * @param array $options * @return array */ public function rollback($paths = [], array $options = []) { - $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->getMigrationsForRollback($options); if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoPendingMigrations('down')); + $this->note('<info>Nothing to rollback.</info>'); return []; @@ -219,9 +244,9 @@ class Migrator { if (($steps = $options['step'] ?? 0) > 0) { return $this->repository->getMigrations($steps); - } else { - return $this->repository->getLast(); } + + return $this->repository->getLast(); } /** @@ -238,6 +263,8 @@ class Migrator $this->requireFiles($files = $this->getMigrationFiles($paths)); + $this->fireMigrationEvent(new MigrationsStarted); + // Next we will run through all of the migrations and call the "down" method // which will reverse each migration in order. This getLast method on the // repository already returns these migration's names in reverse order. @@ -258,20 +285,20 @@ class Migrator ); } + $this->fireMigrationEvent(new MigrationsEnded); + return $rolledBack; } /** * Rolls all of the currently applied migrations back. * - * @param array|string $paths + * @param array|string $paths * @param bool $pretend * @return array */ public function reset($paths = [], $pretend = false) { - $this->notes = []; - // Next, we will reverse the migration list so we can run them back in the // correct order for resetting this database. This will allow us to get // the database back into its "empty" state ready for the migrations. @@ -313,7 +340,7 @@ class Migrator * * @param string $file * @param object $migration - * @param bool $pretend + * @param bool $pretend * @return void */ protected function runDown($file, $migration, $pretend) @@ -331,14 +358,18 @@ class Migrator return $this->pretendToRun($instance, 'down'); } + $startTime = microtime(true); + $this->runMigration($instance, 'down'); + $runTime = round(microtime(true) - $startTime, 2); + // 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("<info>Rolled back:</info> {$name}"); + $this->note("<info>Rolled back:</info> {$name} ({$runTime} seconds)"); } /** @@ -356,7 +387,11 @@ class Migrator $callback = function () use ($migration, $method) { if (method_exists($migration, $method)) { + $this->fireMigrationEvent(new MigrationStarted($migration, $method)); + $migration->{$method}(); + + $this->fireMigrationEvent(new MigrationEnded($migration, $method)); } }; @@ -427,18 +462,18 @@ class Migrator public function getMigrationFiles($paths) { return Collection::make($paths)->flatMap(function ($path) { - return $this->files->glob($path.'/*_*.php'); - })->filter()->sortBy(function ($file) { - return $this->getMigrationName($file); - })->values()->keyBy(function ($file) { + return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php'); + })->filter()->values()->keyBy(function ($file) { return $this->getMigrationName($file); + })->sortBy(function ($file, $key) { + return $key; })->all(); } /** * Require in all the migration files in a given path. * - * @param array $files + * @param array $files * @return void */ public function requireFiles(array $files) @@ -480,6 +515,34 @@ class Migrator return $this->paths; } + /** + * Get the default connection name. + * + * @return string + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Execute the given callback using the given connection as the default connection. + * + * @param string $name + * @param callable $callback + * @return mixed + */ + public function usingConnection($name, callable $callback) + { + $previousConnection = $this->resolver->getDefaultConnection(); + + $this->setConnection($name); + + return tap($callback(), function () use ($previousConnection) { + $this->setConnection($previousConnection); + }); + } + /** * Set the default connection name. * @@ -556,23 +619,41 @@ class Migrator } /** - * Raise a note event for the migrator. + * Set the output implementation that should be used by the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return $this + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + + return $this; + } + + /** + * Write a note to the console's output. * * @param string $message * @return void */ protected function note($message) { - $this->notes[] = $message; + if ($this->output) { + $this->output->writeln($message); + } } /** - * Get the notes for the last operation. + * Fire the given event for the migration. * - * @return array + * @param \Illuminate\Contracts\Database\Events\MigrationEvent $event + * @return void */ - public function getNotes() + public function fireMigrationEvent($event) { - return $this->notes; + if ($this->events) { + $this->events->dispatch($event); + } } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/blank.stub b/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/blank.stub deleted file mode 100644 index da4ce827a25a35c6874b0534ae43355f7f336a17..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/blank.stub +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; - -class DummyClass extends Migration -{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - // - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/create.stub b/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/create.stub deleted file mode 100644 index a98c4749cb1fdd41e2981d14d0d48d385e1b2896..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/create.stub +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; - -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::dropIfExists('DummyTable'); - } -} diff --git a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/update.stub b/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/update.stub deleted file mode 100644 index 1fd4f6ec0903130fbbc446d44fecd803a83ef859..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/database/Migrations/stubs/update.stub +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; - -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/Seance5-6/seance/vendor/illuminate/database/MySqlConnection.php b/Seance5-6/seance/vendor/illuminate/database/MySqlConnection.php index 1e7fff2f5313b7380eaf6d9f3aff1439db2062df..94b5b57d87e08dc85ea7716904cd578ac44ff013 100644 --- a/Seance5-6/seance/vendor/illuminate/database/MySqlConnection.php +++ b/Seance5-6/seance/vendor/illuminate/database/MySqlConnection.php @@ -2,12 +2,11 @@ namespace Illuminate\Database; -use PDO; -use Illuminate\Database\Schema\MySqlBuilder; -use Illuminate\Database\Query\Processors\MySqlProcessor; use Doctrine\DBAL\Driver\PDOMySql\Driver as DoctrineDriver; use Illuminate\Database\Query\Grammars\MySqlGrammar as QueryGrammar; +use Illuminate\Database\Query\Processors\MySqlProcessor; use Illuminate\Database\Schema\Grammars\MySqlGrammar as SchemaGrammar; +use Illuminate\Database\Schema\MySqlBuilder; class MySqlConnection extends Connection { @@ -64,21 +63,4 @@ class MySqlConnection extends Connection { return new DoctrineDriver; } - - /** - * Bind values to their parameters in the given statement. - * - * @param \PDOStatement $statement - * @param array $bindings - * @return void - */ - public function bindValues($statement, $bindings) - { - foreach ($bindings as $key => $value) { - $statement->bindValue( - is_string($key) ? $key : $key + 1, $value, - is_int($value) || is_float($value) ? PDO::PARAM_INT : PDO::PARAM_STR - ); - } - } } diff --git a/Seance5-6/seance/vendor/illuminate/database/PostgresConnection.php b/Seance5-6/seance/vendor/illuminate/database/PostgresConnection.php index 01804a7b8ae3a70c2b608f2584b3dad4b3aa368b..5555df1a2e32b30b082769e3436a1459b78d722a 100644 --- a/Seance5-6/seance/vendor/illuminate/database/PostgresConnection.php +++ b/Seance5-6/seance/vendor/illuminate/database/PostgresConnection.php @@ -2,11 +2,11 @@ namespace Illuminate\Database; -use Illuminate\Database\Schema\PostgresBuilder; use Doctrine\DBAL\Driver\PDOPgSql\Driver as DoctrineDriver; -use Illuminate\Database\Query\Processors\PostgresProcessor; use Illuminate\Database\Query\Grammars\PostgresGrammar as QueryGrammar; +use Illuminate\Database\Query\Processors\PostgresProcessor; use Illuminate\Database\Schema\Grammars\PostgresGrammar as SchemaGrammar; +use Illuminate\Database\Schema\PostgresBuilder; class PostgresConnection extends Connection { diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Builder.php b/Seance5-6/seance/vendor/illuminate/database/Query/Builder.php index b0fedf2c1cad051afd8830a746ed4f8519431b99..4df54acdd5784bc98494bd8f2460002acb57fd22 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Builder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Builder.php @@ -3,24 +3,26 @@ namespace Illuminate\Database\Query; use Closure; -use RuntimeException; -use BadMethodCallException; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use InvalidArgumentException; -use Illuminate\Support\Collection; -use Illuminate\Pagination\Paginator; -use Illuminate\Support\Traits\Macroable; +use DateTimeInterface; use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Database\ConnectionInterface; use Illuminate\Database\Concerns\BuildsQueries; +use Illuminate\Database\ConnectionInterface; +use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Query\Grammars\Grammar; use Illuminate\Database\Query\Processors\Processor; -use Illuminate\Database\Eloquent\Builder as EloquentBuilder; +use Illuminate\Pagination\Paginator; +use Illuminate\Support\Arr; +use Illuminate\Support\Collection; +use Illuminate\Support\LazyCollection; +use Illuminate\Support\Str; +use Illuminate\Support\Traits\ForwardsCalls; +use Illuminate\Support\Traits\Macroable; +use InvalidArgumentException; +use RuntimeException; class Builder { - use BuildsQueries, Macroable { + use BuildsQueries, ForwardsCalls, Macroable { __call as macroCall; } @@ -52,11 +54,14 @@ class Builder */ public $bindings = [ 'select' => [], - 'join' => [], - 'where' => [], + 'from' => [], + 'join' => [], + 'where' => [], + 'groupBy' => [], 'having' => [], - 'order' => [], - 'union' => [], + 'order' => [], + 'union' => [], + 'unionOrder' => [], ]; /** @@ -76,7 +81,9 @@ class Builder /** * Indicates if the query returns distinct results. * - * @var bool + * Occasionally contains the columns that should be distinct. + * + * @var bool|array */ public $distinct = false; @@ -180,7 +187,7 @@ class Builder '=', '<', '>', '<=', '>=', '<>', '!=', '<=>', 'like', 'like binary', 'not like', 'ilike', '&', '|', '^', '<<', '>>', - 'rlike', 'regexp', 'not regexp', + 'rlike', 'not rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*', 'similar to', 'not similar to', 'not ilike', '~~*', '!~~*', ]; @@ -196,8 +203,8 @@ class Builder * 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 + * @param \Illuminate\Database\Query\Grammars\Grammar|null $grammar + * @param \Illuminate\Database\Query\Processors\Processor|null $processor * @return void */ public function __construct(ConnectionInterface $connection, @@ -217,17 +224,45 @@ class Builder */ public function select($columns = ['*']) { - $this->columns = is_array($columns) ? $columns : func_get_args(); + $this->columns = []; + + $columns = is_array($columns) ? $columns : func_get_args(); + + foreach ($columns as $as => $column) { + if (is_string($as) && $this->isQueryable($column)) { + $this->selectSub($column, $as); + } else { + $this->columns[] = $column; + } + } return $this; } + /** + * Add a subselect expression to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return $this + * + * @throws \InvalidArgumentException + */ + public function selectSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->selectRaw( + '('.$query.') as '.$this->grammar->wrap($as), $bindings + ); + } + /** * Add a new "raw" select expression to the query. * * @param string $expression - * @param array $bindings - * @return \Illuminate\Database\Query\Builder|static + * @param array $bindings + * @return $this */ public function selectRaw($expression, array $bindings = []) { @@ -241,15 +276,44 @@ class Builder } /** - * Add a subselect expression to the query. + * Makes "from" fetch from a subquery. * - * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param \Closure|\Illuminate\Database\Query\Builder|string $query * @param string $as - * @return \Illuminate\Database\Query\Builder|static + * @return $this * * @throws \InvalidArgumentException */ - public function selectSub($query, $as) + public function fromSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->fromRaw('('.$query.') as '.$this->grammar->wrapTable($as), $bindings); + } + + /** + * Add a raw from clause to the query. + * + * @param string $expression + * @param mixed $bindings + * @return $this + */ + public function fromRaw($expression, $bindings = []) + { + $this->from = new Expression($expression); + + $this->addBinding($bindings, 'from'); + + return $this; + } + + /** + * Creates a subquery and parse it. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return array + */ + protected function createSub($query) { // If the given query is a Closure, we will execute it while passing in a new // query instance to the Closure. This will give the developer a chance to @@ -260,32 +324,27 @@ class Builder $callback($query = $this->forSubQuery()); } - // Here, we will parse this query into an SQL string and an array of bindings - // so we can add it to the query builder using the selectRaw method so the - // query is included in the real SQL generated by this builder instance. - list($query, $bindings) = $this->parseSubSelect($query); - - return $this->selectRaw( - '('.$query.') as '.$this->grammar->wrap($as), $bindings - ); + return $this->parseSub($query); } /** - * Parse the sub-select query into SQL and bindings. + * Parse the subquery into SQL and bindings. * * @param mixed $query * @return array + * + * @throws \InvalidArgumentException */ - protected function parseSubSelect($query) + protected function parseSub($query) { - if ($query instanceof self) { - $query->columns = [$query->columns[0]]; - + if ($query instanceof self || $query instanceof EloquentBuilder) { return [$query->toSql(), $query->getBindings()]; } elseif (is_string($query)) { return [$query, []]; } else { - throw new InvalidArgumentException; + throw new InvalidArgumentException( + 'A subquery must be a query builder instance, a Closure, or a string.' + ); } } @@ -297,9 +356,19 @@ class Builder */ public function addSelect($column) { - $column = is_array($column) ? $column : func_get_args(); + $columns = is_array($column) ? $column : func_get_args(); - $this->columns = array_merge((array) $this->columns, $column); + foreach ($columns as $as => $column) { + if (is_string($as) && $this->isQueryable($column)) { + if (is_null($this->columns)) { + $this->select($this->from.'.*'); + } + + $this->selectSub($column, $as); + } else { + $this->columns[] = $column; + } + } return $this; } @@ -311,7 +380,13 @@ class Builder */ public function distinct() { - $this->distinct = true; + $columns = func_get_args(); + + if (count($columns) > 0) { + $this->distinct = is_array($columns[0]) || is_bool($columns[0]) ? $columns[0] : $columns; + } else { + $this->distinct = true; + } return $this; } @@ -319,12 +394,17 @@ class Builder /** * Set the table which the query is targeting. * - * @param string $table + * @param \Closure|\Illuminate\Database\Query\Builder|string $table + * @param string|null $as * @return $this */ - public function from($table) + public function from($table, $as = null) { - $this->from = $table; + if ($this->isQueryable($table)) { + return $this->fromSub($table, $as); + } + + $this->from = $as ? "{$table} as {$as}" : $table; return $this; } @@ -333,22 +413,22 @@ class Builder * Add a join clause to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string|null $operator * @param string|null $second * @param string $type - * @param bool $where + * @param bool $where * @return $this */ public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) { - $join = new JoinClause($this, $type, $table); + $join = $this->newJoinClause($this, $type, $table); // 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 ($first instanceof Closure) { - call_user_func($first, $join); + $first($join); $this->joins[] = $join; @@ -373,25 +453,50 @@ class Builder * Add a "join where" clause to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string $operator * @param string $second * @param string $type - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function joinWhere($table, $first, $operator, $second, $type = 'inner') { return $this->join($table, $first, $operator, $second, $type, true); } + /** + * Add a subquery join clause to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return $this + * + * @throws \InvalidArgumentException + */ + public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + [$query, $bindings] = $this->createSub($query); + + $expression = '('.$query.') as '.$this->grammar->wrapTable($as); + + $this->addBinding($bindings, 'join'); + + return $this->join(new Expression($expression), $first, $operator, $second, $type, $where); + } + /** * Add a left join to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string|null $operator * @param string|null $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function leftJoin($table, $first, $operator = null, $second = null) { @@ -402,24 +507,39 @@ class Builder * Add a "join where" clause to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string $operator * @param string $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function leftJoinWhere($table, $first, $operator, $second) { return $this->joinWhere($table, $first, $operator, $second, 'left'); } + /** + * Add a subquery left join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return $this + */ + public function leftJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'left'); + } + /** * Add a right join to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string|null $operator * @param string|null $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function rightJoin($table, $first, $operator = null, $second = null) { @@ -430,24 +550,39 @@ class Builder * Add a "right join where" clause to the query. * * @param string $table - * @param string $first + * @param \Closure|string $first * @param string $operator * @param string $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function rightJoinWhere($table, $first, $operator, $second) { return $this->joinWhere($table, $first, $operator, $second, 'right'); } + /** + * Add a subquery right join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return $this + */ + public function rightJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'right'); + } + /** * Add a "cross join" clause to the query. * * @param string $table - * @param string|null $first + * @param \Closure|string|null $first * @param string|null $operator * @param string|null $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function crossJoin($table, $first = null, $operator = null, $second = null) { @@ -455,11 +590,24 @@ class Builder return $this->join($table, $first, $operator, $second, 'cross'); } - $this->joins[] = new JoinClause($this, 'cross', $table); + $this->joins[] = $this->newJoinClause($this, 'cross', $table); return $this; } + /** + * Get a new join clause. + * + * @param \Illuminate\Database\Query\Builder $parentQuery + * @param string $type + * @param string $table + * @return \Illuminate\Database\Query\JoinClause + */ + protected function newJoinClause(self $parentQuery, $type, $table) + { + return new JoinClause($parentQuery, $type, $table); + } + /** * Merge an array of where clauses and bindings. * @@ -479,9 +627,9 @@ class Builder /** * Add a basic where clause to the query. * - * @param string|array|\Closure $column - * @param mixed $operator - * @param mixed $value + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value * @param string $boolean * @return $this */ @@ -497,22 +645,32 @@ class Builder // 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. - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); // 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) { + if ($column instanceof Closure && is_null($operator)) { return $this->whereNested($column, $boolean); } + // If the column is a Closure instance and there is an operator value, we will + // assume the developer wants to run a subquery and then compare the result + // of that subquery with the given value that was provided to the method. + if ($this->isQueryable($column) && ! is_null($operator)) { + [$sub, $bindings] = $this->createSub($column); + + return $this->addBinding($bindings, 'where') + ->where(new Expression('('.$sub.')'), $operator, $value, $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 ($this->invalidOperator($operator)) { - list($value, $operator) = [$operator, '=']; + [$value, $operator] = [$operator, '=']; } // If the value is a Closure, it means the developer is performing an entire @@ -529,18 +687,22 @@ class Builder return $this->whereNull($column, $boolean, $operator !== '='); } + $type = 'Basic'; + // If the column is making a JSON reference we'll check to see if the value // is a boolean. If it is, we'll add the raw boolean string as an actual // value to the query to ensure this is properly handled by the query. if (Str::contains($column, '->') && is_bool($value)) { $value = new Expression($value ? 'true' : 'false'); + + if (is_string($column)) { + $type = 'JsonBoolean'; + } } // 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' ); @@ -624,15 +786,15 @@ class Builder /** * Add an "or where" clause to the query. * - * @param string|array|\Closure $column - * @param string|null $operator - * @param mixed $value - * @return \Illuminate\Database\Query\Builder|static + * @param \Closure|string|array $column + * @param mixed $operator + * @param mixed $value + * @return $this */ public function orWhere($column, $operator = null, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); return $this->where($column, $operator, $value, 'or'); @@ -645,7 +807,7 @@ class Builder * @param string|null $operator * @param string|null $second * @param string|null $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') { @@ -660,7 +822,7 @@ class Builder // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { - list($second, $operator) = [$operator, '=']; + [$second, $operator] = [$operator, '=']; } // Finally, we will add this where clause into this array of clauses that we @@ -681,7 +843,7 @@ class Builder * @param string|array $first * @param string|null $operator * @param string|null $second - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function orWhereColumn($first, $operator = null, $second = null) { @@ -692,7 +854,7 @@ class Builder * Add a raw where clause to the query. * * @param string $sql - * @param mixed $bindings + * @param mixed $bindings * @param string $boolean * @return $this */ @@ -709,8 +871,8 @@ class Builder * Add a raw or where clause to the query. * * @param string $sql - * @param mixed $bindings - * @return \Illuminate\Database\Query\Builder|static + * @param mixed $bindings + * @return $this */ public function orWhereRaw($sql, $bindings = []) { @@ -721,33 +883,24 @@ class Builder * Add a "where in" clause to the query. * * @param string $column - * @param mixed $values + * @param mixed $values * @param string $boolean - * @param bool $not + * @param bool $not * @return $this */ public function whereIn($column, $values, $boolean = 'and', $not = false) { $type = $not ? 'NotIn' : 'In'; - if ($values instanceof EloquentBuilder) { - $values = $values->getQuery(); - } - // If the value is a query builder instance we will assume the developer wants to // look for any values that exists within this given query. So we will add the // query accordingly so that this query is properly executed when it is run. - if ($values instanceof self) { - return $this->whereInExistingQuery( - $column, $values, $boolean, $not - ); - } + if ($this->isQueryable($values)) { + [$query, $bindings] = $this->createSub($values); - // 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); + $values = [new Expression($query)]; + + $this->addBinding($bindings, 'where'); } // Next, if the value is Arrayable we need to cast it to its raw array form so we @@ -762,11 +915,7 @@ class Builder // Finally we'll add a binding for each values unless that value is an expression // in which case we will just skip over it since it will be the query as a raw // string and not as a parameterized place-holder to be replaced by the PDO. - foreach ($values as $value) { - if (! $value instanceof Expression) { - $this->addBinding($value, 'where'); - } - } + $this->addBinding($this->cleanBindings($values), 'where'); return $this; } @@ -775,8 +924,8 @@ class Builder * Add an "or where in" clause to the query. * * @param string $column - * @param mixed $values - * @return \Illuminate\Database\Query\Builder|static + * @param mixed $values + * @return $this */ public function orWhereIn($column, $values) { @@ -787,9 +936,9 @@ class Builder * Add a "where not in" clause to the query. * * @param string $column - * @param mixed $values + * @param mixed $values * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereNotIn($column, $values, $boolean = 'and') { @@ -800,8 +949,8 @@ class Builder * Add an "or where not in" clause to the query. * * @param string $column - * @param mixed $values - * @return \Illuminate\Database\Query\Builder|static + * @param mixed $values + * @return $this */ public function orWhereNotIn($column, $values) { @@ -809,63 +958,59 @@ class Builder } /** - * Add a where in with a sub-select to the query. + * Add a "where in raw" clause for integer values to the query. * - * @param string $column - * @param \Closure $callback - * @param string $boolean - * @param bool $not + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean + * @param bool $not * @return $this */ - protected function whereInSub($column, Closure $callback, $boolean, $not) + public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false) { - $type = $not ? 'NotInSub' : 'InSub'; + $type = $not ? 'NotInRaw' : 'InRaw'; - // 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->forSubQuery()); + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } - $this->wheres[] = compact('type', 'column', 'query', 'boolean'); + foreach ($values as &$value) { + $value = (int) $value; + } - $this->addBinding($query->getBindings(), 'where'); + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); return $this; } /** - * Add an external sub-select to the query. + * Add a "where not in raw" clause for integer values to the query. * - * @param string $column - * @param \Illuminate\Database\Query\Builder|static $query - * @param string $boolean - * @param bool $not + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean * @return $this */ - protected function whereInExistingQuery($column, $query, $boolean, $not) + public function whereIntegerNotInRaw($column, $values, $boolean = 'and') { - $type = $not ? 'NotInSub' : 'InSub'; - - $this->wheres[] = compact('type', 'column', 'query', 'boolean'); - - $this->addBinding($query->getBindings(), 'where'); - - return $this; + return $this->whereIntegerInRaw($column, $values, $boolean, true); } /** * Add a "where null" clause to the query. * - * @param string $column + * @param string|array $columns * @param string $boolean - * @param bool $not + * @param bool $not * @return $this */ - public function whereNull($column, $boolean = 'and', $not = false) + public function whereNull($columns, $boolean = 'and', $not = false) { $type = $not ? 'NotNull' : 'Null'; - $this->wheres[] = compact('type', 'column', 'boolean'); + foreach (Arr::wrap($columns) as $column) { + $this->wheres[] = compact('type', 'column', 'boolean'); + } return $this; } @@ -874,7 +1019,7 @@ class Builder * Add an "or where null" clause to the query. * * @param string $column - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function orWhereNull($column) { @@ -884,20 +1029,20 @@ class Builder /** * Add a "where not null" clause to the query. * - * @param string $column + * @param string|array $columns * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ - public function whereNotNull($column, $boolean = 'and') + public function whereNotNull($columns, $boolean = 'and') { - return $this->whereNull($column, $boolean, true); + return $this->whereNull($columns, $boolean, true); } /** * Add a where between statement to the query. * * @param string $column - * @param array $values + * @param array $values * @param string $boolean * @param bool $not * @return $this @@ -906,9 +1051,9 @@ class Builder { $type = 'between'; - $this->wheres[] = compact('column', 'type', 'boolean', 'not'); + $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); - $this->addBinding($values, 'where'); + $this->addBinding($this->cleanBindings($values), 'where'); return $this; } @@ -917,8 +1062,8 @@ class Builder * Add an or where between statement to the query. * * @param string $column - * @param array $values - * @return \Illuminate\Database\Query\Builder|static + * @param array $values + * @return $this */ public function orWhereBetween($column, array $values) { @@ -929,9 +1074,9 @@ class Builder * Add a where not between statement to the query. * * @param string $column - * @param array $values + * @param array $values * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereNotBetween($column, array $values, $boolean = 'and') { @@ -942,8 +1087,8 @@ class Builder * Add an or where not between statement to the query. * * @param string $column - * @param array $values - * @return \Illuminate\Database\Query\Builder|static + * @param array $values + * @return $this */ public function orWhereNotBetween($column, array $values) { @@ -954,7 +1099,7 @@ class Builder * Add an "or where not null" clause to the query. * * @param string $column - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function orWhereNotNull($column) { @@ -966,16 +1111,20 @@ class Builder * * @param string $column * @param string $operator - * @param mixed $value + * @param \DateTimeInterface|string|null $value * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereDate($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y-m-d'); + } + return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); } @@ -984,13 +1133,13 @@ class Builder * * @param string $column * @param string $operator - * @param string $value - * @return \Illuminate\Database\Query\Builder|static + * @param \DateTimeInterface|string|null $value + * @return $this */ - public function orWhereDate($column, $operator, $value) + public function orWhereDate($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); return $this->whereDate($column, $operator, $value, 'or'); @@ -1000,13 +1149,21 @@ class Builder * Add a "where time" statement to the query. * * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @param string $boolean + * @return $this */ - public function whereTime($column, $operator, $value, $boolean = 'and') + public function whereTime($column, $operator, $value = null, $boolean = 'and') { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('H:i:s'); + } + return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean); } @@ -1014,14 +1171,14 @@ class Builder * Add an "or where time" statement to the query. * * @param string $column - * @param string $operator - * @param int $value - * @return \Illuminate\Database\Query\Builder|static + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return $this */ - public function orWhereTime($column, $operator, $value) + public function orWhereTime($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); return $this->whereTime($column, $operator, $value, 'or'); @@ -1032,62 +1189,133 @@ class Builder * * @param string $column * @param string $operator - * @param mixed $value + * @param \DateTimeInterface|string|null $value * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereDay($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); + if ($value instanceof DateTimeInterface) { + $value = $value->format('d'); + } + + if (! $value instanceof Expression) { + $value = str_pad($value, 2, '0', STR_PAD_LEFT); + } + return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); } + /** + * Add an "or where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return $this + */ + public function orWhereDay($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereDay($column, $operator, $value, 'or'); + } + /** * Add a "where month" statement to the query. * * @param string $column * @param string $operator - * @param mixed $value + * @param \DateTimeInterface|string|null $value * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereMonth($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); + if ($value instanceof DateTimeInterface) { + $value = $value->format('m'); + } + + if (! $value instanceof Expression) { + $value = str_pad($value, 2, '0', STR_PAD_LEFT); + } + return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); } + /** + * Add an "or where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|null $value + * @return $this + */ + public function orWhereMonth($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereMonth($column, $operator, $value, 'or'); + } + /** * Add a "where year" statement to the query. * * @param string $column * @param string $operator - * @param mixed $value + * @param \DateTimeInterface|string|int|null $value * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function whereYear($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y'); + } + return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); } + /** + * Add an "or where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|int|null $value + * @return $this + */ + public function orWhereYear($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereYear($column, $operator, $value, 'or'); + } + /** * Add a date based (year, month, day, time) statement to the query. * * @param string $type * @param string $column * @param string $operator - * @param int $value + * @param mixed $value * @param string $boolean * @return $this */ @@ -1105,9 +1333,9 @@ class Builder /** * Add a nested where statement to the query. * - * @param \Closure $callback - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @param \Closure $callback + * @param string $boolean + * @return $this */ public function whereNested(Closure $callback, $boolean = 'and') { @@ -1129,7 +1357,7 @@ class Builder /** * Add another query builder as a nested where to the query builder. * - * @param \Illuminate\Database\Query\Builder|static $query + * @param $this $query * @param string $boolean * @return $this */ @@ -1140,7 +1368,7 @@ class Builder $this->wheres[] = compact('type', 'query', 'boolean'); - $this->addBinding($query->getBindings(), 'where'); + $this->addBinding($query->getRawBindings()['where'], 'where'); } return $this; @@ -1149,10 +1377,10 @@ class Builder /** * Add a full sub-select to the query. * - * @param string $column - * @param string $operator - * @param \Closure $callback - * @param string $boolean + * @param string $column + * @param string $operator + * @param \Closure $callback + * @param string $boolean * @return $this */ protected function whereSub($column, $operator, Closure $callback, $boolean) @@ -1176,9 +1404,9 @@ class Builder /** * Add an exists clause to the query. * - * @param \Closure $callback - * @param string $boolean - * @param bool $not + * @param \Closure $callback + * @param string $boolean + * @param bool $not * @return $this */ public function whereExists(Closure $callback, $boolean = 'and', $not = false) @@ -1196,9 +1424,9 @@ class Builder /** * Add an or exists clause to the query. * - * @param \Closure $callback - * @param bool $not - * @return \Illuminate\Database\Query\Builder|static + * @param \Closure $callback + * @param bool $not + * @return $this */ public function orWhereExists(Closure $callback, $not = false) { @@ -1208,9 +1436,9 @@ class Builder /** * Add a where not exists clause to the query. * - * @param \Closure $callback - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static + * @param \Closure $callback + * @param string $boolean + * @return $this */ public function whereNotExists(Closure $callback, $boolean = 'and') { @@ -1221,7 +1449,7 @@ class Builder * Add a where not exists clause to the query. * * @param \Closure $callback - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function orWhereNotExists(Closure $callback) { @@ -1231,7 +1459,7 @@ class Builder /** * Add an exists clause to the query. * - * @param \Illuminate\Database\Query\Builder $query + * @param \Illuminate\Database\Query\Builder $query * @param string $boolean * @param bool $not * @return $this @@ -1247,11 +1475,152 @@ class Builder return $this; } + /** + * Adds a where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @param string $boolean + * @return $this + * + * @throws \InvalidArgumentException + */ + public function whereRowValues($columns, $operator, $values, $boolean = 'and') + { + if (count($columns) !== count($values)) { + throw new InvalidArgumentException('The number of columns must match the number of values'); + } + + $type = 'RowValues'; + + $this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean'); + + $this->addBinding($this->cleanBindings($values)); + + return $this; + } + + /** + * Adds a or where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @return $this + */ + public function orWhereRowValues($columns, $operator, $values) + { + return $this->whereRowValues($columns, $operator, $values, 'or'); + } + + /** + * Add a "where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereJsonContains($column, $value, $boolean = 'and', $not = false) + { + $type = 'JsonContains'; + + $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not'); + + if (! $value instanceof Expression) { + $this->addBinding($this->grammar->prepareBindingForJsonContains($value)); + } + + return $this; + } + + /** + * Add a "or where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonContains($column, $value) + { + return $this->whereJsonContains($column, $value, 'or'); + } + + /** + * Add a "where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonDoesntContain($column, $value, $boolean = 'and') + { + return $this->whereJsonContains($column, $value, $boolean, true); + } + + /** + * Add a "or where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonDoesntContain($column, $value) + { + return $this->whereJsonDoesntContain($column, $value, 'or'); + } + + /** + * Add a "where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonLength($column, $operator, $value = null, $boolean = 'and') + { + $type = 'JsonLength'; + + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($value); + } + + return $this; + } + + /** + * Add a "or where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @return $this + */ + public function orWhereJsonLength($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereJsonLength($column, $operator, $value, 'or'); + } + /** * Handles dynamic "where" clauses to the query. * * @param string $method - * @param string $parameters + * @param array $parameters * @return $this */ public function dynamicWhere($method, $parameters) @@ -1295,8 +1664,8 @@ class Builder * * @param string $segment * @param string $connector - * @param array $parameters - * @param int $index + * @param array $parameters + * @param int $index * @return void */ protected function addDynamic($segment, $connector, $parameters, $index) @@ -1310,19 +1679,35 @@ class Builder } /** - * Add a "group by" clause to the query. + * Add a "group by" clause to the query. + * + * @param array|string ...$groups + * @return $this + */ + public function groupBy(...$groups) + { + foreach ($groups as $group) { + $this->groups = array_merge( + (array) $this->groups, + Arr::wrap($group) + ); + } + + return $this; + } + + /** + * Add a raw groupBy clause to the query. * - * @param array ...$groups + * @param string $sql + * @param array $bindings * @return $this */ - public function groupBy(...$groups) + public function groupByRaw($sql, array $bindings = []) { - foreach ($groups as $group) { - $this->groups = array_merge( - (array) $this->groups, - Arr::wrap($group) - ); - } + $this->groups[] = new Expression($sql); + + $this->addBinding($bindings, 'groupBy'); return $this; } @@ -1343,15 +1728,15 @@ class Builder // 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. - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 ); // 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 ($this->invalidOperator($operator)) { - list($value, $operator) = [$operator, '=']; + [$value, $operator] = [$operator, '=']; } $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); @@ -1369,18 +1754,42 @@ class Builder * @param string $column * @param string|null $operator * @param string|null $value - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function orHaving($column, $operator = null, $value = null) { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + return $this->having($column, $operator, $value, 'or'); } + /** + * Add a "having between " clause to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function havingBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not'); + + $this->addBinding($this->cleanBindings($values), 'having'); + + return $this; + } + /** * Add a raw having clause to the query. * * @param string $sql - * @param array $bindings + * @param array $bindings * @param string $boolean * @return $this */ @@ -1399,8 +1808,8 @@ class Builder * Add a raw or having clause to the query. * * @param string $sql - * @param array $bindings - * @return \Illuminate\Database\Query\Builder|static + * @param array $bindings + * @return $this */ public function orHavingRaw($sql, array $bindings = []) { @@ -1410,15 +1819,31 @@ class Builder /** * Add an "order by" clause to the query. * - * @param string $column + * @param \Closure|\Illuminate\Database\Query\Builder|string $column * @param string $direction * @return $this + * + * @throws \InvalidArgumentException */ public function orderBy($column, $direction = 'asc') { + if ($this->isQueryable($column)) { + [$query, $bindings] = $this->createSub($column); + + $column = new Expression('('.$query.')'); + + $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); + } + + $direction = strtolower($direction); + + if (! in_array($direction, ['asc', 'desc'], true)) { + throw new InvalidArgumentException('Order direction must be "asc" or "desc".'); + } + $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ 'column' => $column, - 'direction' => strtolower($direction) == 'asc' ? 'asc' : 'desc', + 'direction' => $direction, ]; return $this; @@ -1439,7 +1864,7 @@ class Builder * Add an "order by" clause for a timestamp to the query. * * @param string $column - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function latest($column = 'created_at') { @@ -1450,7 +1875,7 @@ class Builder * Add an "order by" clause for a timestamp to the query. * * @param string $column - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function oldest($column = 'created_at') { @@ -1481,7 +1906,7 @@ class Builder $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); - $this->addBinding($bindings, 'order'); + $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); return $this; } @@ -1490,7 +1915,7 @@ class Builder * Alias to set the "offset" value of the query. * * @param int $value - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function skip($value) { @@ -1516,7 +1941,7 @@ class Builder * Alias to set the "limit" value of the query. * * @param int $value - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function take($value) { @@ -1545,28 +1970,51 @@ class Builder * * @param int $page * @param int $perPage - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function forPage($page, $perPage = 15) { - return $this->skip(($page - 1) * $perPage)->take($perPage); + return $this->offset(($page - 1) * $perPage)->limit($perPage); + } + + /** + * Constrain the query to the previous "page" of results before a given ID. + * + * @param int $perPage + * @param int|null $lastId + * @param string $column + * @return $this + */ + public function forPageBeforeId($perPage = 15, $lastId = 0, $column = 'id') + { + $this->orders = $this->removeExistingOrdersFor($column); + + if (! is_null($lastId)) { + $this->where($column, '<', $lastId); + } + + return $this->orderBy($column, 'desc') + ->limit($perPage); } /** * Constrain the query to the next "page" of results after a given ID. * * @param int $perPage - * @param int $lastId + * @param int|null $lastId * @param string $column - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') { $this->orders = $this->removeExistingOrdersFor($column); - return $this->where($column, '>', $lastId) - ->orderBy($column, 'asc') - ->take($perPage); + if (! is_null($lastId)) { + $this->where($column, '>', $lastId); + } + + return $this->orderBy($column, 'asc') + ->limit($perPage); } /** @@ -1589,7 +2037,7 @@ class Builder * * @param \Illuminate\Database\Query\Builder|\Closure $query * @param bool $all - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function union($query, $all = false) { @@ -1608,7 +2056,7 @@ class Builder * Add a union all statement to the query. * * @param \Illuminate\Database\Query\Builder|\Closure $query - * @return \Illuminate\Database\Query\Builder|static + * @return $this */ public function unionAll($query) { @@ -1665,7 +2113,7 @@ class Builder /** * Execute a query for a single record by ID. * - * @param int $id + * @param int|string $id * @param array $columns * @return mixed|static */ @@ -1690,22 +2138,14 @@ class Builder /** * Execute the query as a "select" statement. * - * @param array $columns + * @param array|string $columns * @return \Illuminate\Support\Collection */ public function get($columns = ['*']) { - $original = $this->columns; - - if (is_null($original)) { - $this->columns = $columns; - } - - $results = $this->processor->processSelect($this, $this->runSelect()); - - $this->columns = $original; - - return collect($results); + return collect($this->onceWithColumns(Arr::wrap($columns), function () { + return $this->processor->processSelect($this, $this->runSelect()); + })); } /** @@ -1733,7 +2173,7 @@ class Builder { $page = $page ?: Paginator::resolveCurrentPage($pageName); - $total = $this->getCountForPagination($columns); + $total = $this->getCountForPagination(); $results = $total ? $this->forPage($page, $perPage)->get($columns) : collect(); @@ -1758,7 +2198,7 @@ class Builder { $page = $page ?: Paginator::resolveCurrentPage($pageName); - $this->skip(($page - 1) * $perPage)->take($perPage + 1); + $this->offset(($page - 1) * $perPage)->limit($perPage + 1); return $this->simplePaginator($this->get($columns), $perPage, $page, [ 'path' => Paginator::resolveCurrentPath(), @@ -1798,8 +2238,10 @@ class Builder */ protected function runPaginationCountQuery($columns = ['*']) { - return $this->cloneWithout(['columns', 'orders', 'limit', 'offset']) - ->cloneWithoutBindings(['select', 'order']) + $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; + + return $this->cloneWithout($without) + ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) ->setAggregate('count', $this->withoutSelectAliases($columns)) ->get()->all(); } @@ -1813,15 +2255,15 @@ class Builder protected function withoutSelectAliases(array $columns) { return array_map(function ($column) { - return is_string($column) && ($aliasPosition = strpos(strtolower($column), ' as ')) !== false + return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false ? substr($column, 0, $aliasPosition) : $column; }, $columns); } /** - * Get a generator for the given query. + * Get a lazy collection for the given query. * - * @return \Generator + * @return \Illuminate\Support\LazyCollection */ public function cursor() { @@ -1829,53 +2271,11 @@ class Builder $this->columns = ['*']; } - return $this->connection->cursor( - $this->toSql(), $this->getBindings(), ! $this->useWritePdo - ); - } - - /** - * Chunk the results of a query by comparing numeric IDs. - * - * @param int $count - * @param callable $callback - * @param string $column - * @param string $alias - * @return bool - */ - public function chunkById($count, callable $callback, $column = 'id', $alias = null) - { - $alias = $alias ?: $column; - - $lastId = 0; - - do { - $clone = clone $this; - - // We'll execute the query for the given page and get the results. If there are - // no results we can just break and return from here. When there are results - // we will call the callback with the current chunk of these results here. - $results = $clone->forPageAfterId($count, $lastId, $column)->get(); - - $countResults = $results->count(); - - if ($countResults == 0) { - break; - } - - // 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 ($callback($results) === false) { - return false; - } - - $lastId = $results->last()->{$alias}; - - unset($results); - } while ($countResults == $count); - - return true; + return new LazyCollection(function () { + yield from $this->connection->cursor( + $this->toSql(), $this->getBindings(), ! $this->useWritePdo + ); + }); } /** @@ -1901,15 +2301,32 @@ class Builder */ public function pluck($column, $key = null) { - $results = $this->get(is_null($key) ? [$column] : [$column, $key]); + // First, we will need to select the results of the query accounting for the + // given columns / key. Once we have the results, we will be able to take + // the results and get the exact data that was requested for the query. + $queryResult = $this->onceWithColumns( + is_null($key) ? [$column] : [$column, $key], + function () { + return $this->processor->processSelect( + $this, $this->runSelect() + ); + } + ); + + if (empty($queryResult)) { + return collect(); + } // 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 $results->pluck( - $this->stripTableForPluck($column), - $this->stripTableForPluck($key) - ); + $column = $this->stripTableForPluck($column); + + $key = $this->stripTableForPluck($key); + + return is_array($queryResult[0]) + ? $this->pluckFromArrayColumn($queryResult, $column, $key) + : $this->pluckFromObjectColumn($queryResult, $column, $key); } /** @@ -1920,7 +2337,63 @@ class Builder */ protected function stripTableForPluck($column) { - return is_null($column) ? $column : last(preg_split('~\.| ~', $column)); + if (is_null($column)) { + return $column; + } + + $seperator = strpos(strtolower($column), ' as ') !== false ? ' as ' : '\.'; + + return last(preg_split('~'.$seperator.'~i', $column)); + } + + /** + * Retrieve column values from rows represented as objects. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromObjectColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row->$column; + } + } else { + foreach ($queryResult as $row) { + $results[$row->$key] = $row->$column; + } + } + + return collect($results); + } + + /** + * Retrieve column values from rows represented as arrays. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromArrayColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row[$column]; + } + } else { + foreach ($queryResult as $row) { + $results[$row[$key]] = $row[$column]; + } + } + + return collect($results); } /** @@ -1968,6 +2441,28 @@ class Builder return ! $this->exists(); } + /** + * Execute the given callback if no rows exist for the current query. + * + * @param \Closure $callback + * @return mixed + */ + public function existsOr(Closure $callback) + { + return $this->exists() ? true : $callback(); + } + + /** + * Execute the given callback if rows exist for the current query. + * + * @param \Closure $callback + * @return mixed + */ + public function doesntExistOr(Closure $callback) + { + return $this->doesntExist() ? true : $callback(); + } + /** * Retrieve the "count" result of the query. * @@ -2040,13 +2535,13 @@ class Builder * Execute an aggregate function on the database. * * @param string $function - * @param array $columns + * @param array $columns * @return mixed */ public function aggregate($function, $columns = ['*']) { - $results = $this->cloneWithout(['columns']) - ->cloneWithoutBindings(['select']) + $results = $this->cloneWithout($this->unions ? [] : ['columns']) + ->cloneWithoutBindings($this->unions ? [] : ['select']) ->setAggregate($function, $columns) ->get($columns); @@ -2059,7 +2554,7 @@ class Builder * Execute a numeric aggregate function on the database. * * @param string $function - * @param array $columns + * @param array $columns * @return float|int */ public function numericAggregate($function, $columns = ['*']) @@ -2104,6 +2599,30 @@ class Builder return $this; } + /** + * Execute the given callback while selecting the given columns. + * + * After running the callback, the columns are reset to the original value. + * + * @param array $columns + * @param callable $callback + * @return mixed + */ + protected function onceWithColumns($columns, $callback) + { + $original = $this->columns; + + if (is_null($original)) { + $this->columns = $columns; + } + + $result = $callback(); + + $this->columns = $original; + + return $result; + } + /** * Insert a new record into the database. * @@ -2143,10 +2662,37 @@ class Builder ); } + /** + * Insert a new record into the database while ignoring errors. + * + * @param array $values + * @return int + */ + public function insertOrIgnore(array $values) + { + if (empty($values)) { + return 0; + } + + if (! is_array(reset($values))) { + $values = [$values]; + } else { + foreach ($values as $key => $value) { + ksort($value); + $values[$key] = $value; + } + } + + return $this->connection->affectingStatement( + $this->grammar->compileInsertOrIgnore($this, $values), + $this->cleanBindings(Arr::flatten($values, 1)) + ); + } + /** * Insert a new record and get the value of the primary key. * - * @param array $values + * @param array $values * @param string|null $sequence * @return int */ @@ -2159,6 +2705,23 @@ class Builder return $this->processor->processInsertGetId($this, $sql, $values, $sequence); } + /** + * Insert new records into the table using a subquery. + * + * @param array $columns + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return int + */ + public function insertUsing(array $columns, $query) + { + [$sql, $bindings] = $this->createSub($query); + + return $this->connection->affectingStatement( + $this->grammar->compileInsertUsing($this, $columns, $sql), + $this->cleanBindings($bindings) + ); + } + /** * Update a record in the database. * @@ -2187,16 +2750,22 @@ class Builder return $this->insert(array_merge($attributes, $values)); } - return (bool) $this->take(1)->update($values); + if (empty($values)) { + return true; + } + + return (bool) $this->limit(1)->update($values); } /** * Increment a column's value by a given amount. * * @param string $column - * @param int $amount - * @param array $extra + * @param float|int $amount + * @param array $extra * @return int + * + * @throws \InvalidArgumentException */ public function increment($column, $amount = 1, array $extra = []) { @@ -2215,9 +2784,11 @@ class Builder * Decrement a column's value by a given amount. * * @param string $column - * @param int $amount - * @param array $extra + * @param float|int $amount + * @param array $extra * @return int + * + * @throws \InvalidArgumentException */ public function decrement($column, $amount = 1, array $extra = []) { @@ -2320,7 +2891,7 @@ class Builder /** * Set the bindings on the query builder. * - * @param array $bindings + * @param array $bindings * @param string $type * @return $this * @@ -2340,7 +2911,7 @@ class Builder /** * Add a binding to the query. * - * @param mixed $value + * @param mixed $value * @param string $type * @return $this * @@ -2387,6 +2958,16 @@ class Builder })); } + /** + * Get the default key name of the table. + * + * @return string + */ + protected function defaultKeyName() + { + return 'id'; + } + /** * Get the database connection instance. * @@ -2429,6 +3010,19 @@ class Builder return $this; } + /** + * Determine if the value is a query builder instance or a Closure. + * + * @param mixed $value + * @return bool + */ + protected function isQueryable($value) + { + return $value instanceof self || + $value instanceof EloquentBuilder || + $value instanceof Closure; + } + /** * Clone the query without the given properties. * @@ -2459,11 +3053,33 @@ class Builder }); } + /** + * Dump the current SQL and bindings. + * + * @return $this + */ + public function dump() + { + dump($this->toSql(), $this->getBindings()); + + return $this; + } + + /** + * Die and dump the current SQL and bindings. + * + * @return void + */ + public function dd() + { + dd($this->toSql(), $this->getBindings()); + } + /** * Handle dynamic method calls into the method. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed * * @throws \BadMethodCallException @@ -2478,8 +3094,6 @@ class Builder return $this->dynamicWhere($method, $parameters); } - $className = static::class; - - throw new BadMethodCallException("Call to undefined method {$className}::{$method}()"); + static::throwBadMethodCallException($method); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/Grammar.php b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/Grammar.php index 63770ce87c3bdbaf4b5a034467c35c54dabc388e..a661d2103f05c8cb0439d7224e07689b2e5ec676 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/Grammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/Grammar.php @@ -2,10 +2,12 @@ namespace Illuminate\Database\Query\Grammars; -use Illuminate\Support\Arr; +use Illuminate\Database\Grammar as BaseGrammar; use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinClause; -use Illuminate\Database\Grammar as BaseGrammar; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; +use RuntimeException; class Grammar extends BaseGrammar { @@ -32,7 +34,6 @@ class Grammar extends BaseGrammar 'orders', 'limit', 'offset', - 'unions', 'lock', ]; @@ -44,6 +45,10 @@ class Grammar extends BaseGrammar */ public function compileSelect(Builder $query) { + if ($query->unions && $query->aggregate) { + return $this->compileUnionAggregate($query); + } + // If the query does not have any columns set, we'll set the columns to the // * character to just get all of the columns from the database. Then we // can build the query and concatenate all the pieces together as one. @@ -60,6 +65,10 @@ class Grammar extends BaseGrammar $this->compileComponents($query)) ); + if ($query->unions) { + $sql = $this->wrapUnion($sql).' '.$this->compileUnions($query); + } + $query->columns = $original; return $sql; @@ -79,7 +88,7 @@ class Grammar extends BaseGrammar // 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)) { + if (isset($query->$component) && ! is_null($query->$component)) { $method = 'compile'.ucfirst($component); $sql[$component] = $this->$method($query, $query->$component); @@ -103,7 +112,9 @@ class Grammar extends BaseGrammar // 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 !== '*') { + if (is_array($query->distinct)) { + $column = 'distinct '.$this->columnize($query->distinct); + } elseif ($query->distinct && $column !== '*') { $column = 'distinct '.$column; } @@ -126,7 +137,11 @@ class Grammar extends BaseGrammar return; } - $select = $query->distinct ? 'select distinct ' : 'select '; + if ($query->distinct) { + $select = 'select distinct '; + } else { + $select = 'select '; + } return $select.$this->columnize($columns); } @@ -152,10 +167,14 @@ class Grammar extends BaseGrammar */ protected function compileJoins(Builder $query, $joins) { - return collect($joins)->map(function ($join) { + return collect($joins)->map(function ($join) use ($query) { $table = $this->wrapTable($join->table); - return trim("{$join->type} join {$table} {$this->compileWheres($join)}"); + $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); + + $tableAndNestedJoins = is_null($join->joins) ? $table : '('.$table.$nestedJoins.')'; + + return trim("{$join->type} join {$tableAndNestedJoins} {$this->compileWheres($join)}"); })->implode(' '); } @@ -270,27 +289,39 @@ class Grammar extends BaseGrammar } /** - * Compile a where in sub-select clause. + * Compile a "where not in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. * * @param \Illuminate\Database\Query\Builder $query * @param array $where * @return string */ - protected function whereInSub(Builder $query, $where) + protected function whereNotInRaw(Builder $query, $where) { - return $this->wrap($where['column']).' in ('.$this->compileSelect($where['query']).')'; + if (! empty($where['values'])) { + return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')'; + } + + return '1 = 1'; } /** - * Compile a where not in sub-select clause. + * Compile a "where in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. * * @param \Illuminate\Database\Query\Builder $query * @param array $where * @return string */ - protected function whereNotInSub(Builder $query, $where) + protected function whereInRaw(Builder $query, $where) { - return $this->wrap($where['column']).' not in ('.$this->compileSelect($where['query']).')'; + if (! empty($where['values'])) { + return $this->wrap($where['column']).' in ('.implode(', ', $where['values']).')'; + } + + return '0 = 1'; } /** @@ -328,7 +359,11 @@ class Grammar extends BaseGrammar { $between = $where['not'] ? 'not between' : 'between'; - return $this->wrap($where['column']).' '.$between.' ? and ?'; + $min = $this->parameter(reset($where['values'])); + + $max = $this->parameter(end($where['values'])); + + return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max; } /** @@ -438,8 +473,8 @@ class Grammar extends BaseGrammar /** * Compile a where condition with a sub-select. * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where + * @param \Illuminate\Database\Query\Builder $query + * @param array $where * @return string */ protected function whereSub(Builder $query, $where) @@ -473,6 +508,110 @@ class Grammar extends BaseGrammar return 'not exists ('.$this->compileSelect($where['query']).')'; } + /** + * Compile a where row values condition. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRowValues(Builder $query, $where) + { + $columns = $this->columnize($where['columns']); + + $values = $this->parameterize($where['values']); + + return '('.$columns.') '.$where['operator'].' ('.$values.')'; + } + + /** + * Compile a "where JSON boolean" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonBoolean(Builder $query, $where) + { + $column = $this->wrapJsonBooleanSelector($where['column']); + + $value = $this->wrapJsonBooleanValue( + $this->parameter($where['value']) + ); + + return $column.' '.$where['operator'].' '.$value; + } + + /** + * Compile a "where JSON contains" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonContains(Builder $query, $where) + { + $not = $where['not'] ? 'not ' : ''; + + return $not.$this->compileJsonContains( + $where['column'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonContains($column, $value) + { + throw new RuntimeException('This database engine does not support JSON contains operations.'); + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return json_encode($binding); + } + + /** + * Compile a "where JSON length" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonLength(Builder $query, $where) + { + return $this->compileJsonLength( + $where['column'], $where['operator'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonLength($column, $operator, $value) + { + throw new RuntimeException('This database engine does not support JSON length operations.'); + } + /** * Compile the "group by" portions of the query. * @@ -502,7 +641,7 @@ class Grammar extends BaseGrammar /** * Compile a single having clause. * - * @param array $having + * @param array $having * @return string */ protected function compileHaving(array $having) @@ -512,6 +651,8 @@ class Grammar extends BaseGrammar // clause into SQL based on the components that make it up from builder. if ($having['type'] === 'Raw') { return $having['boolean'].' '.$having['sql']; + } elseif ($having['type'] === 'between') { + return $this->compileHavingBetween($having); } return $this->compileBasicHaving($having); @@ -520,7 +661,7 @@ class Grammar extends BaseGrammar /** * Compile a basic having clause. * - * @param array $having + * @param array $having * @return string */ protected function compileBasicHaving($having) @@ -532,6 +673,25 @@ class Grammar extends BaseGrammar return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter; } + /** + * Compile a "between" having clause. + * + * @param array $having + * @return string + */ + protected function compileHavingBetween($having) + { + $between = $having['not'] ? 'not between' : 'between'; + + $column = $this->wrap($having['column']); + + $min = $this->parameter(head($having['values'])); + + $max = $this->parameter(last($having['values'])); + + return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; + } + /** * Compile the "order by" portions of the query. * @@ -558,9 +718,7 @@ class Grammar extends BaseGrammar protected function compileOrdersToArray(Builder $query, $orders) { return array_map(function ($order) { - return ! isset($order['sql']) - ? $this->wrap($order['column']).' '.$order['direction'] - : $order['sql']; + return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction']; }, $orders); } @@ -636,9 +794,35 @@ class Grammar extends BaseGrammar */ protected function compileUnion(array $union) { - $conjuction = $union['all'] ? ' union all ' : ' union '; + $conjunction = $union['all'] ? ' union all ' : ' union '; - return $conjuction.$union['query']->toSql(); + return $conjunction.$this->wrapUnion($union['query']->toSql()); + } + + /** + * Wrap a union subquery in parentheses. + * + * @param string $sql + * @return string + */ + protected function wrapUnion($sql) + { + return '('.$sql.')'; + } + + /** + * Compile a union aggregate query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnionAggregate(Builder $query) + { + $sql = $this->compileAggregate($query, $query->aggregate); + + $query->aggregate = null; + + return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); } /** @@ -668,6 +852,10 @@ class Grammar extends BaseGrammar // basic routine regardless of an amount of records given to us to insert. $table = $this->wrapTable($query->from); + if (empty($values)) { + return "insert into {$table} default values"; + } + if (! is_array(reset($values))) { $values = [$values]; } @@ -684,11 +872,25 @@ class Grammar extends BaseGrammar return "insert into $table ($columns) values $parameters"; } + /** + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + * + * @throws \RuntimeException + */ + public function compileInsertOrIgnore(Builder $query, array $values) + { + throw new RuntimeException('This database engine does not support inserting while ignoring errors.'); + } + /** * Compile an insert and get ID statement into SQL. * * @param \Illuminate\Database\Query\Builder $query - * @param array $values + * @param array $values * @param string $sequence * @return string */ @@ -697,6 +899,19 @@ class Grammar extends BaseGrammar return $this->compileInsert($query, $values); } + /** + * Compile an insert statement using a subquery into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @param string $sql + * @return string + */ + public function compileInsertUsing(Builder $query, array $columns, string $sql) + { + return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) $sql"; + } + /** * Compile an update statement into SQL. * @@ -704,32 +919,63 @@ class Grammar extends BaseGrammar * @param array $values * @return string */ - public function compileUpdate(Builder $query, $values) + public function compileUpdate(Builder $query, array $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 = collect($values)->map(function ($value, $key) { + $columns = $this->compileUpdateColumns($query, $values); + + $where = $this->compileWheres($query); + + return trim( + isset($query->joins) + ? $this->compileUpdateWithJoins($query, $table, $columns, $where) + : $this->compileUpdateWithoutJoins($query, $table, $columns, $where) + ); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + return collect($values)->map(function ($value, $key) { return $this->wrap($key).' = '.$this->parameter($value); })->implode(', '); + } - // 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. - $joins = ''; - - if (isset($query->joins)) { - $joins = ' '.$this->compileJoins($query, $query->joins); - } + /** + * Compile an update statement without joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) + { + return "update {$table} set {$columns} {$where}"; + } - // 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. - $wheres = $this->compileWheres($query); + /** + * Compile an update statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where + * @return string + */ + protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) + { + $joins = $this->compileJoins($query, $query->joins); - return trim("update {$table}{$joins} set $columns $wheres"); + return "update {$table} {$joins} set {$columns} {$where}"; } /** @@ -741,7 +987,7 @@ class Grammar extends BaseGrammar */ public function prepareBindingsForUpdate(array $bindings, array $values) { - $cleanBindings = Arr::except($bindings, ['join', 'select']); + $cleanBindings = Arr::except($bindings, ['select', 'join']); return array_values( array_merge($bindings['join'], $values, Arr::flatten($cleanBindings)) @@ -756,9 +1002,45 @@ class Grammar extends BaseGrammar */ public function compileDelete(Builder $query) { - $wheres = is_array($query->wheres) ? $this->compileWheres($query) : ''; + $table = $this->wrapTable($query->from); + + $where = $this->compileWheres($query); + + return trim( + isset($query->joins) + ? $this->compileDeleteWithJoins($query, $table, $where) + : $this->compileDeleteWithoutJoins($query, $table, $where) + ); + } + + /** + * Compile a delete statement without joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithoutJoins(Builder $query, $table, $where) + { + return "delete from {$table} {$where}"; + } + + /** + * Compile a delete statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithJoins(Builder $query, $table, $where) + { + $alias = last(explode(' as ', $table)); + + $joins = $this->compileJoins($query, $query->joins); - return trim("delete from {$this->wrapTable($query->from)} $wheres"); + return "delete {$alias} from {$table} {$joins} {$where}"; } /** @@ -769,7 +1051,9 @@ class Grammar extends BaseGrammar */ public function prepareBindingsForDelete(array $bindings) { - return Arr::flatten($bindings); + return Arr::flatten( + Arr::except($bindings, 'select') + ); } /** @@ -780,7 +1064,7 @@ class Grammar extends BaseGrammar */ public function compileTruncate(Builder $query) { - return ['truncate '.$this->wrapTable($query->from) => []]; + return ['truncate table '.$this->wrapTable($query->from) => []]; } /** @@ -827,10 +1111,117 @@ class Grammar extends BaseGrammar return 'ROLLBACK TO SAVEPOINT '.$name; } + /** + * 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 its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { + return $this->wrapAliasedValue($value, $prefixAlias); + } + + // If the given value is a JSON selector we will wrap it differently than a + // traditional value. We will need to split this path and wrap each part + // wrapped, etc. Otherwise, we will simply wrap the value as a string. + if ($this->isJsonSelector($value)) { + return $this->wrapJsonSelector($value); + } + + return $this->wrapSegments(explode('.', $value)); + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function wrapJsonSelector($value) + { + throw new RuntimeException('This database engine does not support JSON operations.'); + } + + /** + * Wrap the given JSON selector for boolean values. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanSelector($value) + { + return $this->wrapJsonSelector($value); + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return $value; + } + + /** + * Split the given JSON selector into the field and the optional path and wrap them separately. + * + * @param string $column + * @return array + */ + protected function wrapJsonFieldAndPath($column) + { + $parts = explode('->', $column, 2); + + $field = $this->wrap($parts[0]); + + $path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1], '->') : ''; + + return [$field, $path]; + } + + /** + * Wrap the given JSON path. + * + * @param string $value + * @param string $delimiter + * @return string + */ + protected function wrapJsonPath($value, $delimiter = '->') + { + $value = preg_replace("/([\\\\]+)?\\'/", "\\'", $value); + + return '\'$."'.str_replace($delimiter, '"."', $value).'"\''; + } + + /** + * Determine if the given string is a JSON selector. + * + * @param string $value + * @return bool + */ + protected function isJsonSelector($value) + { + return Str::contains($value, '->'); + } + /** * Concatenate an array of segments, removing empties. * - * @param array $segments + * @param array $segments * @return string */ protected function concatenate($segments) diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/MySqlGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/MySqlGrammar.php index 8dff604ae6c335c8d7b28ea441afaa9ecd36d327..c26ad195b5ace1bd47283488d8e475728c65e696 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/MySqlGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/MySqlGrammar.php @@ -2,60 +2,57 @@ namespace Illuminate\Database\Query\Grammars; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; use Illuminate\Database\Query\Builder; -use Illuminate\Database\Query\JsonExpression; +use Illuminate\Support\Str; class MySqlGrammar extends Grammar { /** - * The components that make up a select clause. + * The grammar specific operators. * * @var array */ - protected $selectComponents = [ - 'aggregate', - 'columns', - 'from', - 'joins', - 'wheres', - 'groups', - 'havings', - 'orders', - 'limit', - 'offset', - 'lock', - ]; + protected $operators = ['sounds like']; /** - * Compile a select query into SQL. + * Compile an insert ignore statement into SQL. * * @param \Illuminate\Database\Query\Builder $query + * @param array $values * @return string */ - public function compileSelect(Builder $query) + public function compileInsertOrIgnore(Builder $query, array $values) { - $sql = parent::compileSelect($query); + return Str::replaceFirst('insert', 'insert ignore', $this->compileInsert($query, $values)); + } - if ($query->unions) { - $sql = '('.$sql.') '.$this->compileUnions($query); - } + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); - return $sql; + return 'json_contains('.$field.', '.$value.$path.')'; } /** - * Compile a single union statement. + * Compile a "JSON length" statement into SQL. * - * @param array $union + * @param string $column + * @param string $operator + * @param string $value * @return string */ - protected function compileUnion(array $union) + protected function compileJsonLength($column, $operator, $value) { - $conjuction = $union['all'] ? ' union all ' : ' union '; + [$field, $path] = $this->wrapJsonFieldAndPath($column); - return $conjuction.'('.$union['query']->toSql().')'; + return 'json_length('.$field.$path.') '.$operator.' '.$value; } /** @@ -86,65 +83,33 @@ class MySqlGrammar extends Grammar } /** - * Compile an update statement into SQL. + * Compile an insert statement into SQL. * * @param \Illuminate\Database\Query\Builder $query * @param array $values * @return string */ - public function compileUpdate(Builder $query, $values) + public function compileInsert(Builder $query, array $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); - - // 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. - $joins = ''; - - if (isset($query->joins)) { - $joins = ' '.$this->compileJoins($query, $query->joins); + if (empty($values)) { + $values = [[]]; } - // 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); - - $sql = rtrim("update {$table}{$joins} set $columns $where"); - - // If the query has an order by clause we will compile it since MySQL supports - // order bys on update statements. We'll compile them using the typical way - // of compiling order bys. Then they will be appended to the SQL queries. - if (! empty($query->orders)) { - $sql .= ' '.$this->compileOrders($query, $query->orders); - } - - // Updates on MySQL also supports "limits", which allow you to easily update a - // single record very easily. This is not supported by all database engines - // so we have customized this update compiler here in order to add it in. - if (isset($query->limit)) { - $sql .= ' '.$this->compileLimit($query, $query->limit); - } - - return rtrim($sql); + return parent::compileInsert($query, $values); } /** - * Compile all of the columns for an update statement. + * Compile the columns for an update statement. * + * @param \Illuminate\Database\Query\Builder $query * @param array $values * @return string */ - protected function compileUpdateColumns($values) + protected function compileUpdateColumns(Builder $query, array $values) { return collect($values)->map(function ($value, $key) { if ($this->isJsonSelector($key)) { - return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); + return $this->compileJsonUpdateColumn($key, $value); } return $this->wrap($key).' = '.$this->parameter($value); @@ -152,72 +117,69 @@ class MySqlGrammar extends Grammar } /** - * Prepares a JSON column being updated using the JSON_SET function. + * Prepare a JSON column being updated using the JSON_SET function. * * @param string $key - * @param \Illuminate\Database\Query\JsonExpression $value + * @param mixed $value * @return string */ - protected function compileJsonUpdateColumn($key, JsonExpression $value) + protected function compileJsonUpdateColumn($key, $value) { - $path = explode('->', $key); - - $field = $this->wrapValue(array_shift($path)); + if (is_bool($value)) { + $value = $value ? 'true' : 'false'; + } elseif (is_array($value)) { + $value = 'cast(? as json)'; + } else { + $value = $this->parameter($value); + } - $accessor = "'$.\"".implode('"."', $path)."\"'"; + [$field, $path] = $this->wrapJsonFieldAndPath($key); - return "{$field} = json_set({$field}, {$accessor}, {$value->getValue()})"; + return "{$field} = json_set({$field}{$path}, {$value})"; } /** - * Prepare the bindings for an update statement. - * - * Booleans, integers, and doubles are inserted into JSON updates as raw values. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $values = collect($values)->reject(function ($value, $column) { - return $this->isJsonSelector($column) && - in_array(gettype($value), ['boolean', 'integer', 'double']); - })->all(); - - return parent::prepareBindingsForUpdate($bindings, $values); - } - - /** - * Compile a delete statement into SQL. + * Compile an update statement without joins into SQL. * * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $columns + * @param string $where * @return string */ - public function compileDelete(Builder $query) + protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) { - $table = $this->wrapTable($query->from); + $sql = parent::compileUpdateWithoutJoins($query, $table, $columns, $where); + + if (! empty($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } - $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } - return isset($query->joins) - ? $this->compileDeleteWithJoins($query, $table, $where) - : $this->compileDeleteWithoutJoins($query, $table, $where); + return $sql; } /** - * Prepare the bindings for a delete statement. + * Prepare the bindings for an update statement. + * + * Booleans, integers, and doubles are inserted into JSON updates as raw values. * * @param array $bindings + * @param array $values * @return array */ - public function prepareBindingsForDelete(array $bindings) + public function prepareBindingsForUpdate(array $bindings, array $values) { - $cleanBindings = Arr::except($bindings, ['join', 'select']); + $values = collect($values)->reject(function ($value, $column) { + return $this->isJsonSelector($column) && is_bool($value); + })->map(function ($value) { + return is_array($value) ? json_encode($value) : $value; + })->all(); - return array_values( - array_merge($bindings['join'], Arr::flatten($cleanBindings)) - ); + return parent::prepareBindingsForUpdate($bindings, $values); } /** @@ -225,12 +187,12 @@ class MySqlGrammar extends Grammar * * @param \Illuminate\Database\Query\Builder $query * @param string $table - * @param array $where + * @param string $where * @return string */ - protected function compileDeleteWithoutJoins($query, $table, $where) + protected function compileDeleteWithoutJoins(Builder $query, $table, $where) { - $sql = trim("delete from {$table} {$where}"); + $sql = parent::compileDeleteWithoutJoins($query, $table, $where); // When using MySQL, delete statements may contain order by statements and limits // so we will compile both of those here. Once we have finished compiling this @@ -246,24 +208,6 @@ class MySqlGrammar extends Grammar return $sql; } - /** - * Compile a delete query that uses joins. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param array $where - * @return string - */ - protected function compileDeleteWithJoins($query, $table, $where) - { - $joins = ' '.$this->compileJoins($query, $query->joins); - - $alias = strpos(strtolower($table), ' as ') !== false - ? explode(' as ', $table)[1] : $table; - - return trim("delete {$alias} from {$table}{$joins} {$where}"); - } - /** * Wrap a single string in keyword identifiers. * @@ -272,18 +216,7 @@ class MySqlGrammar extends Grammar */ protected function wrapValue($value) { - if ($value === '*') { - return $value; - } - - // If the given value is a JSON selector we will wrap it differently than a - // traditional value. We will need to split this path and wrap each part - // wrapped, etc. Otherwise, we will simply wrap the value as a string. - if ($this->isJsonSelector($value)) { - return $this->wrapJsonSelector($value); - } - - return '`'.str_replace('`', '``', $value).'`'; + return $value === '*' ? $value : '`'.str_replace('`', '``', $value).'`'; } /** @@ -294,23 +227,21 @@ class MySqlGrammar extends Grammar */ protected function wrapJsonSelector($value) { - $path = explode('->', $value); - - $field = $this->wrapValue(array_shift($path)); + [$field, $path] = $this->wrapJsonFieldAndPath($value); - return sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { - return '"'.$part.'"'; - })->implode('.')); + return 'json_unquote(json_extract('.$field.$path.'))'; } /** - * Determine if the given string is a JSON selector. + * Wrap the given JSON selector for boolean values. * * @param string $value - * @return bool + * @return string */ - protected function isJsonSelector($value) + protected function wrapJsonBooleanSelector($value) { - return Str::contains($value, '->'); + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_extract('.$field.$path.')'; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/PostgresGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/PostgresGrammar.php index 564bbfb923e856cd95d3ec6e76133a47556d20b8..46420bb6a596b1580d74ed0673f8d93a56fd2b6a 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/PostgresGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/PostgresGrammar.php @@ -2,9 +2,9 @@ namespace Illuminate\Database\Query\Grammars; +use Illuminate\Database\Query\Builder; use Illuminate\Support\Arr; use Illuminate\Support\Str; -use Illuminate\Database\Query\Builder; class PostgresGrammar extends Grammar { @@ -15,11 +15,33 @@ class PostgresGrammar extends Grammar */ protected $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', + 'like', 'not like', 'between', 'ilike', 'not ilike', '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', - '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '+', '#-', + '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '-', '#-', + 'is distinct from', 'is not distinct from', ]; + /** + * {@inheritdoc} + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + if (Str::contains(strtolower($where['operator']), 'like')) { + return sprintf( + '%s::text %s %s', + $this->wrap($where['column']), + $where['operator'], + $this->parameter($where['value']) + ); + } + + return parent::whereBasic($query, $where); + } + /** * Compile a "where date" clause. * @@ -63,6 +85,62 @@ class PostgresGrammar extends Grammar return 'extract('.$type.' from '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; } + /** + * 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; + } + + if (is_array($query->distinct)) { + $select = 'select distinct on ('.$this->columnize($query->distinct).') '; + } elseif ($query->distinct) { + $select = 'select distinct '; + } else { + $select = 'select '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return '('.$column.')::jsonb @> '.$value; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return 'json_array_length(('.$column.')::json) '.$operator.' '.$value; + } + /** * Compile the lock into SQL. * @@ -80,32 +158,28 @@ class PostgresGrammar extends Grammar } /** - * {@inheritdoc} + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string */ - public function compileInsert(Builder $query, array $values) + public function compileInsertOrIgnore(Builder $query, array $values) { - $table = $this->wrapTable($query->from); - - return empty($values) - ? "insert into {$table} DEFAULT VALUES" - : parent::compileInsert($query, $values); + return $this->compileInsert($query, $values).' on conflict do nothing'; } /** * Compile an insert and get ID statement into SQL. * * @param \Illuminate\Database\Query\Builder $query - * @param array $values + * @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); + return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence ?: 'id'); } /** @@ -115,110 +189,71 @@ class PostgresGrammar extends Grammar * @param array $values * @return string */ - public function compileUpdate(Builder $query, $values) + public function compileUpdate(Builder $query, array $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); + if (isset($query->joins) || isset($query->limit)) { + return $this->compileUpdateWithJoinsOrLimit($query, $values); + } - return trim("update {$table} set {$columns}{$from} {$where}"); + return parent::compileUpdate($query, $values); } /** - * Compile the columns for the update statement. + * Compile the columns for an update statement. * - * @param array $values + * @param \Illuminate\Database\Query\Builder $query + * @param array $values * @return string */ - protected function compileUpdateColumns($values) + protected function compileUpdateColumns(Builder $query, array $values) { - // 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. return collect($values)->map(function ($value, $key) { - return $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - } - - /** - * 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 ''; - } + $column = last(explode('.', $key)); - // 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. - $froms = collect($query->joins)->map(function ($join) { - return $this->wrapTable($join->table); - })->all(); + if ($this->isJsonSelector($key)) { + return $this->compileJsonUpdateColumn($column, $value); + } - if (count($froms) > 0) { - return ' from '.implode(', ', $froms); - } + return $this->wrap($column).' = '.$this->parameter($value); + })->implode(', '); } /** - * Compile the additional where clauses for updates with joins. + * Prepares a JSON column being updated using the JSONB_SET function. * - * @param \Illuminate\Database\Query\Builder $query + * @param string $key + * @param mixed $value * @return string */ - protected function compileUpdateWheres(Builder $query) + protected function compileJsonUpdateColumn($key, $value) { - $baseWheres = $this->compileWheres($query); + $segments = explode('->', $key); - if (! isset($query->joins)) { - return $baseWheres; - } + $field = $this->wrap(array_shift($segments)); - // 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. - $joinWheres = $this->compileUpdateJoinWheres($query); + $path = '\'{"'.implode('","', $segments).'"}\''; - if (trim($baseWheres) == '') { - return 'where '.$this->removeLeadingBoolean($joinWheres); - } - - return $baseWheres.' '.$joinWheres; + return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; } /** - * Compile the "join" clause where clauses for an update. + * Compile an update statement with joins or limit into SQL. * * @param \Illuminate\Database\Query\Builder $query + * @param array $values * @return string */ - protected function compileUpdateJoinWheres(Builder $query) + protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) { - $joinWheres = []; + $table = $this->wrapTable($query->from); - // 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->wheres as $where) { - $method = "where{$where['type']}"; + $columns = $this->compileUpdateColumns($query, $values); - $joinWheres[] = $where['boolean'].' '.$this->$method($query, $where); - } - } + $alias = last(preg_split('/\s+as\s+/i', $query->from)); - return implode(' ', $joinWheres); + $selectSql = $this->compileSelect($query->select($alias.'.ctid')); + + return "update {$table} set {$columns} where {$this->wrap('ctid')} in ({$selectSql})"; } /** @@ -230,13 +265,16 @@ class PostgresGrammar extends Grammar */ public function prepareBindingsForUpdate(array $bindings, array $values) { - // Update statements with "joins" in Postgres use an interesting syntax. We need to - // take all of the bindings and put them on the end of this array since they are - // added to the end of the "where" clause statements as typical where clauses. - $bindingsWithoutJoin = Arr::except($bindings, 'join'); + $values = collect($values)->map(function ($value, $column) { + return is_array($value) || ($this->isJsonSelector($column) && ! $this->isExpression($value)) + ? json_encode($value) + : $value; + })->all(); + + $cleanBindings = Arr::except($bindings, 'select'); return array_values( - array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin)) + array_merge($values, Arr::flatten($cleanBindings)) ); } @@ -248,30 +286,28 @@ class PostgresGrammar extends Grammar */ public function compileDelete(Builder $query) { - $table = $this->wrapTable($query->from); + if (isset($query->joins) || isset($query->limit)) { + return $this->compileDeleteWithJoinsOrLimit($query); + } - return isset($query->joins) - ? $this->compileDeleteWithJoins($query, $table) - : parent::compileDelete($query); + return parent::compileDelete($query); } /** - * Compile a delete query that uses joins. + * Compile a delete statement with joins or limit into SQL. * * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param array $where * @return string */ - protected function compileDeleteWithJoins($query, $table) + protected function compileDeleteWithJoinsOrLimit(Builder $query) { - $using = ' USING '.collect($query->joins)->map(function ($join) { - return $this->wrapTable($join->table); - })->implode(', '); + $table = $this->wrapTable($query->from); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); - $where = count($query->wheres) > 0 ? ' '.$this->compileUpdateWheres($query) : ''; + $selectSql = $this->compileSelect($query->select($alias.'.ctid')); - return trim("delete from {$table}{$using}{$where}"); + return "delete from {$table} where {$this->wrap('ctid')} in ({$selectSql})"; } /** @@ -282,29 +318,7 @@ class PostgresGrammar extends Grammar */ public function compileTruncate(Builder $query) { - return ['truncate '.$this->wrapTable($query->from).' restart identity' => []]; - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value === '*') { - return $value; - } - - // If the given value is a JSON selector we will wrap it differently than a - // traditional value. We will need to split this path and wrap each part - // wrapped, etc. Otherwise, we will simply wrap the value as a string. - if (Str::contains($value, '->')) { - return $this->wrapJsonSelector($value); - } - - return '"'.str_replace('"', '""', $value).'"'; + return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; } /** @@ -317,7 +331,7 @@ class PostgresGrammar extends Grammar { $path = explode('->', $value); - $field = $this->wrapValue(array_shift($path)); + $field = $this->wrapSegments(explode('.', array_shift($path))); $wrappedPath = $this->wrapJsonPathAttributes($path); @@ -330,6 +344,33 @@ class PostgresGrammar extends Grammar return $field.'->>'.$attribute; } + /** + *Wrap the given JSON selector for boolean values. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanSelector($value) + { + $selector = str_replace( + '->>', '->', + $this->wrapJsonSelector($value) + ); + + return '('.$selector.')::jsonb'; + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return "'".$value."'::jsonb"; + } + /** * Wrap the attributes of the give JSON path. * @@ -339,7 +380,9 @@ class PostgresGrammar extends Grammar protected function wrapJsonPathAttributes($path) { return array_map(function ($attribute) { - return "'$attribute'"; + return filter_var($attribute, FILTER_VALIDATE_INT) !== false + ? $attribute + : "'$attribute'"; }, $path); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SQLiteGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SQLiteGrammar.php index cd57081d02c8f3793f264fd6cb2c5b6bd93febfe..2c27ddf3c0e6980c44062c3f347b8681d6a983ba 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SQLiteGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SQLiteGrammar.php @@ -3,28 +3,11 @@ namespace Illuminate\Database\Query\Grammars; use Illuminate\Database\Query\Builder; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; class SQLiteGrammar 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', - ]; - /** * All of the available clause operators. * @@ -37,33 +20,26 @@ class SQLiteGrammar extends Grammar ]; /** - * Compile a select query into SQL. + * Compile the lock into SQL. * * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value * @return string */ - public function compileSelect(Builder $query) + protected function compileLock(Builder $query, $value) { - $sql = parent::compileSelect($query); - - if ($query->unions) { - $sql = 'select * from ('.$sql.') '.$this->compileUnions($query); - } - - return $sql; + return ''; } /** - * Compile a single union statement. + * Wrap a union subquery in parentheses. * - * @param array $union + * @param string $sql * @return string */ - protected function compileUnion(array $union) + protected function wrapUnion($sql) { - $conjuction = $union['all'] ? ' union all ' : ' union '; - - return $conjuction.'select * from ('.$union['query']->toSql().')'; + return 'select * from ('.$sql.')'; } /** @@ -136,54 +112,181 @@ class SQLiteGrammar extends Grammar */ protected function dateBasedWhere($type, Builder $query, $where) { - $value = str_pad($where['value'], 2, '0', STR_PAD_LEFT); + $value = $this->parameter($where['value']); - $value = $this->parameter($value); + return "strftime('{$type}', {$this->wrap($where['column'])}) {$where['operator']} cast({$value} as text)"; + } - return "strftime('{$type}', {$this->wrap($where['column'])}) {$where['operator']} {$value}"; + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_array_length('.$field.$path.') '.$operator.' '.$value; } /** - * Compile an insert statement into SQL. + * Compile an update statement into SQL. * * @param \Illuminate\Database\Query\Builder $query * @param array $values * @return string */ - public function compileInsert(Builder $query, array $values) + public function compileUpdate(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 (isset($query->joins) || isset($query->limit)) { + return $this->compileUpdateWithJoinsOrLimit($query, $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 empty(reset($values)) - ? "insert into $table default values" - : parent::compileInsert($query, reset($values)); + return parent::compileUpdate($query, $values); + } + + /** + * Compile an insert ignore statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsertOrIgnore(Builder $query, array $values) + { + return Str::replaceFirst('insert', 'insert or ignore', $this->compileInsert($query, $values)); + } + + /** + * Compile the columns for an update statement. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateColumns(Builder $query, array $values) + { + $jsonGroups = $this->groupJsonColumnsForUpdate($values); + + return collect($values)->reject(function ($value, $key) { + return $this->isJsonSelector($key); + })->merge($jsonGroups)->map(function ($value, $key) use ($jsonGroups) { + $column = last(explode('.', $key)); + + $value = isset($jsonGroups[$key]) ? $this->compileJsonPatch($column, $value) : $this->parameter($value); + + return $this->wrap($column).' = '.$value; + })->implode(', '); + } + + /** + * Group the nested JSON columns. + * + * @param array $values + * @return array + */ + protected function groupJsonColumnsForUpdate(array $values) + { + $groups = []; + + foreach ($values as $key => $value) { + if ($this->isJsonSelector($key)) { + Arr::set($groups, str_replace('->', '.', Str::after($key, '.')), $value); + } } - $names = $this->columnize(array_keys(reset($values))); + return $groups; + } + + /** + * Compile a "JSON" patch statement into SQL. + * + * @param string $column + * @param mixed $value + * @return string + */ + protected function compileJsonPatch($column, $value) + { + return "json_patch(ifnull({$this->wrap($column)}, json('{}')), json({$this->parameter($value)}))"; + } + + /** + * Compile an update statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) + { + $table = $this->wrapTable($query->from); + + $columns = $this->compileUpdateColumns($query, $values); - $columns = []; + $alias = last(preg_split('/\s+as\s+/i', $query->from)); - // 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); + $selectSql = $this->compileSelect($query->select($alias.'.rowid')); + + return "update {$table} set {$columns} where {$this->wrap('rowid')} in ({$selectSql})"; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $groups = $this->groupJsonColumnsForUpdate($values); + + $values = collect($values)->reject(function ($value, $key) { + return $this->isJsonSelector($key); + })->merge($groups)->map(function ($value) { + return is_array($value) ? json_encode($value) : $value; + })->all(); + + $cleanBindings = Arr::except($bindings, 'select'); + + return array_values( + array_merge($values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + if (isset($query->joins) || isset($query->limit)) { + return $this->compileDeleteWithJoinsOrLimit($query); } - $columns = array_fill(0, count($values), implode(', ', $columns)); + return parent::compileDelete($query); + } + + /** + * Compile a delete statement with joins or limit into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileDeleteWithJoinsOrLimit(Builder $query) + { + $table = $this->wrapTable($query->from); + + $alias = last(preg_split('/\s+as\s+/i', $query->from)); - return "insert into $table ($names) select ".implode(' union all select ', $columns); + $selectSql = $this->compileSelect($query->select($alias.'.rowid')); + + return "delete from {$table} where {$this->wrap('rowid')} in ({$selectSql})"; } /** @@ -199,4 +302,17 @@ class SQLiteGrammar extends Grammar 'delete from '.$this->wrapTable($query->from) => [], ]; } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_extract('.$field.$path.')'; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SqlServerGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SqlServerGrammar.php index dfefda3a22a36f96bb08b41417429166f5e6a258..f0a0bfc5190bf6d2b05c78b9164c401968cff6e7 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SqlServerGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Grammars/SqlServerGrammar.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Query\Grammars; -use Illuminate\Support\Arr; use Illuminate\Database\Query\Builder; +use Illuminate\Support\Arr; class SqlServerGrammar extends Grammar { @@ -103,6 +103,60 @@ class SqlServerGrammar extends Grammar return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value; } + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value; + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return $value.' in (select [value] from openjson('.$field.$path.'))'; + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return is_bool($binding) ? json_encode($binding) : $binding; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return '(select count(*) from openjson('.$field.$path.')) '.$operator.' '.$value; + } + /** * Create a full ANSI offset clause for the query. * @@ -156,7 +210,7 @@ class SqlServerGrammar extends Grammar { $constraint = $this->compileRowConstraint($query); - return "select * from ({$sql}) as temp_table where row_num {$constraint}"; + return "select * from ({$sql}) as temp_table where row_num {$constraint} order by row_num"; } /** @@ -226,120 +280,47 @@ class SqlServerGrammar extends Grammar } /** - * Compile an exists statement into SQL. + * Wrap a union subquery in parentheses. * - * @param \Illuminate\Database\Query\Builder $query + * @param string $sql * @return string */ - public function compileExists(Builder $query) + protected function wrapUnion($sql) { - $existsQuery = clone $query; - - $existsQuery->columns = []; - - return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); + return 'select * from ('.$sql.') as '.$this->wrapTable('temp_table'); } /** - * Compile a delete statement into SQL. + * Compile an exists statement into SQL. * * @param \Illuminate\Database\Query\Builder $query * @return string */ - public function compileDelete(Builder $query) + public function compileExists(Builder $query) { - $table = $this->wrapTable($query->from); + $existsQuery = clone $query; - $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + $existsQuery->columns = []; - return isset($query->joins) - ? $this->compileDeleteWithJoins($query, $table, $where) - : trim("delete from {$table} {$where}"); + return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); } /** - * Compile a delete statement with joins into SQL. + * Compile an update statement with joins into SQL. * * @param \Illuminate\Database\Query\Builder $query * @param string $table + * @param string $columns * @param string $where * @return string */ - protected function compileDeleteWithJoins(Builder $query, $table, $where) - { - $joins = ' '.$this->compileJoins($query, $query->joins); - - $alias = strpos(strtolower($table), ' as ') !== false - ? explode(' as ', $table)[1] : $table; - - return trim("delete {$alias} from {$table}{$joins} {$where}"); - } - - /** - * 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 update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, $values) + protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) { - list($table, $alias) = $this->parseUpdateTable($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 = collect($values)->map(function ($value, $key) { - return $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - - // 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. - $joins = ''; - - if (isset($query->joins)) { - $joins = ' '.$this->compileJoins($query, $query->joins); - } + $alias = last(explode(' as ', $table)); - // 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); + $joins = $this->compileJoins($query, $query->joins); - if (! empty($joins)) { - return trim("update {$alias} set {$columns} from {$table}{$joins} {$where}"); - } - - return trim("update {$table}{$joins} set $columns $where"); - } - - /** - * Get the table and alias for the given table. - * - * @param string $table - * @return array - */ - protected function parseUpdateTable($table) - { - $table = $alias = $this->wrapTable($table); - - if (strpos(strtolower($table), '] as [') !== false) { - $alias = '['.explode('] as [', $table)[1]; - } - - return [$table, $alias]; + return "update {$alias} set {$columns} from {$table} {$joins} {$where}"; } /** @@ -351,26 +332,13 @@ class SqlServerGrammar extends Grammar */ public function prepareBindingsForUpdate(array $bindings, array $values) { - // Update statements with joins in SQL Servers utilize an unique syntax. We need to - // take all of the bindings and put them on the end of this array since they are - // added to the end of the "where" clause statements as typical where clauses. - $bindingsWithoutJoin = Arr::except($bindings, 'join'); + $cleanBindings = Arr::except($bindings, 'select'); return array_values( - array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin)) + array_merge($values, Arr::flatten($cleanBindings)) ); } - /** - * Determine if the grammar supports savepoints. - * - * @return bool - */ - public function supportsSavepoints() - { - return true; - } - /** * Compile the SQL statement to define a savepoint. * @@ -414,6 +382,30 @@ class SqlServerGrammar extends Grammar return $value === '*' ? $value : '['.str_replace(']', ']]', $value).']'; } + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($value); + + return 'json_value('.$field.$path.')'; + } + + /** + * Wrap the given JSON boolean value. + * + * @param string $value + * @return string + */ + protected function wrapJsonBooleanValue($value) + { + return "'".$value."'"; + } + /** * Wrap a table in keyword identifiers. * @@ -422,7 +414,11 @@ class SqlServerGrammar extends Grammar */ public function wrapTable($table) { - return $this->wrapTableValuedFunction(parent::wrapTable($table)); + if (! $this->isExpression($table)) { + return $this->wrapTableValuedFunction(parent::wrapTable($table)); + } + + return $this->getValue($table); } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/JoinClause.php b/Seance5-6/seance/vendor/illuminate/database/Query/JoinClause.php index 4b32df29e99a53f28cd54443f6e1b9b696ec3b1e..4d84e59de58fcca0f785016bbc23b6fc9ec34001 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/JoinClause.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/JoinClause.php @@ -21,16 +21,37 @@ class JoinClause extends Builder public $table; /** - * The parent query builder instance. + * The connection of the parent query builder. * - * @var \Illuminate\Database\Query\Builder + * @var \Illuminate\Database\ConnectionInterface */ - private $parentQuery; + protected $parentConnection; + + /** + * The grammar of the parent query builder. + * + * @var \Illuminate\Database\Query\Grammars\Grammar + */ + protected $parentGrammar; + + /** + * The processor of the parent query builder. + * + * @var \Illuminate\Database\Query\Processors\Processor + */ + protected $parentProcessor; + + /** + * The class name of the parent query builder. + * + * @var string + */ + protected $parentClass; /** * Create a new join clause instance. * - * @param \Illuminate\Database\Query\Builder $parentQuery + * @param \Illuminate\Database\Query\Builder $parentQuery * @param string $type * @param string $table * @return void @@ -39,10 +60,13 @@ class JoinClause extends Builder { $this->type = $type; $this->table = $table; - $this->parentQuery = $parentQuery; + $this->parentClass = get_class($parentQuery); + $this->parentGrammar = $parentQuery->getGrammar(); + $this->parentProcessor = $parentQuery->getProcessor(); + $this->parentConnection = $parentQuery->getConnection(); parent::__construct( - $parentQuery->getConnection(), $parentQuery->getGrammar(), $parentQuery->getProcessor() + $this->parentConnection, $this->parentGrammar, $this->parentProcessor ); } @@ -56,7 +80,7 @@ class JoinClause extends Builder * * will produce the following SQL: * - * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` + * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` * * @param \Closure|string $first * @param string|null $operator @@ -95,7 +119,7 @@ class JoinClause extends Builder */ public function newQuery() { - return new static($this->parentQuery, $this->type, $this->table); + return new static($this->newParentQuery(), $this->type, $this->table); } /** @@ -105,6 +129,18 @@ class JoinClause extends Builder */ protected function forSubQuery() { - return $this->parentQuery->newQuery(); + return $this->newParentQuery()->newQuery(); + } + + /** + * Create a new parent query instance. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newParentQuery() + { + $class = $this->parentClass; + + return new $class($this->parentConnection, $this->parentGrammar, $this->parentProcessor); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/JsonExpression.php b/Seance5-6/seance/vendor/illuminate/database/Query/JsonExpression.php deleted file mode 100644 index 12635ffcafe4556f262010b9506977c00f33afcd..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/database/Query/JsonExpression.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Illuminate\Database\Query; - -use InvalidArgumentException; - -class JsonExpression extends Expression -{ - /** - * Create a new raw query expression. - * - * @param mixed $value - * @return void - */ - public function __construct($value) - { - parent::__construct( - $this->getJsonBindingParameter($value) - ); - } - - /** - * Translate the given value into the appropriate JSON binding parameter. - * - * @param mixed $value - * @return string - */ - protected function getJsonBindingParameter($value) - { - switch ($type = gettype($value)) { - case 'boolean': - return $value ? 'true' : 'false'; - case 'integer': - case 'double': - return $value; - case 'string': - return '?'; - case 'object': - case 'array': - return '?'; - } - - throw new InvalidArgumentException('JSON value is of illegal type: '.$type); - } -} diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/PostgresProcessor.php b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/PostgresProcessor.php index 90abf24682ed86e1f077ed17c80c86fe84c970a1..8fa6b350fa6cc3b9903a4712ecf870e3a77ad628 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/PostgresProcessor.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/PostgresProcessor.php @@ -11,8 +11,8 @@ class PostgresProcessor extends Processor * * @param \Illuminate\Database\Query\Builder $query * @param string $sql - * @param array $values - * @param string $sequence + * @param array $values + * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/Processor.php b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/Processor.php index f78429fbafe3900ebaa33a86bcbcb8f795f43faa..0069b436d55322cc1f675c1936d838732fe64968 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/Processor.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/Processor.php @@ -23,8 +23,8 @@ class Processor * * @param \Illuminate\Database\Query\Builder $query * @param string $sql - * @param array $values - * @param string $sequence + * @param array $values + * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) diff --git a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/SqlServerProcessor.php b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/SqlServerProcessor.php index 65140c49b2af2b5e114d981b3de9e8893e0fb2e9..49476f095594bb065b86fd0e7cc98d0eff6592ce 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Query/Processors/SqlServerProcessor.php +++ b/Seance5-6/seance/vendor/illuminate/database/Query/Processors/SqlServerProcessor.php @@ -13,8 +13,8 @@ class SqlServerProcessor extends Processor * * @param \Illuminate\Database\Query\Builder $query * @param string $sql - * @param array $values - * @param string $sequence + * @param array $values + * @param string|null $sequence * @return int */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) @@ -37,6 +37,7 @@ class SqlServerProcessor extends Processor * * @param \Illuminate\Database\Connection $connection * @return int + * * @throws \Exception */ protected function processInsertGetIdForOdbc(Connection $connection) diff --git a/Seance5-6/seance/vendor/illuminate/database/QueryException.php b/Seance5-6/seance/vendor/illuminate/database/QueryException.php index 9a3687d65be64f0271b27979ad5f0c123104a740..74e5a31aaacaaf77b54fff1b1f908f48294c14a0 100644 --- a/Seance5-6/seance/vendor/illuminate/database/QueryException.php +++ b/Seance5-6/seance/vendor/illuminate/database/QueryException.php @@ -2,8 +2,9 @@ namespace Illuminate\Database; -use PDOException; use Illuminate\Support\Str; +use PDOException; +use Throwable; class QueryException extends PDOException { @@ -26,10 +27,10 @@ class QueryException extends PDOException * * @param string $sql * @param array $bindings - * @param \Exception $previous + * @param \Throwable $previous * @return void */ - public function __construct($sql, array $bindings, $previous) + public function __construct($sql, array $bindings, Throwable $previous) { parent::__construct('', 0, $previous); @@ -48,10 +49,10 @@ class QueryException extends PDOException * * @param string $sql * @param array $bindings - * @param \Exception $previous + * @param \Throwable $previous * @return string */ - protected function formatMessage($sql, $bindings, $previous) + protected function formatMessage($sql, $bindings, Throwable $previous) { return $previous->getMessage().' (SQL: '.Str::replaceArray('?', $bindings, $sql).')'; } diff --git a/Seance5-6/seance/vendor/illuminate/database/README.md b/Seance5-6/seance/vendor/illuminate/database/README.md index b3014b082e829d7eb65073ce9378e18f6a98f716..7d59ab7d8c6615a23c3690fddba43e2858b1bbde 100644 --- a/Seance5-6/seance/vendor/illuminate/database/README.md +++ b/Seance5-6/seance/vendor/illuminate/database/README.md @@ -45,7 +45,7 @@ $users = Capsule::table('users')->where('votes', '>', 100)->get(); ``` Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade: ```PHP -$results = Capsule::select('select * from users where id = ?', array(1)); +$results = Capsule::select('select * from users where id = ?', [1]); ``` **Using The Schema Builder** diff --git a/Seance5-6/seance/vendor/illuminate/database/SQLiteConnection.php b/Seance5-6/seance/vendor/illuminate/database/SQLiteConnection.php index a5ec3218b8f1627888ded4b3b513d811a879b401..4990fdd299a1d893fb08f9951d7a0b7cc79553ee 100644 --- a/Seance5-6/seance/vendor/illuminate/database/SQLiteConnection.php +++ b/Seance5-6/seance/vendor/illuminate/database/SQLiteConnection.php @@ -2,14 +2,38 @@ namespace Illuminate\Database; -use Illuminate\Database\Schema\SQLiteBuilder; -use Illuminate\Database\Query\Processors\SQLiteProcessor; use Doctrine\DBAL\Driver\PDOSqlite\Driver as DoctrineDriver; use Illuminate\Database\Query\Grammars\SQLiteGrammar as QueryGrammar; +use Illuminate\Database\Query\Processors\SQLiteProcessor; use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar; +use Illuminate\Database\Schema\SQLiteBuilder; class SQLiteConnection extends Connection { + /** + * Create a new database connection instance. + * + * @param \PDO|\Closure $pdo + * @param string $database + * @param string $tablePrefix + * @param array $config + * @return void + */ + public function __construct($pdo, $database = '', $tablePrefix = '', array $config = []) + { + parent::__construct($pdo, $database, $tablePrefix, $config); + + $enableForeignKeyConstraints = $this->getForeignKeyConstraintsConfigurationValue(); + + if ($enableForeignKeyConstraints === null) { + return; + } + + $enableForeignKeyConstraints + ? $this->getSchemaBuilder()->enableForeignKeyConstraints() + : $this->getSchemaBuilder()->disableForeignKeyConstraints(); + } + /** * Get the default query grammar instance. * @@ -63,4 +87,14 @@ class SQLiteConnection extends Connection { return new DoctrineDriver; } + + /** + * Get the database connection foreign key constraints configuration option. + * + * @return bool|null + */ + protected function getForeignKeyConstraintsConfigurationValue() + { + return $this->getConfig('foreign_key_constraints'); + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Blueprint.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Blueprint.php index 2342cec2abc60164a5299c6dd09990f4309f53c1..24be84cf2b0ffcc9e8dff742843f000fc093cdd9 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Blueprint.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Blueprint.php @@ -2,11 +2,13 @@ namespace Illuminate\Database\Schema; +use BadMethodCallException; use Closure; -use Illuminate\Support\Fluent; use Illuminate\Database\Connection; -use Illuminate\Support\Traits\Macroable; use Illuminate\Database\Schema\Grammars\Grammar; +use Illuminate\Database\SQLiteConnection; +use Illuminate\Support\Fluent; +use Illuminate\Support\Traits\Macroable; class Blueprint { @@ -19,10 +21,17 @@ class Blueprint */ protected $table; + /** + * The prefix of the table. + * + * @var string + */ + protected $prefix; + /** * The columns that should be added to the table. * - * @var \Illuminate\Support\Fluent[] + * @var \Illuminate\Database\Schema\ColumnDefinition[] */ protected $columns = []; @@ -62,11 +71,13 @@ class Blueprint * * @param string $table * @param \Closure|null $callback + * @param string $prefix * @return void */ - public function __construct($table, Closure $callback = null) + public function __construct($table, Closure $callback = null, $prefix = '') { $this->table = $table; + $this->prefix = $prefix; if (! is_null($callback)) { $callback($this); @@ -96,17 +107,19 @@ class Blueprint */ public function toSql(Connection $connection, Grammar $grammar) { - $this->addImpliedCommands(); + $this->addImpliedCommands($grammar); $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. + $this->ensureCommandsAreValid($connection); + foreach ($this->commands as $command) { $method = 'compile'.ucfirst($command->name); - if (method_exists($grammar, $method)) { + if (method_exists($grammar, $method) || $grammar::hasMacro($method)) { if (! is_null($sql = $grammar->$method($this, $command, $connection))) { $statements = array_merge($statements, (array) $sql); } @@ -116,12 +129,51 @@ class Blueprint return $statements; } + /** + * Ensure the commands on the blueprint are valid for the connection type. + * + * @param \Illuminate\Database\Connection $connection + * @return void + * + * @throws \BadMethodCallException + */ + protected function ensureCommandsAreValid(Connection $connection) + { + if ($connection instanceof SQLiteConnection) { + if ($this->commandsNamed(['dropColumn', 'renameColumn'])->count() > 1) { + throw new BadMethodCallException( + "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." + ); + } + + if ($this->commandsNamed(['dropForeign'])->count() > 0) { + throw new BadMethodCallException( + "SQLite doesn't support dropping foreign keys (you would need to re-create the table)." + ); + } + } + } + + /** + * Get all of the commands matching the given names. + * + * @param array $names + * @return \Illuminate\Support\Collection + */ + protected function commandsNamed(array $names) + { + return collect($this->commands)->filter(function ($command) use ($names) { + return in_array($command->name, $names); + }); + } + /** * Add the commands that are implied by the blueprint's state. * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar * @return void */ - protected function addImpliedCommands() + protected function addImpliedCommands(Grammar $grammar) { if (count($this->getAddedColumns()) > 0 && ! $this->creating()) { array_unshift($this->commands, $this->createCommand('add')); @@ -132,6 +184,8 @@ class Blueprint } $this->addFluentIndexes(); + + $this->addFluentCommands($grammar); } /** @@ -148,6 +202,7 @@ class Blueprint // index method can be called without a name and it will generate one. if ($column->{$index} === true) { $this->{$index}($column->name); + $column->{$index} = false; continue 2; } @@ -157,6 +212,7 @@ class Blueprint // the index since the developer specified the explicit name for this. elseif (isset($column->{$index})) { $this->{$index}($column->name, $column->{$index}); + $column->{$index} = false; continue 2; } @@ -164,6 +220,31 @@ class Blueprint } } + /** + * Add the fluent commands specified on any columns. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function addFluentCommands(Grammar $grammar) + { + foreach ($this->columns as $column) { + foreach ($grammar->getFluentCommands() as $commandName) { + $attributeName = lcfirst($commandName); + + if (! isset($column->{$attributeName})) { + continue; + } + + $value = $column->{$attributeName}; + + $this->addCommand( + $commandName, compact('value', 'column') + ); + } + } + } + /** * Determine if the blueprint has a create command. * @@ -172,7 +253,7 @@ class Blueprint protected function creating() { return collect($this->commands)->contains(function ($command) { - return $command->name == 'create'; + return $command->name === 'create'; }); } @@ -244,7 +325,7 @@ class Blueprint /** * Indicate that the given primary key should be dropped. * - * @param string|array $index + * @param string|array|null $index * @return \Illuminate\Support\Fluent */ public function dropPrimary($index = null) @@ -296,6 +377,18 @@ class Blueprint return $this->dropIndexCommand('dropForeign', 'foreign', $index); } + /** + * Indicate that the given indexes should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameIndex($from, $to) + { + return $this->addCommand('renameIndex', compact('from', 'to')); + } + /** * Indicate that the timestamp columns should be dropped. * @@ -319,21 +412,23 @@ class Blueprint /** * Indicate that the soft delete column should be dropped. * + * @param string $column * @return void */ - public function dropSoftDeletes() + public function dropSoftDeletes($column = 'deleted_at') { - $this->dropColumn('deleted_at'); + $this->dropColumn($column); } /** * Indicate that the soft delete column should be dropped. * + * @param string $column * @return void */ - public function dropSoftDeletesTz() + public function dropSoftDeletesTz($column = 'deleted_at') { - $this->dropSoftDeletes(); + $this->dropSoftDeletes($column); } /** @@ -346,6 +441,20 @@ class Blueprint $this->dropColumn('remember_token'); } + /** + * Indicate that the polymorphic columns should be dropped. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function dropMorphs($name, $indexName = null) + { + $this->dropIndex($indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"])); + + $this->dropColumn("{$name}_type", "{$name}_id"); + } + /** * Rename the table to a given name. * @@ -361,7 +470,7 @@ class Blueprint * Specify the primary key(s) for the table. * * @param string|array $columns - * @param string $name + * @param string|null $name * @param string|null $algorithm * @return \Illuminate\Support\Fluent */ @@ -374,7 +483,7 @@ class Blueprint * Specify a unique index for the table. * * @param string|array $columns - * @param string $name + * @param string|null $name * @param string|null $algorithm * @return \Illuminate\Support\Fluent */ @@ -387,7 +496,7 @@ class Blueprint * Specify an index for the table. * * @param string|array $columns - * @param string $name + * @param string|null $name * @param string|null $algorithm * @return \Illuminate\Support\Fluent */ @@ -400,7 +509,7 @@ class Blueprint * Specify a spatial index for the table. * * @param string|array $columns - * @param string $name + * @param string|null $name * @return \Illuminate\Support\Fluent */ public function spatialIndex($columns, $name = null) @@ -412,30 +521,58 @@ class Blueprint * Specify a foreign key for the table. * * @param string|array $columns - * @param string $name - * @return \Illuminate\Support\Fluent + * @param string|null $name + * @return \Illuminate\Database\Schema\ForeignKeyDefinition */ public function foreign($columns, $name = null) { - return $this->indexCommand('foreign', $columns, $name); + $command = new ForeignKeyDefinition( + $this->indexCommand('foreign', $columns, $name)->getAttributes() + ); + + $this->commands[count($this->commands) - 1] = $command; + + return $command; + } + + /** + * Create a new auto-incrementing big integer (8-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function id($column = 'id') + { + return $this->bigIncrements($column); } /** * Create a new auto-incrementing integer (4-byte) column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function increments($column) { return $this->unsignedInteger($column, true); } + /** + * Create a new auto-incrementing integer (4-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function integerIncrements($column) + { + return $this->unsignedInteger($column, true); + } + /** * Create a new auto-incrementing tiny integer (1-byte) column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function tinyIncrements($column) { @@ -446,7 +583,7 @@ class Blueprint * Create a new auto-incrementing small integer (2-byte) column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function smallIncrements($column) { @@ -457,7 +594,7 @@ class Blueprint * Create a new auto-incrementing medium integer (3-byte) column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function mediumIncrements($column) { @@ -468,7 +605,7 @@ class Blueprint * Create a new auto-incrementing big integer (8-byte) column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function bigIncrements($column) { @@ -479,8 +616,8 @@ class Blueprint * Create a new char column on the table. * * @param string $column - * @param int $length - * @return \Illuminate\Support\Fluent + * @param int|null $length + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function char($column, $length = null) { @@ -493,8 +630,8 @@ class Blueprint * Create a new string column on the table. * * @param string $column - * @param int $length - * @return \Illuminate\Support\Fluent + * @param int|null $length + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function string($column, $length = null) { @@ -507,7 +644,7 @@ class Blueprint * Create a new text column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function text($column) { @@ -518,7 +655,7 @@ class Blueprint * Create a new medium text column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function mediumText($column) { @@ -529,7 +666,7 @@ class Blueprint * Create a new long text column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function longText($column) { @@ -542,7 +679,7 @@ class Blueprint * @param string $column * @param bool $autoIncrement * @param bool $unsigned - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function integer($column, $autoIncrement = false, $unsigned = false) { @@ -555,7 +692,7 @@ class Blueprint * @param string $column * @param bool $autoIncrement * @param bool $unsigned - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function tinyInteger($column, $autoIncrement = false, $unsigned = false) { @@ -568,7 +705,7 @@ class Blueprint * @param string $column * @param bool $autoIncrement * @param bool $unsigned - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function smallInteger($column, $autoIncrement = false, $unsigned = false) { @@ -581,7 +718,7 @@ class Blueprint * @param string $column * @param bool $autoIncrement * @param bool $unsigned - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function mediumInteger($column, $autoIncrement = false, $unsigned = false) { @@ -594,7 +731,7 @@ class Blueprint * @param string $column * @param bool $autoIncrement * @param bool $unsigned - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function bigInteger($column, $autoIncrement = false, $unsigned = false) { @@ -606,7 +743,7 @@ class Blueprint * * @param string $column * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedInteger($column, $autoIncrement = false) { @@ -618,7 +755,7 @@ class Blueprint * * @param string $column * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedTinyInteger($column, $autoIncrement = false) { @@ -630,7 +767,7 @@ class Blueprint * * @param string $column * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedSmallInteger($column, $autoIncrement = false) { @@ -642,7 +779,7 @@ class Blueprint * * @param string $column * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedMediumInteger($column, $autoIncrement = false) { @@ -654,24 +791,43 @@ class Blueprint * * @param string $column * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedBigInteger($column, $autoIncrement = false) { return $this->bigInteger($column, $autoIncrement, true); } + /** + * Create a new unsigned big integer (8-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ForeignIdColumnDefinition + */ + public function foreignId($column) + { + $this->columns[] = $column = new ForeignIdColumnDefinition($this, [ + 'type' => 'bigInteger', + 'name' => $column, + 'autoIncrement' => false, + 'unsigned' => true, + ]); + + return $column; + } + /** * Create a new float column on the table. * * @param string $column * @param int $total * @param int $places - * @return \Illuminate\Support\Fluent + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition */ - public function float($column, $total = 8, $places = 2) + public function float($column, $total = 8, $places = 2, $unsigned = false) { - return $this->addColumn('float', $column, compact('total', 'places')); + return $this->addColumn('float', $column, compact('total', 'places', 'unsigned')); } /** @@ -680,11 +836,12 @@ class Blueprint * @param string $column * @param int|null $total * @param int|null $places - * @return \Illuminate\Support\Fluent + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition */ - public function double($column, $total = null, $places = null) + public function double($column, $total = null, $places = null, $unsigned = false) { - return $this->addColumn('double', $column, compact('total', 'places')); + return $this->addColumn('double', $column, compact('total', 'places', 'unsigned')); } /** @@ -693,11 +850,38 @@ class Blueprint * @param string $column * @param int $total * @param int $places - * @return \Illuminate\Support\Fluent + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition */ - public function decimal($column, $total = 8, $places = 2) + public function decimal($column, $total = 8, $places = 2, $unsigned = false) { - return $this->addColumn('decimal', $column, compact('total', 'places')); + return $this->addColumn('decimal', $column, compact('total', 'places', 'unsigned')); + } + + /** + * Create a new unsigned float column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedFloat($column, $total = 8, $places = 2) + { + return $this->float($column, $total, $places, true); + } + + /** + * Create a new unsigned double column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedDouble($column, $total = null, $places = null) + { + return $this->double($column, $total, $places, true); } /** @@ -706,20 +890,18 @@ class Blueprint * @param string $column * @param int $total * @param int $places - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function unsignedDecimal($column, $total = 8, $places = 2) { - return $this->addColumn('decimal', $column, [ - 'total' => $total, 'places' => $places, 'unsigned' => true, - ]); + return $this->decimal($column, $total, $places, true); } /** * Create a new boolean column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function boolean($column) { @@ -731,18 +913,30 @@ class Blueprint * * @param string $column * @param array $allowed - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function enum($column, array $allowed) { return $this->addColumn('enum', $column, compact('allowed')); } + /** + * Create a new set column on the table. + * + * @param string $column + * @param array $allowed + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function set($column, array $allowed) + { + return $this->addColumn('set', $column, compact('allowed')); + } + /** * Create a new json column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function json($column) { @@ -753,7 +947,7 @@ class Blueprint * Create a new jsonb column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function jsonb($column) { @@ -764,7 +958,7 @@ class Blueprint * Create a new date column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function date($column) { @@ -776,7 +970,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function dateTime($column, $precision = 0) { @@ -788,7 +982,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function dateTimeTz($column, $precision = 0) { @@ -800,7 +994,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function time($column, $precision = 0) { @@ -812,7 +1006,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function timeTz($column, $precision = 0) { @@ -824,7 +1018,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function timestamp($column, $precision = 0) { @@ -836,7 +1030,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function timestampTz($column, $precision = 0) { @@ -887,7 +1081,7 @@ class Blueprint * * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function softDeletes($column = 'deleted_at', $precision = 0) { @@ -897,19 +1091,20 @@ class Blueprint /** * Add a "deleted at" timestampTz for the table. * + * @param string $column * @param int $precision - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ - public function softDeletesTz($precision = 0) + public function softDeletesTz($column = 'deleted_at', $precision = 0) { - return $this->timestampTz('deleted_at', $precision)->nullable(); + return $this->timestampTz($column, $precision)->nullable(); } /** * Create a new year column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function year($column) { @@ -920,7 +1115,7 @@ class Blueprint * Create a new binary column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function binary($column) { @@ -931,7 +1126,7 @@ class Blueprint * Create a new uuid column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function uuid($column) { @@ -942,7 +1137,7 @@ class Blueprint * Create a new IP address column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function ipAddress($column) { @@ -953,7 +1148,7 @@ class Blueprint * Create a new MAC address column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function macAddress($column) { @@ -964,7 +1159,7 @@ class Blueprint * Create a new geometry column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function geometry($column) { @@ -975,18 +1170,19 @@ class Blueprint * Create a new point column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @param int|null $srid + * @return \Illuminate\Database\Schema\ColumnDefinition */ - public function point($column) + public function point($column, $srid = null) { - return $this->addColumn('point', $column); + return $this->addColumn('point', $column, compact('srid')); } /** * Create a new linestring column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function lineString($column) { @@ -997,7 +1193,7 @@ class Blueprint * Create a new polygon column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function polygon($column) { @@ -1008,7 +1204,7 @@ class Blueprint * Create a new geometrycollection column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function geometryCollection($column) { @@ -1019,7 +1215,7 @@ class Blueprint * Create a new multipoint column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function multiPoint($column) { @@ -1030,7 +1226,7 @@ class Blueprint * Create a new multilinestring column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function multiLineString($column) { @@ -1041,13 +1237,36 @@ class Blueprint * Create a new multipolygon column on the table. * * @param string $column - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function multiPolygon($column) { return $this->addColumn('multipolygon', $column); } + /** + * Create a new multipolygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPolygonZ($column) + { + return $this->addColumn('multipolygonz', $column); + } + + /** + * Create a new generated, computed column on the table. + * + * @param string $column + * @param string $expression + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function computed($column, $expression) + { + return $this->addColumn('computed', $column, compact('expression')); + } + /** * Add the proper columns for a polymorphic table. * @@ -1057,11 +1276,11 @@ class Blueprint */ public function morphs($name, $indexName = null) { - $this->unsignedInteger("{$name}_id"); - $this->string("{$name}_type"); - $this->index(["{$name}_id", "{$name}_type"], $indexName); + $this->unsignedBigInteger("{$name}_id"); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); } /** @@ -1073,17 +1292,49 @@ class Blueprint */ public function nullableMorphs($name, $indexName = null) { - $this->unsignedInteger("{$name}_id")->nullable(); + $this->string("{$name}_type")->nullable(); + + $this->unsignedBigInteger("{$name}_id")->nullable(); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + /** + * Add the proper columns for a polymorphic table using UUIDs. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function uuidMorphs($name, $indexName = null) + { + $this->string("{$name}_type"); + + $this->uuid("{$name}_id"); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Add nullable columns for a polymorphic table using UUIDs. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function nullableUuidMorphs($name, $indexName = null) + { $this->string("{$name}_type")->nullable(); - $this->index(["{$name}_id", "{$name}_type"], $indexName); + $this->uuid("{$name}_id")->nullable(); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); } /** * Adds the `remember_token` column to the table. * - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function rememberToken() { @@ -1144,7 +1395,7 @@ class Blueprint */ protected function createIndexName($type, array $columns) { - $index = strtolower($this->table.'_'.implode('_', $columns).'_'.$type); + $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); return str_replace(['-', '.'], '_', $index); } @@ -1155,11 +1406,11 @@ class Blueprint * @param string $type * @param string $name * @param array $parameters - * @return \Illuminate\Support\Fluent + * @return \Illuminate\Database\Schema\ColumnDefinition */ public function addColumn($type, $name, array $parameters = []) { - $this->columns[] = $column = new Fluent( + $this->columns[] = $column = new ColumnDefinition( array_merge(compact('type', 'name'), $parameters) ); @@ -1175,7 +1426,7 @@ class Blueprint public function removeColumn($name) { $this->columns = array_values(array_filter($this->columns, function ($c) use ($name) { - return $c['attributes']['name'] != $name; + return $c['name'] != $name; })); return $this; @@ -1220,7 +1471,7 @@ class Blueprint /** * Get the columns on the blueprint. * - * @return \Illuminate\Support\Fluent[] + * @return \Illuminate\Database\Schema\ColumnDefinition[] */ public function getColumns() { @@ -1240,7 +1491,7 @@ class Blueprint /** * Get the columns on the blueprint that should be added. * - * @return \Illuminate\Support\Fluent[] + * @return \Illuminate\Database\Schema\ColumnDefinition[] */ public function getAddedColumns() { @@ -1252,7 +1503,7 @@ class Blueprint /** * Get the columns on the blueprint that should be changed. * - * @return \Illuminate\Support\Fluent[] + * @return \Illuminate\Database\Schema\ColumnDefinition[] */ public function getChangedColumns() { diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Builder.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Builder.php index 822011538eb1d10892a99649fcd98a0fd988af30..93571b2c4a9ac854914bb351609f94b5662e5aa8 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Builder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Builder.php @@ -3,8 +3,10 @@ namespace Illuminate\Database\Schema; use Closure; -use LogicException; +use Doctrine\DBAL\Types\Type; use Illuminate\Database\Connection; +use LogicException; +use RuntimeException; class Builder { @@ -69,7 +71,7 @@ class Builder { $table = $this->connection->getTablePrefix().$table; - return count($this->connection->select( + return count($this->connection->selectFromWriteConnection( $this->grammar->compileTableExists(), [$table] )) > 0; } @@ -92,7 +94,7 @@ class Builder * Determine if the given table has given columns. * * @param string $table - * @param array $columns + * @param array $columns * @return bool */ public function hasColumns($table, array $columns) @@ -130,7 +132,7 @@ class Builder */ public function getColumnListing($table) { - $results = $this->connection->select($this->grammar->compileColumnListing( + $results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing( $this->connection->getTablePrefix().$table )); @@ -140,7 +142,7 @@ class Builder /** * Modify a table on the schema. * - * @param string $table + * @param string $table * @param \Closure $callback * @return void */ @@ -152,7 +154,7 @@ class Builder /** * Create a new table on the schema. * - * @param string $table + * @param string $table * @param \Closure $callback * @return void */ @@ -203,6 +205,42 @@ class Builder throw new LogicException('This database driver does not support dropping all tables.'); } + /** + * Drop all views from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllViews() + { + throw new LogicException('This database driver does not support dropping all views.'); + } + + /** + * Drop all types from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllTypes() + { + throw new LogicException('This database driver does not support dropping all types.'); + } + + /** + * Get all of the table names for the database. + * + * @return void + * + * @throws \LogicException + */ + public function getAllTables() + { + throw new LogicException('This database driver does not support getting all tables.'); + } + /** * Rename a table on the schema. * @@ -261,11 +299,44 @@ class Builder */ protected function createBlueprint($table, Closure $callback = null) { + $prefix = $this->connection->getConfig('prefix_indexes') + ? $this->connection->getConfig('prefix') + : ''; + if (isset($this->resolver)) { - return call_user_func($this->resolver, $table, $callback); + return call_user_func($this->resolver, $table, $callback, $prefix); + } + + return new Blueprint($table, $callback, $prefix); + } + + /** + * Register a custom Doctrine mapping type. + * + * @param string $class + * @param string $name + * @param string $type + * @return void + * + * @throws \Doctrine\DBAL\DBALException + * @throws \RuntimeException + */ + public function registerCustomDoctrineType($class, $name, $type) + { + if (! $this->connection->isDoctrineAvailable()) { + throw new RuntimeException( + 'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).' + ); } - return new Blueprint($table, $callback); + if (! Type::hasType($name)) { + Type::addType($name, $class); + + $this->connection + ->getDoctrineSchemaManager() + ->getDatabasePlatform() + ->registerDoctrineTypeMapping($type, $name); + } } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/ChangeColumn.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/ChangeColumn.php index 4751ecbed7f66d6f95291d6989f6e2562183cd9d..3ea01d92b003c212bec7922a976233e838fbfaf5 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/ChangeColumn.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/ChangeColumn.php @@ -2,14 +2,14 @@ namespace Illuminate\Database\Schema\Grammars; -use RuntimeException; -use Doctrine\DBAL\Types\Type; -use Illuminate\Support\Fluent; +use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; +use Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Schema\Table; +use Doctrine\DBAL\Types\Type; use Illuminate\Database\Connection; -use Doctrine\DBAL\Schema\Comparator; use Illuminate\Database\Schema\Blueprint; -use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; +use Illuminate\Support\Fluent; +use RuntimeException; class ChangeColumn { @@ -19,7 +19,7 @@ class ChangeColumn * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Connection $connection * @return array * * @throws \RuntimeException @@ -82,7 +82,10 @@ class ChangeColumn if (! is_null($option = static::mapFluentOptionToDoctrine($key))) { if (method_exists($column, $method = 'set'.ucfirst($option))) { $column->{$method}(static::mapFluentValueToDoctrine($option, $value)); + continue; } + + $column->setCustomSchemaOption($option, static::mapFluentValueToDoctrine($option, $value)); } } } @@ -118,6 +121,13 @@ class ChangeColumn $options['length'] = static::calculateDoctrineTextLength($fluent['type']); } + if (in_array($fluent['type'], ['json', 'binary'])) { + $options['customSchemaOptions'] = [ + 'collation' => '', + 'charset' => '', + ]; + } + return $options; } @@ -200,6 +210,6 @@ class ChangeColumn */ protected static function mapFluentValueToDoctrine($option, $value) { - return $option == 'notnull' ? ! $value : $value; + return $option === 'notnull' ? ! $value : $value; } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/Grammar.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/Grammar.php index ddd38385710d05924ec714a3a68cffe3a64e2224..b60dfe817b627967169c300ada8d82eeea0cfdb2 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/Grammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/Grammar.php @@ -2,13 +2,14 @@ namespace Illuminate\Database\Schema\Grammars; -use Illuminate\Support\Fluent; +use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; use Doctrine\DBAL\Schema\TableDiff; use Illuminate\Database\Connection; +use Illuminate\Database\Grammar as BaseGrammar; use Illuminate\Database\Query\Expression; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Grammar as BaseGrammar; -use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; +use Illuminate\Support\Fluent; +use RuntimeException; abstract class Grammar extends BaseGrammar { @@ -19,6 +20,13 @@ abstract class Grammar extends BaseGrammar */ protected $transactions = false; + /** + * The commands to be executed outside of create or alter command. + * + * @var array + */ + protected $fluentCommands = []; + /** * Compile a rename column command. * @@ -37,7 +45,7 @@ abstract class Grammar extends BaseGrammar * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Connection $connection * @return array * * @throws \RuntimeException @@ -90,7 +98,7 @@ abstract class Grammar extends BaseGrammar /** * Compile the blueprint's column definitions. * - * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Database\Schema\Blueprint $blueprint * @return array */ protected function getColumns(Blueprint $blueprint) @@ -120,6 +128,19 @@ abstract class Grammar extends BaseGrammar return $this->{'type'.ucfirst($column->type)}($column); } + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return void + * + * @throws \RuntimeException + */ + protected function typeComputed(Fluent $column) + { + throw new RuntimeException('This database driver does not support the computed type.'); + } + /** * Add the column modifiers to the definition. * @@ -173,7 +194,7 @@ abstract class Grammar extends BaseGrammar * Add a prefix to an array of values. * * @param string $prefix - * @param array $values + * @param array $values * @return array */ public function prefixArray($prefix, array $values) @@ -186,7 +207,7 @@ abstract class Grammar extends BaseGrammar /** * Wrap a table in keyword identifiers. * - * @param mixed $table + * @param mixed $table * @return string */ public function wrapTable($table) @@ -200,7 +221,7 @@ abstract class Grammar extends BaseGrammar * Wrap a value in keyword identifiers. * * @param \Illuminate\Database\Query\Expression|string $value - * @param bool $prefixAlias + * @param bool $prefixAlias * @return string */ public function wrap($value, $prefixAlias = false) @@ -213,7 +234,7 @@ abstract class Grammar extends BaseGrammar /** * Format a value so that it can be used in "default" clauses. * - * @param mixed $value + * @param mixed $value * @return string */ protected function getDefaultValue($value) @@ -243,6 +264,16 @@ abstract class Grammar extends BaseGrammar }); } + /** + * Get the fluent commands for the grammar. + * + * @return array + */ + public function getFluentCommands() + { + return $this->fluentCommands; + } + /** * Check if this Grammar supports schema changes wrapped in a transaction. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/MySqlGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/MySqlGrammar.php index 149f300a2c3432bda6969b7656740151883bc2ae..6464a5d807d42439f1caadfdf08d8cbcfee52075 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/MySqlGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/MySqlGrammar.php @@ -2,9 +2,10 @@ namespace Illuminate\Database\Schema\Grammars; -use Illuminate\Support\Fluent; use Illuminate\Database\Connection; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Fluent; +use RuntimeException; class MySqlGrammar extends Grammar { @@ -14,8 +15,8 @@ class MySqlGrammar extends Grammar * @var array */ protected $modifiers = [ - 'Unsigned', 'VirtualAs', 'StoredAs', 'Charset', 'Collate', 'Nullable', - 'Default', 'Increment', 'Comment', 'After', 'First', + 'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable', + 'Srid', 'Default', 'Increment', 'Comment', 'After', 'First', ]; /** @@ -32,7 +33,7 @@ class MySqlGrammar extends Grammar */ public function compileTableExists() { - return 'select * from information_schema.tables where table_schema = ? and table_name = ?'; + return "select * from information_schema.tables where table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; } /** @@ -114,9 +115,9 @@ class MySqlGrammar extends Grammar // added to either this create table blueprint or the configuration for this // connection that the query is targeting. We'll add it to this SQL query. if (isset($blueprint->collation)) { - $sql .= ' collate '.$blueprint->collation; + $sql .= " collate '{$blueprint->collation}'"; } elseif (! is_null($collation = $connection->getConfig('collation'))) { - $sql .= ' collate '.$collation; + $sql .= " collate '{$collation}'"; } return $sql; @@ -342,6 +343,22 @@ class MySqlGrammar extends Grammar return "rename table {$from} to ".$this->wrapTable($command->to); } + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s rename index %s to %s', + $this->wrapTable($blueprint), + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + /** * Compile the SQL needed to drop all tables. * @@ -353,6 +370,17 @@ class MySqlGrammar extends Grammar return 'drop table '.implode(',', $this->wrapArray($tables)); } + /** + * Compile the SQL needed to drop all views. + * + * @param array $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view '.implode(',', $this->wrapArray($views)); + } + /** * Compile the SQL needed to retrieve all table names. * @@ -363,6 +391,16 @@ class MySqlGrammar extends Grammar return 'SHOW FULL TABLES WHERE table_type = \'BASE TABLE\''; } + /** + * Compile the SQL needed to retrieve all view names. + * + * @return string + */ + public function compileGetAllViews() + { + return 'SHOW FULL TABLES WHERE table_type = \'VIEW\''; + } + /** * Compile the command to enable foreign key constraints. * @@ -542,14 +580,25 @@ class MySqlGrammar extends Grammar } /** - * Create the column definition for an enum type. + * Create the column definition for an enumeration type. * * @param \Illuminate\Support\Fluent $column * @return string */ protected function typeEnum(Fluent $column) { - return "enum('".implode("', '", $column->allowed)."')"; + return sprintf('enum(%s)', $this->quoteString($column->allowed)); + } + + /** + * Create the column definition for a set enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSet(Fluent $column) + { + return sprintf('set(%s)', $this->quoteString($column->allowed)); } /** @@ -593,7 +642,9 @@ class MySqlGrammar extends Grammar */ protected function typeDateTime(Fluent $column) { - return $column->precision ? "datetime($column->precision)" : 'datetime'; + $columnType = $column->precision ? "datetime($column->precision)" : 'datetime'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; } /** @@ -796,6 +847,19 @@ class MySqlGrammar extends Grammar return 'multipolygon'; } + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return void + * + * @throws \RuntimeException + */ + protected function typeComputed(Fluent $column) + { + throw new RuntimeException('This database driver requires a type, see the virtualAs / storedAs modifiers.'); + } + /** * Get the SQL for a generated virtual column modifier. * @@ -862,7 +926,7 @@ class MySqlGrammar extends Grammar protected function modifyCollate(Blueprint $blueprint, Fluent $column) { if (! is_null($column->collation)) { - return ' collate '.$column->collation; + return " collate '{$column->collation}'"; } } @@ -878,6 +942,10 @@ class MySqlGrammar extends Grammar if (is_null($column->virtualAs) && is_null($column->storedAs)) { return $column->nullable ? ' null' : ' not null'; } + + if ($column->nullable === false) { + return ' not null'; + } } /** @@ -950,6 +1018,20 @@ class MySqlGrammar extends Grammar } } + /** + * Get the SQL for a SRID column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifySrid(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) { + return ' srid '.$column->srid; + } + } + /** * Wrap a single string in keyword identifiers. * diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/PostgresGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/PostgresGrammar.php index 5eed79cdc480dab3efc4a134b52d6c23b98343f7..2b2d381b5f0366589c0d6b3c61f00223f695b069 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/PostgresGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/PostgresGrammar.php @@ -2,9 +2,8 @@ namespace Illuminate\Database\Schema\Grammars; -use RuntimeException; -use Illuminate\Support\Fluent; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Fluent; class PostgresGrammar extends Grammar { @@ -20,7 +19,7 @@ class PostgresGrammar extends Grammar * * @var array */ - protected $modifiers = ['Increment', 'Nullable', 'Default']; + protected $modifiers = ['Collate', 'Increment', 'Nullable', 'Default', 'VirtualAs', 'StoredAs']; /** * The columns available as serials. @@ -29,6 +28,13 @@ class PostgresGrammar extends Grammar */ protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; + /** + * The commands to be executed outside of create or alter command. + * + * @var array + */ + protected $fluentCommands = ['Comment']; + /** * Compile the query to determine if a table exists. * @@ -36,7 +42,7 @@ class PostgresGrammar extends Grammar */ public function compileTableExists() { - return 'select * from information_schema.tables where table_schema = ? and table_name = ?'; + return "select * from information_schema.tables where table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; } /** @@ -160,6 +166,10 @@ class PostgresGrammar extends Grammar $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred'; } + if (! is_null($command->notValid)) { + $sql .= ' not valid'; + } + return $sql; } @@ -190,7 +200,7 @@ class PostgresGrammar extends Grammar /** * Compile the SQL needed to drop all tables. * - * @param string $tables + * @param array $tables * @return string */ public function compileDropAllTables($tables) @@ -198,15 +208,58 @@ class PostgresGrammar extends Grammar return 'drop table "'.implode('","', $tables).'" cascade'; } + /** + * Compile the SQL needed to drop all views. + * + * @param array $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view "'.implode('","', $views).'" cascade'; + } + + /** + * Compile the SQL needed to drop all types. + * + * @param array $types + * @return string + */ + public function compileDropAllTypes($types) + { + return 'drop type "'.implode('","', $types).'" cascade'; + } + /** * Compile the SQL needed to retrieve all table names. * - * @param string $schema + * @param string|array $schema * @return string */ public function compileGetAllTables($schema) { - return "select tablename from pg_catalog.pg_tables where schemaname = '{$schema}'"; + return "select tablename from pg_catalog.pg_tables where schemaname in ('".implode("','", (array) $schema)."')"; + } + + /** + * Compile the SQL needed to retrieve all view names. + * + * @param string|array $schema + * @return string + */ + public function compileGetAllViews($schema) + { + return "select viewname from pg_catalog.pg_views where schemaname in ('".implode("','", (array) $schema)."')"; + } + + /** + * Compile the SQL needed to retrieve all type names. + * + * @return string + */ + public function compileGetAllTypes() + { + return 'select distinct pg_type.typname from pg_type inner join pg_enum on pg_enum.enumtypid = pg_type.oid'; } /** @@ -303,6 +356,21 @@ class PostgresGrammar extends Grammar return "alter table {$from} rename to ".$this->wrapTable($command->to); } + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter index %s rename to %s', + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + /** * Compile the command to enable foreign key constraints. * @@ -323,6 +391,22 @@ class PostgresGrammar extends Grammar return 'SET CONSTRAINTS ALL DEFERRED;'; } + /** + * Compile a comment command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileComment(Blueprint $blueprint, Fluent $command) + { + return sprintf('comment on column %s.%s is %s', + $this->wrapTable($blueprint), + $this->wrap($command->column->name), + "'".str_replace("'", "''", $command->value)."'" + ); + } + /** * Create the column definition for a char type. * @@ -386,7 +470,7 @@ class PostgresGrammar extends Grammar */ protected function typeInteger(Fluent $column) { - return $column->autoIncrement ? 'serial' : 'integer'; + return $this->generatableColumn('integer', $column); } /** @@ -397,7 +481,7 @@ class PostgresGrammar extends Grammar */ protected function typeBigInteger(Fluent $column) { - return $column->autoIncrement ? 'bigserial' : 'bigint'; + return $this->generatableColumn('bigint', $column); } /** @@ -408,7 +492,7 @@ class PostgresGrammar extends Grammar */ protected function typeMediumInteger(Fluent $column) { - return $column->autoIncrement ? 'serial' : 'integer'; + return $this->generatableColumn('integer', $column); } /** @@ -419,7 +503,7 @@ class PostgresGrammar extends Grammar */ protected function typeTinyInteger(Fluent $column) { - return $column->autoIncrement ? 'smallserial' : 'smallint'; + return $this->generatableColumn('smallint', $column); } /** @@ -430,7 +514,42 @@ class PostgresGrammar extends Grammar */ protected function typeSmallInteger(Fluent $column) { - return $column->autoIncrement ? 'smallserial' : 'smallint'; + return $this->generatableColumn('smallint', $column); + } + + /** + * Create the column definition for a generatable column. + * + * @param string $type + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function generatableColumn($type, Fluent $column) + { + if (! $column->autoIncrement && is_null($column->generatedAs)) { + return $type; + } + + if ($column->autoIncrement && is_null($column->generatedAs)) { + return with([ + 'integer' => 'serial', + 'bigint' => 'bigserial', + 'smallint' => 'smallserial', + ])[$type]; + } + + $options = ''; + + if (! is_bool($column->generatedAs) && ! empty($column->generatedAs)) { + $options = sprintf(' (%s)', $column->generatedAs); + } + + return sprintf( + '%s generated %s as identity%s', + $type, + $column->always ? 'always' : 'by default', + $options + ); } /** @@ -489,18 +608,18 @@ class PostgresGrammar extends Grammar } /** - * Create the column definition for an enum type. + * Create the column definition for an enumeration 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).'))'; + return sprintf( + 'varchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); } /** @@ -544,7 +663,7 @@ class PostgresGrammar extends Grammar */ protected function typeDateTime(Fluent $column) { - return "timestamp($column->precision) without time zone"; + return $this->typeTimestamp($column); } /** @@ -555,7 +674,7 @@ class PostgresGrammar extends Grammar */ protected function typeDateTimeTz(Fluent $column) { - return "timestamp($column->precision) with time zone"; + return $this->typeTimestampTz($column); } /** @@ -566,7 +685,7 @@ class PostgresGrammar extends Grammar */ protected function typeTime(Fluent $column) { - return "time($column->precision) without time zone"; + return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; } /** @@ -577,7 +696,7 @@ class PostgresGrammar extends Grammar */ protected function typeTimeTz(Fluent $column) { - return "time($column->precision) with time zone"; + return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; } /** @@ -588,7 +707,7 @@ class PostgresGrammar extends Grammar */ protected function typeTimestamp(Fluent $column) { - $columnType = "timestamp($column->precision) without time zone"; + $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; } @@ -601,7 +720,7 @@ class PostgresGrammar extends Grammar */ protected function typeTimestampTz(Fluent $column) { - $columnType = "timestamp($column->precision) with time zone"; + $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; } @@ -665,11 +784,11 @@ class PostgresGrammar extends Grammar * Create the column definition for a spatial Geometry type. * * @param \Illuminate\Support\Fluent $column - * @throws \RuntimeException + * @return string */ protected function typeGeometry(Fluent $column) { - throw new RuntimeException('The database driver in use does not support the Geometry spatial column type.'); + return $this->formatPostGisType('geometry', $column); } /** @@ -680,7 +799,7 @@ class PostgresGrammar extends Grammar */ protected function typePoint(Fluent $column) { - return $this->formatPostGisType('point'); + return $this->formatPostGisType('point', $column); } /** @@ -691,7 +810,7 @@ class PostgresGrammar extends Grammar */ protected function typeLineString(Fluent $column) { - return $this->formatPostGisType('linestring'); + return $this->formatPostGisType('linestring', $column); } /** @@ -702,7 +821,7 @@ class PostgresGrammar extends Grammar */ protected function typePolygon(Fluent $column) { - return $this->formatPostGisType('polygon'); + return $this->formatPostGisType('polygon', $column); } /** @@ -713,7 +832,7 @@ class PostgresGrammar extends Grammar */ protected function typeGeometryCollection(Fluent $column) { - return $this->formatPostGisType('geometrycollection'); + return $this->formatPostGisType('geometrycollection', $column); } /** @@ -724,7 +843,7 @@ class PostgresGrammar extends Grammar */ protected function typeMultiPoint(Fluent $column) { - return $this->formatPostGisType('multipoint'); + return $this->formatPostGisType('multipoint', $column); } /** @@ -735,7 +854,7 @@ class PostgresGrammar extends Grammar */ public function typeMultiLineString(Fluent $column) { - return $this->formatPostGisType('multilinestring'); + return $this->formatPostGisType('multilinestring', $column); } /** @@ -746,18 +865,52 @@ class PostgresGrammar extends Grammar */ protected function typeMultiPolygon(Fluent $column) { - return $this->formatPostGisType('multipolygon'); + return $this->formatPostGisType('multipolygon', $column); + } + + /** + * Create the column definition for a spatial MultiPolygonZ type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPolygonZ(Fluent $column) + { + return $this->formatPostGisType('multipolygonz', $column); } /** * Format the column definition for a PostGIS spatial type. * * @param string $type + * @param \Illuminate\Support\Fluent $column * @return string */ - private function formatPostGisType(string $type) + private function formatPostGisType(string $type, Fluent $column) + { + if ($column->isGeometry === null) { + return sprintf('geography(%s, %s)', $type, $column->projection ?? '4326'); + } + + if ($column->projection !== null) { + return sprintf('geometry(%s, %s)', $type, $column->projection); + } + + return "geometry({$type})"; + } + + /** + * 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) { - return "geography($type, 4326)"; + if (! is_null($column->collation)) { + return ' collate '.$this->wrapValue($column->collation); + } } /** @@ -795,8 +948,36 @@ class PostgresGrammar extends Grammar */ protected function modifyIncrement(Blueprint $blueprint, Fluent $column) { - if (in_array($column->type, $this->serials) && $column->autoIncrement) { + if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) { return ' primary key'; } } + + /** + * Get the SQL for a generated virtual column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) + { + if ($column->virtualAs !== null) { + return " generated always as ({$column->virtualAs})"; + } + } + + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) + { + if ($column->storedAs !== null) { + return " generated always as ({$column->storedAs}) stored"; + } + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/RenameColumn.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/RenameColumn.php index a07c4febb99dece893288000c5fc7a9849e43241..3fe9fd8fbb10173aec111f67543993b9a8d1f82b 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/RenameColumn.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/RenameColumn.php @@ -2,12 +2,12 @@ namespace Illuminate\Database\Schema\Grammars; -use Illuminate\Support\Fluent; +use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\TableDiff; use Illuminate\Database\Connection; use Illuminate\Database\Schema\Blueprint; -use Doctrine\DBAL\Schema\AbstractSchemaManager as SchemaManager; +use Illuminate\Support\Fluent; class RenameColumn { diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SQLiteGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SQLiteGrammar.php index 27e372d5d6d8a50942171c32956a3ff75295b679..c52cd8ff8868711d9f41ea38518b3c313294d753 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SQLiteGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SQLiteGrammar.php @@ -2,10 +2,12 @@ namespace Illuminate\Database\Schema\Grammars; -use RuntimeException; -use Illuminate\Support\Fluent; +use Doctrine\DBAL\Schema\Index; use Illuminate\Database\Connection; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Arr; +use Illuminate\Support\Fluent; +use RuntimeException; class SQLiteGrammar extends Grammar { @@ -84,7 +86,7 @@ class SQLiteGrammar extends Grammar // If this foreign key specifies the action to be taken on update we will add // that to the statement here. We'll append it to this SQL and then return - // the SQL so we can keep adding any other foreign consraints onto this. + // the SQL so we can keep adding any other foreign constraints onto this. if (! is_null($foreign->onUpdate)) { $sql .= " on update {$foreign->onUpdate}"; } @@ -177,6 +179,8 @@ class SQLiteGrammar extends Grammar * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Support\Fluent $command + * @return void + * * @throws \RuntimeException */ public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) @@ -230,6 +234,26 @@ class SQLiteGrammar extends Grammar return "delete from sqlite_master where type in ('table', 'index', 'trigger')"; } + /** + * Compile the SQL needed to drop all views. + * + * @return string + */ + public function compileDropAllViews() + { + return "delete from sqlite_master where type in ('view')"; + } + + /** + * Compile the SQL needed to rebuild the database. + * + * @return string + */ + public function compileRebuild() + { + return 'vacuum'; + } + /** * Compile a drop column command. * @@ -286,6 +310,8 @@ class SQLiteGrammar extends Grammar * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Support\Fluent $command + * @return void + * * @throws \RuntimeException */ public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) @@ -307,6 +333,41 @@ class SQLiteGrammar extends Grammar return "alter table {$from} rename to ".$this->wrapTable($command->to); } + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + * + * @throws \RuntimeException + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $schemaManager = $connection->getDoctrineSchemaManager(); + + $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); + + $index = Arr::get($indexes, $command->from); + + if (! $index) { + throw new RuntimeException("Index [{$command->from}] does not exist."); + } + + $newIndex = new Index( + $command->to, $index->getColumns(), $index->isUnique(), + $index->isPrimary(), $index->getFlags(), $index->getOptions() + ); + + $platform = $schemaManager->getDatabasePlatform(); + + return [ + $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), + $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), + ]; + } + /** * Compile the command to enable foreign key constraints. * @@ -502,14 +563,18 @@ class SQLiteGrammar extends Grammar } /** - * Create the column definition for an enum type. + * Create the column definition for an enumeration type. * * @param \Illuminate\Support\Fluent $column * @return string */ protected function typeEnum(Fluent $column) { - return 'varchar'; + return sprintf( + 'varchar check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); } /** @@ -553,7 +618,7 @@ class SQLiteGrammar extends Grammar */ protected function typeDateTime(Fluent $column) { - return 'datetime'; + return $this->typeTimestamp($column); } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SqlServerGrammar.php b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SqlServerGrammar.php index 40a21c1d5603d1af90d65c68b3c2efb734c4957b..d356e87cdead5c2338a757212d7145e93bfb7862 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SqlServerGrammar.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/Grammars/SqlServerGrammar.php @@ -2,8 +2,8 @@ namespace Illuminate\Database\Schema\Grammars; -use Illuminate\Support\Fluent; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Fluent; class SqlServerGrammar extends Grammar { @@ -19,7 +19,7 @@ class SqlServerGrammar extends Grammar * * @var array */ - protected $modifiers = ['Increment', 'Collate', 'Nullable', 'Default']; + protected $modifiers = ['Increment', 'Collate', 'Nullable', 'Default', 'Persisted']; /** * The columns available as serials. @@ -192,7 +192,29 @@ class SqlServerGrammar extends Grammar { $columns = $this->wrapArray($command->columns); - return 'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); + $dropExistingConstraintsSql = $this->compileDropDefaultConstraint($blueprint, $command).';'; + + return $dropExistingConstraintsSql.'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); + } + + /** + * Compile a drop default constraint command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $command) + { + $columns = "'".implode("','", $command->columns)."'"; + + $sql = "DECLARE @sql NVARCHAR(MAX) = '';"; + $sql .= "SELECT @sql += 'ALTER TABLE [dbo].[{$blueprint->getTable()}] DROP CONSTRAINT ' + OBJECT_NAME([default_object_id]) + ';' "; + $sql .= 'FROM SYS.COLUMNS '; + $sql .= "WHERE [object_id] = OBJECT_ID('[dbo].[{$blueprint->getTable()}]') AND [name] in ({$columns}) AND [default_object_id] <> 0;"; + $sql .= 'EXEC(@sql)'; + + return $sql; } /** @@ -277,6 +299,21 @@ class SqlServerGrammar extends Grammar return "sp_rename {$from}, ".$this->wrapTable($command->to); } + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf("sp_rename N'%s', %s, N'INDEX'", + $this->wrap($blueprint->getTable().'.'.$command->from), + $this->wrap($command->to) + ); + } + /** * Compile the command to enable foreign key constraints. * @@ -297,6 +334,36 @@ class SqlServerGrammar extends Grammar return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";'; } + /** + * Compile the command to drop all foreign keys. + * + * @return string + */ + public function compileDropAllForeignKeys() + { + return "DECLARE @sql NVARCHAR(MAX) = N''; + SELECT @sql += 'ALTER TABLE ' + + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + + QUOTENAME(OBJECT_NAME(parent_object_id)) + + ' DROP CONSTRAINT ' + QUOTENAME(name) + ';' + FROM sys.foreign_keys; + + EXEC sp_executesql @sql;"; + } + + /** + * Compile the command to drop all views. + * + * @return string + */ + public function compileDropAllViews() + { + return "DECLARE @sql NVARCHAR(MAX) = N''; + SELECT @sql += 'DROP VIEW ' + QUOTENAME(OBJECT_SCHEMA_NAME(object_id)) + '.' + QUOTENAME(name) + ';' + FROM sys.views; + + EXEC sp_executesql @sql;"; + } + /** * Create the column definition for a char type. * @@ -452,14 +519,18 @@ class SqlServerGrammar extends Grammar } /** - * Create the column definition for an enum type. + * Create the column definition for an enumeration type. * * @param \Illuminate\Support\Fluent $column * @return string */ protected function typeEnum(Fluent $column) { - return 'nvarchar(255)'; + return sprintf( + 'nvarchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); } /** @@ -503,7 +574,7 @@ class SqlServerGrammar extends Grammar */ protected function typeDateTime(Fluent $column) { - return $column->precision ? "datetime2($column->precision)" : 'datetime'; + return $this->typeTimestamp($column); } /** @@ -514,7 +585,7 @@ class SqlServerGrammar extends Grammar */ protected function typeDateTimeTz(Fluent $column) { - return $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; + return $this->typeTimestampTz($column); } /** @@ -555,20 +626,16 @@ class SqlServerGrammar extends Grammar /** * Create the column definition for a timestamp (with time zone) type. * - * @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx + * @link https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetimeoffset-transact-sql?view=sql-server-ver15 * * @param \Illuminate\Support\Fluent $column * @return string */ protected function typeTimestampTz(Fluent $column) { - if ($column->useCurrent) { - $columnType = $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; + $columnType = $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; - return "$columnType default CURRENT_TIMESTAMP"; - } - - return "datetimeoffset($column->precision)"; + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; } /** @@ -714,6 +781,17 @@ class SqlServerGrammar extends Grammar return 'geography'; } + /** + * Create the column definition for a generated, computed column type. + * + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function typeComputed(Fluent $column) + { + return "as ({$column->expression})"; + } + /** * Get the SQL for a collation column modifier. * @@ -737,7 +815,9 @@ class SqlServerGrammar extends Grammar */ protected function modifyNullable(Blueprint $blueprint, Fluent $column) { - return $column->nullable ? ' null' : ' not null'; + if ($column->type !== 'computed') { + return $column->nullable ? ' null' : ' not null'; + } } /** @@ -768,6 +848,20 @@ class SqlServerGrammar extends Grammar } } + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyPersisted(Blueprint $blueprint, Fluent $column) + { + if ($column->persisted) { + return ' persisted'; + } + } + /** * Wrap a table in keyword identifiers. * @@ -782,4 +876,19 @@ class SqlServerGrammar extends Grammar return parent::wrapTable($table); } + + /** + * Quote the given string literal. + * + * @param string|array $value + * @return string + */ + public function quoteString($value) + { + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "N'$value'"; + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/MySqlBuilder.php b/Seance5-6/seance/vendor/illuminate/database/Schema/MySqlBuilder.php index 7e4c6d2bcd434e09f53b0ac080857ed9decb4e8d..f07946c85e233adb8341ae49ae49aa59fa8ed790 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/MySqlBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/MySqlBuilder.php @@ -64,15 +64,51 @@ class MySqlBuilder extends Builder $this->enableForeignKeyConstraints(); } + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + /** * Get all of the table names for the database. * * @return array */ - protected function getAllTables() + public function getAllTables() { return $this->connection->select( $this->grammar->compileGetAllTables() ); } + + /** + * Get all of the view names for the database. + * + * @return array + */ + public function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews() + ); + } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/PostgresBuilder.php b/Seance5-6/seance/vendor/illuminate/database/Schema/PostgresBuilder.php index 8fa0a2c1909c4e5b46eff45998c6a5b7c53c0406..76673a719a416cccf761bd688c876b353111355d 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/PostgresBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/PostgresBuilder.php @@ -12,7 +12,7 @@ class PostgresBuilder extends Builder */ public function hasTable($table) { - list($schema, $table) = $this->parseSchemaAndTable($table); + [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; @@ -30,7 +30,7 @@ class PostgresBuilder extends Builder { $tables = []; - $excludedTables = ['spatial_ref_sys']; + $excludedTables = $this->connection->getConfig('dont_drop') ?? ['spatial_ref_sys']; foreach ($this->getAllTables() as $row) { $row = (array) $row; @@ -51,15 +51,87 @@ class PostgresBuilder extends Builder ); } + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + + /** + * Drop all types from the database. + * + * @return void + */ + public function dropAllTypes() + { + $types = []; + + foreach ($this->getAllTypes() as $row) { + $row = (array) $row; + + $types[] = reset($row); + } + + if (empty($types)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllTypes($types) + ); + } + /** * Get all of the table names for the database. * * @return array */ - protected function getAllTables() + public function getAllTables() + { + return $this->connection->select( + $this->grammar->compileGetAllTables((array) $this->connection->getConfig('schema')) + ); + } + + /** + * Get all of the view names for the database. + * + * @return array + */ + public function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews((array) $this->connection->getConfig('schema')) + ); + } + + /** + * Get all of the type names for the database. + * + * @return array + */ + public function getAllTypes() { return $this->connection->select( - $this->grammar->compileGetAllTables($this->connection->getConfig('schema')) + $this->grammar->compileGetAllTypes() ); } @@ -71,7 +143,7 @@ class PostgresBuilder extends Builder */ public function getColumnListing($table) { - list($schema, $table) = $this->parseSchemaAndTable($table); + [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/SQLiteBuilder.php b/Seance5-6/seance/vendor/illuminate/database/Schema/SQLiteBuilder.php index 8cfacc114b156e2324151cafd07b675dd18a4f9e..78b6b9c78d2ec1c57e83cac7ba865f4c360fa008 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/SQLiteBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/SQLiteBuilder.php @@ -20,6 +20,24 @@ class SQLiteBuilder extends Builder $this->connection->select($this->grammar->compileDropAllTables()); $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $this->connection->select($this->grammar->compileEnableWriteableSchema()); + + $this->connection->select($this->grammar->compileDropAllViews()); + + $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); } /** diff --git a/Seance5-6/seance/vendor/illuminate/database/Schema/SqlServerBuilder.php b/Seance5-6/seance/vendor/illuminate/database/Schema/SqlServerBuilder.php index 2c54282dd2a5eecb7671b07db747395f94819f26..0b3e47bec9a61013847a96ce3b37bc17dc7399e9 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Schema/SqlServerBuilder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Schema/SqlServerBuilder.php @@ -11,10 +11,18 @@ class SqlServerBuilder extends Builder */ public function dropAllTables() { - $this->disableForeignKeyConstraints(); + $this->connection->statement($this->grammar->compileDropAllForeignKeys()); $this->connection->statement($this->grammar->compileDropAllTables()); + } - $this->enableForeignKeyConstraints(); + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $this->connection->statement($this->grammar->compileDropAllViews()); } } diff --git a/Seance5-6/seance/vendor/illuminate/database/Seeder.php b/Seance5-6/seance/vendor/illuminate/database/Seeder.php index e4d300968d9ef7aa6a1b317e07bd7ef30a7be92e..2facfd7de225cfbd6732d75888d7a929ffd49b46 100644 --- a/Seance5-6/seance/vendor/illuminate/database/Seeder.php +++ b/Seance5-6/seance/vendor/illuminate/database/Seeder.php @@ -2,10 +2,10 @@ namespace Illuminate\Database; -use Illuminate\Support\Arr; -use InvalidArgumentException; use Illuminate\Console\Command; use Illuminate\Container\Container; +use Illuminate\Support\Arr; +use InvalidArgumentException; abstract class Seeder { @@ -35,11 +35,23 @@ abstract class Seeder $classes = Arr::wrap($class); foreach ($classes as $class) { + $seeder = $this->resolve($class); + + $name = get_class($seeder); + if ($silent === false && isset($this->command)) { - $this->command->getOutput()->writeln("<info>Seeding:</info> $class"); + $this->command->getOutput()->writeln("<comment>Seeding:</comment> {$name}"); } - $this->resolve($class)->__invoke(); + $startTime = microtime(true); + + $seeder->__invoke(); + + $runTime = round(microtime(true) - $startTime, 2); + + if ($silent === false && isset($this->command)) { + $this->command->getOutput()->writeln("<info>Seeded:</info> {$name} ({$runTime} seconds)"); + } } return $this; @@ -108,7 +120,7 @@ abstract class Seeder /** * Run the database seeds. * - * @return void + * @return mixed * * @throws \InvalidArgumentException */ diff --git a/Seance5-6/seance/vendor/illuminate/database/SqlServerConnection.php b/Seance5-6/seance/vendor/illuminate/database/SqlServerConnection.php index 95395637d6b89c40f31064d36735296a5e454007..c5f0c19cff8bb4c1153073c3ba6614ee2d547fc3 100644 --- a/Seance5-6/seance/vendor/illuminate/database/SqlServerConnection.php +++ b/Seance5-6/seance/vendor/illuminate/database/SqlServerConnection.php @@ -3,13 +3,12 @@ namespace Illuminate\Database; use Closure; -use Exception; -use Throwable; -use Illuminate\Database\Schema\SqlServerBuilder; use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as DoctrineDriver; -use Illuminate\Database\Query\Processors\SqlServerProcessor; use Illuminate\Database\Query\Grammars\SqlServerGrammar as QueryGrammar; +use Illuminate\Database\Query\Processors\SqlServerProcessor; use Illuminate\Database\Schema\Grammars\SqlServerGrammar as SchemaGrammar; +use Illuminate\Database\Schema\SqlServerBuilder; +use Throwable; class SqlServerConnection extends Connection { @@ -20,12 +19,12 @@ class SqlServerConnection extends Connection * @param int $attempts * @return mixed * - * @throws \Exception|\Throwable + * @throws \Throwable */ public function transaction(Closure $callback, $attempts = 1) { for ($a = 1; $a <= $attempts; $a++) { - if ($this->getDriverName() == 'sqlsrv') { + if ($this->getDriverName() === 'sqlsrv') { return parent::transaction($callback); } @@ -43,11 +42,7 @@ class SqlServerConnection extends Connection // 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->getPdo()->exec('ROLLBACK TRAN'); - - throw $e; - } catch (Throwable $e) { + catch (Throwable $e) { $this->getPdo()->exec('ROLLBACK TRAN'); throw $e; diff --git a/Seance5-6/seance/vendor/illuminate/database/composer.json b/Seance5-6/seance/vendor/illuminate/database/composer.json index 153abad646f2cdc1beffb61d1b32ef2d0654260e..9289beac1243cbcd5b152d42d667070ca42fae3b 100644 --- a/Seance5-6/seance/vendor/illuminate/database/composer.json +++ b/Seance5-6/seance/vendor/illuminate/database/composer.json @@ -15,10 +15,12 @@ } ], "require": { - "php": ">=7.0", - "illuminate/container": "5.5.*", - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*" + "php": "^7.2.5", + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "symfony/console": "^5.0" }, "autoload": { "psr-4": { @@ -27,16 +29,16 @@ }, "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.5.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.5.*).", - "illuminate/filesystem": "Required to use the migrations (5.5.*).", - "illuminate/pagination": "Required to paginate the result set (5.5.*)." + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (^7.0).", + "illuminate/events": "Required to use the observers with Eloquent (^7.0).", + "illuminate/filesystem": "Required to use the migrations (^7.0).", + "illuminate/pagination": "Required to paginate the result set (^7.0)." }, "config": { "sort-packages": true diff --git a/Seance5-6/seance/vendor/illuminate/support/Arr.php b/Seance5-6/seance/vendor/illuminate/support/Arr.php index 5cf83eb1e70c99a1211cdd2786eac10c537dc6a6..c86306587fc8c9501fd4a4d97b2cf8246cac731e 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Arr.php +++ b/Seance5-6/seance/vendor/illuminate/support/Arr.php @@ -3,8 +3,8 @@ namespace Illuminate\Support; use ArrayAccess; -use InvalidArgumentException; use Illuminate\Support\Traits\Macroable; +use InvalidArgumentException; class Arr { @@ -24,9 +24,9 @@ class Arr /** * Add an element to an array using "dot" notation if it doesn't exist. * - * @param array $array + * @param array $array * @param string $key - * @param mixed $value + * @param mixed $value * @return array */ public static function add($array, $key, $value) @@ -41,7 +41,7 @@ class Arr /** * Collapse an array of arrays into a single array. * - * @param array $array + * @param iterable $array * @return array */ public static function collapse($array) @@ -55,16 +55,16 @@ class Arr continue; } - $results = array_merge($results, $values); + $results[] = $values; } - return $results; + return array_merge([], ...$results); } /** * Cross join the given arrays, returning all possible permutations. * - * @param array ...$arrays + * @param iterable ...$arrays * @return array */ public static function crossJoin(...$arrays) @@ -102,7 +102,7 @@ class Arr /** * Flatten a multi-dimensional associative array with dots. * - * @param array $array + * @param iterable $array * @param string $prepend * @return array */ @@ -154,7 +154,7 @@ class Arr /** * Return the first element in an array passing a given truth test. * - * @param array $array + * @param iterable $array * @param callable|null $callback * @param mixed $default * @return mixed @@ -172,7 +172,7 @@ class Arr } foreach ($array as $key => $value) { - if (call_user_func($callback, $value, $key)) { + if ($callback($value, $key)) { return $value; } } @@ -200,7 +200,7 @@ class Arr /** * Flatten a multi-dimensional array into a single level. * - * @param array $array + * @param iterable $array * @param int $depth * @return array */ @@ -213,10 +213,14 @@ class Arr if (! is_array($item)) { $result[] = $item; - } elseif ($depth === 1) { - $result = array_merge($result, array_values($item)); } else { - $result = array_merge($result, static::flatten($item, $depth - 1)); + $values = $depth === 1 + ? array_values($item) + : static::flatten($item, $depth - 1); + + foreach ($values as $value) { + $result[] = $value; + } } } @@ -271,8 +275,8 @@ class Arr * Get an item from an array using "dot" notation. * * @param \ArrayAccess|array $array - * @param string $key - * @param mixed $default + * @param string|int|null $key + * @param mixed $default * @return mixed */ public static function get($array, $key, $default = null) @@ -313,17 +317,9 @@ class Arr */ public static function has($array, $keys) { - if (is_null($keys)) { - return false; - } - $keys = (array) $keys; - if (! $array) { - return false; - } - - if ($keys === []) { + if (! $array || $keys === []) { return false; } @@ -346,6 +342,38 @@ class Arr return true; } + /** + * Determine if any of the keys exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string|array $keys + * @return bool + */ + public static function hasAny($array, $keys) + { + if (is_null($keys)) { + return false; + } + + $keys = (array) $keys; + + if (! $array) { + return false; + } + + if ($keys === []) { + return false; + } + + foreach ($keys as $key) { + if (static::has($array, $key)) { + return true; + } + } + + return false; + } + /** * Determines if an array is associative. * @@ -376,7 +404,7 @@ class Arr /** * Pluck an array of values from an array. * - * @param array $array + * @param iterable $array * @param string|array $value * @param string|array|null $key * @return array @@ -385,7 +413,7 @@ class Arr { $results = []; - list($value, $key) = static::explodePluckParameters($value, $key); + [$value, $key] = static::explodePluckParameters($value, $key); foreach ($array as $item) { $itemValue = data_get($item, $value); @@ -447,9 +475,9 @@ class Arr /** * Get a value from the array, and remove it. * - * @param array $array + * @param array $array * @param string $key - * @param mixed $default + * @param mixed $default * @return mixed */ public static function pull(&$array, $key, $default = null) @@ -506,9 +534,9 @@ class Arr * * If no key is given to the method, the entire array will be replaced. * - * @param array $array - * @param string $key - * @param mixed $value + * @param array $array + * @param string|null $key + * @param mixed $value * @return array */ public static function set(&$array, $key, $value) @@ -541,11 +569,18 @@ class Arr * Shuffle the given array and return the result. * * @param array $array + * @param int|null $seed * @return array */ - public static function shuffle($array) + public static function shuffle($array, $seed = null) { - shuffle($array); + if (is_null($seed)) { + shuffle($array); + } else { + mt_srand($seed); + shuffle($array); + mt_srand(); + } return $array; } @@ -585,6 +620,17 @@ class Arr return $array; } + /** + * Convert the array into a query string. + * + * @param array $array + * @return string + */ + public static function query($array) + { + return http_build_query($array, null, '&', PHP_QUERY_RFC3986); + } + /** * Filter the array using the given callback. * @@ -598,13 +644,17 @@ class Arr } /** - * If the given value is not an array, wrap it in one. + * If the given value is not an array and not null, wrap it in one. * * @param mixed $value * @return array */ public static function wrap($value) { - return ! is_array($value) ? [$value] : $value; + if (is_null($value)) { + return []; + } + + return is_array($value) ? $value : [$value]; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Carbon.php b/Seance5-6/seance/vendor/illuminate/support/Carbon.php index db1bdbef0121d8b5c9eac89399cce218a973e439..9383c3fd897da923aad69ab5c809a04eeee0eaa5 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Carbon.php +++ b/Seance5-6/seance/vendor/illuminate/support/Carbon.php @@ -2,47 +2,9 @@ namespace Illuminate\Support; -use JsonSerializable; use Carbon\Carbon as BaseCarbon; -use Illuminate\Support\Traits\Macroable; -class Carbon extends BaseCarbon implements JsonSerializable +class Carbon extends BaseCarbon { - use Macroable; - - /** - * The custom Carbon JSON serializer. - * - * @var callable|null - */ - protected static $serializer; - - /** - * 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; - } + // } diff --git a/Seance5-6/seance/vendor/illuminate/support/Collection.php b/Seance5-6/seance/vendor/illuminate/support/Collection.php index 38dd526f0365bb9c42504c7a868e28157e231d07..51a97db021597f28561acfdd2ff0f49b2f4dc55c 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Collection.php +++ b/Seance5-6/seance/vendor/illuminate/support/Collection.php @@ -2,23 +2,15 @@ namespace Illuminate\Support; -use stdClass; -use Countable; -use Exception; use ArrayAccess; -use Traversable; use ArrayIterator; -use CachingIterator; -use JsonSerializable; -use IteratorAggregate; -use Illuminate\Support\Debug\Dumper; +use Illuminate\Support\Traits\EnumeratesValues; use Illuminate\Support\Traits\Macroable; -use Illuminate\Contracts\Support\Jsonable; -use Illuminate\Contracts\Support\Arrayable; +use stdClass; -class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable +class Collection implements ArrayAccess, Enumerable { - use Macroable; + use EnumeratesValues, Macroable; /** * The items contained in the collection. @@ -27,16 +19,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate */ protected $items = []; - /** - * The methods that can be proxied. - * - * @var array - */ - protected static $proxies = [ - 'average', 'avg', 'contains', 'each', 'every', 'filter', 'first', 'flatMap', - 'keyBy', 'map', 'partition', 'reject', 'sortBy', 'sortByDesc', 'sum', 'unique', - ]; - /** * Create a new collection. * @@ -48,46 +30,11 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate $this->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); - } - - /** - * Wrap the given value in a collection if applicable. - * - * @param mixed $value - * @return static - */ - public static function wrap($value) - { - return $value instanceof self - ? new static($value) - : new static(Arr::wrap($value)); - } - - /** - * Get the underlying items from the given collection if applicable. - * - * @param array|static $value - * @return array - */ - public static function unwrap($value) - { - return $value instanceof self ? $value->all() : $value; - } - /** * Create a new collection by invoking the callback a given amount of times. * * @param int $number - * @param callable $callback + * @param callable|null $callback * @return static */ public static function times($number, callable $callback = null) @@ -114,46 +61,55 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Get the average value of a given key. + * Get a lazy collection for the items in this collection. * - * @param callable|string|null $callback - * @return mixed + * @return \Illuminate\Support\LazyCollection */ - public function avg($callback = null) + public function lazy() { - if ($count = $this->count()) { - return $this->sum($callback) / $count; - } + return new LazyCollection($this->items); } /** - * Alias for the "avg" method. + * Get the average value of a given key. * * @param callable|string|null $callback * @return mixed */ - public function average($callback = null) + public function avg($callback = null) { - return $this->avg($callback); + $callback = $this->valueRetriever($callback); + + $items = $this->map(function ($value) use ($callback) { + return $callback($value); + })->filter(function ($value) { + return ! is_null($value); + }); + + if ($count = $items->count()) { + return $items->sum() / $count; + } } /** * Get the median of a given key. * - * @param null $key + * @param string|array|null $key * @return mixed */ public function median($key = null) { - $count = $this->count(); + $values = (isset($key) ? $this->pluck($key) : $this) + ->filter(function ($item) { + return ! is_null($item); + })->sort()->values(); - if ($count == 0) { + $count = $values->count(); + + if ($count === 0) { return; } - $values = (isset($key) ? $this->pluck($key) : $this) - ->sort()->values(); - $middle = (int) ($count / 2); if ($count % 2) { @@ -168,14 +124,12 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate /** * Get the mode of a given key. * - * @param mixed $key + * @param string|array|null $key * @return array|null */ public function mode($key = null) { - $count = $this->count(); - - if ($count == 0) { + if ($this->count() === 0) { return; } @@ -216,7 +170,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate */ public function contains($key, $operator = null, $value = null) { - if (func_num_args() == 1) { + if (func_num_args() === 1) { if ($this->useAsCallable($key)) { $placeholder = new stdClass; @@ -229,28 +183,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return $this->contains($this->operatorForWhere(...func_get_args())); } - /** - * Determine if an item exists in the collection using strict comparison. - * - * @param mixed $key - * @param mixed $value - * @return bool - */ - public function containsStrict($key, $value = null) - { - if (func_num_args() == 2) { - return $this->contains(function ($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, true); - } - /** * Cross join with the given lists, returning all possible permutations. * @@ -265,55 +197,49 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Dump the collection and end the script. + * Get the items in the collection that are not present in the given items. * - * @return void + * @param mixed $items + * @return static */ - public function dd(...$args) + public function diff($items) { - http_response_code(500); - - call_user_func_array([$this, 'dump'], $args); - - die(1); + return new static(array_diff($this->items, $this->getArrayableItems($items))); } /** - * Dump the collection. + * Get the items in the collection that are not present in the given items, using the callback. * - * @return $this + * @param mixed $items + * @param callable $callback + * @return static */ - public function dump() + public function diffUsing($items, callable $callback) { - (new static(func_get_args())) - ->push($this) - ->each(function ($item) { - (new Dumper)->dump($item); - }); - - return $this; + return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); } /** - * Get the items in the collection that are not present in the given items. + * Get the items in the collection whose keys and values are not present in the given items. * * @param mixed $items * @return static */ - public function diff($items) + public function diffAssoc($items) { - return new static(array_diff($this->items, $this->getArrayableItems($items))); + return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); } /** - * Get the items in the collection whose keys and values are not present in the given items. + * Get the items in the collection whose keys and values are not present in the given items, using the callback. * * @param mixed $items + * @param callable $callback * @return static */ - public function diffAssoc($items) + public function diffAssocUsing($items, callable $callback) { - return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); + return new static(array_diff_uassoc($this->items, $this->getArrayableItems($items), $callback)); } /** @@ -328,60 +254,73 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Execute a callback over each item. + * Get the items in the collection whose keys are not present in the given items, using the callback. * + * @param mixed $items * @param callable $callback - * @return $this + * @return static */ - public function each(callable $callback) + public function diffKeysUsing($items, callable $callback) { - foreach ($this->items as $key => $item) { - if ($callback($item, $key) === false) { - break; + return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Retrieve duplicate items from the collection. + * + * @param callable|null $callback + * @param bool $strict + * @return static + */ + public function duplicates($callback = null, $strict = false) + { + $items = $this->map($this->valueRetriever($callback)); + + $uniqueItems = $items->unique(null, $strict); + + $compare = $this->duplicateComparator($strict); + + $duplicates = new static; + + foreach ($items as $key => $value) { + if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) { + $uniqueItems->shift(); + } else { + $duplicates[$key] = $value; } } - return $this; + return $duplicates; } /** - * Execute a callback over each nested chunk of items. + * Retrieve duplicate items from the collection using strict comparison. * - * @param callable $callback + * @param callable|null $callback * @return static */ - public function eachSpread(callable $callback) + public function duplicatesStrict($callback = null) { - return $this->each(function ($chunk, $key) use ($callback) { - $chunk[] = $key; - - return $callback(...$chunk); - }); + return $this->duplicates($callback, true); } /** - * Determine if all items in the collection pass the given test. + * Get the comparison function to detect duplicates. * - * @param string|callable $key - * @param mixed $operator - * @param mixed $value - * @return bool + * @param bool $strict + * @return \Closure */ - public function every($key, $operator = null, $value = null) + protected function duplicateComparator($strict) { - if (func_num_args() == 1) { - $callback = $this->valueRetriever($key); - - foreach ($this->items as $k => $v) { - if (! $callback($v, $k)) { - return false; - } - } - - return true; + if ($strict) { + return function ($a, $b) { + return $a === $b; + }; } - return $this->every($this->operatorForWhere(...func_get_args())); + return function ($a, $b) { + return $a == $b; + }; } /** @@ -392,7 +331,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate */ public function except($keys) { - if ($keys instanceof self) { + if ($keys instanceof Enumerable) { $keys = $keys->all(); } elseif (! is_array($keys)) { $keys = func_get_args(); @@ -417,165 +356,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Apply the callback if the value is truthy. - * - * @param bool $value - * @param callable $callback - * @param callable $default - * @return mixed - */ - public function when($value, callable $callback, callable $default = null) - { - if ($value) { - return $callback($this, $value); - } elseif ($default) { - return $default($this, $value); - } - - return $this; - } - - /** - * Apply the callback if the value is falsy. - * - * @param bool $value - * @param callable $callback - * @param callable $default - * @return mixed - */ - public function unless($value, callable $callback, callable $default = null) - { - return $this->when(! $value, $callback, $default); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param mixed $operator - * @param mixed $value - * @return static - */ - public function where($key, $operator, $value = null) - { - return $this->filter($this->operatorForWhere(...func_get_args())); - } - - /** - * Get an operator checker callback. - * - * @param string $key - * @param string $operator - * @param mixed $value - * @return \Closure - */ - protected function operatorForWhere($key, $operator, $value = null) - { - if (func_num_args() == 2) { - $value = $operator; - - $operator = '='; - } - - return function ($item) use ($key, $operator, $value) { - $retrieved = data_get($item, $key); - - $strings = array_filter([$retrieved, $value], function ($value) { - return is_string($value) || (is_object($value) && method_exists($value, '__toString')); - }); - - if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) { - return in_array($operator, ['!=', '<>', '!==']); - } - - switch ($operator) { - default: - case '=': - case '==': return $retrieved == $value; - case '!=': - case '<>': return $retrieved != $value; - case '<': return $retrieved < $value; - case '>': return $retrieved > $value; - case '<=': return $retrieved <= $value; - case '>=': return $retrieved >= $value; - case '===': return $retrieved === $value; - case '!==': return $retrieved !== $value; - } - }; - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param mixed $value - * @return static - */ - public function whereStrict($key, $value) - { - return $this->where($key, '===', $value); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param mixed $values - * @param bool $strict - * @return static - */ - public function whereIn($key, $values, $strict = false) - { - $values = $this->getArrayableItems($values); - - return $this->filter(function ($item) use ($key, $values, $strict) { - return in_array(data_get($item, $key), $values, $strict); - }); - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param mixed $values - * @return static - */ - public function whereInStrict($key, $values) - { - return $this->whereIn($key, $values, true); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param mixed $values - * @param bool $strict - * @return static - */ - public function whereNotIn($key, $values, $strict = false) - { - $values = $this->getArrayableItems($values); - - return $this->reject(function ($item) use ($key, $values, $strict) { - return in_array(data_get($item, $key), $values, $strict); - }); - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param mixed $values - * @return static - */ - public function whereNotInStrict($key, $values) - { - return $this->whereNotIn($key, $values, true); - } - - /** - * Get the first item from the collection. + * Get the first item from the collection passing the given truth test. * * @param callable|null $callback * @param mixed $default @@ -586,19 +367,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return Arr::first($this->items, $callback, $default); } - /** - * Get the first item by the given key value pair. - * - * @param string $key - * @param mixed $operator - * @param mixed $value - * @return static - */ - public function firstWhere($key, $operator, $value = null) - { - return $this->first($this->operatorForWhere(...func_get_args())); - } - /** * Get a flattened array of the items in the collection. * @@ -654,7 +422,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate /** * Group an associative array by a field or using a callback. * - * @param callable|string $groupBy + * @param array|callable|string $groupBy * @param bool $preserveKeys * @return static */ @@ -745,7 +513,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate * Concatenate values of a given key as a string. * * @param string $value - * @param string $glue + * @param string|null $glue * @return string */ public function implode($value, $glue = null) @@ -794,24 +562,33 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Determine if the collection is not empty. + * Join all items from the collection using a string. The final items can use a separate glue string. * - * @return bool + * @param string $glue + * @param string $finalGlue + * @return string */ - public function isNotEmpty() + public function join($glue, $finalGlue = '') { - return ! $this->isEmpty(); - } + if ($finalGlue === '') { + return $this->implode($glue); + } - /** - * 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); + $count = $this->count(); + + if ($count === 0) { + return ''; + } + + if ($count === 1) { + return $this->last(); + } + + $collection = new static($this->items); + + $finalItem = $collection->pop(); + + return $collection->implode($glue).$finalGlue.$finalItem; } /** @@ -864,52 +641,32 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Run a map over each nested chunk of items. + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. * * @param callable $callback * @return static */ - public function mapSpread(callable $callback) + public function mapToDictionary(callable $callback) { - return $this->map(function ($chunk, $key) use ($callback) { - $chunk[] = $key; + $dictionary = []; - return $callback(...$chunk); - }); - } + foreach ($this->items as $key => $item) { + $pair = $callback($item, $key); - /** - * Run a dictionary map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @param callable $callback - * @return static - */ - public function mapToDictionary(callable $callback) - { - $dictionary = $this->map($callback)->reduce(function ($groups, $pair) { - $groups[key($pair)][] = reset($pair); + $key = key($pair); - return $groups; - }, []); + $value = reset($pair); - return new static($dictionary); - } + if (! isset($dictionary[$key])) { + $dictionary[$key] = []; + } - /** - * Run a grouping map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @param callable $callback - * @return static - */ - public function mapToGroups(callable $callback) - { - $groups = $this->mapToDictionary($callback); + $dictionary[$key][] = $value; + } - return $groups->map([$this, 'make']); + return new static($dictionary); } /** @@ -936,57 +693,25 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * 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(); - } - - /** - * Map the values into a new class. + * Merge the collection with the given items. * - * @param string $class + * @param mixed $items * @return static */ - public function mapInto($class) - { - return $this->map(function ($value, $key) use ($class) { - return new $class($value, $key); - }); - } - - /** - * Get the max value of a given key. - * - * @param callable|string|null $callback - * @return mixed - */ - public function max($callback = null) + public function merge($items) { - $callback = $this->valueRetriever($callback); - - return $this->filter(function ($value) { - return ! is_null($value); - })->reduce(function ($result, $item) use ($callback) { - $value = $callback($item); - - return is_null($result) || $value > $result ? $value : $result; - }); + return new static(array_merge($this->items, $this->getArrayableItems($items))); } /** - * Merge the collection with the given items. + * Recursively merge the collection with the given items. * * @param mixed $items * @return static */ - public function merge($items) + public function mergeRecursive($items) { - return new static(array_merge($this->items, $this->getArrayableItems($items))); + return new static(array_merge_recursive($this->items, $this->getArrayableItems($items))); } /** @@ -1011,25 +736,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return new static($this->items + $this->getArrayableItems($items)); } - /** - * Get the min value of a given key. - * - * @param callable|string|null $callback - * @return mixed - */ - public function min($callback = null) - { - $callback = $this->valueRetriever($callback); - - return $this->filter(function ($value) { - return ! is_null($value); - })->reduce(function ($result, $item) use ($callback) { - $value = $callback($item); - - return is_null($result) || $value < $result ? $value : $result; - }); - } - /** * Create a new collection consisting of every n-th element. * @@ -1066,7 +772,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return new static($this->items); } - if ($keys instanceof self) { + if ($keys instanceof Enumerable) { $keys = $keys->all(); } @@ -1075,50 +781,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate 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) - { - $offset = max(0, ($page - 1) * $perPage); - - return $this->slice($offset, $perPage); - } - - /** - * Partition the collection into two arrays using the given callback or key. - * - * @param callable|string $callback - * @return static - */ - public function partition($callback) - { - $partitions = [new static, new static]; - - $callback = $this->valueRetriever($callback); - - foreach ($this->items as $key => $item) { - $partitions[(int) ! $callback($item, $key)][$key] = $item; - } - - return new static($partitions); - } - - /** - * Pass the collection to the given callback and return the result. - * - * @param callable $callback - * @return mixed - */ - public function pipe(callable $callback) - { - return $callback($this); - } - /** * Get and remove the last item from the collection. * @@ -1144,14 +806,16 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Push an item onto the end of the collection. + * Push one or more items onto the end of the collection. * - * @param mixed $value + * @param mixed $values [optional] * @return $this */ - public function push($value) + public function push(...$values) { - $this->offsetSet(null, $value); + foreach ($values as $value) { + $this->items[] = $value; + } return $this; } @@ -1159,8 +823,8 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate /** * Push all of the given items onto the collection. * - * @param \Traversable $source - * @return $this + * @param iterable $source + * @return static */ public function concat($source) { @@ -1203,7 +867,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate * Get one or a specified number of items randomly from the collection. * * @param int|null $number - * @return mixed + * @return static|mixed * * @throws \InvalidArgumentException */ @@ -1229,22 +893,25 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Create a collection of all elements that do not pass a given truth test. + * Replace the collection items with the given items. * - * @param callable|mixed $callback + * @param mixed $items * @return static */ - public function reject($callback) + public function replace($items) { - if ($this->useAsCallable($callback)) { - return $this->filter(function ($value, $key) use ($callback) { - return ! $callback($value, $key); - }); - } + return new static(array_replace($this->items, $this->getArrayableItems($items))); + } - return $this->filter(function ($item) use ($callback) { - return $item != $callback; - }); + /** + * Recursively replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replaceRecursive($items) + { + return new static(array_replace_recursive($this->items, $this->getArrayableItems($items))); } /** @@ -1271,7 +938,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } foreach ($this->items as $key => $item) { - if (call_user_func($value, $item, $key)) { + if ($value($item, $key)) { return $key; } } @@ -1292,31 +959,30 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate /** * Shuffle the items in the collection. * - * @param int $seed + * @param int|null $seed * @return static */ public function shuffle($seed = null) { - $items = $this->items; - - if (is_null($seed)) { - shuffle($items); - } else { - srand($seed); - - usort($items, function () { - return rand(-1, 1); - }); - } + return new static(Arr::shuffle($this->items, $seed)); + } - return new static($items); + /** + * Skip the first {$count} items. + * + * @param int $count + * @return static + */ + public function skip($count) + { + return $this->slice($count); } /** * Slice the underlying collection array. * * @param int $offset - * @param int $length + * @param int|null $length * @return static */ public function slice($offset, $length = null) @@ -1336,13 +1002,33 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return new static; } - $groupSize = ceil($this->count() / $numberOfGroups); + $groups = new static; + + $groupSize = floor($this->count() / $numberOfGroups); + + $remain = $this->count() % $numberOfGroups; + + $start = 0; + + for ($i = 0; $i < $numberOfGroups; $i++) { + $size = $groupSize; - return $this->chunk($groupSize); + if ($i < $remain) { + $size++; + } + + if ($size) { + $groups->push(new static(array_slice($this->items, $start, $size))); + + $start += $size; + } + } + + return $groups; } /** - * Chunk the underlying collection array. + * Chunk the collection into chunks of the given size. * * @param int $size * @return static @@ -1368,13 +1054,28 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate * @param callable|null $callback * @return static */ - public function sort(callable $callback = null) + public function sort($callback = null) { $items = $this->items; - $callback + $callback && is_callable($callback) ? uasort($items, $callback) - : asort($items); + : asort($items, $callback); + + return new static($items); + } + + /** + * Sort items in descending order. + * + * @param int $options + * @return static + */ + public function sortDesc($options = SORT_REGULAR) + { + $items = $this->items; + + arsort($items, $options); return new static($items); } @@ -1426,39 +1127,47 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Splice a portion of the underlying collection array. + * Sort the collection keys. * - * @param int $offset - * @param int|null $length - * @param mixed $replacement + * @param int $options + * @param bool $descending * @return static */ - public function splice($offset, $length = null, $replacement = []) + public function sortKeys($options = SORT_REGULAR, $descending = false) { - if (func_num_args() == 1) { - return new static(array_splice($this->items, $offset)); - } + $items = $this->items; - return new static(array_splice($this->items, $offset, $length, $replacement)); + $descending ? krsort($items, $options) : ksort($items, $options); + + return new static($items); } /** - * Get the sum of the given values. + * Sort the collection keys in descending order. * - * @param callable|string|null $callback - * @return mixed + * @param int $options + * @return static */ - public function sum($callback = null) + public function sortKeysDesc($options = SORT_REGULAR) { - if (is_null($callback)) { - return array_sum($this->items); - } + return $this->sortKeys($options, true); + } - $callback = $this->valueRetriever($callback); + /** + * 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 $this->reduce(function ($result, $item) use ($callback) { - return $result + $callback($item); - }, 0); + return new static(array_splice($this->items, $offset, $length, $replacement)); } /** @@ -1476,19 +1185,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return $this->slice(0, $limit); } - /** - * Pass the collection to the given callback and then return it. - * - * @param callable $callback - * @return $this - */ - public function tap(callable $callback) - { - $callback(new static($this->items)); - - return $this; - } - /** * Transform each item in the collection using a callback. * @@ -1502,43 +1198,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return $this; } - /** - * Return only unique items from the collection array. - * - * @param string|callable|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false) - { - if (is_null($key)) { - return new static(array_unique($this->items, SORT_REGULAR)); - } - - $callback = $this->valueRetriever($key); - - $exists = []; - - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { - if (in_array($id = $callback($item, $key), $exists, $strict)) { - return true; - } - - $exists[] = $id; - }); - } - - /** - * Return only unique items from the collection array using strict comparison. - * - * @param string|callable|null $key - * @return static - */ - public function uniqueStrict($key = null) - { - return $this->unique($key, true); - } - /** * Reset the keys on the underlying array. * @@ -1549,23 +1208,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate 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. * @@ -1600,49 +1242,6 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate return new static(array_pad($this->items, $size, $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 array_map(function ($value) { - if ($value instanceof JsonSerializable) { - return $value->jsonSerialize(); - } elseif ($value instanceof Jsonable) { - return json_decode($value->toJson(), true); - } elseif ($value instanceof Arrayable) { - return $value->toArray(); - } - - return $value; - }, $this->items); - } - - /** - * Get the collection of items as JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } - /** * Get an iterator for the items. * @@ -1654,24 +1253,26 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate } /** - * Get a CachingIterator instance. + * Count the number of items in the collection. * - * @param int $flags - * @return \CachingIterator + * @return int */ - public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) + public function count() { - return new CachingIterator($this->getIterator(), $flags); + return count($this->items); } /** - * Count the number of items in the collection. + * Add an item to the collection. * - * @return int + * @param mixed $item + * @return $this */ - public function count() + public function add($item) { - return count($this->items); + $this->items[] = $item; + + return $this; } /** @@ -1732,67 +1333,4 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate { 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 (is_array($items)) { - return $items; - } elseif ($items instanceof self) { - return $items->all(); - } elseif ($items instanceof Arrayable) { - return $items->toArray(); - } elseif ($items instanceof Jsonable) { - return json_decode($items->toJson(), true); - } elseif ($items instanceof JsonSerializable) { - return $items->jsonSerialize(); - } elseif ($items instanceof Traversable) { - return iterator_to_array($items); - } - - return (array) $items; - } - - /** - * Add a method to the list of proxied methods. - * - * @param string $method - * @return void - */ - public static function proxy($method) - { - static::$proxies[] = $method; - } - - /** - * Dynamically access collection proxies. - * - * @param string $key - * @return mixed - * - * @throws \Exception - */ - public function __get($key) - { - if (! in_array($key, static::$proxies)) { - throw new Exception("Property [{$key}] does not exist on this collection instance."); - } - - return new HigherOrderCollectionProxy($this, $key); - } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Composer.php b/Seance5-6/seance/vendor/illuminate/support/Composer.php index bc76aeb24699614a2b0590838fd21590703cdec2..7eca930cb3370a98fe97d60d2202ccb639eb4dcc 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Composer.php +++ b/Seance5-6/seance/vendor/illuminate/support/Composer.php @@ -3,8 +3,8 @@ namespace Illuminate\Support; use Illuminate\Filesystem\Filesystem; -use Symfony\Component\Process\Process; use Symfony\Component\Process\PhpExecutableFinder; +use Symfony\Component\Process\Process; class Composer { @@ -18,7 +18,7 @@ class Composer /** * The working path to regenerate from. * - * @var string + * @var string|null */ protected $workingPath; @@ -38,16 +38,16 @@ class Composer /** * Regenerate the Composer autoloader files. * - * @param string $extra + * @param string|array $extra * @return void */ public function dumpAutoloads($extra = '') { - $process = $this->getProcess(); + $extra = $extra ? (array) $extra : []; - $process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra)); + $command = array_merge($this->findComposer(), ['dump-autoload'], $extra); - $process->run(); + $this->getProcess($command)->run(); } /** @@ -63,25 +63,36 @@ class Composer /** * Get the composer command for the environment. * - * @return string + * @return array */ protected function findComposer() { if ($this->files->exists($this->workingPath.'/composer.phar')) { - return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)).' composer.phar'; + return [$this->phpBinary(), 'composer.phar']; } - return 'composer'; + return ['composer']; + } + + /** + * Get the PHP binary. + * + * @return string + */ + protected function phpBinary() + { + return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); } /** * Get a new Symfony process instance. * + * @param array $command * @return \Symfony\Component\Process\Process */ - protected function getProcess() + protected function getProcess(array $command) { - return (new Process('', $this->workingPath))->setTimeout(null); + return (new Process($command, $this->workingPath))->setTimeout(null); } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Debug/Dumper.php b/Seance5-6/seance/vendor/illuminate/support/Debug/Dumper.php deleted file mode 100644 index 7442343f80976893448a9becb8c24d85d7057150..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/support/Debug/Dumper.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Illuminate\Support\Debug; - -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; - -class Dumper -{ - /** - * Dump a value with elegance. - * - * @param mixed $value - * @return void - */ - public function dump($value) - { - if (class_exists(CliDumper::class)) { - $dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper; - - $dumper->dump((new VarCloner)->cloneVar($value)); - } else { - var_dump($value); - } - } -} diff --git a/Seance5-6/seance/vendor/illuminate/support/Debug/HtmlDumper.php b/Seance5-6/seance/vendor/illuminate/support/Debug/HtmlDumper.php deleted file mode 100644 index 5825ac8dba7c257bc67938279cde48989b2f6b87..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/support/Debug/HtmlDumper.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Illuminate\Support\Debug; - -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/Seance5-6/seance/vendor/illuminate/support/Facades/App.php b/Seance5-6/seance/vendor/illuminate/support/Facades/App.php index 0e9e6370f2f00c1a7cfc684a97f0978f56b59c8a..67e0b4c233e44da5d1ef72c5d8fad671afc91bfb 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/App.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/App.php @@ -5,17 +5,44 @@ namespace Illuminate\Support\Facades; /** * @method static string version() * @method static string basePath() - * @method static string environment() + * @method static string bootstrapPath(string $path = '') + * @method static string configPath(string $path = '') + * @method static string databasePath(string $path = '') + * @method static string environmentPath() + * @method static string resourcePath(string $path = '') + * @method static string storagePath(string $path = '') + * @method static string|bool environment(string|array ...$environments) + * @method static bool runningInConsole() + * @method static bool runningUnitTests() * @method static bool isDownForMaintenance() * @method static void registerConfiguredProviders() - * @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, array $options = [], bool $force = false) + * @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, bool $force = false) * @method static void registerDeferredProvider(string $provider, string $service = null) + * @method static \Illuminate\Support\ServiceProvider resolveProvider(string $provider) * @method static void boot() - * @method static void booting(mixed $callback) - * @method static void booted(mixed $callback) + * @method static void booting(callable $callback) + * @method static void booted(callable $callback) + * @method static void bootstrapWith(array $bootstrappers) + * @method static bool configurationIsCached() + * @method static string detectEnvironment(callable $callback) + * @method static string environmentFile() + * @method static string environmentFilePath() + * @method static string getCachedConfigPath() * @method static string getCachedServicesPath() + * @method static string getCachedPackagesPath() + * @method static string getCachedRoutesPath() + * @method static string getLocale() + * @method static string getNamespace() + * @method static array getProviders(\Illuminate\Support\ServiceProvider|string $provider) + * @method static bool hasBeenBootstrapped() + * @method static void loadDeferredProviders() + * @method static \Illuminate\Contracts\Foundation\Application loadEnvironmentFrom(string $file) + * @method static bool routesAreCached() + * @method static void setLocale(string $locale) + * @method static bool shouldSkipMiddleware() + * @method static void terminate() * - * @see \Illuminate\Foundation\Application + * @see \Illuminate\Contracts\Foundation\Application */ class App extends Facade { diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Artisan.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Artisan.php index 8be0b5c7e63c0b4dbe23e177a15dab74ffbcc7b5..d4c7391b61d4e6cfd76d14613cdde984c2bdc249 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Artisan.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Artisan.php @@ -5,11 +5,13 @@ namespace Illuminate\Support\Facades; use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract; /** - * @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output = null) - * @method static int call(string $command, array $parameters = [], $outputBuffer = null) - * @method static int queue(string $command, array $parameters = []) + * @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface|null $output = null) + * @method static int call(string $command, array $parameters = [], \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer = null) + * @method static \Illuminate\Foundation\Bus\PendingDispatch queue(string $command, array $parameters = []) * @method static array all() * @method static string output() + * @method static void terminate(\Symfony\Component\Console\Input\InputInterface $input, int $status) + * @method static \Illuminate\Foundation\Console\ClosureCommand command(string $command, callable $callback) * * @see \Illuminate\Contracts\Console\Kernel */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Auth.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Auth.php index 3f9d0d28243d7a72a07589694927fac707dcf6fc..bc19fb0289bd0614d1d38f59996c4c67d32c4173 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Auth.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Auth.php @@ -18,6 +18,11 @@ namespace Illuminate\Support\Facades; * @method static bool onceUsingId(mixed $id) * @method static bool viaRemember() * @method static void logout() + * @method static \Symfony\Component\HttpFoundation\Response|null onceBasic(string $field = 'email',array $extraConditions = []) + * @method static bool|null logoutOtherDevices(string $password, string $attribute = 'password') + * @method static \Illuminate\Contracts\Auth\UserProvider|null createUserProvider(string $provider = null) + * @method static \Illuminate\Auth\AuthManager extend(string $driver, \Closure $callback) + * @method static \Illuminate\Auth\AuthManager provider(string $name, \Closure $callback) * * @see \Illuminate\Auth\AuthManager * @see \Illuminate\Contracts\Auth\Factory @@ -39,10 +44,11 @@ class Auth extends Facade /** * Register the typical authentication routes for an application. * + * @param array $options * @return void */ - public static function routes() + public static function routes(array $options = []) { - static::$app->make('router')->auth(); + static::$app->make('router')->auth($options); } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Blade.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Blade.php index b016a46c25ca00130861b8514a6f319406ea4e27..003176c72f305b770fc7eaeccf3858dc19faaced 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Blade.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Blade.php @@ -3,6 +3,23 @@ namespace Illuminate\Support\Facades; /** + * @method static void compile(string|null $path = null) + * @method static string getPath() + * @method static void setPath(string $path) + * @method static string compileString(string $value) + * @method static string stripParentheses(string $expression) + * @method static void extend(callable $compiler) + * @method static array getExtensions() + * @method static void if(string $name, callable $callback) + * @method static bool check(string $name, array ...$parameters) + * @method static void component(string $path, string|null $alias = null) + * @method static void include(string $path, string|null $alias = null) + * @method static void directive(string $name, callable $handler) + * @method static array getCustomDirectives() + * @method static void setEchoFormat(string $format) + * @method static void withDoubleEncoding() + * @method static void withoutDoubleEncoding() + * * @see \Illuminate\View\Compilers\BladeCompiler */ class Blade extends Facade @@ -14,6 +31,6 @@ class Blade extends Facade */ protected static function getFacadeAccessor() { - return static::$app['view']->getEngineResolver()->resolve('blade')->getCompiler(); + return 'blade.compiler'; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Broadcast.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Broadcast.php index 81af932174668dec05ea62cd9aeb05582a523686..23e9e0f145ad1ca517a144a195ab24910aafcdf0 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Broadcast.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Broadcast.php @@ -5,6 +5,11 @@ namespace Illuminate\Support\Facades; use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactoryContract; /** + * @method static void connection($name = null); + * @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback, array $options = []) + * @method static mixed auth(\Illuminate\Http\Request $request) + * @method static void routes() + * * @see \Illuminate\Contracts\Broadcasting\Factory */ class Broadcast extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Bus.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Bus.php index eeebac4f511c17991006587280731af8888e67fd..dea462050a2d1795244b154f3226bbed2eb5ddf9 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Bus.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Bus.php @@ -2,10 +2,21 @@ namespace Illuminate\Support\Facades; -use Illuminate\Support\Testing\Fakes\BusFake; use Illuminate\Contracts\Bus\Dispatcher as BusDispatcherContract; +use Illuminate\Foundation\Bus\PendingChain; +use Illuminate\Support\Testing\Fakes\BusFake; /** + * @method static mixed dispatch($command) + * @method static mixed dispatchNow($command, $handler = null) + * @method static bool hasCommandHandler($command) + * @method static bool|mixed getCommandHandler($command) + * @method static \Illuminate\Contracts\Bus\Dispatcher pipeThrough(array $pipes) + * @method static \Illuminate\Contracts\Bus\Dispatcher map(array $map) + * @method static void assertDispatched(string $command, callable|int $callback = null) + * @method static void assertDispatchedTimes(string $command, int $times = 1) + * @method static void assertNotDispatched(string $command, callable|int $callback = null) + * * @see \Illuminate\Contracts\Bus\Dispatcher */ class Bus extends Facade @@ -13,11 +24,28 @@ class Bus extends Facade /** * Replace the bound instance with a fake. * - * @return void + * @param array|string $jobsToFake + * @return \Illuminate\Support\Testing\Fakes\BusFake + */ + public static function fake($jobsToFake = []) + { + static::swap($fake = new BusFake(static::getFacadeRoot(), $jobsToFake)); + + return $fake; + } + + /** + * Dispatch the given chain of jobs. + * + * @param array|mixed $jobs + * @return \Illuminate\Foundation\Bus\PendingDispatch */ - public static function fake() + public static function dispatchChain($jobs) { - static::swap(new BusFake); + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + return (new PendingChain(array_shift($jobs), $jobs)) + ->dispatch(); } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Cache.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Cache.php index 2e32301faf1e6afb206a301acc46dc3e0ecf910c..26e584ce7e1ed764879fdc3af966f13d92dc0820 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Cache.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Cache.php @@ -3,6 +3,22 @@ namespace Illuminate\Support\Facades; /** + * @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null) + * @method static bool has(string $key) + * @method static bool missing(string $key) + * @method static mixed get(string $key, mixed $default = null) + * @method static mixed pull(string $key, mixed $default = null) + * @method static bool put(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl) + * @method static bool add(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl) + * @method static int|bool increment(string $key, $value = 1) + * @method static int|bool decrement(string $key, $value = 1) + * @method static bool forever(string $key, $value) + * @method static mixed remember(string $key, \DateTimeInterface|\DateInterval|int $ttl, \Closure $callback) + * @method static mixed sear(string $key, \Closure $callback) + * @method static mixed rememberForever(string $key, \Closure $callback) + * @method static bool forget(string $key) + * @method static \Illuminate\Contracts\Cache\Store getStore() + * * @see \Illuminate\Cache\CacheManager * @see \Illuminate\Cache\Repository */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Config.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Config.php index 3eb4fdf35d1b171acd1828758f594819dde4b014..e1fa74abca1cbf1cc00bc69e39741e27091478df 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Config.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Config.php @@ -3,6 +3,13 @@ namespace Illuminate\Support\Facades; /** + * @method static bool has($key) + * @method static mixed get($key, $default = null) + * @method static array all() + * @method static void set($key, $value = null) + * @method static void prepend($key, $value) + * @method static void push($key, $value) + * * @see \Illuminate\Config\Repository */ class Config extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Cookie.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Cookie.php index bbcd5a30fd73aec7e02e57e04f1ad60fb64a802d..245ed1ec71b3303178272d69aa4ffd43ebb599c2 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Cookie.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Cookie.php @@ -3,6 +3,10 @@ namespace Illuminate\Support\Facades; /** + * @method static void queue(...$parameters) + * @method static unqueue($name) + * @method static array getQueuedCookies() + * * @see \Illuminate\Cookie\CookieJar */ class Cookie extends Facade @@ -21,9 +25,9 @@ class Cookie extends Facade /** * Retrieve a cookie from the request. * - * @param string $key - * @param mixed $default - * @return string + * @param string|null $key + * @param mixed $default + * @return string|array|null */ public static function get($key = null, $default = null) { diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Crypt.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Crypt.php index 0eef08d1bddbbcd288f19ded8c27d8c028115422..20f269d9b416350ca2211be56c771a9af1d863be 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Crypt.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Crypt.php @@ -3,6 +3,14 @@ namespace Illuminate\Support\Facades; /** + * @method static bool supported(string $key, string $cipher) + * @method static string generateKey(string $cipher) + * @method static string encrypt(mixed $value, bool $serialize = true) + * @method static string encryptString(string $value) + * @method static mixed decrypt(string $payload, bool $unserialize = true) + * @method static string decryptString(string $payload) + * @method static string getKey() + * * @see \Illuminate\Encryption\Encrypter */ class Crypt extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/DB.php b/Seance5-6/seance/vendor/illuminate/support/Facades/DB.php index 0369128e3e91f77334e6e821ab13a86294c10633..a249b4a099b4f718dec5fc29e4c41290b72f6374 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/DB.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/DB.php @@ -3,6 +3,28 @@ namespace Illuminate\Support\Facades; /** + * @method static \Illuminate\Database\ConnectionInterface connection(string $name = null) + * @method static string getDefaultConnection() + * @method static void setDefaultConnection(string $name) + * @method static \Illuminate\Database\Query\Builder table(string $table) + * @method static \Illuminate\Database\Query\Expression raw($value) + * @method static mixed selectOne(string $query, array $bindings = []) + * @method static array select(string $query, array $bindings = []) + * @method static bool insert(string $query, array $bindings = []) + * @method static int update(string $query, array $bindings = []) + * @method static int delete(string $query, array $bindings = []) + * @method static bool statement(string $query, array $bindings = []) + * @method static int affectingStatement(string $query, array $bindings = []) + * @method static bool unprepared(string $query) + * @method static array prepareBindings(array $bindings) + * @method static mixed transaction(\Closure $callback, int $attempts = 1) + * @method static void beginTransaction() + * @method static void commit() + * @method static void rollBack() + * @method static int transactionLevel() + * @method static array pretend(\Closure $callback) + * @method static void listen(\Closure $callback) + * * @see \Illuminate\Database\DatabaseManager * @see \Illuminate\Database\Connection */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Event.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Event.php index 11757f029d591657fe502f81029bb30c93ab91bd..32f1743ea70b2d21f30f85de93e168035da37416 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Event.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Event.php @@ -6,6 +6,23 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Testing\Fakes\EventFake; /** + * @method static void listen(string|array $events, \Closure|string $listener) + * @method static bool hasListeners(string $eventName) + * @method static void push(string $event, array $payload = []) + * @method static void flush(string $event) + * @method static void subscribe(object|string $subscriber) + * @method static array|null until(string|object $event, mixed $payload = []) + * @method static array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false) + * @method static array getListeners(string $eventName) + * @method static \Closure makeListener(\Closure|string $listener, bool $wildcard = false) + * @method static \Closure createClassListener(string $listener, bool $wildcard = false) + * @method static void forget(string $event) + * @method static void forgetPushed() + * @method static \Illuminate\Events\Dispatcher setQueueResolver(callable $resolver) + * @method static void assertDispatched(string $event, callable|int $callback = null) + * @method static void assertDispatchedTimes(string $event, int $times = 1) + * @method static void assertNotDispatched(string $event, callable|int $callback = null) + * * @see \Illuminate\Events\Dispatcher */ class Event extends Facade @@ -14,13 +31,37 @@ class Event extends Facade * Replace the bound instance with a fake. * * @param array|string $eventsToFake - * @return void + * @return \Illuminate\Support\Testing\Fakes\EventFake */ public static function fake($eventsToFake = []) { static::swap($fake = new EventFake(static::getFacadeRoot(), $eventsToFake)); Model::setEventDispatcher($fake); + Cache::refreshEventDispatcher(); + + return $fake; + } + + /** + * Replace the bound instance with a fake during the given callable's execution. + * + * @param callable $callable + * @param array $eventsToFake + * @return callable + */ + public static function fakeFor(callable $callable, array $eventsToFake = []) + { + $originalDispatcher = static::getFacadeRoot(); + + static::fake($eventsToFake); + + return tap($callable(), function () use ($originalDispatcher) { + static::swap($originalDispatcher); + + Model::setEventDispatcher($originalDispatcher); + Cache::refreshEventDispatcher(); + }); } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Facade.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Facade.php index c53180ccf8bfc2c1b1514dc1416995a64476fb61..64c39b43340e4ad685dd6f195d0b73c2760749fb 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Facade.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Facade.php @@ -2,9 +2,10 @@ namespace Illuminate\Support\Facades; +use Closure; use Mockery; -use RuntimeException; use Mockery\MockInterface; +use RuntimeException; abstract class Facade { @@ -23,19 +24,56 @@ abstract class Facade protected static $resolvedInstance; /** - * Convert the facade into a Mockery spy. + * Run a Closure when the facade has been resolved. * + * @param \Closure $callback * @return void */ + public static function resolved(Closure $callback) + { + $accessor = static::getFacadeAccessor(); + + if (static::$app->resolved($accessor) === true) { + $callback(static::getFacadeRoot()); + } + + static::$app->afterResolving($accessor, function ($service) use ($callback) { + $callback($service); + }); + } + + /** + * Convert the facade into a Mockery spy. + * + * @return \Mockery\MockInterface + */ public static function spy() { if (! static::isMock()) { $class = static::getMockableClass(); - static::swap($class ? Mockery::spy($class) : Mockery::spy()); + return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { + static::swap($spy); + }); } } + /** + * Initiate a partial mock on the facade. + * + * @return \Mockery\MockInterface + */ + public static function partialMock() + { + $name = static::getFacadeAccessor(); + + $mock = static::isMock() + ? static::$resolvedInstance[$name] + : static::createFreshMockInstance(); + + return $mock->makePartial(); + } + /** * Initiate a mock expectation on the facade. * @@ -55,7 +93,7 @@ abstract class Facade /** * Create a fresh mock instance for the given class. * - * @return \Mockery\Expectation + * @return \Mockery\MockInterface */ protected static function createFreshMockInstance() { @@ -143,7 +181,7 @@ abstract class Facade /** * Resolve the facade root instance from the container. * - * @param string|object $name + * @param object|string $name * @return mixed */ protected static function resolveFacadeInstance($name) @@ -156,7 +194,9 @@ abstract class Facade return static::$resolvedInstance[$name]; } - return static::$resolvedInstance[$name] = static::$app[$name]; + if (static::$app) { + return static::$resolvedInstance[$name] = static::$app[$name]; + } } /** @@ -205,7 +245,7 @@ abstract class Facade * Handle dynamic, static calls to the object. * * @param string $method - * @param array $args + * @param array $args * @return mixed * * @throws \RuntimeException diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/File.php b/Seance5-6/seance/vendor/illuminate/support/Facades/File.php index 0f81bf62a9699b9be8c0021b31b3af7b33cae303..c23a1dc6f58a574c5bd767bde5f92f8f5b17d8a8 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/File.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/File.php @@ -3,6 +3,45 @@ namespace Illuminate\Support\Facades; /** + * @method static bool exists(string $path) + * @method static string get(string $path, bool $lock = false) + * @method static string sharedGet(string $path) + * @method static mixed getRequire(string $path) + * @method static mixed requireOnce(string $file) + * @method static string hash(string $path) + * @method static int|bool put(string $path, string $contents, bool $lock = false) + * @method static void replace(string $path, string $content) + * @method static int prepend(string $path, string $data) + * @method static int append(string $path, string $data) + * @method static mixed chmod(string $path, int|null $mode = null) + * @method static bool delete(string|array $paths) + * @method static bool move(string $path, string $target) + * @method static bool copy(string $path, string $target) + * @method static void link(string $target, string $link) + * @method static string name(string $path) + * @method static string basename(string $path) + * @method static string dirname(string $path) + * @method static string extension(string $path) + * @method static string type(string $path) + * @method static string|false mimeType(string $path) + * @method static int size(string $path) + * @method static int lastModified(string $path) + * @method static bool isDirectory(string $directory) + * @method static bool isReadable(string $path) + * @method static bool isWritable(string $path) + * @method static bool isFile(string $file) + * @method static array glob(string $pattern, int $flags = 0) + * @method static \Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden = false) + * @method static \Symfony\Component\Finder\SplFileInfo[] allFiles(string $directory, bool $hidden = false) + * @method static array directories(string $directory) + * @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true) + * @method static bool makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false) + * @method static bool moveDirectory(string $from, string $to, bool $overwrite = false) + * @method static bool copyDirectory(string $directory, string $destination, int|null $options = null) + * @method static bool deleteDirectory(string $directory, bool $preserve = false) + * @method static bool deleteDirectories(string $directory) + * @method static bool cleanDirectory(string $directory) + * * @see \Illuminate\Filesystem\Filesystem */ class File extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Gate.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Gate.php index 62977c63e5fe1ffa5413428681f8a3627b8e8aeb..0c172e2851337c3e9a2cef8b9584fc7149a1c0cd 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Gate.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Gate.php @@ -5,6 +5,23 @@ namespace Illuminate\Support\Facades; use Illuminate\Contracts\Auth\Access\Gate as GateContract; /** + * @method static bool has(string $ability) + * @method static \Illuminate\Contracts\Auth\Access\Gate define(string $ability, callable|string $callback) + * @method static \Illuminate\Contracts\Auth\Access\Gate policy(string $class, string $policy) + * @method static \Illuminate\Contracts\Auth\Access\Gate before(callable $callback) + * @method static \Illuminate\Contracts\Auth\Access\Gate after(callable $callback) + * @method static bool allows(string $ability, array|mixed $arguments = []) + * @method static bool denies(string $ability, array|mixed $arguments = []) + * @method static bool check(iterable|string $abilities, array|mixed $arguments = []) + * @method static bool any(iterable|string $abilities, array|mixed $arguments = []) + * @method static \Illuminate\Auth\Access\Response authorize(string $ability, array|mixed $arguments = []) + * @method static mixed raw(string $ability, array|mixed $arguments = []) + * @method static mixed getPolicyFor(object|string $class) + * @method static \Illuminate\Contracts\Auth\Access\Gate forUser(\Illuminate\Contracts\Auth\Authenticatable|mixed $user) + * @method static array abilities() + * @method static \Illuminate\Auth\Access\Response inspect(string $ability, array|mixed $arguments = []) + * @method static \Illuminate\Auth\Access\Gate guessPolicyNamesUsing(callable $callback) + * * @see \Illuminate\Contracts\Auth\Access\Gate */ class Gate extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Hash.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Hash.php index 848642543205042ef59c79b8b18df97b770da6f4..70cf07c4e5cfec5e5bd274dd6290c96ffb545c02 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Hash.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Hash.php @@ -3,7 +3,12 @@ namespace Illuminate\Support\Facades; /** - * @see \Illuminate\Hashing\BcryptHasher + * @method static array info(string $hashedValue) + * @method static string make(string $value, array $options = []) + * @method static bool check(string $value, string $hashedValue, array $options = []) + * @method static bool needsRehash(string $hashedValue, array $options = []) + * + * @see \Illuminate\Hashing\HashManager */ class Hash extends Facade { diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Input.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Input.php deleted file mode 100644 index 35f52d563299b04c411c8801bec8a7f0d99caf68..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Input.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace Illuminate\Support\Facades; - -/** - * @see \Illuminate\Http\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/Seance5-6/seance/vendor/illuminate/support/Facades/Lang.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Lang.php index e5862b99368912f801b314824ccf4d30b72add7d..4222e04531c712c33f29c4a0781ff2031eeca3f3 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Lang.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Lang.php @@ -3,6 +3,11 @@ namespace Illuminate\Support\Facades; /** + * @method static mixed get(string $key, array $replace = [], string $locale = null, bool $fallback = true) + * @method static string choice(string $key, \Countable|int|array $number, array $replace = [], string $locale = null) + * @method static string getLocale() + * @method static void setLocale(string $locale) + * * @see \Illuminate\Translation\Translator */ class Lang extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Log.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Log.php index b10e064788c36dce00a53b1709ca40af255fe049..149adc6f868741c473e1e4efae86dacf1fba3f45 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Log.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Log.php @@ -2,10 +2,20 @@ namespace Illuminate\Support\Facades; -use Psr\Log\LoggerInterface; - /** - * @see \Illuminate\Log\Writer + * @method static void emergency(string $message, array $context = []) + * @method static void alert(string $message, array $context = []) + * @method static void critical(string $message, array $context = []) + * @method static void error(string $message, array $context = []) + * @method static void warning(string $message, array $context = []) + * @method static void notice(string $message, array $context = []) + * @method static void info(string $message, array $context = []) + * @method static void debug(string $message, array $context = []) + * @method static void log($level, string $message, array $context = []) + * @method static \Psr\Log\LoggerInterface channel(string $channel = null) + * @method static \Psr\Log\LoggerInterface stack(array $channels, string $channel = null) + * + * @see \Illuminate\Log\Logger */ class Log extends Facade { @@ -16,6 +26,6 @@ class Log extends Facade */ protected static function getFacadeAccessor() { - return LoggerInterface::class; + return 'log'; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Mail.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Mail.php index f5140c476f24345b811fbe9bbcaca8bb31fb5ac3..79340d6773783812b88817aee15abb5d5a5878f0 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Mail.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Mail.php @@ -5,18 +5,39 @@ namespace Illuminate\Support\Facades; use Illuminate\Support\Testing\Fakes\MailFake; /** + * @method static \Illuminate\Mail\PendingMail to($users) + * @method static \Illuminate\Mail\PendingMail bcc($users) + * @method static void raw(string $text, $callback) + * @method static void send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string $callback = null) + * @method static array failures() + * @method static mixed queue(\Illuminate\Contracts\Mail\Mailable|string|array $view, string $queue = null) + * @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, \Illuminate\Contracts\Mail\Mailable|string|array $view, string $queue = null) + * @method static void assertSent(string $mailable, callable|int $callback = null) + * @method static void assertNotSent(string $mailable, callable|int $callback = null) + * @method static void assertNothingSent() + * @method static void assertQueued(string $mailable, callable|int $callback = null) + * @method static void assertNotQueued(string $mailable, callable $callback = null) + * @method static void assertNothingQueued() + * @method static \Illuminate\Support\Collection sent(string $mailable, \Closure|string $callback = null) + * @method static bool hasSent(string $mailable) + * @method static \Illuminate\Support\Collection queued(string $mailable, \Closure|string $callback = null) + * @method static bool hasQueued(string $mailable) + * * @see \Illuminate\Mail\Mailer + * @see \Illuminate\Support\Testing\Fakes\MailFake */ class Mail extends Facade { /** * Replace the bound instance with a fake. * - * @return void + * @return \Illuminate\Support\Testing\Fakes\MailFake */ public static function fake() { - static::swap(new MailFake); + static::swap($fake = new MailFake); + + return $fake; } /** @@ -26,6 +47,6 @@ class Mail extends Facade */ protected static function getFacadeAccessor() { - return 'mailer'; + return 'mail.manager'; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Notification.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Notification.php index 37fb6c93c86aea6ce05a380be7bacd575a9bc6d7..3af8e715f52e49387a696b87855d8b4c3d38386f 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Notification.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Notification.php @@ -2,11 +2,23 @@ namespace Illuminate\Support\Facades; -use Illuminate\Notifications\ChannelManager; use Illuminate\Notifications\AnonymousNotifiable; +use Illuminate\Notifications\ChannelManager; use Illuminate\Support\Testing\Fakes\NotificationFake; /** + * @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, $notification) + * @method static void sendNow(\Illuminate\Support\Collection|array|mixed $notifiables, $notification) + * @method static mixed channel(string|null $name = null) + * @method static \Illuminate\Notifications\ChannelManager locale(string|null $locale) + * @method static void assertSentTo(mixed $notifiable, string $notification, callable $callback = null) + * @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1) + * @method static void assertNotSentTo(mixed $notifiable, string $notification, callable $callback = null) + * @method static void assertNothingSent() + * @method static void assertTimesSent(int $expectedCount, string $notification) + * @method static \Illuminate\Support\Collection sent(mixed $notifiable, string $notification, callable $callback = null) + * @method static bool hasSent(mixed $notifiable, string $notification) + * * @see \Illuminate\Notifications\ChannelManager */ class Notification extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Password.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Password.php index 6ebea841f99d5f8a280ac47ee684314985e7cf44..228b588827d571370374e1dd99f0c54082eab0cf 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Password.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Password.php @@ -2,7 +2,12 @@ namespace Illuminate\Support\Facades; +use Illuminate\Contracts\Auth\PasswordBroker; + /** + * @method static string sendResetLink(array $credentials) + * @method static mixed reset(array $credentials, \Closure $callback) + * * @see \Illuminate\Auth\Passwords\PasswordBroker */ class Password extends Facade @@ -12,35 +17,28 @@ class Password extends Facade * * @var string */ - const RESET_LINK_SENT = 'passwords.sent'; + const RESET_LINK_SENT = PasswordBroker::RESET_LINK_SENT; /** * Constant representing a successfully reset password. * * @var string */ - const PASSWORD_RESET = 'passwords.reset'; + const PASSWORD_RESET = PasswordBroker::PASSWORD_RESET; /** * Constant representing the user not found response. * * @var string */ - const INVALID_USER = 'passwords.user'; - - /** - * Constant representing an invalid password. - * - * @var string - */ - const INVALID_PASSWORD = 'passwords.password'; + const INVALID_USER = PasswordBroker::INVALID_USER; /** * Constant representing an invalid token. * * @var string */ - const INVALID_TOKEN = 'passwords.token'; + const INVALID_TOKEN = PasswordBroker::INVALID_TOKEN; /** * Get the registered name of the component. diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Queue.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Queue.php index 647312f27a26e03314dc8549fe4d45c8d0c298fc..d1ca3568d2e22b3364f4cb15af605b790c296dda 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Queue.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Queue.php @@ -5,6 +5,22 @@ namespace Illuminate\Support\Facades; use Illuminate\Support\Testing\Fakes\QueueFake; /** + * @method static int size(string $queue = null) + * @method static mixed push(string|object $job, mixed $data = '', $queue = null) + * @method static mixed pushOn(string $queue, string|object $job, mixed $data = '') + * @method static mixed pushRaw(string $payload, string $queue = null, array $options = []) + * @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '', string $queue = null) + * @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '') + * @method static mixed bulk(array $jobs, mixed $data = '', string $queue = null) + * @method static \Illuminate\Contracts\Queue\Job|null pop(string $queue = null) + * @method static string getConnectionName() + * @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name) + * @method static void assertNothingPushed() + * @method static void assertNotPushed(string $job, callable $callback = null) + * @method static void assertPushed(string $job, callable|int $callback = null) + * @method static void assertPushedOn(string $queue, string $job, callable|int $callback = null) + * @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable $callback = null) + * * @see \Illuminate\Queue\QueueManager * @see \Illuminate\Queue\Queue */ @@ -13,11 +29,13 @@ class Queue extends Facade /** * Replace the bound instance with a fake. * - * @return void + * @return \Illuminate\Support\Testing\Fakes\QueueFake */ public static function fake() { - static::swap(new QueueFake(static::getFacadeApplication())); + static::swap($fake = new QueueFake(static::getFacadeApplication())); + + return $fake; } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Redirect.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Redirect.php index 647a7c316a3790f06d509ecfa2afd1a63a308597..8bfcfebc232369f2c10386744378f26bf141892e 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Redirect.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Redirect.php @@ -3,6 +3,19 @@ namespace Illuminate\Support\Facades; /** + * @method static \Illuminate\Http\RedirectResponse home(int $status = 302) + * @method static \Illuminate\Http\RedirectResponse back(int $status = 302, array $headers = [], $fallback = false) + * @method static \Illuminate\Http\RedirectResponse refresh(int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse guest(string $path, int $status = 302, array $headers = [], bool $secure = null) + * @method static \Illuminate\Http\RedirectResponse intended(string $default = '/', int $status = 302, array $headers = [], bool $secure = null) + * @method static \Illuminate\Http\RedirectResponse to(string $path, int $status = 302, array $headers = [], bool $secure = null) + * @method static \Illuminate\Http\RedirectResponse away(string $path, int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse secure(string $path, int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse route(string $route, array $parameters = [], int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse action(string $action, array $parameters = [], int $status = 302, array $headers = []) + * @method static \Illuminate\Routing\UrlGenerator getUrlGenerator() + * @method static void setSession(\Illuminate\Session\Store $session) + * * @see \Illuminate\Routing\Redirector */ class Redirect extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Redis.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Redis.php index a7491ba58be3a458ce37e538fb3f195e6eb39762..f0fc8e1b560d8b8e56300651608febc9d52b32a6 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Redis.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Redis.php @@ -3,6 +3,8 @@ namespace Illuminate\Support\Facades; /** + * @method static \Illuminate\Redis\Connections\Connection connection(string $name = null) + * * @see \Illuminate\Redis\RedisManager * @see \Illuminate\Contracts\Redis\Factory */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Request.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Request.php index 5cb12f4e71ec059df9a87f0c8d1d991bde75fe02..c181f7c8320e0e2ddb285ccbbe80762366031d88 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Request.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Request.php @@ -3,6 +3,87 @@ namespace Illuminate\Support\Facades; /** + * @method static bool matchesType(string $actual, string $type) + * @method static bool isJson() + * @method static bool expectsJson() + * @method static bool wantsJson() + * @method static bool accepts(string|array $contentTypes) + * @method static bool prefers(string|array $contentTypes) + * @method static bool acceptsAnyContentType() + * @method static bool acceptsJson() + * @method static bool acceptsHtml() + * @method static string format($default = 'html') + * @method static string|array old(string|null $key = null, string|array|null $default = null) + * @method static void flash() + * @method static void flashOnly(array|mixed $keys) + * @method static void flashExcept(array|mixed $keys) + * @method static void flush() + * @method static string|array|null server(string|null $key = null, string|array|null $default = null) + * @method static bool hasHeader(string $key) + * @method static string|array|null header(string|null $key = null, string|array|null $default = null) + * @method static string|null bearerToken() + * @method static bool exists(string|array $key) + * @method static bool has(string|array $key) + * @method static bool hasAny(string|array $key) + * @method static bool filled(string|array $key) + * @method static bool anyFilled(string|array $key) + * @method static array keys() + * @method static array all(array|mixed|null $keys = null) + * @method static string|array|null input(string|null $key = null, string|array|null $default = null) + * @method static array only(array|mixed $keys) + * @method static array except(array|mixed $keys) + * @method static string|array|null query(string|null $key = null, string|array|null $default = null) + * @method static string|array|null post(string|null $key = null, string|array|null $default = null) + * @method static bool hasCookie(string $key) + * @method static string|array|null cookie(string|null $key = null, string|array|null $default = null) + * @method static array allFiles() + * @method static bool hasFile(string $key) + * @method static \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null file(string|null $key = null, mixed $default = null) + * @method static \Illuminate\Http\Request capture() + * @method static \Illuminate\Http\Request instance() + * @method static string method() + * @method static string root() + * @method static string url() + * @method static string fullUrl() + * @method static string fullUrlWithQuery(array $query) + * @method static string path() + * @method static string decodedPath() + * @method static string|null segment(int $index, string|null $default = null) + * @method static array segments() + * @method static bool is(mixed ...$patterns) + * @method static bool routeIs(mixed ...$patterns) + * @method static bool fullUrlIs(mixed ...$patterns) + * @method static bool ajax() + * @method static bool pjax() + * @method static bool prefetch() + * @method static bool secure() + * @method static string|null ip() + * @method static array ips() + * @method static string userAgent() + * @method static \Illuminate\Http\Request merge(array $input) + * @method static \Illuminate\Http\Request replace(array $input) + * @method static \Symfony\Component\HttpFoundation\ParameterBag|mixed json(string|null $key = null, mixed $default = null) + * @method static \Illuminate\Http\Request createFrom(\Illuminate\Http\Request $from, \Illuminate\Http\Request|null $to = null) + * @method static \Illuminate\Http\Request createFromBase(\Symfony\Component\HttpFoundation\Request $request) + * @method static \Illuminate\Http\Request duplicate(array|null $query = null, array|null $request = null, array|null $attributes = null, array|null $cookies = null, array|null $files = null, array|null $server = null) + * @method static mixed filterFiles(mixed $files) + * @method static \Illuminate\Session\Store session() + * @method static \Illuminate\Session\Store|null getSession() + * @method static void setLaravelSession(\Illuminate\Contracts\Session\Session $session) + * @method static mixed user(string|null $guard = null) + * @method static \Illuminate\Routing\Route|object|string route(string|null $param = null, string|null $default = null) + * @method static string fingerprint() + * @method static \Illuminate\Http\Request setJson(\Symfony\Component\HttpFoundation\ParameterBag $json) + * @method static \Closure getUserResolver() + * @method static \Illuminate\Http\Request setUserResolver(\Closure $callback) + * @method static \Closure getRouteResolver() + * @method static \Illuminate\Http\Request setRouteResolver(\Closure $callback) + * @method static array toArray() + * @method static bool offsetExists(string $offset) + * @method static mixed offsetGet(string $offset) + * @method static void offsetSet(string $offset, mixed $value) + * @method static void offsetUnset(string $offset) + * * @see \Illuminate\Http\Request */ class Request extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Response.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Response.php index 2bbf02b082330c4ed8ac65dfd0dd58317015d646..ab8576b18bfcef57d3f58050d80435a715a5eb0a 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Response.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Response.php @@ -5,6 +5,21 @@ namespace Illuminate\Support\Facades; use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract; /** + * @method static \Illuminate\Http\Response make(string $content = '', int $status = 200, array $headers = []) + * @method static \Illuminate\Http\Response noContent($status = 204, array $headers = []) + * @method static \Illuminate\Http\Response view(string $view, array $data = [], int $status = 200, array $headers = []) + * @method static \Illuminate\Http\JsonResponse json(string|array $data = [], int $status = 200, array $headers = [], int $options = 0) + * @method static \Illuminate\Http\JsonResponse jsonp(string $callback, string|array $data = [], int $status = 200, array $headers = [], int $options = 0) + * @method static \Symfony\Component\HttpFoundation\StreamedResponse stream(\Closure $callback, int $status = 200, array $headers = []) + * @method static \Symfony\Component\HttpFoundation\StreamedResponse streamDownload(\Closure $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment') + * @method static \Symfony\Component\HttpFoundation\BinaryFileResponse download(\SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment') + * @method static \Symfony\Component\HttpFoundation\BinaryFileResponse file($file, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null) + * @method static \Illuminate\Http\RedirectResponse redirectToRoute(string $route, array $parameters = [], int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse redirectToAction(string $action, array $parameters = [], int $status = 302, array $headers = []) + * @method static \Illuminate\Http\RedirectResponse redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null) + * @method static \Illuminate\Http\RedirectResponse redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null) + * * @see \Illuminate\Contracts\Routing\ResponseFactory */ class Response extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Route.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Route.php index ab2086c4d187cb57f49950ee8bfd90de0a5d566d..079f99e4765a441f05bc9d32ce0073c6230ad011 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Route.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Route.php @@ -3,28 +3,38 @@ namespace Illuminate\Support\Facades; /** - * @method static \Illuminate\Support\Facades\Route get(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route post(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route put(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route delete(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route patch(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route options(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route any(string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route match(array|string $methods, string $uri, \Closure|array|string|null $action = null) - * @method static \Illuminate\Support\Facades\Route prefix(string $prefix) + * @method static \Illuminate\Routing\Route fallback(\Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route get(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route post(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route put(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route delete(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route patch(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route options(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route any(string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, \Closure|array|string|callable|null $action = null) + * @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix) + * @method static \Illuminate\Routing\RouteRegistrar where(array $where) * @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = []) + * @method static void resources(array $resources) + * @method static void pattern(string $key, string $pattern) * @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = []) - * @method static \Illuminate\Support\Facades\Route middleware(array|string|null $middleware) - * @method static \Illuminate\Support\Facades\Route substituteBindings(\Illuminate\Support\Facades\Route $route) + * @method static void apiResources(array $resources, array $options = []) + * @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware) + * @method static \Illuminate\Routing\Route substituteBindings(\Illuminate\Support\Facades\Route $route) * @method static void substituteImplicitBindings(\Illuminate\Support\Facades\Route $route) - * @method static \Illuminate\Support\Facades\Route as(string $value) - * @method static \Illuminate\Support\Facades\Route domain(string $value) - * @method static \Illuminate\Support\Facades\Route name(string $value) - * @method static \Illuminate\Support\Facades\Route namespace(string $value) - * @method static \Illuminate\Support\Facades\Route where(array|string $name, string $expression = null) - * @method static \Illuminate\Routing\Router group(\Closure|string|array $value, \Closure|string $routes) - * @method static \Illuminate\Support\Facades\Route redirect(string $uri, string $destination, int $status = 301) - * @method static \Illuminate\Support\Facades\Route view(string $uri, string $view, array $data = []) + * @method static \Illuminate\Routing\RouteRegistrar as(string $value) + * @method static \Illuminate\Routing\RouteRegistrar domain(string $value) + * @method static \Illuminate\Routing\RouteRegistrar name(string $value) + * @method static \Illuminate\Routing\RouteRegistrar namespace(string $value) + * @method static \Illuminate\Routing\Router|\Illuminate\Routing\RouteRegistrar group(\Closure|string|array $attributes, \Closure|string $routes) + * @method static \Illuminate\Routing\Route redirect(string $uri, string $destination, int $status = 302) + * @method static \Illuminate\Routing\Route permanentRedirect(string $uri, string $destination) + * @method static \Illuminate\Routing\Route view(string $uri, string $view, array $data = []) + * @method static void bind(string $key, string|callable $binder) + * @method static void model(string $key, string $class, \Closure|null $callback = null) + * @method static \Illuminate\Routing\Route current() + * @method static string|null currentRouteName() + * @method static string|null currentRouteAction() * * @see \Illuminate\Routing\Router */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Schema.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Schema.php index 0cf1ee942becdf4ed5e515a9a571fd2bf6cb658a..bb71a606cd0eb315bc4140b592fc6b1d49c39380 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Schema.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Schema.php @@ -7,6 +7,14 @@ namespace Illuminate\Support\Facades; * @method static \Illuminate\Database\Schema\Builder drop(string $table) * @method static \Illuminate\Database\Schema\Builder dropIfExists(string $table) * @method static \Illuminate\Database\Schema\Builder table(string $table, \Closure $callback) + * @method static \Illuminate\Database\Schema\Builder rename(string $from, string $to) + * @method static void defaultStringLength(int $length) + * @method static bool hasTable(string $table) + * @method static bool hasColumn(string $table, string $column) + * @method static bool hasColumns(string $table, array $columns) + * @method static \Illuminate\Database\Schema\Builder disableForeignKeyConstraints() + * @method static \Illuminate\Database\Schema\Builder enableForeignKeyConstraints() + * @method static void registerCustomDoctrineType(string $class, string $name, string $type) * * @see \Illuminate\Database\Schema\Builder */ @@ -15,7 +23,7 @@ class Schema extends Facade /** * Get a schema builder instance for a connection. * - * @param string $name + * @param string|null $name * @return \Illuminate\Database\Schema\Builder */ public static function connection($name) diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Session.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Session.php index bc9b5fd9a146df0b5b433a2e4945e59e9359ea71..63256520d8a8c6a8802e2a887845a0bf5a5ac653 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Session.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Session.php @@ -3,6 +3,30 @@ namespace Illuminate\Support\Facades; /** + * @method static string getName() + * @method static string getId() + * @method static void setId(string $id) + * @method static bool start() + * @method static bool save() + * @method static array all() + * @method static bool exists(string|array $key) + * @method static bool has(string|array $key) + * @method static mixed get(string $key, $default = null) + * @method static mixed pull(string $key, $default = null) + * @method static void put(string|array $key, $value = null) + * @method static string token() + * @method static mixed remove(string $key) + * @method static void forget(string|array $keys) + * @method static void flush() + * @method static bool migrate(bool $destroy = false) + * @method static bool isStarted() + * @method static string|null previousUrl() + * @method static void setPreviousUrl(string $url) + * @method static \SessionHandlerInterface getHandler() + * @method static bool handlerNeedsRequest() + * @method static void setRequestOnHandler(\Illuminate\Http\Request $request) + * @method static void push(string $key, mixed $value) + * * @see \Illuminate\Session\SessionManager * @see \Illuminate\Session\Store */ diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Storage.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Storage.php index 1ab840d9036f114c0ba2687d47d1dbf97b847a94..53dafc80bd2b7b6624d92703897bafb46f693010 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Storage.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Storage.php @@ -5,6 +5,30 @@ namespace Illuminate\Support\Facades; use Illuminate\Filesystem\Filesystem; /** + * @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string $name = null) + * @method static bool exists(string $path) + * @method static string get(string $path) + * @method static resource|null readStream(string $path) + * @method static bool put(string $path, string|resource $contents, mixed $options = []) + * @method static bool writeStream(string $path, resource $resource, array $options = []) + * @method static string getVisibility(string $path) + * @method static bool setVisibility(string $path, string $visibility) + * @method static bool prepend(string $path, string $data) + * @method static bool append(string $path, string $data) + * @method static bool delete(string|array $paths) + * @method static bool copy(string $from, string $to) + * @method static bool move(string $from, string $to) + * @method static int size(string $path) + * @method static int lastModified(string $path) + * @method static array files(string|null $directory = null, bool $recursive = false) + * @method static array allFiles(string|null $directory = null) + * @method static array directories(string|null $directory = null, bool $recursive = false) + * @method static array allDirectories(string|null $directory = null) + * @method static bool makeDirectory(string $path) + * @method static bool deleteDirectory(string $directory) + * @method static \Illuminate\Contracts\Filesystem\Filesystem assertExists(string|array $path) + * @method static \Illuminate\Contracts\Filesystem\Filesystem assertMissing(string|array $path) + * * @see \Illuminate\Filesystem\FilesystemManager */ class Storage extends Facade @@ -13,33 +37,40 @@ class Storage extends Facade * Replace the given disk with a local testing disk. * * @param string|null $disk - * - * @return void + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem */ - public static function fake($disk = null) + public static function fake($disk = null, array $config = []) { - $disk = $disk ?: self::$app['config']->get('filesystems.default'); + $disk = $disk ?: static::$app['config']->get('filesystems.default'); (new Filesystem)->cleanDirectory( $root = storage_path('framework/testing/disks/'.$disk) ); - static::set($disk, self::createLocalDriver(['root' => $root])); + static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ + 'root' => $root, + ]))); + + return $fake; } /** * Replace the given disk with a persistent local testing disk. * * @param string|null $disk - * @return void + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem */ - public static function persistentFake($disk = null) + public static function persistentFake($disk = null, array $config = []) { - $disk = $disk ?: self::$app['config']->get('filesystems.default'); + $disk = $disk ?: static::$app['config']->get('filesystems.default'); - static::set($disk, self::createLocalDriver([ + static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ 'root' => storage_path('framework/testing/disks/'.$disk), - ])); + ]))); + + return $fake; } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/URL.php b/Seance5-6/seance/vendor/illuminate/support/Facades/URL.php index e17414bc061248e0a6b37dbae7f7b66b8b3f5abf..1ef545c11e101dee43995757d8df55de46d78e8a 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/URL.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/URL.php @@ -3,6 +3,21 @@ namespace Illuminate\Support\Facades; /** + * @method static string current() + * @method static string full() + * @method static string previous($fallback = false) + * @method static string to(string $path, $extra = [], bool $secure = null) + * @method static string secure(string $path, array $parameters = []) + * @method static string asset(string $path, bool $secure = null) + * @method static string route(string $name, $parameters = [], bool $absolute = true) + * @method static string action(string $action, $parameters = [], bool $absolute = true) + * @method static \Illuminate\Contracts\Routing\UrlGenerator setRootControllerNamespace(string $rootNamespace) + * @method static string signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null, bool $absolute = true) + * @method static string temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], bool $absolute = true) + * @method static bool hasValidSignature(\Illuminate\Http\Request $request, bool $absolute = true) + * @method static void defaults(array $defaults) + * @method static void forceScheme(string $scheme) + * * @see \Illuminate\Routing\UrlGenerator */ class URL extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/Validator.php b/Seance5-6/seance/vendor/illuminate/support/Facades/Validator.php index e3e1ba4dc4ea6ca1a1499104f4f81b01b4d9e734..30f9f9b104d9ed0fcb4b8bda8ede8299ec319008 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/Validator.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/Validator.php @@ -3,6 +3,11 @@ namespace Illuminate\Support\Facades; /** + * @method static \Illuminate\Contracts\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) + * @method static void extend(string $rule, \Closure|string $extension, string $message = null) + * @method static void extendImplicit(string $rule, \Closure|string $extension, string $message = null) + * @method static void replacer(string $rule, \Closure|string $replacer) + * * @see \Illuminate\Validation\Factory */ class Validator extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Facades/View.php b/Seance5-6/seance/vendor/illuminate/support/Facades/View.php index 9de57c328dcace6a00bc6a2c046e4cbbb3d65dbc..e7b16c19592b552dde69b9aa972c6dd41d47fec5 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Facades/View.php +++ b/Seance5-6/seance/vendor/illuminate/support/Facades/View.php @@ -3,6 +3,15 @@ namespace Illuminate\Support\Facades; /** + * @method static bool exists(string $view) + * @method static \Illuminate\Contracts\View\View file(string $path, array $data = [], array $mergeData = []) + * @method static \Illuminate\Contracts\View\View make(string $view, array $data = [], array $mergeData = []) + * @method static mixed share(array|string $key, $value = null) + * @method static array composer(array|string $views, \Closure|string $callback) + * @method static array creator(array|string $views, \Closure|string $callback) + * @method static \Illuminate\Contracts\View\Factory addNamespace(string $namespace, string|array $hints) + * @method static \Illuminate\Contracts\View\Factory replaceNamespace(string $namespace, string|array $hints) + * * @see \Illuminate\View\Factory */ class View extends Facade diff --git a/Seance5-6/seance/vendor/illuminate/support/Fluent.php b/Seance5-6/seance/vendor/illuminate/support/Fluent.php index c34a5d760dadeb3781a7a1c212fc10ac650489d4..e02fa9402b1183f939350619e017046b411ee8b9 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Fluent.php +++ b/Seance5-6/seance/vendor/illuminate/support/Fluent.php @@ -3,23 +3,23 @@ namespace Illuminate\Support; use ArrayAccess; -use JsonSerializable; -use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Contracts\Support\Jsonable; +use JsonSerializable; -class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable +class Fluent implements Arrayable, ArrayAccess, Jsonable, JsonSerializable { /** - * All of the attributes set on the container. + * All of the attributes set on the fluent instance. * * @var array */ protected $attributes = []; /** - * Create a new fluent container instance. + * Create a new fluent instance. * - * @param array|object $attributes + * @param array|object $attributes * @return void */ public function __construct($attributes = []) @@ -30,10 +30,10 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable } /** - * Get an attribute from the container. + * Get an attribute from the fluent instance. * * @param string $key - * @param mixed $default + * @param mixed $default * @return mixed */ public function get($key, $default = null) @@ -46,7 +46,7 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable } /** - * Get the attributes from the container. + * Get the attributes from the fluent instance. * * @return array */ @@ -56,7 +56,7 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable } /** - * Convert the Fluent instance to an array. + * Convert the fluent instance to an array. * * @return array */ @@ -76,7 +76,7 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable } /** - * Convert the Fluent instance to JSON. + * Convert the fluent instance to JSON. * * @param int $options * @return string @@ -112,7 +112,7 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable * Set the value at the given offset. * * @param string $offset - * @param mixed $value + * @param mixed $value * @return void */ public function offsetSet($offset, $value) @@ -132,10 +132,10 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable } /** - * Handle dynamic calls to the container to set attributes. + * Handle dynamic calls to the fluent instance to set attributes. * * @param string $method - * @param array $parameters + * @param array $parameters * @return $this */ public function __call($method, $parameters) @@ -160,7 +160,7 @@ class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable * Dynamically set the value of an attribute. * * @param string $key - * @param mixed $value + * @param mixed $value * @return void */ public function __set($key, $value) diff --git a/Seance5-6/seance/vendor/illuminate/support/HigherOrderCollectionProxy.php b/Seance5-6/seance/vendor/illuminate/support/HigherOrderCollectionProxy.php index 7a781a0216eac9beb3d5ebd8e572abc97599ec8f..106356c3acc577c5b6404b1d8513298a504a0565 100644 --- a/Seance5-6/seance/vendor/illuminate/support/HigherOrderCollectionProxy.php +++ b/Seance5-6/seance/vendor/illuminate/support/HigherOrderCollectionProxy.php @@ -3,14 +3,14 @@ namespace Illuminate\Support; /** - * @mixin \Illuminate\Support\Collection + * @mixin \Illuminate\Support\Enumerable */ class HigherOrderCollectionProxy { /** * The collection being operated on. * - * @var \Illuminate\Support\Collection + * @var \Illuminate\Support\Enumerable */ protected $collection; @@ -24,11 +24,11 @@ class HigherOrderCollectionProxy /** * Create a new proxy instance. * - * @param \Illuminate\Support\Collection $collection + * @param \Illuminate\Support\Enumerable $collection * @param string $method * @return void */ - public function __construct(Collection $collection, $method) + public function __construct(Enumerable $collection, $method) { $this->method = $method; $this->collection = $collection; diff --git a/Seance5-6/seance/vendor/illuminate/support/InteractsWithTime.php b/Seance5-6/seance/vendor/illuminate/support/InteractsWithTime.php index 19ed3f242a62776804cd9ddff47a92b21d1799f7..2b617c392a5a0d904e1fc0ed5c822a16db2899e6 100644 --- a/Seance5-6/seance/vendor/illuminate/support/InteractsWithTime.php +++ b/Seance5-6/seance/vendor/illuminate/support/InteractsWithTime.php @@ -34,7 +34,7 @@ trait InteractsWithTime return $delay instanceof DateTimeInterface ? $delay->getTimestamp() - : Carbon::now()->addSeconds($delay)->getTimestamp(); + : Carbon::now()->addRealSeconds($delay)->getTimestamp(); } /** diff --git a/Seance5-6/seance/vendor/illuminate/support/Manager.php b/Seance5-6/seance/vendor/illuminate/support/Manager.php index 592776c2c859118d69aad64c11e86c58c62a4726..8b20f6a25e581fb41dcbabe1e707bb7ce6f86e8e 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Manager.php +++ b/Seance5-6/seance/vendor/illuminate/support/Manager.php @@ -3,17 +3,34 @@ namespace Illuminate\Support; use Closure; +use Illuminate\Contracts\Container\Container; use InvalidArgumentException; abstract class Manager { /** - * The application instance. + * The container instance. * - * @var \Illuminate\Foundation\Application + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The container instance. + * + * @var \Illuminate\Contracts\Container\Container + * + * @deprecated Use the $container property instead. */ protected $app; + /** + * The configuration repository instance. + * + * @var \Illuminate\Contracts\Config\Repository + */ + protected $config; + /** * The registered custom driver creators. * @@ -31,12 +48,14 @@ abstract class Manager /** * Create a new manager instance. * - * @param \Illuminate\Foundation\Application $app + * @param \Illuminate\Contracts\Container\Container $container * @return void */ - public function __construct($app) + public function __construct(Container $container) { - $this->app = $app; + $this->app = $container; + $this->container = $container; + $this->config = $container->make('config'); } /** @@ -49,13 +68,21 @@ abstract class Manager /** * Get a driver instance. * - * @param string $driver + * @param string|null $driver * @return mixed + * + * @throws \InvalidArgumentException */ public function driver($driver = null) { $driver = $driver ?: $this->getDefaultDriver(); + if (is_null($driver)) { + throw new InvalidArgumentException(sprintf( + 'Unable to resolve NULL driver for [%s].', static::class + )); + } + // 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. @@ -76,9 +103,9 @@ abstract class Manager */ protected function createDriver($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. + // First, we will determine if a custom driver creator exists for the given driver and + // if it does not we will check for a creator method for the driver. Custom creator + // callbacks allow developers to build their own "drivers" easily using Closures. if (isset($this->customCreators[$driver])) { return $this->callCustomCreator($driver); } else { @@ -88,6 +115,7 @@ abstract class Manager return $this->$method(); } } + throw new InvalidArgumentException("Driver [$driver] not supported."); } @@ -99,13 +127,13 @@ abstract class Manager */ protected function callCustomCreator($driver) { - return $this->customCreators[$driver]($this->app); + return $this->customCreators[$driver]($this->container); } /** * Register a custom driver creator Closure. * - * @param string $driver + * @param string $driver * @param \Closure $callback * @return $this */ @@ -130,7 +158,7 @@ abstract class Manager * Dynamically call the default driver instance. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed */ public function __call($method, $parameters) diff --git a/Seance5-6/seance/vendor/illuminate/support/MessageBag.php b/Seance5-6/seance/vendor/illuminate/support/MessageBag.php index da2c31e29dbe1bb80f01a1d12242e7774e9dd0b5..dec897d4affce54e61b51fc0639bc7258d7afcd7 100644 --- a/Seance5-6/seance/vendor/illuminate/support/MessageBag.php +++ b/Seance5-6/seance/vendor/illuminate/support/MessageBag.php @@ -3,11 +3,11 @@ namespace Illuminate\Support; use Countable; -use JsonSerializable; -use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Contracts\Support\MessageProvider; +use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\MessageBag as MessageBagContract; +use Illuminate\Contracts\Support\MessageProvider; +use JsonSerializable; class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider { @@ -34,8 +34,9 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me public function __construct(array $messages = []) { foreach ($messages as $key => $value) { - $this->messages[$key] = $value instanceof Arrayable - ? $value->toArray() : (array) $value; + $value = $value instanceof Arrayable ? $value->toArray() : (array) $value; + + $this->messages[$key] = array_unique($value); } } @@ -50,7 +51,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Add a message to the bag. + * Add a message to the message bag. * * @param string $key * @param string $message @@ -80,7 +81,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Merge a new array of messages into the bag. + * Merge a new array of messages into the message bag. * * @param \Illuminate\Contracts\Support\MessageProvider|array $messages * @return $this @@ -99,11 +100,15 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me /** * Determine if messages exist for all of the given keys. * - * @param array|string $key + * @param array|string|null $key * @return bool */ public function has($key) { + if ($this->isEmpty()) { + return false; + } + if (is_null($key)) { return $this->any(); } @@ -127,6 +132,10 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me */ public function hasAny($keys = []) { + if ($this->isEmpty()) { + return false; + } + $keys = is_array($keys) ? $keys : func_get_args(); foreach ($keys as $key) { @@ -139,10 +148,10 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get the first message from the bag for a given key. + * Get the first message from the message bag for a given key. * - * @param string $key - * @param string $format + * @param string|null $key + * @param string|null $format * @return string */ public function first($key = null, $format = null) @@ -155,17 +164,17 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get all of the messages from the bag for a given key. + * Get all of the messages from the message bag for a given key. * * @param string $key - * @param string $format + * @param string|null $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 check if the key is implicit & collect - // all the messages that match a given key and output it as an array. + // If the message exists in the message bag, we will transform it and return + // the message. Otherwise, we will check if the key is implicit & collect + // all the messages that match the given key and output it as an array. if (array_key_exists($key, $this->messages)) { return $this->transform( $this->messages[$key], $this->checkFormat($format), $key @@ -200,9 +209,9 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get all of the messages for every key in the bag. + * Get all of the messages for every key in the message bag. * - * @param string $format + * @param string|null $format * @return array */ public function all($format = null) @@ -219,9 +228,9 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get all of the unique messages for every key in the bag. + * Get all of the unique messages for every key in the message bag. * - * @param string $format + * @param string|null $format * @return array */ public function unique($format = null) @@ -232,7 +241,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me /** * Format an array of messages. * - * @param array $messages + * @param array $messages * @param string $format * @param string $messageKey * @return array @@ -260,7 +269,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get the raw messages in the container. + * Get the raw messages in the message bag. * * @return array */ @@ -270,7 +279,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get the raw messages in the container. + * Get the raw messages in the message bag. * * @return array */ @@ -343,7 +352,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me } /** - * Get the number of messages in the container. + * Get the number of messages in the message bag. * * @return int */ diff --git a/Seance5-6/seance/vendor/illuminate/support/NamespacedItemResolver.php b/Seance5-6/seance/vendor/illuminate/support/NamespacedItemResolver.php index fea32753058f4a715b7c09d8494ca15486f77ae2..e9251db609765ec73581e3cef12ba167732bf74b 100644 --- a/Seance5-6/seance/vendor/illuminate/support/NamespacedItemResolver.php +++ b/Seance5-6/seance/vendor/illuminate/support/NamespacedItemResolver.php @@ -74,7 +74,7 @@ class NamespacedItemResolver */ protected function parseNamespacedSegments($key) { - list($namespace, $item) = explode('::', $key); + [$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 @@ -92,7 +92,7 @@ class NamespacedItemResolver * Set the parsed value of a key. * * @param string $key - * @param array $parsed + * @param array $parsed * @return void */ public function setParsedKey($key, $parsed) diff --git a/Seance5-6/seance/vendor/illuminate/support/Optional.php b/Seance5-6/seance/vendor/illuminate/support/Optional.php index 8f35221ad2c0edd421c9eb596cb66abfa220f2c1..5e0b7d9cb040f753899704481aea06e4283cc11d 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Optional.php +++ b/Seance5-6/seance/vendor/illuminate/support/Optional.php @@ -3,6 +3,7 @@ namespace Illuminate\Support; use ArrayAccess; +use ArrayObject; class Optional implements ArrayAccess { @@ -37,26 +38,27 @@ class Optional implements ArrayAccess public function __get($key) { if (is_object($this->value)) { - return $this->value->{$key}; + return $this->value->{$key} ?? null; } } /** - * Dynamically pass a method to the underlying object. + * Dynamically check a property exists on the underlying object. * - * @param string $method - * @param array $parameters - * @return mixed + * @param mixed $name + * @return bool */ - public function __call($method, $parameters) + public function __isset($name) { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); + if (is_object($this->value)) { + return isset($this->value->{$name}); } - if (is_object($this->value)) { - return $this->value->{$method}(...$parameters); + if (is_array($this->value) || $this->value instanceof ArrayObject) { + return isset($this->value[$name]); } + + return false; } /** @@ -107,4 +109,22 @@ class Optional implements ArrayAccess unset($this->value[$key]); } } + + /** + * Dynamically pass a method to the underlying object. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (is_object($this->value)) { + return $this->value->{$method}(...$parameters); + } + } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Pluralizer.php b/Seance5-6/seance/vendor/illuminate/support/Pluralizer.php index 6cc55ad7b885498ce3505bc6a5942125df2a6847..9badfc59ee8922667e11833a31158fe1c5881443 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Pluralizer.php +++ b/Seance5-6/seance/vendor/illuminate/support/Pluralizer.php @@ -45,6 +45,8 @@ class Pluralizer 'pokemon', 'police', 'rain', + 'recommended', + 'related', 'rice', 'series', 'sheep', @@ -59,12 +61,12 @@ class Pluralizer * Get the plural form of an English word. * * @param string $value - * @param int $count + * @param int $count * @return string */ public static function plural($value, $count = 2) { - if ((int) $count === 1 || static::uncountable($value)) { + if ((int) abs($count) === 1 || static::uncountable($value)) { return $value; } @@ -109,8 +111,8 @@ class Pluralizer $functions = ['mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords']; foreach ($functions as $function) { - if (call_user_func($function, $comparison) === $comparison) { - return call_user_func($function, $value); + if ($function($comparison) === $comparison) { + return $function($value); } } diff --git a/Seance5-6/seance/vendor/illuminate/support/ServiceProvider.php b/Seance5-6/seance/vendor/illuminate/support/ServiceProvider.php index ba0f64a764a86dc328946302376899a2a14e0bcb..b429d9abaea2635f55c056d1cdfb7f0135a9a654 100644 --- a/Seance5-6/seance/vendor/illuminate/support/ServiceProvider.php +++ b/Seance5-6/seance/vendor/illuminate/support/ServiceProvider.php @@ -3,6 +3,11 @@ namespace Illuminate\Support; use Illuminate\Console\Application as Artisan; +use Illuminate\Contracts\Foundation\CachesConfiguration; +use Illuminate\Contracts\Foundation\CachesRoutes; +use Illuminate\Contracts\Support\DeferrableProvider; +use Illuminate\Database\Eloquent\Factory as ModelFactory; +use Illuminate\View\Compilers\BladeCompiler; abstract class ServiceProvider { @@ -13,13 +18,6 @@ abstract class ServiceProvider */ protected $app; - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = false; - /** * The paths that should be published. * @@ -45,6 +43,16 @@ abstract class ServiceProvider $this->app = $app; } + /** + * Register any application services. + * + * @return void + */ + public function register() + { + // + } + /** * Merge the given configuration with the existing configuration. * @@ -54,9 +62,11 @@ abstract class ServiceProvider */ protected function mergeConfigFrom($path, $key) { - $config = $this->app['config']->get($key, []); - - $this->app['config']->set($key, array_merge(require $path, $config)); + if (! ($this->app instanceof CachesConfiguration && $this->app->configurationIsCached())) { + $this->app['config']->set($key, array_merge( + require $path, $this->app['config']->get($key, []) + )); + } } /** @@ -67,7 +77,7 @@ abstract class ServiceProvider */ protected function loadRoutesFrom($path) { - if (! $this->app->routesAreCached()) { + if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) { require $path; } } @@ -81,15 +91,34 @@ abstract class ServiceProvider */ protected function loadViewsFrom($path, $namespace) { - if (is_array($this->app->config['view']['paths'])) { - foreach ($this->app->config['view']['paths'] as $viewPath) { - if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) { - $this->app['view']->addNamespace($namespace, $appPath); + $this->callAfterResolving('view', function ($view) use ($path, $namespace) { + if (isset($this->app->config['view']['paths']) && + is_array($this->app->config['view']['paths'])) { + foreach ($this->app->config['view']['paths'] as $viewPath) { + if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) { + $view->addNamespace($namespace, $appPath); + } } } - } - $this->app['view']->addNamespace($namespace, $path); + $view->addNamespace($namespace, $path); + }); + } + + /** + * Register the given view components with a custom prefix. + * + * @param string $prefix + * @param array $components + * @return void + */ + protected function loadViewComponentsAs($prefix, array $components) + { + $this->callAfterResolving(BladeCompiler::class, function ($blade) use ($prefix, $components) { + foreach ($components as $component) { + $blade->component($component, null, $prefix); + } + }); } /** @@ -101,7 +130,9 @@ abstract class ServiceProvider */ protected function loadTranslationsFrom($path, $namespace) { - $this->app['translator']->addNamespace($namespace, $path); + $this->callAfterResolving('translator', function ($translator) use ($path, $namespace) { + $translator->addNamespace($namespace, $path); + }); } /** @@ -112,38 +143,71 @@ abstract class ServiceProvider */ protected function loadJsonTranslationsFrom($path) { - $this->app['translator']->addJsonPath($path); + $this->callAfterResolving('translator', function ($translator) use ($path) { + $translator->addJsonPath($path); + }); } /** - * Register a database migration path. + * Register database migration paths. * * @param array|string $paths * @return void */ protected function loadMigrationsFrom($paths) { - $this->app->afterResolving('migrator', function ($migrator) use ($paths) { + $this->callAfterResolving('migrator', function ($migrator) use ($paths) { foreach ((array) $paths as $path) { $migrator->path($path); } }); } + /** + * Register Eloquent model factory paths. + * + * @param array|string $paths + * @return void + */ + protected function loadFactoriesFrom($paths) + { + $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) { + foreach ((array) $paths as $path) { + $factory->load($path); + } + }); + } + + /** + * Setup an after resolving listener, or fire immediately if already resolved. + * + * @param string $name + * @param callable $callback + * @return void + */ + protected function callAfterResolving($name, $callback) + { + $this->app->afterResolving($name, $callback); + + if ($this->app->resolved($name)) { + $callback($this->app->make($name), $this->app); + } + } + /** * Register paths to be published by the publish command. * * @param array $paths - * @param string $group + * @param mixed $groups * @return void */ - protected function publishes(array $paths, $group = null) + protected function publishes(array $paths, $groups = null) { $this->ensurePublishArrayInitialized($class = static::class); static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); - if ($group) { + foreach ((array) $groups as $group) { $this->addPublishGroup($group, $paths); } } @@ -182,8 +246,8 @@ abstract class ServiceProvider /** * Get the paths to publish. * - * @param string $provider - * @param string $group + * @param string|null $provider + * @param string|null $group * @return array */ public static function pathsToPublish($provider = null, $group = null) @@ -295,6 +359,6 @@ abstract class ServiceProvider */ public function isDeferred() { - return $this->defer; + return $this instanceof DeferrableProvider; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Str.php b/Seance5-6/seance/vendor/illuminate/support/Str.php index 6775f92df8836adca071f96f18beef4a636b47c7..05fbb8d5f7e7a95d6d9f2b64e9e9cb539adbf57f 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Str.php +++ b/Seance5-6/seance/vendor/illuminate/support/Str.php @@ -3,6 +3,11 @@ namespace Illuminate\Support; use Illuminate\Support\Traits\Macroable; +use Ramsey\Uuid\Codec\TimestampFirstCombCodec; +use Ramsey\Uuid\Generator\CombGenerator; +use Ramsey\Uuid\Uuid; +use Ramsey\Uuid\UuidFactory; +use voku\helper\ASCII; class Str { @@ -30,7 +35,25 @@ class Str protected static $studlyCache = []; /** - * Return the remainder of a string after a given value. + * The callback that should be used to generate UUIDs. + * + * @var callable + */ + protected static $uuidFactory; + + /** + * Get a new stringable object from the given string. + * + * @param string $string + * @return \Illuminate\Support\Stringable + */ + public static function of($string) + { + return new Stringable($string); + } + + /** + * Return the remainder of a string after the first occurrence of a given value. * * @param string $subject * @param string $search @@ -41,6 +64,28 @@ class Str return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0]; } + /** + * Return the remainder of a string after the last occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function afterLast($subject, $search) + { + if ($search === '') { + return $subject; + } + + $position = strrpos($subject, (string) $search); + + if ($position === false) { + return $subject; + } + + return substr($subject, $position + strlen($search)); + } + /** * Transliterate a UTF-8 value to ASCII. * @@ -50,29 +95,58 @@ class Str */ public static function ascii($value, $language = 'en') { - $languageSpecific = static::languageSpecificCharsArray($language); + return ASCII::to_ascii($value, $language); + } - if (! is_null($languageSpecific)) { - $value = str_replace($languageSpecific[0], $languageSpecific[1], $value); + /** + * Get the portion of a string before the first occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function before($subject, $search) + { + return $search === '' ? $subject : explode($search, $subject)[0]; + } + + /** + * Get the portion of a string before the last occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function beforeLast($subject, $search) + { + if ($search === '') { + return $subject; } - foreach (static::charsArray() as $key => $val) { - $value = str_replace($val, $key, $value); + $pos = mb_strrpos($subject, $search); + + if ($pos === false) { + return $subject; } - return preg_replace('/[^\x20-\x7E]/u', '', $value); + return static::substr($subject, 0, $pos); } /** - * Get the portion of a string before a given value. + * Get the portion of a string between two given values. * * @param string $subject - * @param string $search + * @param string $from + * @param string $to * @return string */ - public static function before($subject, $search) + public static function between($subject, $from, $to) { - return $search === '' ? $subject : explode($search, $subject)[0]; + if ($from === '' || $to === '') { + return $subject; + } + + return static::beforeLast(static::after($subject, $from), $to); } /** @@ -94,7 +168,7 @@ class Str * Determine if a given string contains a given substring. * * @param string $haystack - * @param string|array $needles + * @param string|string[] $needles * @return bool */ public static function contains($haystack, $needles) @@ -108,11 +182,29 @@ class Str return false; } + /** + * Determine if a given string contains all array values. + * + * @param string $haystack + * @param string[] $needles + * @return bool + */ + public static function containsAll($haystack, array $needles) + { + foreach ($needles as $needle) { + if (! static::contains($haystack, $needle)) { + return false; + } + } + + return true; + } + /** * Determine if a given string ends with a given substring. * * @param string $haystack - * @param string|array $needles + * @param string|string[] $needles * @return bool */ public static function endsWith($haystack, $needles) @@ -149,7 +241,7 @@ class Str */ public static function is($pattern, $value) { - $patterns = is_array($pattern) ? $pattern : (array) $pattern; + $patterns = Arr::wrap($pattern); if (empty($patterns)) { return false; @@ -178,6 +270,32 @@ class Str return false; } + /** + * Determine if a given string is 7 bit ASCII. + * + * @param string $value + * @return bool + */ + public static function isAscii($value) + { + return ASCII::is_ascii($value); + } + + /** + * Determine if a given string is a valid UUID. + * + * @param string $value + * @return bool + */ + public static function isUuid($value) + { + if (! is_string($value)) { + return false; + } + + return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0; + } + /** * Convert a string to kebab case. * @@ -193,7 +311,7 @@ class Str * Return the length of the given string. * * @param string $value - * @param string $encoding + * @param string|null $encoding * @return int */ public static function length($value, $encoding = null) @@ -209,7 +327,7 @@ class Str * Limit the number of characters in a string. * * @param string $value - * @param int $limit + * @param int $limit * @param string $end * @return string */ @@ -237,7 +355,7 @@ class Str * Limit the number of words in a string. * * @param string $value - * @param int $words + * @param int $words * @param string $end * @return string */ @@ -253,11 +371,11 @@ class Str } /** - * Parse a Class@method style callback into class and method. + * Parse a Class[@]method style callback into class and method. * * @param string $callback * @param string|null $default - * @return array + * @return array<int, string|null> */ public static function parseCallback($callback, $default = null) { @@ -268,7 +386,7 @@ class Str * Get the plural form of an English word. * * @param string $value - * @param int $count + * @param int $count * @return string */ public static function plural($value, $count = 2) @@ -276,6 +394,22 @@ class Str return Pluralizer::plural($value, $count); } + /** + * Pluralize the last word of an English, studly caps case string. + * + * @param string $value + * @param int $count + * @return string + */ + public static function pluralStudly($value, $count = 2) + { + $parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE); + + $lastWord = array_pop($parts); + + return implode('', $parts).self::plural($lastWord, $count); + } + /** * Generate a more truly "random" alpha-numeric string. * @@ -301,17 +435,21 @@ class Str * Replace a given value in the string sequentially with an array. * * @param string $search - * @param array $replace + * @param array<int|string, string> $replace * @param string $subject * @return string */ public static function replaceArray($search, array $replace, $subject) { - foreach ($replace as $value) { - $subject = static::replaceFirst($search, $value, $subject); + $segments = explode($search, $subject); + + $result = array_shift($segments); + + foreach ($segments as $segment) { + $result .= (array_shift($replace) ?? $search).$segment; } - return $subject; + return $result; } /** @@ -408,28 +546,14 @@ class Str * * @param string $title * @param string $separator - * @param string $language + * @param string|null $language * @return string */ public static function slug($title, $separator = '-', $language = 'en') { - $title = static::ascii($title, $language); - - // Convert all dashes/underscores into separator - $flip = $separator == '-' ? '_' : '-'; - - $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); - - // Replace @ with the word 'at' - $title = str_replace('@', $separator.'at'.$separator, $title); - - // Remove all characters that are not the separator, letters, numbers, or whitespace. - $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); + $language = $language ?? ''; - // Replace all separator characters and whitespace by a single separator - $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); - - return trim($title, $separator); + return ASCII::to_slugify($title, $separator, $language, [], true); } /** @@ -460,13 +584,13 @@ class Str * Determine if a given string starts with a given substring. * * @param string $haystack - * @param string|array $needles + * @param string|string[] $needles * @return bool */ public static function startsWith($haystack, $needles) { foreach ((array) $needles as $needle) { - if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) { + if ((string) $needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) { return true; } } @@ -518,166 +642,60 @@ class Str } /** - * Returns the replacements for the ascii method. - * - * Note: Adapted from Stringy\Stringy. + * Generate a UUID (version 4). * - * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt - * - * @return array + * @return \Ramsey\Uuid\UuidInterface */ - protected static function charsArray() + public static function uuid() { - static $charsArray; + return static::$uuidFactory + ? call_user_func(static::$uuidFactory) + : Uuid::uuid4(); + } - if (isset($charsArray)) { - return $charsArray; + /** + * Generate a time-ordered UUID (version 4). + * + * @return \Ramsey\Uuid\UuidInterface + */ + public static function orderedUuid() + { + if (static::$uuidFactory) { + return call_user_func(static::$uuidFactory); } - return $charsArray = [ - '0' => ['°', '₀', '۰', '0'], - '1' => ['¹', '₁', '۱', '1'], - '2' => ['²', '₂', '۲', '2'], - '3' => ['³', '₃', '۳', '3'], - '4' => ['⁴', '₄', '۴', '٤', '4'], - '5' => ['⁵', '₅', '۵', '٥', '5'], - '6' => ['⁶', '₆', '۶', '٦', '6'], - '7' => ['⁷', '₇', '۷', '7'], - '8' => ['⁸', '₈', '۸', '8'], - '9' => ['⁹', '₉', '۹', '9'], - 'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', 'a', 'ä'], - 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b'], - 'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', 'c'], - 'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', 'd'], - 'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ', 'e'], - 'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', 'f'], - 'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', 'g'], - 'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', 'h'], - 'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', 'i'], - 'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'], - 'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', 'k'], - 'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', 'l'], - 'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm'], - 'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', 'n'], - 'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'θ', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ', 'o', 'ö'], - 'p' => ['п', 'π', 'ပ', 'პ', 'پ', 'p'], - 'q' => ['ყ', 'q'], - 'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', 'r'], - 's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს', 's'], - 't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ', 't'], - 'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ', 'u', 'ў', 'ü'], - 'v' => ['в', 'ვ', 'ϐ', 'v'], - 'w' => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ', 'w'], - 'x' => ['χ', 'ξ', 'x'], - 'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ', 'y'], - 'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', 'z'], - 'aa' => ['ع', 'आ', 'آ'], - 'ae' => ['æ', 'ǽ'], - 'ai' => ['ऐ'], - 'ch' => ['ч', 'ჩ', 'ჭ', 'چ'], - 'dj' => ['ђ', 'đ'], - 'dz' => ['џ', 'ძ'], - 'ei' => ['ऍ'], - 'gh' => ['غ', 'ღ'], - 'ii' => ['ई'], - 'ij' => ['ij'], - 'kh' => ['х', 'خ', 'ხ'], - 'lj' => ['љ'], - 'nj' => ['њ'], - 'oe' => ['ö', 'œ', 'ؤ'], - 'oi' => ['ऑ'], - 'oii' => ['ऒ'], - 'ps' => ['ψ'], - 'sh' => ['ш', 'შ', 'ش'], - 'shch' => ['щ'], - 'ss' => ['ß'], - 'sx' => ['ŝ'], - 'th' => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'], - 'ts' => ['ц', 'ც', 'წ'], - 'ue' => ['ü'], - 'uu' => ['ऊ'], - 'ya' => ['я'], - 'yu' => ['ю'], - 'zh' => ['ж', 'ჟ', 'ژ'], - '(c)' => ['©'], - 'A' => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Å', 'Ā', 'Ą', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ', 'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', 'А', 'Ǻ', 'Ǎ', 'A', 'Ä'], - 'B' => ['Б', 'Β', 'ब', 'B'], - 'C' => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ', 'C'], - 'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ', 'D'], - 'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', 'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ', 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э', 'Є', 'Ə', 'E'], - 'F' => ['Ф', 'Φ', 'F'], - 'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ', 'G'], - 'H' => ['Η', 'Ή', 'Ħ', 'H'], - 'I' => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į', 'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', 'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', 'Ǐ', 'ϒ', 'I'], - 'J' => ['J'], - 'K' => ['К', 'Κ', 'K'], - 'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल', 'L'], - 'M' => ['М', 'Μ', 'M'], - 'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν', 'N'], - 'O' => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ', 'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ø', 'Ō', 'Ő', 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', 'Ὸ', 'Ό', 'О', 'Θ', 'Ө', 'Ǒ', 'Ǿ', 'O', 'Ö'], - 'P' => ['П', 'Π', 'P'], - 'Q' => ['Q'], - 'R' => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ', 'R'], - 'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ', 'S'], - 'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ', 'T'], - 'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ', 'Ự', 'Û', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', 'Ǔ', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ', 'U', 'Ў', 'Ü'], - 'V' => ['В', 'V'], - 'W' => ['Ω', 'Ώ', 'Ŵ', 'W'], - 'X' => ['Χ', 'Ξ', 'X'], - 'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ', 'Y'], - 'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ', 'Z'], - 'AE' => ['Æ', 'Ǽ'], - 'Ch' => ['Ч'], - 'Dj' => ['Ђ'], - 'Dz' => ['Џ'], - 'Gx' => ['Ĝ'], - 'Hx' => ['Ĥ'], - 'Ij' => ['IJ'], - 'Jx' => ['Ĵ'], - 'Kh' => ['Х'], - 'Lj' => ['Љ'], - 'Nj' => ['Њ'], - 'Oe' => ['Œ'], - 'Ps' => ['Ψ'], - 'Sh' => ['Ш'], - 'Shch' => ['Щ'], - 'Ss' => ['ẞ'], - 'Th' => ['Þ'], - 'Ts' => ['Ц'], - 'Ya' => ['Я'], - 'Yu' => ['Ю'], - 'Zh' => ['Ж'], - ' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", "\xEF\xBE\xA0"], - ]; - } - - /** - * Returns the language specific replacements for the ascii method. - * - * Note: Adapted from Stringy\Stringy. - * - * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt + $factory = new UuidFactory(); + + $factory->setRandomGenerator(new CombGenerator( + $factory->getRandomGenerator(), + $factory->getNumberConverter() + )); + + $factory->setCodec(new TimestampFirstCombCodec( + $factory->getUuidBuilder() + )); + + return $factory->uuid4(); + } + + /** + * Set the callable that will be used to generate UUIDs. * - * @param string $language - * @return array|null - */ - protected static function languageSpecificCharsArray($language) - { - static $languageSpecific; - - if (! isset($languageSpecific)) { - $languageSpecific = [ - 'bg' => [ - ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], - ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], - ], - 'de' => [ - ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], - ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], - ], - ]; - } + * @param callable|null $factory + * @return void + */ + public static function createUuidsUsing(callable $factory = null) + { + static::$uuidFactory = $factory; + } - return $languageSpecific[$language] ?? null; + /** + * Indicate that UUIDs should be created normally and not using a custom factory. + * + * @return void + */ + public static function createUuidsNormally() + { + static::$uuidFactory = null; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/BusFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/BusFake.php index ae1209a3c14d9a69f6b312a44a182a26389024c6..7a5f0eb2f0d8a072bbdd5f79f42dc1fa30392f6c 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/BusFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/BusFake.php @@ -2,11 +2,27 @@ namespace Illuminate\Support\Testing\Fakes; +use Closure; use Illuminate\Contracts\Bus\Dispatcher; +use Illuminate\Support\Arr; use PHPUnit\Framework\Assert as PHPUnit; class BusFake implements Dispatcher { + /** + * The original Bus dispatcher implementation. + * + * @var \Illuminate\Contracts\Bus\Dispatcher + */ + protected $dispatcher; + + /** + * The job types that should be intercepted instead of dispatched. + * + * @var array + */ + protected $jobsToFake; + /** * The commands that have been dispatched. * @@ -14,6 +30,27 @@ class BusFake implements Dispatcher */ protected $commands = []; + /** + * The commands that have been dispatched after the response has been sent. + * + * @var array + */ + protected $commandsAfterResponse = []; + + /** + * Create a new bus fake instance. + * + * @param \Illuminate\Contracts\Bus\Dispatcher $dispatcher + * @param array|string $jobsToFake + * @return void + */ + public function __construct(Dispatcher $dispatcher, $jobsToFake = []) + { + $this->dispatcher = $dispatcher; + + $this->jobsToFake = Arr::wrap($jobsToFake); + } + /** * Assert if a job was dispatched based on a truth-test callback. * @@ -28,7 +65,8 @@ class BusFake implements Dispatcher } PHPUnit::assertTrue( - $this->dispatched($command, $callback)->count() > 0, + $this->dispatched($command, $callback)->count() > 0 || + $this->dispatchedAfterResponse($command, $callback)->count() > 0, "The expected [{$command}] job was not dispatched." ); } @@ -40,10 +78,13 @@ class BusFake implements Dispatcher * @param int $times * @return void */ - protected function assertDispatchedTimes($command, $times = 1) + public function assertDispatchedTimes($command, $times = 1) { + $count = $this->dispatched($command)->count() + + $this->dispatchedAfterResponse($command)->count(); + PHPUnit::assertTrue( - ($count = $this->dispatched($command)->count()) === $times, + $count === $times, "The expected [{$command}] job was pushed {$count} times instead of {$times} times." ); } @@ -58,11 +99,61 @@ class BusFake implements Dispatcher public function assertNotDispatched($command, $callback = null) { PHPUnit::assertTrue( - $this->dispatched($command, $callback)->count() === 0, + $this->dispatched($command, $callback)->count() === 0 && + $this->dispatchedAfterResponse($command, $callback)->count() === 0, "The unexpected [{$command}] job was dispatched." ); } + /** + * Assert if a job was dispatched after the response was sent based on a truth-test callback. + * + * @param string $command + * @param callable|int|null $callback + * @return void + */ + public function assertDispatchedAfterResponse($command, $callback = null) + { + if (is_numeric($callback)) { + return $this->assertDispatchedAfterResponseTimes($command, $callback); + } + + PHPUnit::assertTrue( + $this->dispatchedAfterResponse($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched for after sending the response." + ); + } + + /** + * Assert if a job was pushed after the response was sent a number of times. + * + * @param string $command + * @param int $times + * @return void + */ + public function assertDispatchedAfterResponseTimes($command, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->dispatchedAfterResponse($command)->count()) === $times, + "The expected [{$command}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a job was dispatched based on a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return void + */ + public function assertNotDispatchedAfterResponse($command, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatchedAfterResponse($command, $callback)->count() === 0, + "The unexpected [{$command}] job was dispatched for after sending the response." + ); + } + /** * Get all of the jobs matching a truth-test callback. * @@ -85,6 +176,28 @@ class BusFake implements Dispatcher }); } + /** + * Get all of the jobs dispatched after the response was sent matching a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatchedAfterResponse(string $command, $callback = null) + { + if (! $this->hasDispatchedAfterResponse($command)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->commandsAfterResponse[$command])->filter(function ($command) use ($callback) { + return $callback($command); + }); + } + /** * Determine if there are any stored commands for a given class. * @@ -96,6 +209,17 @@ class BusFake implements Dispatcher return isset($this->commands[$command]) && ! empty($this->commands[$command]); } + /** + * Determine if there are any stored commands for a given class. + * + * @param string $command + * @return bool + */ + public function hasDispatchedAfterResponse($command) + { + return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]); + } + /** * Dispatch a command to its appropriate handler. * @@ -104,7 +228,11 @@ class BusFake implements Dispatcher */ public function dispatch($command) { - return $this->dispatchNow($command); + if ($this->shouldFakeJob($command)) { + $this->commands[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatch($command); + } } /** @@ -116,7 +244,46 @@ class BusFake implements Dispatcher */ public function dispatchNow($command, $handler = null) { - $this->commands[get_class($command)][] = $command; + if ($this->shouldFakeJob($command)) { + $this->commands[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatchNow($command, $handler); + } + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatchAfterResponse($command) + { + if ($this->shouldFakeJob($command)) { + $this->commandsAfterResponse[get_class($command)][] = $command; + } else { + return $this->dispatcher->dispatch($command); + } + } + + /** + * Determine if an command should be faked or actually dispatched. + * + * @param mixed $command + * @return bool + */ + protected function shouldFakeJob($command) + { + if (empty($this->jobsToFake)) { + return true; + } + + return collect($this->jobsToFake) + ->filter(function ($job) use ($command) { + return $job instanceof Closure + ? $job($command) + : $job === get_class($command); + })->isNotEmpty(); } /** @@ -127,6 +294,43 @@ class BusFake implements Dispatcher */ public function pipeThrough(array $pipes) { - // + $this->dispatcher->pipeThrough($pipes); + + return $this; + } + + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command) + { + return $this->dispatcher->hasCommandHandler($command); + } + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return mixed + */ + public function getCommandHandler($command) + { + return $this->dispatcher->getCommandHandler($command); + } + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map) + { + $this->dispatcher->map($map); + + return $this; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/EventFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/EventFake.php index edbb90eb1b960e04dd29cac0aac6096b10227e7a..7fe7ccc898744e707ced4e0705a549670c3640be 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/EventFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/EventFake.php @@ -2,9 +2,10 @@ namespace Illuminate\Support\Testing\Fakes; +use Closure; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\Arr; use PHPUnit\Framework\Assert as PHPUnit; -use Illuminate\Contracts\Events\Dispatcher; class EventFake implements Dispatcher { @@ -134,7 +135,7 @@ class EventFake implements Dispatcher */ public function listen($events, $listener) { - // + $this->dispatcher->listen($events, $listener); } /** @@ -145,7 +146,7 @@ class EventFake implements Dispatcher */ public function hasListeners($eventName) { - // + return $this->dispatcher->hasListeners($eventName); } /** @@ -168,7 +169,7 @@ class EventFake implements Dispatcher */ public function subscribe($subscriber) { - // + $this->dispatcher->subscribe($subscriber); } /** @@ -182,19 +183,6 @@ class EventFake implements Dispatcher // } - /** - * 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) - { - return $this->dispatch($event, $payload, $halt); - } - /** * Fire an event and call the listeners. * @@ -207,10 +195,10 @@ class EventFake implements Dispatcher { $name = is_object($event) ? get_class($event) : (string) $event; - if ($this->shouldFakeEvent($name)) { + if ($this->shouldFakeEvent($name, $payload)) { $this->events[$name][] = func_get_args(); } else { - $this->dispatcher->dispatch($event, $payload, $halt); + return $this->dispatcher->dispatch($event, $payload, $halt); } } @@ -218,11 +206,22 @@ class EventFake implements Dispatcher * Determine if an event should be faked or actually dispatched. * * @param string $eventName + * @param mixed $payload * @return bool */ - protected function shouldFakeEvent($eventName) + protected function shouldFakeEvent($eventName, $payload) { - return empty($this->eventsToFake) || in_array($eventName, $this->eventsToFake); + if (empty($this->eventsToFake)) { + return true; + } + + return collect($this->eventsToFake) + ->filter(function ($event) use ($eventName, $payload) { + return $event instanceof Closure + ? $event($eventName, $payload) + : $event === $eventName; + }) + ->isNotEmpty(); } /** @@ -249,8 +248,8 @@ class EventFake implements Dispatcher /** * Dispatch an event and call the listeners. * - * @param string|object $event - * @param mixed $payload + * @param string|object $event + * @param mixed $payload * @return void */ public function until($event, $payload = []) diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/MailFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/MailFake.php index 0d11c086320b6324119e4e3922351ad0e2e4a844..bce3143d81135a7e0d1d0f8e9c44149d5369df5c 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/MailFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/MailFake.php @@ -2,13 +2,21 @@ namespace Illuminate\Support\Testing\Fakes; -use Illuminate\Contracts\Mail\Mailer; use Illuminate\Contracts\Mail\Mailable; -use PHPUnit\Framework\Assert as PHPUnit; +use Illuminate\Contracts\Mail\Mailer; +use Illuminate\Contracts\Mail\MailQueue; use Illuminate\Contracts\Queue\ShouldQueue; +use PHPUnit\Framework\Assert as PHPUnit; -class MailFake implements Mailer +class MailFake implements Mailer, MailQueue { + /** + * The mailer currently being used to send a message. + * + * @var string + */ + protected $currentMailer; + /** * All of the mailables that have been sent. * @@ -36,9 +44,15 @@ class MailFake implements Mailer return $this->assertSentTimes($mailable, $callback); } + $message = "The expected [{$mailable}] mailable was not sent."; + + if (count($this->queuedMailables) > 0) { + $message .= ' Did you mean to use assertQueued() instead?'; + } + PHPUnit::assertTrue( $this->sent($mailable, $callback)->count() > 0, - "The expected [{$mailable}] mailable was not sent." + $message ); } @@ -79,7 +93,11 @@ class MailFake implements Mailer */ public function assertNothingSent() { - PHPUnit::assertEmpty($this->mailables, 'Mailables were sent unexpectedly.'); + $mailableNames = collect($this->mailables)->map(function ($mailable) { + return get_class($mailable); + })->join(', '); + + PHPUnit::assertEmpty($this->mailables, 'The following mailables were sent unexpectedly: '.$mailableNames); } /** @@ -138,7 +156,11 @@ class MailFake implements Mailer */ public function assertNothingQueued() { - PHPUnit::assertEmpty($this->queuedMailables, 'Mailables were queued unexpectedly.'); + $mailableNames = collect($this->queuedMailables)->map(function ($mailable) { + return get_class($mailable); + })->join(', '); + + PHPUnit::assertEmpty($this->queuedMailables, 'The following mailables were queued unexpectedly: '.$mailableNames); } /** @@ -233,6 +255,19 @@ class MailFake implements Mailer }); } + /** + * Get a mailer instance by name. + * + * @param string|null $name + * @return \Illuminate\Mail\Mailer + */ + public function mailer($name = null) + { + $this->currentMailer = $name; + + return $this; + } + /** * Begin the process of mailing a mailable class instance. * @@ -256,11 +291,11 @@ class MailFake implements Mailer } /** - * Send a new message when only a raw text part. + * Send a new message with only a raw text part. * * @param string $text * @param \Closure|string $callback - * @return int + * @return void */ public function raw($text, $callback) { @@ -272,7 +307,7 @@ class MailFake implements Mailer * * @param string|array $view * @param array $data - * @param \Closure|string $callback + * @param \Closure|string|null $callback * @return void */ public function send($view, array $data = [], $callback = null) @@ -281,8 +316,12 @@ class MailFake implements Mailer return; } + $view->mailer($this->currentMailer); + + $this->currentMailer = null; + if ($view instanceof ShouldQueue) { - return $this->queue($view, $data, $callback); + return $this->queue($view, $data); } $this->mailables[] = $view; @@ -301,9 +340,26 @@ class MailFake implements Mailer return; } + $view->mailer($this->currentMailer); + + $this->currentMailer = null; + $this->queuedMailables[] = $view; } + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view + * @param string|null $queue + * @return mixed + */ + public function later($delay, $view, $queue = null) + { + $this->queue($view, $queue); + } + /** * Get the array of failed recipients. * @@ -311,6 +367,6 @@ class MailFake implements Mailer */ public function failures() { - // + return []; } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/NotificationFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/NotificationFake.php index b610932b62da3071f36c3ab03ad4f6993e592fc6..95edd71a94eca12d750cc0dd955b9193ced95394 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/NotificationFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/NotificationFake.php @@ -2,14 +2,19 @@ namespace Illuminate\Support\Testing\Fakes; -use Ramsey\Uuid\Uuid; +use Exception; +use Illuminate\Contracts\Notifications\Dispatcher as NotificationDispatcher; +use Illuminate\Contracts\Notifications\Factory as NotificationFactory; +use Illuminate\Contracts\Translation\HasLocalePreference; use Illuminate\Support\Collection; +use Illuminate\Support\Str; +use Illuminate\Support\Traits\Macroable; use PHPUnit\Framework\Assert as PHPUnit; -use Illuminate\Contracts\Notifications\Factory as NotificationFactory; -use Illuminate\Contracts\Notifications\Dispatcher as NotificationDispatcher; -class NotificationFake implements NotificationFactory, NotificationDispatcher +class NotificationFake implements NotificationDispatcher, NotificationFactory { + use Macroable; + /** * All of the notifications that have been sent. * @@ -17,6 +22,13 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher */ protected $notifications = []; + /** + * Locale used when sending notifications. + * + * @var string|null + */ + public $locale; + /** * Assert if a notification was sent based on a truth-test callback. * @@ -24,10 +36,16 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher * @param string $notification * @param callable|null $callback * @return void + * + * @throws \Exception */ public function assertSentTo($notifiable, $notification, $callback = null) { if (is_array($notifiable) || $notifiable instanceof Collection) { + if (count($notifiable) === 0) { + throw new Exception('No notifiable given.'); + } + foreach ($notifiable as $singleNotifiable) { $this->assertSentTo($singleNotifiable, $notification, $callback); } @@ -57,7 +75,7 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher { PHPUnit::assertTrue( ($count = $this->sent($notifiable, $notification)->count()) === $times, - "The expected [{$notification}] notification was sent {$count} times instead of {$times} times." + "Expected [{$notification}] to be sent {$times} times, but was sent {$count} times." ); } @@ -68,10 +86,16 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher * @param string $notification * @param callable|null $callback * @return void + * + * @throws \Exception */ public function assertNotSentTo($notifiable, $notification, $callback = null) { if (is_array($notifiable) || $notifiable instanceof Collection) { + if (count($notifiable) === 0) { + throw new Exception('No notifiable given.'); + } + foreach ($notifiable as $singleNotifiable) { $this->assertNotSentTo($singleNotifiable, $notification, $callback); } @@ -95,6 +119,27 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher PHPUnit::assertEmpty($this->notifications, 'Notifications were sent unexpectedly.'); } + /** + * Assert the total amount of times a notification was sent. + * + * @param int $expectedCount + * @param string $notification + * @return void + */ + public function assertTimesSent($expectedCount, $notification) + { + $actualCount = collect($this->notifications) + ->flatten(1) + ->reduce(function ($count, $sent) use ($notification) { + return $count + count($sent[$notification] ?? []); + }, 0); + + PHPUnit::assertSame( + $expectedCount, $actualCount, + "Expected [{$notification}] to be sent {$expectedCount} times, but was sent {$actualCount} times." + ); + } + /** * Get all of the notifications matching a truth-test callback. * @@ -141,11 +186,7 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher */ protected function notificationsFor($notifiable, $notification) { - if (isset($this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification])) { - return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification]; - } - - return []; + return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? []; } /** @@ -165,9 +206,10 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher * * @param \Illuminate\Support\Collection|array|mixed $notifiables * @param mixed $notification + * @param array|null $channels * @return void */ - public function sendNow($notifiables, $notification) + public function sendNow($notifiables, $notification, array $channels = null) { if (! $notifiables instanceof Collection && ! is_array($notifiables)) { $notifiables = [$notifiables]; @@ -175,13 +217,18 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher foreach ($notifiables as $notifiable) { if (! $notification->id) { - $notification->id = Uuid::uuid4()->toString(); + $notification->id = Str::uuid()->toString(); } $this->notifications[get_class($notifiable)][$notifiable->getKey()][get_class($notification)][] = [ 'notification' => $notification, - 'channels' => $notification->via($notifiable), + 'channels' => $channels ?: $notification->via($notifiable), 'notifiable' => $notifiable, + 'locale' => $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { + if ($notifiable instanceof HasLocalePreference) { + return $notifiable->preferredLocale(); + } + }), ]; } } @@ -196,4 +243,17 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher { // } + + /** + * Set the locale of notifications. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/PendingMailFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/PendingMailFake.php index e344fcfb2dbcd6d054ad242e51f1a3a06e6e4cec..37a4000e78c883c0696fbfda6543b4b27e1f048e 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/PendingMailFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/PendingMailFake.php @@ -2,7 +2,7 @@ namespace Illuminate\Support\Testing\Fakes; -use Illuminate\Mail\Mailable; +use Illuminate\Contracts\Mail\Mailable; use Illuminate\Mail\PendingMail; class PendingMailFake extends PendingMail @@ -21,7 +21,7 @@ class PendingMailFake extends PendingMail /** * Send a new mailable message instance. * - * @param \Illuminate\Mail\Mailable $mailable + * @param \Illuminate\Contracts\Mail\Mailable $mailable; * @return mixed */ public function send(Mailable $mailable) @@ -32,7 +32,7 @@ class PendingMailFake extends PendingMail /** * Send a mailable message immediately. * - * @param \Illuminate\Mail\Mailable $mailable + * @param \Illuminate\Contracts\Mail\Mailable $mailable; * @return mixed */ public function sendNow(Mailable $mailable) @@ -43,7 +43,7 @@ class PendingMailFake extends PendingMail /** * Push the given mailable onto the queue. * - * @param \Illuminate\Mail\Mailable $mailable + * @param \Illuminate\Contracts\Mail\Mailable $mailable; * @return mixed */ public function queue(Mailable $mailable) diff --git a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/QueueFake.php b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/QueueFake.php index 66d191e90c95a59bb5fceb3ff9e4815e9f5a3fe2..30bf327de758839fa7a44985ebd127fba5cbb654 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/QueueFake.php +++ b/Seance5-6/seance/vendor/illuminate/support/Testing/Fakes/QueueFake.php @@ -2,8 +2,9 @@ namespace Illuminate\Support\Testing\Fakes; -use Illuminate\Queue\QueueManager; +use BadMethodCallException; use Illuminate\Contracts\Queue\Queue; +use Illuminate\Queue\QueueManager; use PHPUnit\Framework\Assert as PHPUnit; class QueueFake extends QueueManager implements Queue @@ -68,6 +69,106 @@ class QueueFake extends QueueManager implements Queue }); } + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + public function assertPushedWithChain($job, $expectedChain = [], $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + PHPUnit::assertTrue( + collect($expectedChain)->isNotEmpty(), + 'The expected chain can not be empty.' + ); + + $this->isChainOfObjects($expectedChain) + ? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback) + : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); + } + + /** + * Assert if a job was pushed with an empty chain based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertPushedWithoutChain($job, $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + $this->assertPushedWithChainOfClasses($job, [], $callback); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) + { + $chain = collect($expectedChain)->map(function ($job) { + return serialize($job); + })->all(); + + PHPUnit::assertTrue( + $this->pushed($job, $callback)->filter(function ($job) use ($chain) { + return $job->chained == $chain; + })->isNotEmpty(), + 'The expected chain was not pushed.' + ); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) + { + $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { + return collect($chain)->map(function ($job) { + return get_class(unserialize($job)); + }); + })->filter(function ($chain) use ($expectedChain) { + return $chain->all() === $expectedChain; + }); + + PHPUnit::assertTrue( + $matching->isNotEmpty(), 'The expected chain was not pushed.' + ); + } + + /** + * Determine if the given chain is entirely composed of objects. + * + * @param array $chain + * @return bool + */ + protected function isChainOfObjects($chain) + { + return ! collect($chain)->contains(function ($job) { + return ! is_object($job); + }); + } + /** * Determine if a job was pushed based on a truth-test callback. * @@ -140,20 +241,22 @@ class QueueFake extends QueueManager implements Queue /** * Get the size of the queue. * - * @param string $queue + * @param string|null $queue * @return int */ public function size($queue = null) { - return 0; + return collect($this->jobs)->flatten(1)->filter(function ($job) use ($queue) { + return $job['queue'] === $queue; + })->count(); } /** * Push a new job onto the queue. * * @param string $job - * @param mixed $data - * @param string $queue + * @param mixed $data + * @param string|null $queue * @return mixed */ public function push($job, $data = '', $queue = null) @@ -168,8 +271,8 @@ class QueueFake extends QueueManager implements Queue * Push a raw payload onto the queue. * * @param string $payload - * @param string $queue - * @param array $options + * @param string|null $queue + * @param array $options * @return mixed */ public function pushRaw($payload, $queue = null, array $options = []) @@ -180,10 +283,10 @@ class QueueFake extends QueueManager implements Queue /** * Push a new job onto the queue after a delay. * - * @param \DateTime|int $delay + * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job - * @param mixed $data - * @param string $queue + * @param mixed $data + * @param string|null $queue * @return mixed */ public function later($delay, $job, $data = '', $queue = null) @@ -196,7 +299,7 @@ class QueueFake extends QueueManager implements Queue * * @param string $queue * @param string $job - * @param mixed $data + * @param mixed $data * @return mixed */ public function pushOn($queue, $job, $data = '') @@ -208,9 +311,9 @@ class QueueFake extends QueueManager implements Queue * Push a new job onto the queue after a delay. * * @param string $queue - * @param \DateTime|int $delay + * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job - * @param mixed $data + * @param mixed $data * @return mixed */ public function laterOn($queue, $delay, $job, $data = '') @@ -221,7 +324,7 @@ class QueueFake extends QueueManager implements Queue /** * Pop the next job off of the queue. * - * @param string $queue + * @param string|null $queue * @return \Illuminate\Contracts\Queue\Job|null */ public function pop($queue = null) @@ -232,9 +335,9 @@ class QueueFake extends QueueManager implements Queue /** * Push an array of jobs onto the queue. * - * @param array $jobs - * @param mixed $data - * @param string $queue + * @param array $jobs + * @param mixed $data + * @param string|null $queue * @return mixed */ public function bulk($jobs, $data = '', $queue = null) @@ -244,6 +347,16 @@ class QueueFake extends QueueManager implements Queue } } + /** + * Get the jobs that have been pushed. + * + * @return array + */ + public function pushedJobs() + { + return $this->jobs; + } + /** * Get the connection name for the queue. * @@ -257,11 +370,27 @@ class QueueFake extends QueueManager implements Queue /** * Set the connection name for the queue. * - * @param string $name + * @param string $name * @return $this */ public function setConnectionName($name) { return $this; } + + /** + * Override the QueueManager to prevent circular dependency. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + throw new BadMethodCallException(sprintf( + 'Call to undefined method %s::%s()', static::class, $method + )); + } } diff --git a/Seance5-6/seance/vendor/illuminate/support/Traits/CapsuleManagerTrait.php b/Seance5-6/seance/vendor/illuminate/support/Traits/CapsuleManagerTrait.php index 08089ef661fc82850c2c335aea100d37cfca40f0..0532755228b08f0b60e554de78b53b986c5f63cf 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Traits/CapsuleManagerTrait.php +++ b/Seance5-6/seance/vendor/illuminate/support/Traits/CapsuleManagerTrait.php @@ -2,8 +2,8 @@ namespace Illuminate\Support\Traits; -use Illuminate\Support\Fluent; use Illuminate\Contracts\Container\Container; +use Illuminate\Support\Fluent; trait CapsuleManagerTrait { diff --git a/Seance5-6/seance/vendor/illuminate/support/Traits/Macroable.php b/Seance5-6/seance/vendor/illuminate/support/Traits/Macroable.php index a7703b145cbbdee0aded6d19fbf9ad016e42a198..0c2112c7fba52495fddeb5dcfa094591587034cc 100644 --- a/Seance5-6/seance/vendor/illuminate/support/Traits/Macroable.php +++ b/Seance5-6/seance/vendor/illuminate/support/Traits/Macroable.php @@ -2,10 +2,10 @@ namespace Illuminate\Support\Traits; +use BadMethodCallException; use Closure; use ReflectionClass; use ReflectionMethod; -use BadMethodCallException; trait Macroable { @@ -19,9 +19,8 @@ trait Macroable /** * Register a custom macro. * - * @param string $name + * @param string $name * @param object|callable $macro - * * @return void */ public static function macro($name, $macro) @@ -33,18 +32,22 @@ trait Macroable * Mix another object into the class. * * @param object $mixin + * @param bool $replace * @return void + * + * @throws \ReflectionException */ - public static function mixin($mixin) + public static function mixin($mixin, $replace = true) { $methods = (new ReflectionClass($mixin))->getMethods( ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED ); foreach ($methods as $method) { - $method->setAccessible(true); - - static::macro($method->name, $method->invoke($mixin)); + if ($replace || ! static::hasMacro($method->name)) { + $method->setAccessible(true); + static::macro($method->name, $method->invoke($mixin)); + } } } @@ -63,7 +66,7 @@ trait Macroable * Dynamically handle calls to the class. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed * * @throws \BadMethodCallException @@ -71,21 +74,25 @@ trait Macroable public static function __callStatic($method, $parameters) { if (! static::hasMacro($method)) { - throw new BadMethodCallException("Method {$method} does not exist."); + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); } - if (static::$macros[$method] instanceof Closure) { - return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters); + $macro = static::$macros[$method]; + + if ($macro instanceof Closure) { + return call_user_func_array(Closure::bind($macro, null, static::class), $parameters); } - return call_user_func_array(static::$macros[$method], $parameters); + return $macro(...$parameters); } /** * Dynamically handle calls to the class. * * @param string $method - * @param array $parameters + * @param array $parameters * @return mixed * * @throws \BadMethodCallException @@ -93,7 +100,9 @@ trait Macroable public function __call($method, $parameters) { if (! static::hasMacro($method)) { - throw new BadMethodCallException("Method {$method} does not exist."); + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); } $macro = static::$macros[$method]; @@ -102,6 +111,6 @@ trait Macroable return call_user_func_array($macro->bindTo($this, static::class), $parameters); } - return call_user_func_array($macro, $parameters); + return $macro(...$parameters); } } diff --git a/Seance5-6/seance/vendor/illuminate/support/composer.json b/Seance5-6/seance/vendor/illuminate/support/composer.json index 35f3ebd21156a3e3a043af8f698ef186511325f3..4c130da9300365b4503cfb87a35efdef5c7b3da6 100644 --- a/Seance5-6/seance/vendor/illuminate/support/composer.json +++ b/Seance5-6/seance/vendor/illuminate/support/composer.json @@ -14,13 +14,15 @@ } ], "require": { - "php": ">=7.0", + "php": "^7.2.5", + "ext-json": "*", "ext-mbstring": "*", - "doctrine/inflector": "~1.1", - "illuminate/contracts": "5.5.*", - "nesbot/carbon": "^1.24.1" + "doctrine/inflector": "^1.1", + "illuminate/contracts": "^7.0", + "nesbot/carbon": "^2.17", + "voku/portable-ascii": "^1.4.8" }, - "replace": { + "conflict": { "tightenco/collect": "<5.5.33" }, "autoload": { @@ -33,13 +35,16 @@ }, "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "7.x-dev" } }, "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.5.*).", - "symfony/process": "Required to use the composer class (~3.3).", - "symfony/var-dumper": "Required to use the dd function (~3.3)." + "illuminate/filesystem": "Required to use the composer class (^7.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^5.0).", + "symfony/var-dumper": "Required to use the dd function (^5.0).", + "vlucas/phpdotenv": "Required to use the Env class and env helper (^4.0)." }, "config": { "sort-packages": true diff --git a/Seance5-6/seance/vendor/illuminate/support/helpers.php b/Seance5-6/seance/vendor/illuminate/support/helpers.php index c52fd66fa742eb53e83110cede967edea5770a01..f17649d1fbe4ac89fc99b96130f030a54a7b23d1 100644 --- a/Seance5-6/seance/vendor/illuminate/support/helpers.php +++ b/Seance5-6/seance/vendor/illuminate/support/helpers.php @@ -1,12 +1,11 @@ <?php +use Illuminate\Contracts\Support\Htmlable; use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use Illuminate\Support\Optional; use Illuminate\Support\Collection; -use Illuminate\Support\Debug\Dumper; -use Illuminate\Contracts\Support\Htmlable; +use Illuminate\Support\Env; use Illuminate\Support\HigherOrderTapProxy; +use Illuminate\Support\Optional; if (! function_exists('append_config')) { /** @@ -31,306 +30,6 @@ if (! function_exists('append_config')) { } } -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_collapse')) { - /** - * Collapse an array of arrays into a single array. - * - * @param 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 keys. - * - * @param array $array - * @param array|string $keys - * @return array - */ - function array_except($array, $keys) - { - return Arr::except($array, $keys); - } -} - -if (! function_exists('array_first')) { - /** - * Return the first element in an array passing a given truth test. - * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - function array_first($array, callable $callback = null, $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 - * @param int $depth - * @return array - */ - function array_flatten($array, $depth = INF) - { - return Arr::flatten($array, $depth); - } -} - -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 \ArrayAccess|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 or items exist in an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string|array $keys - * @return bool - */ - function array_has($array, $keys) - { - return Arr::has($array, $keys); - } -} - -if (! function_exists('array_last')) { - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - function array_last($array, callable $callback = null, $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_random')) { - /** - * Get a random value from an array. - * - * @param array $array - * @param int|null $num - * @return mixed - */ - function array_random($array, $num = null) - { - return Arr::random($array, $num); - } -} - -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 by the given callback or attribute name. - * - * @param array $array - * @param callable|string|null $callback - * @return array - */ - function array_sort($array, $callback = null) - { - 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('array_wrap')) { - /** - * If the given value is not an array, wrap it in one. - * - * @param mixed $value - * @return array - */ - function array_wrap($value) - { - return Arr::wrap($value); - } -} - if (! function_exists('blank')) { /** * Determine if the given value is "blank". @@ -360,19 +59,6 @@ if (! function_exists('blank')) { } } -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. @@ -390,7 +76,7 @@ if (! function_exists('class_basename')) { if (! function_exists('class_uses_recursive')) { /** - * Returns all traits used by a class, its subclasses and trait of their traits. + * Returns all traits used by a class, its parent classes and trait of their traits. * * @param object|string $class * @return array @@ -403,7 +89,7 @@ if (! function_exists('class_uses_recursive')) { $results = []; - foreach (array_merge([$class => $class], class_parents($class)) as $class) { + foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) { $results += trait_uses_recursive($class); } @@ -428,7 +114,7 @@ if (! function_exists('data_fill')) { /** * Fill in data where it's missing. * - * @param mixed $target + * @param mixed $target * @param string|array $key * @param mixed $value * @return mixed @@ -443,9 +129,9 @@ 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 + * @param mixed $target + * @param string|array|int|null $key + * @param mixed $default * @return mixed */ function data_get($target, $key, $default = null) @@ -464,7 +150,11 @@ if (! function_exists('data_get')) { return value($default); } - $result = Arr::pluck($target, $key); + $result = []; + + foreach ($target as $item) { + $result[] = data_get($item, $key); + } return in_array('*', $key) ? Arr::collapse($result) : $result; } @@ -544,34 +234,15 @@ if (! function_exists('data_set')) { } } -if (! function_exists('dd')) { - /** - * Dump the passed variables and end the script. - * - * @param mixed $args - * @return void - */ - function dd(...$args) - { - http_response_code(500); - - foreach ($args as $x) { - (new Dumper)->dump($x); - } - - die(1); - } -} - if (! function_exists('e')) { /** - * Escape HTML special characters in a string. + * Encode HTML special characters in a string. * * @param \Illuminate\Contracts\Support\Htmlable|string $value * @param bool $doubleEncode * @return string */ - function e($value, $doubleEncode = false) + function e($value, $doubleEncode = true) { if ($value instanceof Htmlable) { return $value->toHtml(); @@ -581,56 +252,17 @@ if (! function_exists('e')) { } } -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('env')) { /** * Gets the value of an environment variable. * * @param string $key - * @param mixed $default + * @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; + return Env::get($key, $default); } } @@ -660,19 +292,6 @@ if (! function_exists('head')) { } } -if (! function_exists('kebab_case')) { - /** - * Convert a string to kebab case. - * - * @param string $value - * @return string - */ - function kebab_case($value) - { - return Str::kebab($value); - } -} - if (! function_exists('last')) { /** * Get the last element from an array. @@ -691,8 +310,8 @@ if (! function_exists('object_get')) { * Get an item from an object using "dot" notation. * * @param object $object - * @param string $key - * @param mixed $default + * @param string|null $key + * @param mixed $default * @return mixed */ function object_get($object, $key, $default = null) @@ -718,11 +337,16 @@ if (! function_exists('optional')) { * Provide access to optional objects. * * @param mixed $value + * @param callable|null $callback * @return mixed */ - function optional($value = null) + function optional($value = null, callable $callback = null) { - return new Optional($value); + if (is_null($callback)) { + return new Optional($value); + } elseif (! is_null($value)) { + return $callback($value); + } } } @@ -731,7 +355,7 @@ if (! function_exists('preg_replace_array')) { * Replace a given pattern with each value in the array in sequentially. * * @param string $pattern - * @param array $replacements + * @param array $replacements * @param string $subject * @return string */ @@ -752,24 +376,26 @@ if (! function_exists('retry')) { * @param int $times * @param callable $callback * @param int $sleep + * @param callable|null $when * @return mixed * * @throws \Exception */ - function retry($times, callable $callback, $sleep = 0) + function retry($times, callable $callback, $sleep = 0, $when = null) { - $times--; + $attempts = 0; beginning: + $attempts++; + $times--; + try { - return $callback(); + return $callback($attempts); } catch (Exception $e) { - if (! $times) { + if ($times < 1 || ($when && ! $when($e))) { throw $e; } - $times--; - if ($sleep) { usleep($sleep * 1000); } @@ -779,248 +405,6 @@ if (! function_exists('retry')) { } } -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_after')) { - /** - * Return the remainder of a string after a given value. - * - * @param string $subject - * @param string $search - * @return string - */ - function str_after($subject, $search) - { - return Str::after($subject, $search); - } -} - -if (! function_exists('str_before')) { - /** - * Get the portion of a string before a given value. - * - * @param string $subject - * @param string $search - * @return string - */ - function str_before($subject, $search) - { - return Str::before($subject, $search); - } -} - -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|array $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) - { - return Str::replaceArray($search, $replace, $subject); - } -} - -if (! function_exists('str_replace_first')) { - /** - * Replace the first occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @param string $subject - * @return string - */ - function str_replace_first($search, $replace, $subject) - { - return Str::replaceFirst($search, $replace, $subject); - } -} - -if (! function_exists('str_replace_last')) { - /** - * Replace the last occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @param string $subject - * @return string - */ - function str_replace_last($search, $replace, $subject) - { - return Str::replaceLast($search, $replace, $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 - * @param string $language - * @return string - */ - function str_slug($title, $separator = '-', $language = 'en') - { - return Str::slug($title, $separator, $language); - } -} - -if (! function_exists('str_start')) { - /** - * Begin a string with a single instance of a given value. - * - * @param string $value - * @param string $prefix - * @return string - */ - function str_start($value, $prefix) - { - return Str::start($value, $prefix); - } -} - -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('tap')) { /** * Call the given Closure with the given value then return the value. @@ -1049,6 +433,7 @@ if (! function_exists('throw_if')) { * @param \Throwable|string $exception * @param array ...$parameters * @return mixed + * * @throws \Throwable */ function throw_if($condition, $exception, ...$parameters) @@ -1069,6 +454,7 @@ if (! function_exists('throw_unless')) { * @param \Throwable|string $exception * @param array ...$parameters * @return mixed + * * @throws \Throwable */ function throw_unless($condition, $exception, ...$parameters) @@ -1081,19 +467,6 @@ if (! function_exists('throw_unless')) { } } -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. @@ -1157,7 +530,7 @@ if (! function_exists('windows_os')) { */ function windows_os() { - return strtolower(substr(PHP_OS, 0, 3)) === 'win'; + return PHP_OS_FAMILY === 'Windows'; } } diff --git a/Seance5-6/seance/vendor/kylekatarnls/update-helper/LICENSE b/Seance5-6/seance/vendor/kylekatarnls/update-helper/LICENSE deleted file mode 100644 index d55dee54922af9d2e758b2e97a2bdfa7d1dc87c0..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -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/Seance5-6/seance/vendor/kylekatarnls/update-helper/composer.json b/Seance5-6/seance/vendor/kylekatarnls/update-helper/composer.json deleted file mode 100644 index ced852789ca58cf4a0498f45c4dac00070b25a2d..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/composer.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "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/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php b/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php deleted file mode 100644 index f0e2313889653336eba9601dd9ed167146e62879..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace UpdateHelper; - -use Composer\Composer; -use Composer\EventDispatcher\Event; -use Composer\EventDispatcher\EventSubscriberInterface; -use Composer\IO\IOInterface; -use Composer\Plugin\PluginInterface; - -class ComposerPlugin implements PluginInterface, EventSubscriberInterface -{ - protected $io; - - public function activate(Composer $composer, IOInterface $io) - { - $this->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/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php b/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php deleted file mode 100644 index 8213b5e5f7b118e598bfd48d8dba6cff993d9157..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace UpdateHelper; - -use InvalidArgumentException; - -class NotUpdateInterfaceInstanceException extends InvalidArgumentException -{ -} diff --git a/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelper.php b/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelper.php deleted file mode 100644 index 3d3f0c0c4c465aa5ebc78a844cfc8683613f834d..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelper.php +++ /dev/null @@ -1,385 +0,0 @@ -<?php - -namespace UpdateHelper; - -use Composer\Composer; -use Composer\EventDispatcher\Event; -use Composer\Installer\PackageEvent; -use Composer\IO\IOInterface; -use Composer\Json\JsonFile; -use Composer\Script\Event as ScriptEvent; -use Composer\Semver\Semver; -use Exception; -use InvalidArgumentException; -use RuntimeException; -use Throwable; - -class UpdateHelper -{ - /** @var Event */ - private $event; - /** @var IOInterface|null */ - private $io; - /** @var Composer */ - private $composer; - /** @var array */ - private $dependencies = array(); - /** @var string */ - private $composerFilePath; - /** @var JsonFile */ - private $file; - - protected static function appendConfig(&$classes, $directory, $key = null) - { - $file = $directory.DIRECTORY_SEPARATOR.'composer.json'; - $json = new JsonFile($file); - $key = $key ? $key : 'update-helper'; - - try { - $dependencyConfig = $json->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/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php b/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php deleted file mode 100644 index 3809dc0f27fd520abb45ef0def7a7b0dd931c657..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -namespace UpdateHelper; - -interface UpdateHelperInterface -{ - public function check(UpdateHelper $helper); -} diff --git a/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon b/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon deleted file mode 100644 index 49c4c9a80da1f4052d8bbb321abf972c6311c8de..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env php -<?php - -$dir = __DIR__.'/..'; - -if (!file_exists($dir.'/autoload.php')) { - $dir = __DIR__.'/../vendor'; -} - -if (!file_exists($dir.'/autoload.php')) { - $dir = __DIR__.'/../../..'; -} - -if (!file_exists($dir.'/autoload.php')) { - echo 'Autoload not found.'; - exit(1); -} - -$composerInstalled = false; - -if (!file_exists($dir.'/composer/composer')) { - $composerInstalled = true; - shell_exec('composer require --dev composer/composer'); -} - -include $dir.'/autoload.php'; - -Carbon\Upgrade::upgrade(); - -if ($composerInstalled) { - shell_exec('composer remove --dev composer/composer'); -} - -exit(0); diff --git a/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon.bat b/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon.bat deleted file mode 100644 index 428bf4f0c85472c1622e905ce20bd3110b78ab86..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/nesbot/carbon/bin/upgrade-carbon.bat +++ /dev/null @@ -1,4 +0,0 @@ -@ECHO OFF -setlocal DISABLEDELAYEDEXPANSION -SET BIN_TARGET=%~dp0/upgrade-carbon -php "%BIN_TARGET%" %* diff --git a/Seance5-6/seance/vendor/nesbot/carbon/composer.json b/Seance5-6/seance/vendor/nesbot/carbon/composer.json index 991347c741cba694ae7984a4769fc835d8d8d1a5..7ece43f54dcb3d89fcda9626806d0cea448cda29 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/composer.json +++ b/Seance5-6/seance/vendor/nesbot/carbon/composer.json @@ -1,7 +1,7 @@ { "name": "nesbot/carbon", "type": "library", - "description": "A simple API extension for DateTime.", + "description": "An API extension for DateTime that supports 281 different languages.", "keywords": [ "date", "time", @@ -18,22 +18,32 @@ "name": "Brian Nesbitt", "email": "brian@nesbot.com", "homepage": "http://nesbot.com" + }, + { + "name": "kylekatarnls", + "homepage": "http://github.com/kylekatarnls" } ], - "bin": ["bin/upgrade-carbon"], + "prefer-stable": true, + "minimum-stability": "dev", + "bin": ["bin/carbon"], "require": { - "php": ">=5.3.9", - "kylekatarnls/update-helper": "^1.1", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" + "php": "^7.1.8 || ^8.0", + "ext-json": "*", + "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { - "composer/composer": "^1.2", - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "kylekatarnls/multi-tester": "^1.1", + "phpmd/phpmd": "^2.8", + "phpstan/phpstan": "^0.11", + "phpunit/phpunit": "^7.5 || ^8.0", + "squizlabs/php_codesniffer": "^3.4" }, "autoload": { "psr-4": { - "": "src/" + "Carbon\\": "src/Carbon/" } }, "autoload-dev": { @@ -42,25 +52,29 @@ } }, "config": { + "process-timeout": 0, "sort-packages": true }, "scripts": { "test": [ "@phpunit", - "@phpcs" + "@style-check" + ], + "style-check": [ + "@phpcs", + "@phpstan", + "@phpmd" ], - "phpunit": "phpunit --verbose --coverage-clover=coverage.xml", + "phpunit": "phpunit --verbose", "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" - ] + "phpmd": "phpmd src text /phpmd.xml", + "phpdoc": "php phpdoc.php" }, "extra": { - "update-helper": "Carbon\\Upgrade", + "branch-alias": { + "dev-master": "2.x-dev" + }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" diff --git a/Seance5-6/seance/vendor/nesbot/carbon/readme.md b/Seance5-6/seance/vendor/nesbot/carbon/readme.md index 5e9d1ccbcd80ecca4dd4cc674a7a4a7ae0d1fb64..f88a141612a4779a06e39144f64b7b0c44b35214 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/readme.md +++ b/Seance5-6/seance/vendor/nesbot/carbon/readme.md @@ -1,14 +1,14 @@ # Carbon -[](https://packagist.org/packages/nesbot/carbon) -[](https://packagist.org/packages/nesbot/carbon) -[](https://travis-ci.org/briannesbitt/Carbon) -[](https://styleci.io/repos/5724990) -[](https://codecov.io/github/briannesbitt/Carbon?branch=master) -[](https://php-eye.com/package/nesbot/carbon) -[](https://github.com/phpstan/phpstan) +[](https://packagist.org/packages/nesbot/carbon) +[](https://packagist.org/packages/nesbot/carbon) +[](https://travis-ci.org/briannesbitt/Carbon) +[](https://styleci.io/repos/5724990) +[](https://codecov.io/github/briannesbitt/Carbon?branch=master) +[](https://github.com/phpstan/phpstan) +[](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme) -A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com) +An international PHP extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com) ```php use Carbon\Carbon; @@ -41,7 +41,11 @@ Carbon::setTestNow(); if (Carbon::now()->isWeekend()) { echo 'Party!'; } +// Over 200 languages (and over 500 regional variants) supported: echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' +echo Carbon::now()->subMinutes(2)->locale('zh_CN')->diffForHumans(); // '2分钟前' +echo Carbon::parse('2019-07-23 14:51')->isoFormat('LLLL'); // 'Tuesday, July 23, 2019 2:51 PM' +echo Carbon::parse('2019-07-23 14:51')->locale('fr_FR')->isoFormat('LLLL'); // 'mardi 23 juillet 2019 14:51' // ... but also does 'from now', 'after' and 'before' // rolling up to seconds, minutes, hours, days, months, years @@ -49,6 +53,8 @@ echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' $daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); ``` +[Get supported nesbot/carbon with the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme) + ## Installation ### With Composer @@ -60,7 +66,7 @@ $ composer require nesbot/carbon ```json { "require": { - "nesbot/carbon": "~1.21" + "nesbot/carbon": "^2.16" } } ``` @@ -78,11 +84,11 @@ 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. +Why are you not using [composer](http://getcomposer.org/)? Download the Carbon [latest release](https://github.com/briannesbitt/Carbon/releases) and put the contents of the ZIP archive into a directory in your project. Then require the file `autoload.php` to get all classes and dependencies loaded on need. ```php <?php -require 'path/to/Carbon.php'; +require 'path-to-Carbon-directory/autoload.php'; use Carbon\Carbon; @@ -92,3 +98,36 @@ printf("Now: %s", Carbon::now()); ## Docs [http://carbon.nesbot.com/docs](http://carbon.nesbot.com/docs) + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## Credits + +### Contributors + +This project exists thanks to all the people who contribute. + +<a href="https://github.com/briannesbitt/Carbon/graphs/contributors" target="_blank"><img src="https://opencollective.com/Carbon/contributors.svg?width=890&button=false" /></a> + +### Translators + +[Thanks to people helping us to translate Carbon in so many languages](https://carbon.nesbot.com/contribute/translators/) + +### Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Carbon#backer)] + +<a href="https://opencollective.com/Carbon#backers" target="_blank"><img src="https://opencollective.com/Carbon/backers.svg?width=890"></a> + +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Carbon#sponsor)] +<a href="https://opencollective.com/Carbon/sponsor/0/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/0/avatar.svg"></a> +<a href="https://opencollective.com/Carbon/sponsor/1/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/1/avatar.svg"></a> +<a href="https://opencollective.com/Carbon/sponsor/2/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/2/avatar.svg"></a> +<a href="https://opencollective.com/Carbon/sponsor/3/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/3/avatar.svg"></a> +<a href="https://opencollective.com/Carbon/sponsor/4/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/4/avatar.svg"></a> diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Carbon.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Carbon.php index 7b8a5d91088e043071784c3e88aa4c609815e4ac..c5525ea93f5d97a25cfdd56ca44f4e1f91d85fd4 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Carbon.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,5420 +8,515 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Carbon; -use Carbon\Exceptions\InvalidDateException; -use Closure; -use DateInterval; -use DatePeriod; +use Carbon\Traits\Date; use DateTime; -use DateTimeInterface; -use DateTimeZone; -use InvalidArgumentException; -use JsonSerializable; -use Symfony\Component\Translation\TranslatorInterface; /** - * A simple API extension for DateTime + * A simple API extension for DateTime. + * + * <autodoc generated by `composer phpdoc`> + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property string $localeDayOfWeek the day of week in current locale LC_TIME + * @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME + * @property string $localeMonth the month in current locale LC_TIME + * @property string $shortLocaleMonth the abbreviated month in current locale LC_TIME + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @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 $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @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 the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance * - * @property int $year - * @property int $yearIso - * @property int $month - * @property int $day - * @property int $hour - * @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 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 + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(\Carbon\Carbon|\DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method Carbon years(int $value) Set current instance year to the given value. + * @method Carbon year(int $value) Set current instance year to the given value. + * @method Carbon setYears(int $value) Set current instance year to the given value. + * @method Carbon setYear(int $value) Set current instance year to the given value. + * @method Carbon months(int $value) Set current instance month to the given value. + * @method Carbon month(int $value) Set current instance month to the given value. + * @method Carbon setMonths(int $value) Set current instance month to the given value. + * @method Carbon setMonth(int $value) Set current instance month to the given value. + * @method Carbon days(int $value) Set current instance day to the given value. + * @method Carbon day(int $value) Set current instance day to the given value. + * @method Carbon setDays(int $value) Set current instance day to the given value. + * @method Carbon setDay(int $value) Set current instance day to the given value. + * @method Carbon hours(int $value) Set current instance hour to the given value. + * @method Carbon hour(int $value) Set current instance hour to the given value. + * @method Carbon setHours(int $value) Set current instance hour to the given value. + * @method Carbon setHour(int $value) Set current instance hour to the given value. + * @method Carbon minutes(int $value) Set current instance minute to the given value. + * @method Carbon minute(int $value) Set current instance minute to the given value. + * @method Carbon setMinutes(int $value) Set current instance minute to the given value. + * @method Carbon setMinute(int $value) Set current instance minute to the given value. + * @method Carbon seconds(int $value) Set current instance second to the given value. + * @method Carbon second(int $value) Set current instance second to the given value. + * @method Carbon setSeconds(int $value) Set current instance second to the given value. + * @method Carbon setSecond(int $value) Set current instance second to the given value. + * @method Carbon millis(int $value) Set current instance millisecond to the given value. + * @method Carbon milli(int $value) Set current instance millisecond to the given value. + * @method Carbon setMillis(int $value) Set current instance millisecond to the given value. + * @method Carbon setMilli(int $value) Set current instance millisecond to the given value. + * @method Carbon milliseconds(int $value) Set current instance millisecond to the given value. + * @method Carbon millisecond(int $value) Set current instance millisecond to the given value. + * @method Carbon setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method Carbon setMillisecond(int $value) Set current instance millisecond to the given value. + * @method Carbon micros(int $value) Set current instance microsecond to the given value. + * @method Carbon micro(int $value) Set current instance microsecond to the given value. + * @method Carbon setMicros(int $value) Set current instance microsecond to the given value. + * @method Carbon setMicro(int $value) Set current instance microsecond to the given value. + * @method Carbon microseconds(int $value) Set current instance microsecond to the given value. + * @method Carbon microsecond(int $value) Set current instance microsecond to the given value. + * @method Carbon setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method Carbon setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method Carbon addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method Carbon addYear() Add one year to the instance (using date interval). + * @method Carbon subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method Carbon subYear() Sub one year to the instance (using date interval). + * @method Carbon addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method Carbon addMonth() Add one month to the instance (using date interval). + * @method Carbon subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method Carbon subMonth() Sub one month to the instance (using date interval). + * @method Carbon addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method Carbon addDay() Add one day to the instance (using date interval). + * @method Carbon subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method Carbon subDay() Sub one day to the instance (using date interval). + * @method Carbon addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method Carbon addHour() Add one hour to the instance (using date interval). + * @method Carbon subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method Carbon subHour() Sub one hour to the instance (using date interval). + * @method Carbon addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method Carbon addMinute() Add one minute to the instance (using date interval). + * @method Carbon subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method Carbon subMinute() Sub one minute to the instance (using date interval). + * @method Carbon addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method Carbon addSecond() Add one second to the instance (using date interval). + * @method Carbon subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method Carbon subSecond() Sub one second to the instance (using date interval). + * @method Carbon addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon addMilli() Add one millisecond to the instance (using date interval). + * @method Carbon subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon subMilli() Sub one millisecond to the instance (using date interval). + * @method Carbon addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon addMillisecond() Add one millisecond to the instance (using date interval). + * @method Carbon subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon subMillisecond() Sub one millisecond to the instance (using date interval). + * @method Carbon addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon addMicro() Add one microsecond to the instance (using date interval). + * @method Carbon subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon subMicro() Sub one microsecond to the instance (using date interval). + * @method Carbon addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon addMicrosecond() Add one microsecond to the instance (using date interval). + * @method Carbon subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method Carbon subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method Carbon addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method Carbon addMillennium() Add one millennium to the instance (using date interval). + * @method Carbon subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method Carbon subMillennium() Sub one millennium to the instance (using date interval). + * @method Carbon addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method Carbon addCentury() Add one century to the instance (using date interval). + * @method Carbon subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method Carbon subCentury() Sub one century to the instance (using date interval). + * @method Carbon addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method Carbon addDecade() Add one decade to the instance (using date interval). + * @method Carbon subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method Carbon subDecade() Sub one decade to the instance (using date interval). + * @method Carbon addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method Carbon addQuarter() Add one quarter to the instance (using date interval). + * @method Carbon subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method Carbon subQuarter() Sub one quarter to the instance (using date interval). + * @method Carbon addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method Carbon addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method Carbon addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method Carbon addWeek() Add one week to the instance (using date interval). + * @method Carbon subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method Carbon subWeek() Sub one week to the instance (using date interval). + * @method Carbon addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method Carbon addWeekday() Add one weekday to the instance (using date interval). + * @method Carbon subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method Carbon subWeekday() Sub one weekday to the instance (using date interval). + * @method Carbon addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMicro() Add one microsecond to the instance (using timestamp). + * @method Carbon subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method Carbon addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method Carbon subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method Carbon addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMilli() Add one millisecond to the instance (using timestamp). + * @method Carbon subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method Carbon addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method Carbon subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method Carbon addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealSecond() Add one second to the instance (using timestamp). + * @method Carbon subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method Carbon addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMinute() Add one minute to the instance (using timestamp). + * @method Carbon subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method Carbon addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealHour() Add one hour to the instance (using timestamp). + * @method Carbon subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method Carbon addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealDay() Add one day to the instance (using timestamp). + * @method Carbon subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method Carbon addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealWeek() Add one week to the instance (using timestamp). + * @method Carbon subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method Carbon addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMonth() Add one month to the instance (using timestamp). + * @method Carbon subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method Carbon addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealQuarter() Add one quarter to the instance (using timestamp). + * @method Carbon subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method Carbon addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealYear() Add one year to the instance (using timestamp). + * @method Carbon subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method Carbon addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealDecade() Add one decade to the instance (using timestamp). + * @method Carbon subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method Carbon addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealCentury() Add one century to the instance (using timestamp). + * @method Carbon subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method Carbon addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method Carbon addRealMillennium() Add one millennium to the instance (using timestamp). + * @method Carbon subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method Carbon subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method Carbon roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method Carbon roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method Carbon floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method Carbon floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method Carbon ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method Carbon ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method Carbon roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method Carbon roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method Carbon floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method Carbon floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method Carbon ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method Carbon ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method Carbon roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method Carbon roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method Carbon floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method Carbon floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method Carbon ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method Carbon ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method Carbon roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method Carbon roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method Carbon floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method Carbon floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method Carbon ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method Carbon ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method Carbon roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method Carbon roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method Carbon floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method Carbon floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method Carbon ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method Carbon ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method Carbon roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method Carbon roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method Carbon floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method Carbon floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method Carbon ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method Carbon ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method Carbon roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method Carbon roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method Carbon floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method Carbon floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method Carbon ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method Carbon ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method Carbon roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method Carbon roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method Carbon floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method Carbon floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method Carbon ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method Carbon ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method Carbon roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method Carbon roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method Carbon floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method Carbon floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method Carbon ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method Carbon ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method Carbon roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method Carbon roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method Carbon floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method Carbon floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method Carbon ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method Carbon ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method Carbon roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method Carbon roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method Carbon floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method Carbon floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method Carbon ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method Carbon ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method Carbon roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method Carbon roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method Carbon floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method Carbon floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method Carbon ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method Carbon ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(\DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method static Carbon createFromImmutable(\DateTimeImmutable $dateTime) Create a new Carbon object from an immutable date. + * @method static Carbon createFromFormat(string $format, string $time, string|\DateTimeZone $timezone = null) Parse a string into a new Carbon object according to the specified format. + * @method static Carbon __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * + * </autodoc> */ -class Carbon extends DateTime implements JsonSerializable +class Carbon extends DateTime implements CarbonInterface { - 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. - */ - const SUNDAY = 0; - const MONDAY = 1; - const TUESDAY = 2; - const WEDNESDAY = 3; - const THURSDAY = 4; - const FRIDAY = 5; - const SATURDAY = 6; - - /** - * Names of days of the week. - * - * @var array - */ - protected static $days = array( - self::SUNDAY => 'Sunday', - self::MONDAY => 'Monday', - self::TUESDAY => 'Tuesday', - self::WEDNESDAY => 'Wednesday', - self::THURSDAY => 'Thursday', - self::FRIDAY => 'Friday', - self::SATURDAY => 'Saturday', - ); - - /** - * 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. - * - * @var string - */ - 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. - * - * @var string - */ - protected static $toStringFormat = self::DEFAULT_TO_STRING_FORMAT; - - /** - * First day of week. - * - * @var int - */ - protected static $weekStartsAt = self::MONDAY; - - /** - * Last day of week. - * - * @var int - */ - protected static $weekEndsAt = self::SUNDAY; - - /** - * 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 $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. - * - * @var \Carbon\Carbon - */ - protected static $testNow; - - /** - * A translator to ... er ... translate stuff. - * - * @var \Symfony\Component\Translation\TranslatorInterface - */ - protected static $translator; - - /** - * The errors that can occur. - * - * @var array - */ - protected static $lastErrors; - - /** - * The custom Carbon JSON serializer. - * - * @var callable|null - */ - protected static $serializer; - - /** - * The registered string macros. - * - * @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; - } + use Date; /** - * Get the month comparison default behavior. + * Returns true if the current class/instance is mutable. * * @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 - * - * @throws \InvalidArgumentException - * - * @return \DateTimeZone - */ - protected static function safeCreateDateTimeZone($object) - { - if ($object === null) { - // Don't return null... avoid Bug #52063 in PHP <5.3.6 - return new DateTimeZone(date_default_timezone_get()); - } - - if ($object instanceof DateTimeZone) { - return $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; - } - - // 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 - - throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); - } - - /////////////////////////////////////////////////////////////////// - //////////////////////////// CONSTRUCTORS ///////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Create a new Carbon instance. - * - * 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 - */ - 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 - $isNow = empty($time) || $time === 'now'; - if (static::hasTestNow() && ($isNow || static::hasRelativeKeywords($time))) { - $testInstance = clone static::getTestNow(); - - //shift the time according to the given time zone - if ($tz !== null && $tz !== static::getTestNow()->getTimezone()) { - $testInstance->setTimezone($tz); - } else { - $tz = $testInstance->getTimezone(); - } - - if (static::hasRelativeKeywords($time)) { - $testInstance->modify($time); - } - - $time = $testInstance->format(static::MOCK_DATETIME_FORMAT); - } - - $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. - * - * @param \DateTime|\DateTimeInterface $date - * - * @return static - */ - public static function instance($date) - { - 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(). - * - * @param string|null $time - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function parse($time = null, $tz = null) - { - return new static($time, $tz); - } - - /** - * Get a Carbon instance for the current date and time. - * - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function now($tz = null) - { - return new static(null, $tz); - } - - /** - * Create a Carbon instance for today. - * - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function today($tz = null) - { - return static::parse('today', $tz); - } - - /** - * Create a Carbon instance for tomorrow. - * - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function tomorrow($tz = null) + public static function isMutable() { - return static::parse('tomorrow', $tz); - } - - /** - * Create a Carbon instance for yesterday. - * - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function yesterday($tz = null) - { - return static::parse('yesterday', $tz); - } - - /** - * Create a Carbon instance for the greatest supported date. - * - * @return static - */ - public static function maxValue() - { - if (self::$PHPIntSize === 4) { - // 32 bit - return static::createFromTimestamp(PHP_INT_MAX); // @codeCoverageIgnore - } - - // 64 bit - return static::create(9999, 12, 31, 23, 59, 59); - } - - /** - * Create a Carbon instance for the lowest supported date. - * - * @return static - */ - public static function minValue() - { - if (self::$PHPIntSize === 4) { - // 32 bit - return static::createFromTimestamp(~PHP_INT_MAX); // @codeCoverageIgnore - } - - // 64 bit - return static::create(1, 1, 1, 0, 0, 0); - } - - /** - * 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 $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 - * - * @throws \InvalidArgumentException - * - * @return static - */ - public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) - { - $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 = $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; - } - - $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 new safe 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 $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 $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 createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) - { - $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 just a date. The time portion is set to now. - * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param \DateTimeZone|string|null $tz - * - * @throws \InvalidArgumentException - * - * @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 date. The time portion is set to midnight. - * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param \DateTimeZone|string|null $tz - * - * @return static - */ - public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null) - { - return static::create($year, $month, $day, 0, 0, 0, $tz); - } - - /** - * Create a Carbon instance from just a time. The date portion is set to today. - * - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param \DateTimeZone|string|null $tz - * - * @throws \InvalidArgumentException - * - * @return static - */ - public static function createFromTime($hour = null, $minute = null, $second = null, $tz = null) - { - return static::create(null, null, null, $hour, $minute, $second, $tz); - } - - /** - * 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 static function createFromTimeString($time, $tz = null) - { - return static::today($tz)->setTimeFromTimeString($time); - } - - private static function createFromFormatAndTimezone($format, $time, $tz) - { - return $tz !== null - ? parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)) - : parent::createFromFormat($format, $time); - } - - /** - * Create a Carbon instance from a specific format. - * - * @param string $format Datetime format - * @param string $time - * @param \DateTimeZone|string|null $tz - * - * @throws InvalidArgumentException - * - * @return static - */ - 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 = '(?<!\\\\)(\\\\{2})*'; - - $nonIgnored = preg_replace("/^.*{$nonEscaped}!/s", '', $format); - - if ($tz === null && !preg_match("/{$nonEscaped}[eOPT]/", $nonIgnored)) { - $tz = $mock->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 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 $this->diffInYears(); - - case $name === 'quarter': - return (int) ceil($this->month / static::MONTHS_PER_QUARTER); - - case $name === 'offset': - return $this->getOffset(); - - case $name === 'offsetHours': - return $this->getOffset() / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR; - - case $name === 'dst': - return $this->format('I') === '1'; - - case $name === 'local': - return $this->getOffset() === $this->copy()->setTimezone(date_default_timezone_get())->getOffset(); - - case $name === 'utc': - return $this->getOffset() === 0; - - case $name === 'timezone' || $name === 'tz': - return $this->getTimezone(); - - case $name === 'timezoneName' || $name === 'tzName': - return $this->getTimezone()->getName(); - - default: - throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); - } - } - - /** - * Check if an attribute exists on the object - * - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - try { - $this->__get($name); - } catch (InvalidArgumentException $e) { - return false; - } - return true; } - - /** - * Set a part of the Carbon object - * - * @param string $name - * @param string|int|\DateTimeZone $value - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function __set($name, $value) - { - switch ($name) { - case 'year': - case 'month': - case 'day': - case 'hour': - case 'minute': - case 'second': - 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': - parent::setTimestamp($value); - break; - - case 'timezone': - case 'tz': - $this->setTimezone($value); - break; - - default: - throw new InvalidArgumentException(sprintf("Unknown setter '%s'", $name)); - } - } - - /** - * Set the instance's year - * - * @param int $value - * - * @return static - */ - public function year($value) - { - $this->year = $value; - - return $this; - } - - /** - * Set the instance's month - * - * @param int $value - * - * @return static - */ - public function month($value) - { - $this->month = $value; - - return $this; - } - - /** - * Set the instance's day - * - * @param int $value - * - * @return static - */ - public function day($value) - { - $this->day = $value; - - return $this; - } - - /** - * Set the instance's hour - * - * @param int $value - * - * @return static - */ - public function hour($value) - { - $this->hour = $value; - - return $this; - } - - /** - * Set the instance's minute - * - * @param int $value - * - * @return static - */ - public function minute($value) - { - $this->minute = $value; - - return $this; - } - - /** - * Set the instance's second - * - * @param int $value - * - * @return static - */ - public function second($value) - { - $this->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 - * - * @param int $year - * @param int $month - * @param int $day - * @param int $hour - * @param int $minute - * @param int $second - * - * @return static - */ - public function setDateTime($year, $month, $day, $hour, $minute, $second = 0) - { - return $this->setDate($year, $month, $day)->setTime($hour, $minute, $second); - } - - /** - * Set the time by time string - * - * @param string $time - * - * @return static - */ - public function setTimeFromTimeString($time) - { - if (strpos($time, ':') === false) { - $time .= ':0'; - } - - return $this->modify($time); - } - - /** - * Set the instance's timestamp - * - * @param int $value - * - * @return static - */ - public function timestamp($value) - { - return $this->setTimestamp($value); - } - - /** - * Alias for setTimezone() - * - * @param \DateTimeZone|string $value - * - * @return static - */ - public function timezone($value) - { - return $this->setTimezone($value); - } - - /** - * Alias for setTimezone() - * - * @param \DateTimeZone|string $value - * - * @return static - */ - public function tz($value) - { - return $this->setTimezone($value); - } - - /** - * Set the instance's timezone from a string or object - * - * @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 ///////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Get the first day of week - * - * @return int - */ - public static function getWeekStartsAt() - { - return static::$weekStartsAt; - } - - /** - * Set the first day of week - * - * @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; - } - - /** - * Get the last day of week - * - * @return int - */ - public static function getWeekEndsAt() - { - return static::$weekEndsAt; - } - - /** - * Set the last day of week - * - * @param int $day - * - * @throws InvalidArgumentException - * - * @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; - } - - /** - * Get weekend days - * - * @return array - */ - public static function getWeekendDays() - { - return static::$weekendDays; - } - - /** - * Set weekend days - * - * @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 //////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Set a Carbon instance (real or mock) to be returned when a "now" - * instance is created. The provided instance will be returned - * specifically under the following conditions: - * - 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. - * - * To clear the test instance call this method using the default - * parameter of null. - * - * @param \Carbon\Carbon|null $testNow real or mock Carbon instance - * @param \Carbon\Carbon|string|null $testNow - */ - public static function setTestNow($testNow = null) - { - static::$testNow = is_string($testNow) ? static::parse($testNow) : $testNow; - } - - /** - * Get the Carbon instance (real or mock) to be returned when a "now" - * instance is created. - * - * @return static the current instance used for testing - */ - public static function getTestNow() - { - return static::$testNow; - } - - /** - * Determine if there is a valid test instance set. A valid test instance - * is anything that is not null. - * - * @return bool true if there is a test instance, otherwise false - */ - public static function hasTestNow() - { - return static::getTestNow() !== null; - } - - /** - * Determine if a time string will produce a relative date. - * - * @param string $time - * - * @return bool true if time match a relative date, false if absolute or invalid time string - */ - public static function hasRelativeKeywords($time) - { - if (strtotime($time) === 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; - } - - /////////////////////////////////////////////////////////////////// - /////////////////////// LOCALIZATION ////////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Initialize the translator instance if necessary. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - protected static function translator() - { - if (static::$translator === null) { - static::$translator = Translator::get(); - } - - return static::$translator; - } - - /** - * Get the translator instance in use - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - public static function getTranslator() - { - return static::translator(); - } - - /** - * Set the translator instance to use - * - * @param \Symfony\Component\Translation\TranslatorInterface $translator - * - * @return void - */ - public static function setTranslator(TranslatorInterface $translator) - { - static::$translator = $translator; - } - - /** - * Get the current translator locale - * - * @return string - */ - public static function getLocale() - { - return static::translator()->getLocale(); - } - - /** - * Set the current translator locale and indicate if the source locale file exists - * - * @param string $locale locale ex. en - * - * @return bool - */ - public static function setLocale($locale) - { - return static::translator()->setLocale($locale) !== false; - } - - /** - * 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 $locale locale ex. en - * - * @return mixed - */ - public static function executeWithLocale($locale, $func) - { - $currentLocale = static::getLocale(); - $result = call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator()); - static::setLocale($currentLocale); - - return $result; - } - - /** - * Returns true if the given locale is internally supported and has short-units support. - * Support is considered enabled if either year, day or hour has a short variant translated. - * - * @param string $locale locale ex. en - * - * @return bool - */ - public static function localeHasShortUnits($locale) - { - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { - return $newLocale && - ( - ($y = $translator->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') - ); - }); - } - - /** - * 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 $locale locale ex. en - * - * @return bool - */ - public static function localeHasDiffSyntax($locale) - { - 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'; - }); - } - - /** - * 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. - * - * @param string $locale locale ex. en - * - * @return bool - */ - public static function localeHasDiffOneDayWords($locale) - { - 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'; - }); - } - - /** - * 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. - * - * @param string $locale locale ex. en - * - * @return bool - */ - public static function localeHasDiffTwoDayWords($locale) - { - 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'; - }); - } - - /** - * 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('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); // @codeCoverageIgnore - } - - $formatted = strftime($format, strtotime($this->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 - */ - public function toFormattedDateString() - { - return $this->format('M j, Y'); - } - - /** - * Format the instance as time - * - * @return string - */ - public function toTimeString() - { - return $this->format('H:i:s'); - } - - /** - * Format the instance as date and time - * - * @return string - */ - 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 - * - * @return string - */ - public function toDayDateTimeString() - { - return $this->format('D, M j, Y g:i A'); - } - - /** - * Format the instance as ATOM - * - * @return string - */ - public function toAtomString() - { - return $this->format(static::ATOM); - } - - /** - * Format the instance as COOKIE - * - * @return string - */ - public function toCookieString() - { - return $this->format(static::COOKIE); - } - - /** - * Format the instance as ISO8601 - * - * @return string - */ - public function toIso8601String() - { - return $this->toAtomString(); - } - - /** - * Format the instance as RFC822 - * - * @return string - */ - 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 - * - * @return string - */ - public function toRfc850String() - { - return $this->format(static::RFC850); - } - - /** - * Format the instance as RFC1036 - * - * @return string - */ - public function toRfc1036String() - { - return $this->format(static::RFC1036); - } - - /** - * Format the instance as RFC1123 - * - * @return string - */ - public function toRfc1123String() - { - return $this->format(static::RFC1123); - } - - /** - * Format the instance as RFC2822 - * - * @return string - */ - public function toRfc2822String() - { - return $this->format(static::RFC2822); - } - - /** - * Format the instance as RFC3339 - * - * @return string - */ - public function toRfc3339String() - { - return $this->format(static::RFC3339); - } - - /** - * Format the instance as RSS - * - * @return string - */ - public function toRssString() - { - return $this->format(static::RSS); - } - - /** - * Format the instance as W3C - * - * @return string - */ - public function toW3cString() - { - return $this->format(static::W3C); - } - - /** - * Format the instance as RFC7231 - * - * @return string - */ - public function toRfc7231String() - { - return $this->copy() - ->setTimezone('GMT') - ->format(static::RFC7231_FORMAT); - } - - /** - * Get default array representation - * - * @return array - */ - public function toArray() - { - 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, - ); - } - - /** - * Get default object representation. - * - * @example - * ``` - * var_dump(Carbon::now()->toObject()); - * ``` - * - * @return object - */ - public function toObject() - { - return (object) $this->toArray(); - } - - /** - * Returns english human readable complete date string. - * - * @example - * ``` - * echo Carbon::now()->toString(); - * ``` - * - * @return string - */ - public function toString() - { - return $this->format('D M j Y H:i:s \G\M\TO'); - } - - /** - * 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). - * - * @example - * ``` - * echo Carbon::now('America/Toronto')->toISOString() . "\n"; - * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; - * ``` - * - * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. - * - * @return null|string - */ - public function toISOString($keepOffset = false) - { - 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; - } - - /** - * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. - * - * @example - * ``` - * echo Carbon::now('America/Toronto')->toJSON(); - * ``` - * - * @return null|string - */ - public function toJSON() - { - return $this->toISOString(); - } - - /** - * Return native DateTime PHP object matching the current instance. - * - * @example - * ``` - * var_dump(Carbon::now()->toDateTime()); - * ``` - * - * @return DateTime - */ - public function toDateTime() - { - return new DateTime($this->format('Y-m-d H:i:s.u'), $this->getTimezone()); - } - - /** - * @alias toDateTime - * - * Return native DateTime PHP object matching the current instance. - * - * @example - * ``` - * var_dump(Carbon::now()->toDate()); - * ``` - * - * @return DateTime - */ - public function toDate() - { - return $this->toDateTime(); - } - - /////////////////////////////////////////////////////////////////// - ////////////////////////// COMPARISONS //////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Determines if the instance is equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function eq($date) - { - return $this == $date; - } - - /** - * Determines if the instance is equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see eq() - * - * @return bool - */ - public function equalTo($date) - { - return $this->eq($date); - } - - /** - * Determines if the instance is not equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function ne($date) - { - return !$this->eq($date); - } - - /** - * Determines if the instance is not equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see ne() - * - * @return bool - */ - public function notEqualTo($date) - { - return $this->ne($date); - } - - /** - * Determines if the instance is greater (after) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function gt($date) - { - return $this > $date; - } - - /** - * Determines if the instance is greater (after) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see gt() - * - * @return bool - */ - public function greaterThan($date) - { - return $this->gt($date); - } - - /** - * Determines if the instance is greater (after) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see gt() - * - * @return bool - */ - public function isAfter($date) - { - return $this->gt($date); - } - - /** - * Determines if the instance is greater (after) than or equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function gte($date) - { - return $this >= $date; - } - - /** - * Determines if the instance is greater (after) than or equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see gte() - * - * @return bool - */ - public function greaterThanOrEqualTo($date) - { - return $this->gte($date); - } - - /** - * Determines if the instance is less (before) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function lt($date) - { - return $this < $date; - } - - /** - * Determines if the instance is less (before) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see lt() - * - * @return bool - */ - public function lessThan($date) - { - return $this->lt($date); - } - - /** - * Determines if the instance is less (before) than another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see lt() - * - * @return bool - */ - public function isBefore($date) - { - return $this->lt($date); - } - - /** - * Determines if the instance is less (before) or equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @return bool - */ - public function lte($date) - { - return $this <= $date; - } - - /** - * Determines if the instance is less (before) or equal to another - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see lte() - * - * @return bool - */ - public function lessThanOrEqualTo($date) - { - return $this->lte($date); - } - - /** - * 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 between($date1, $date2, $equal = true) - { - 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); - } - - protected function floatDiffInSeconds($date) - { - $date = $this->resolveCarbon($date); - - return abs($this->diffInRealSeconds($date, false) + ($date->micro - $this->micro) / 1000000); - } - - /** - * 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 isBetween($date1, $date2, $equal = true) - { - return $this->between($date1, $date2, $equal); - } - - /** - * Get the closest date from the instance. - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 - * - * @return static - */ - public function closest($date1, $date2) - { - return $this->floatDiffInSeconds($date1) < $this->floatDiffInSeconds($date2) ? $date1 : $date2; - } - - /** - * Get the farthest date from the instance. - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 - * - * @return static - */ - public function farthest($date1, $date2) - { - return $this->floatDiffInSeconds($date1) > $this->floatDiffInSeconds($date2) ? $date1 : $date2; - } - - /** - * Get the minimum instance between a given instance (default now) and the current instance. - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * - * @return static - */ - public function min($date = null) - { - $date = $this->resolveCarbon($date); - - return $this->lt($date) ? $this : $date; - } - - /** - * Get the minimum instance between a given instance (default now) and the current instance. - * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date - * - * @see min() - * - * @return static - */ - public function minimum($date = null) - { - return $this->min($date); - } - - /** - * Get the maximum instance between a given instance (default now) and the current instance. - * - * @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); - } - - /** - * 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); - } - - /** - * Add quarters to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addQuarters($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); - } - - /** - * Add months to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addMonths($value) - { - if (static::shouldOverflowMonths()) { - return $this->addMonthsWithOverflow($value); - } - - return $this->addMonthsNoOverflow($value); - } - - /** - * Add a month to the instance - * - * @param int $value - * - * @return static - */ - 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 - * - * @param int $value - * - * @return static - */ - 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 - * - * @param int $value - * - * @return static - */ - public function subMonthsWithOverflow($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); - } - - /** - * Add months without overflowing to the instance. Positive $value - * travels forward while negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addMonthsNoOverflow($value) - { - $day = $this->day; - - $this->modify((int) $value.' month'); - - if ($day !== $this->day) { - $this->modify('last day of previous month'); - } - - return $this; - } - - /** - * Add a month with no overflow to the instance - * - * @param int $value - * - * @return static - */ - public function addMonthNoOverflow($value = 1) - { - return $this->addMonthsNoOverflow($value); - } - - /** - * Remove months with no overflow from the instance - * - * @param int $value - * - * @return static - */ - public function subMonthsNoOverflow($value) - { - return $this->addMonthsNoOverflow(-1 * $value); - } - - /** - * Remove a month with no overflow from the instance - * - * @param int $value - * - * @return static - */ - public function subMonthNoOverflow($value = 1) - { - return $this->subMonthsNoOverflow($value); - } - - /** - * Add days to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addDays($value) - { - return $this->modify((int) $value.' day'); - } - - /** - * Add a day to the instance - * - * @param int $value - * - * @return static - */ - public function addDay($value = 1) - { - return $this->addDays($value); - } - - /** - * Remove days from the instance - * - * @param int $value - * - * @return static - */ - public function subDays($value) - { - return $this->addDays(-1 * $value); - } - - /** - * Remove a day from the instance - * - * @param int $value - * - * @return static - */ - public function subDay($value = 1) - { - return $this->subDays($value); - } - - /** - * Add weekdays to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addWeekdays($value) - { - // Fix for weekday bug https://bugs.php.net/bug.php?id=54909 - $t = $this->toTimeString(); - $this->modify((int) $value.' weekday'); - - return $this->setTimeFromTimeString($t); - } - - /** - * Add a weekday to the instance - * - * @param int $value - * - * @return static - */ - public function addWeekday($value = 1) - { - return $this->addWeekdays($value); - } - - /** - * Remove weekdays from the instance - * - * @param int $value - * - * @return static - */ - public function subWeekdays($value) - { - return $this->addWeekdays(-1 * $value); - } - - /** - * Remove a weekday from the instance - * - * @param int $value - * - * @return static - */ - public function subWeekday($value = 1) - { - return $this->subWeekdays($value); - } - - /** - * Add weeks to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addWeeks($value) - { - return $this->modify((int) $value.' week'); - } - - /** - * Add a week to the instance - * - * @param int $value - * - * @return static - */ - public function addWeek($value = 1) - { - return $this->addWeeks($value); - } - - /** - * Remove weeks to the instance - * - * @param int $value - * - * @return static - */ - public function subWeeks($value) - { - return $this->addWeeks(-1 * $value); - } - - /** - * Remove a week from the instance - * - * @param int $value - * - * @return static - */ - public function subWeek($value = 1) - { - return $this->subWeeks($value); - } - - /** - * Add hours to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addHours($value) - { - return $this->modify((int) $value.' hour'); - } - - /** - * 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 - * - * @return static - */ - public function addHour($value = 1) - { - return $this->addHours($value); - } - - /** - * 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 - * - * @return static - */ - public function subHour($value = 1) - { - return $this->subHours($value); - } - - /** - * 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 subRealMinutes($value = 1) - { - return $this->subRealMinute($value); - } - - /** - * Add seconds to the instance. Positive $value travels forward while - * negative $value travels into the past. - * - * @param int $value - * - * @return static - */ - public function addSeconds($value) - { - return $this->modify((int) $value.' second'); - } - - /** - * 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 addRealSeconds($value) - { - return $this->setTimestamp($this->getTimestamp() + $value); - } - - /** - * Add a second to the instance. - * - * @param int $value - * - * @return static - */ - public function addSecond($value = 1) - { - return $this->addSeconds($value); - } - - /** - * Add a second to the instance using timestamp. - * - * @param int $value - * - * @return static - */ - public function addRealSecond($value = 1) - { - return $this->addRealSeconds($value); - } - - /** - * Remove seconds from the instance. - * - * @param int $value - * - * @return static - */ - public function subSeconds($value) - { - return $this->addSeconds(-1 * $value); - } - - /** - * Remove seconds from the instance using timestamp. - * - * @param int $value - * - * @return static - */ - public function subRealSeconds($value) - { - return $this->addRealSeconds(-1 * $value); - } - - /** - * Remove a second from the instance - * - * @param int $value - * - * @return static - */ - public function subSecond($value = 1) - { - return $this->subSeconds($value); - } - - /** - * Remove a second from the instance using timestamp. - * - * @param int $value - * - * @return static - */ - public function subRealSecond($value = 1) - { - 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\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInYears($date = null, $absolute = true) - { - return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%y'); - } - - /** - * Get the difference in months - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInMonths($date = null, $absolute = true) - { - $date = $this->resolveCarbon($date); - - return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m'); - } - - /** - * Get the difference in weeks - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInWeeks($date = null, $absolute = true) - { - return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK); - } - - /** - * Get the difference in days - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInDays($date = null, $absolute = true) - { - 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\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInDaysFiltered(Closure $callback, $date = null, $absolute = true) - { - return $this->diffFiltered(CarbonInterval::day(), $callback, $date, $absolute); - } - - /** - * Get the difference in hours using a filter closure - * - * @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, $date = null, $absolute = true) - { - 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\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, $absolute = true) - { - $start = $this; - $end = $this->resolveCarbon($date); - $inverse = false; - - if ($end < $start) { - $start = $end; - $end = $this; - $inverse = true; - } - - $period = new DatePeriod($start, $ci, $end); - $values = array_filter(iterator_to_array($period), function ($date) use ($callback) { - return call_user_func($callback, Carbon::instance($date)); - }); - - $diff = count($values); - - return $inverse && !$absolute ? -$diff : $diff; - } - - /** - * Get the difference in weekdays - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInWeekdays($date = null, $absolute = true) - { - return $this->diffInDaysFiltered(function (Carbon $date) { - return $date->isWeekday(); - }, $date, $absolute); - } - - /** - * Get the difference in weekend days using a filter - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInWeekendDays($date = null, $absolute = true) - { - return $this->diffInDaysFiltered(function (Carbon $date) { - return $date->isWeekend(); - }, $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 seconds using timestamps. - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInRealSeconds($date = null, $absolute = true) - { - $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 microseconds. - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInMicroseconds($date = null, $absolute = true) - { - $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 microseconds using timestamps. - * - * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference - * - * @return int - */ - public function diffInRealMicroseconds($date = null, $absolute = true) - { - /** @var Carbon $date */ - $date = $this->resolveCarbon($date); - $value = ($date->timestamp - $this->timestamp) * static::MICROSECONDS_PER_SECOND + - $date->micro - $this->micro; - - return $absolute ? abs($value) : $value; - } - - /** - * The number of seconds since midnight. - * - * @return int - */ - public function secondsSinceMidnight() - { - return $this->diffInSeconds($this->copy()->startOfDay()); - } - - /** - * The number of seconds until 23:59:59. - * - * @return int - */ - public function secondsUntilEndOfDay() - { - return $this->diffInSeconds($this->copy()->endOfDay()); - } - - /** - * 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 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 = $this->nowWithSameTz(); - } elseif (!$other instanceof DateTime && !$other instanceof DateTimeInterface) { - $other = static::parse($other); - } - - $diffInterval = $this->diff($other); - - $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)); - } - } - - // break the loop after we get the required number of parts in array - if (count($interval) >= $parts) { - break; - } - } - - if (count($interval) === 0) { - if ($isNow && static::getHumanDiffOptions() & self::JUST_NOW) { - $key = 'diff_now'; - $translation = static::translator()->trans($key); - if ($translation !== $key) { - return $translation; - } - } - $count = static::getHumanDiffOptions() & self::NO_ZERO_DIFF ? 1 : 0; - $unit = $short ? 's' : 'second'; - $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); - } - - // join the interval parts by a space - $time = implode(' ', $interval); - - unset($diffIntervalArray, $interval); - - if ($absolute) { - return $time; - } - - $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)); - } - } - - return static::translator()->trans($transId, array(':time' => $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; - } - - 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); - } - - /** - * 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; - - if ($absolute instanceof DateTimeInterface) { - list($other, $absolute, $short, $parts) = array_pad(func_get_args(), 5, null); - } - - return $this->from($other, $absolute, $short, $parts); - } - - /////////////////////////////////////////////////////////////////// - //////////////////////////// MODIFIERS //////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Resets the time to 00:00:00 start of day - * - * @return static - */ - public function startOfDay() - { - return $this->modify('00:00:00.000000'); - } - - /** - * Resets the time to 23:59:59 end of day - * - * @return static - */ - public function endOfDay() - { - return $this->modify('23:59:59.999999'); - } - - /** - * Resets the date to the first day of the month and the time to 00:00:00 - * - * @return static - */ - public function startOfMonth() - { - return $this->setDate($this->year, $this->month, 1)->startOfDay(); - } - - /** - * Resets the date to end of the month and time to 23:59:59 - * - * @return static - */ - public function endOfMonth() - { - 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(); - } - - /** - * Resets the date to the first day of the year and the time to 00:00:00 - * - * @return static - */ - public function startOfYear() - { - return $this->setDate($this->year, 1, 1)->startOfDay(); - } - - /** - * Resets the date to end of the year and time to 23:59:59 - * - * @return static - */ - public function endOfYear() - { - return $this->setDate($this->year, 12, 31)->endOfDay(); - } - - /** - * Resets the date to the first day of the decade and the time to 00:00:00 - * - * @return static - */ - public function startOfDecade() - { - $year = $this->year - $this->year % static::YEARS_PER_DECADE; - - return $this->setDate($year, 1, 1)->startOfDay(); - } - - /** - * Resets the date to end of the decade and time to 23:59:59 - * - * @return static - */ - public function endOfDecade() - { - $year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1; - - 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 startOfCentury() - { - $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY; - - 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 endOfCentury() - { - $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(); - } - - /** - * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 - * - * @return static - */ - public function startOfWeek() - { - while ($this->dayOfWeek !== static::$weekStartsAt) { - $this->subDay(); - } - - return $this->startOfDay(); - } - - /** - * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59 - * - * @return static - */ - public function endOfWeek() - { - 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek - * - * @return static - */ - public function next($dayOfWeek = null) - { - if ($dayOfWeek === null) { - $dayOfWeek = $this->dayOfWeek; - } - - 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek - * - * @return static - */ - public function previous($dayOfWeek = null) - { - if ($dayOfWeek === null) { - $dayOfWeek = $this->dayOfWeek; - } - - return $this->startOfDay()->modify('last '.static::$days[$dayOfWeek]); - } - - /** - * 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek - * - * @return static - */ - public function firstOfMonth($dayOfWeek = null) - { - $this->startOfDay(); - - if ($dayOfWeek === null) { - return $this->day(1); - } - - return $this->modify('first '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year); - } - - /** - * 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek - * - * @return static - */ - public function lastOfMonth($dayOfWeek = null) - { - $this->startOfDay(); - - if ($dayOfWeek === null) { - return $this->day($this->daysInMonth); - } - - return $this->modify('last '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year); - } - - /** - * 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 constants to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int $nth - * @param int $dayOfWeek - * - * @return mixed - */ - public function nthOfMonth($nth, $dayOfWeek) - { - $date = $this->copy()->firstOfMonth(); - $check = $date->format('Y-m'); - $date->modify('+'.$nth.' '.static::$days[$dayOfWeek]); - - 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek day of the week default null - * - * @return static - */ - public function firstOfQuarter($dayOfWeek = null) - { - 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek day of the week default null - * - * @return static - */ - public function lastOfQuarter($dayOfWeek = null) - { - 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 constants to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int $nth - * @param int $dayOfWeek - * - * @return mixed - */ - public function nthOfQuarter($nth, $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 < $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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek day of the week default null - * - * @return static - */ - public function firstOfYear($dayOfWeek = null) - { - return $this->month(1)->firstOfMonth($dayOfWeek); - } - - /** - * 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 constants - * to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int|null $dayOfWeek day of the week default null - * - * @return static - */ - public function lastOfYear($dayOfWeek = null) - { - return $this->month(static::MONTHS_PER_YEAR)->lastOfMonth($dayOfWeek); - } - - /** - * 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 constants to indicate the desired dayOfWeek, ex. static::MONDAY. - * - * @param int $nth - * @param int $dayOfWeek - * - * @return mixed - */ - public function nthOfYear($nth, $dayOfWeek) - { - $date = $this->copy()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); - - 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\Carbon|\DateTimeInterface|string|null $date - * - * @return static - */ - public function average($date = null) - { - $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; - } - - /////////////////////////////////////////////////////////////////// - /////////////////////////// SERIALIZATION ///////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * 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 string $name - * - * @return bool - */ - 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) - { - if (!method_exists($className, 'instance')) { - throw new \InvalidArgumentException("$className has not the instance() method needed to cast the date."); - } - - return $className::instance($this); - } } diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php index e8c60325be5379f387d75ac491580ba779720441..0c79f4e0a8d337ebd56ee2e075f903546e4025c3 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,16 +8,16 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Carbon; +use BadMethodCallException; +use Carbon\Exceptions\ParseErrorException; +use Carbon\Traits\Mixin; +use Carbon\Traits\Options; use Closure; use DateInterval; +use Exception; use InvalidArgumentException; -use ReflectionClass; -use ReflectionFunction; -use ReflectionMethod; -use Symfony\Component\Translation\TranslatorInterface; /** * A simple API extension for DateInterval. @@ -31,6 +31,8 @@ use Symfony\Component\Translation\TranslatorInterface; * @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 int $microseconds Total microseconds of the current interval. + * @property int $milliseconds Total microseconds of the current interval. * @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. @@ -41,6 +43,9 @@ use Symfony\Component\Translation\TranslatorInterface; * @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. + * @property-read float $totalMilliseconds Number of milliseconds equivalent to the interval. + * @property-read float $totalMicroseconds Number of microseconds equivalent to the interval. + * @property-read string $locale locale of the current instance * * @method static CarbonInterval years($years = 1) Create instance specifying a number of years. * @method static CarbonInterval year($years = 1) Alias for years() @@ -57,24 +62,114 @@ use Symfony\Component\Translation\TranslatorInterface; * @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 = 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(). + * @method static CarbonInterval milliseconds($milliseconds = 1) Create instance specifying a number of milliseconds. + * @method static CarbonInterval millisecond($milliseconds = 1) Alias for milliseconds() + * @method static CarbonInterval microseconds($microseconds = 1) Create instance specifying a number of microseconds. + * @method static CarbonInterval microsecond($microseconds = 1) Alias for microseconds() + * @method $this years($years = 1) Set the years portion of the current interval. + * @method $this year($years = 1) Alias for years(). + * @method $this months($months = 1) Set the months portion of the current interval. + * @method $this month($months = 1) Alias for months(). + * @method $this weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. + * @method $this week($weeks = 1) Alias for weeks(). + * @method $this days($days = 1) Set the days portion of the current interval. + * @method $this dayz($days = 1) Alias for days(). + * @method $this day($days = 1) Alias for days(). + * @method $this hours($hours = 1) Set the hours portion of the current interval. + * @method $this hour($hours = 1) Alias for hours(). + * @method $this minutes($minutes = 1) Set the minutes portion of the current interval. + * @method $this minute($minutes = 1) Alias for minutes(). + * @method $this seconds($seconds = 1) Set the seconds portion of the current interval. + * @method $this second($seconds = 1) Alias for seconds(). + * @method $this milliseconds($seconds = 1) Set the seconds portion of the current interval. + * @method $this millisecond($seconds = 1) Alias for seconds(). + * @method $this microseconds($seconds = 1) Set the seconds portion of the current interval. + * @method $this microsecond($seconds = 1) Alias for seconds(). + * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundWeek(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundWeeks(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorWeek(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorWeeks(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilWeek(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilWeeks(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. */ class CarbonInterval extends DateInterval { + use Options, Mixin { + Mixin::mixin as baseMixin; + } + /** * Interval spec period designators */ @@ -99,6 +194,29 @@ class CarbonInterval extends DateInterval */ protected static $cascadeFactors; + /** + * @var array + */ + protected static $formats = [ + 'y' => 'y', + 'Y' => 'y', + 'o' => 'y', + 'm' => 'm', + 'n' => 'm', + 'W' => 'weeks', + 'd' => 'd', + 'j' => 'd', + 'z' => 'd', + 'h' => 'h', + 'g' => 'h', + 'H' => 'h', + 'G' => 'h', + 'i' => 'i', + 's' => 's', + 'u' => 'micro', + 'v' => 'milli', + ]; + /** * @var array|null */ @@ -109,13 +227,28 @@ class CarbonInterval extends DateInterval * * @var array */ - protected static $macros = array(); + protected static $macros = []; /** - * 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(). + * Timezone handler for settings() method. + * + * @var mixed + */ + protected $tzName; + + /** + * Set the instance's timezone from a string or object and add/subtract the offset difference. + * + * @param \DateTimeZone|string $tzName + * + * @return static */ - const PHP_DAYS_FALSE = -99999; + public function shiftTimezone($tzName) + { + $this->tzName = $tzName; + + return $this; + } /** * Mapping of units and factors for cascading. @@ -126,13 +259,15 @@ class CarbonInterval extends DateInterval */ 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'), - ); + return static::$cascadeFactors ?: [ + 'milliseconds' => [Carbon::MICROSECONDS_PER_MILLISECOND, 'microseconds'], + 'seconds' => [Carbon::MILLISECONDS_PER_SECOND, 'milliseconds'], + 'minutes' => [Carbon::SECONDS_PER_MINUTE, 'seconds'], + 'hours' => [Carbon::MINUTES_PER_HOUR, 'minutes'], + 'dayz' => [Carbon::HOURS_PER_DAY, 'hours'], + 'months' => [Carbon::DAYS_PER_WEEK * Carbon::WEEKS_PER_MONTH, 'dayz'], + 'years' => [Carbon::MONTHS_PER_YEAR, 'months'], + ]; } private static function standardizeUnit($unit) @@ -145,11 +280,10 @@ class CarbonInterval extends DateInterval private static function getFlipCascadeFactors() { if (!self::$flipCascadeFactors) { - self::$flipCascadeFactors = array(); - foreach (static::getCascadeFactors() as $to => $tuple) { - list($factor, $from) = $tuple; + self::$flipCascadeFactors = []; - self::$flipCascadeFactors[self::standardizeUnit($from)] = array(self::standardizeUnit($to), $factor); + foreach (static::getCascadeFactors() as $to => [$factor, $from]) { + self::$flipCascadeFactors[self::standardizeUnit($from)] = [self::standardizeUnit($to), $factor]; } } @@ -157,6 +291,8 @@ class CarbonInterval extends DateInterval } /** + * Set default cascading factors for ->cascade() method. + * * @param array $cascadeFactors */ public static function setCascadeFactors(array $cascadeFactors) @@ -165,18 +301,6 @@ class CarbonInterval extends DateInterval static::$cascadeFactors = $cascadeFactors; } - /** - * Determine if the interval was created via DateTime:diff() or not. - * - * @param DateInterval $interval - * - * @return bool - */ - private static function wasCreatedFromDiff(DateInterval $interval) - { - return $interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE; - } - /////////////////////////////////////////////////////////////////// //////////////////////////// CONSTRUCTORS ///////////////////////// /////////////////////////////////////////////////////////////////// @@ -184,16 +308,27 @@ class CarbonInterval extends DateInterval /** * Create a new CarbonInterval instance. * - * @param int $years - * @param int $months - * @param int $weeks - * @param int $days - * @param int $hours - * @param int $minutes - * @param int $seconds + * @param int|null $years + * @param int|null $months + * @param int|null $weeks + * @param int|null $days + * @param int|null $hours + * @param int|null $minutes + * @param int|null $seconds + * @param int|null $microseconds + * + * @throws Exception when the interval_spec (passed as $years) cannot be parsed as an interval. */ - public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) + public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null) { + if ($years instanceof DateInterval) { + parent::__construct(static::getDateIntervalSpec($years)); + $this->f = $years->f; + static::copyNegativeUnits($years, $this); + + return; + } + $spec = $years; if (!is_string($spec) || floatval($years) || preg_match('/^[0-9.]/', $years)) { @@ -222,6 +357,10 @@ class CarbonInterval extends DateInterval } parent::__construct($spec); + + if (!is_null($microseconds)) { + $this->f = $microseconds / Carbon::MICROSECONDS_PER_SECOND; + } } /** @@ -238,7 +377,7 @@ class CarbonInterval extends DateInterval $target = self::standardizeUnit($target); $factors = static::getFlipCascadeFactors(); if (isset($factors[$source])) { - list($to, $factor) = $factors[$source]; + [$to, $factor] = $factors[$source]; if ($to === $target) { return $factor; } @@ -272,7 +411,7 @@ class CarbonInterval extends DateInterval * * @return int */ - public static function getMinutesPerHours() + public static function getMinutesPerHour() { return static::getFactor('minutes', 'hours') ?: Carbon::MINUTES_PER_HOUR; } @@ -282,11 +421,31 @@ class CarbonInterval extends DateInterval * * @return int */ - public static function getSecondsPerMinutes() + public static function getSecondsPerMinute() { return static::getFactor('seconds', 'minutes') ?: Carbon::SECONDS_PER_MINUTE; } + /** + * Returns current config for microseconds per second. + * + * @return int + */ + public static function getMillisecondsPerSecond() + { + return static::getFactor('milliseconds', 'seconds') ?: Carbon::MILLISECONDS_PER_SECOND; + } + + /** + * Returns current config for microseconds per second. + * + * @return int + */ + public static function getMicrosecondsPerMillisecond() + { + return static::getFactor('microseconds', 'milliseconds') ?: Carbon::MICROSECONDS_PER_MILLISECOND; + } + /** * Create a new CarbonInterval instance from specific values. * This is an alias for the constructor that allows better fluent @@ -300,12 +459,80 @@ class CarbonInterval extends DateInterval * @param int $hours * @param int $minutes * @param int $seconds + * @param int $microseconds + * + * @throws Exception when the interval_spec (passed as $years) cannot be parsed as an interval. + * + * @return static + */ + public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null) + { + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds, $microseconds); + } + + /** + * Parse a string into a new CarbonInterval object according to the specified format. + * + * @example + * ``` + * echo Carboninterval::createFromFormat('H:i', '1:30'); + * ``` + * + * @param string $format Format of the $interval input string + * @param string $interval Input string to convert into an interval + * + * @throws Exception when the $interval cannot be parsed as an interval. * * @return static */ - public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) + public static function createFromFormat(string $format, ?string $interval) { - return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); + $instance = new static(0); + $length = mb_strlen($format); + + if (preg_match('/s([,.])([uv])$/', $format, $match)) { + $interval = explode($match[1], $interval); + $index = count($interval) - 1; + $interval[$index] = str_pad($interval[$index], $match[2] === 'v' ? 3 : 6, '0'); + $interval = implode($match[1], $interval); + } + + for ($index = 0; $index < $length; $index++) { + $expected = mb_substr($format, $index, 1); + $nextCharacter = mb_substr($interval, 0, 1); + $unit = static::$formats[$expected] ?? null; + + if ($unit) { + if (!preg_match('/^-?\d+/', $interval, $match)) { + throw new ParseErrorException('number', $nextCharacter); + } + + $interval = mb_substr($interval, mb_strlen($match[0])); + $instance->$unit += intval($match[0]); + + continue; + } + + if ($nextCharacter !== $expected) { + throw new ParseErrorException( + "'$expected'", + $nextCharacter, + 'Allowed substitutes for interval formats are '.implode(', ', array_keys(static::$formats))."\n". + 'See https://www.php.net/manual/en/function.date.php for their meaning' + ); + } + + $interval = mb_substr($interval, 1); + } + + if ($interval !== '') { + throw new ParseErrorException( + 'end of string', + $interval + ); + } + + return $instance; } /** @@ -317,61 +544,76 @@ class CarbonInterval extends DateInterval { $date = new static($this->spec()); $date->invert = $this->invert; + $date->f = $this->f; return $date; } + /** + * Get a copy of the instance. + * + * @return static + */ + public function clone() + { + return $this->copy(); + } + /** * Provide static helpers to create instances. Allows CarbonInterval::years(3). * * Note: This is done using the magic method to allow static and instance methods to * have the same names. * - * @param string $name - * @param array $args + * @param string $method magic method name called + * @param array $parameters parameters list * - * @return static + * @return static|null */ - public static function __callStatic($name, $args) + public static function __callStatic($method, $parameters) { - $arg = count($args) === 0 ? 1 : $args[0]; + $arg = count($parameters) === 0 ? 1 : $parameters[0]; - switch ($name) { - case 'years': + switch (Carbon::singularUnit(rtrim($method, 'z'))) { case 'year': return new static($arg); - case 'months': case 'month': return new static(null, $arg); - case 'weeks': case 'week': return new static(null, null, $arg); - case 'days': - case 'dayz': case 'day': return new static(null, null, null, $arg); - case 'hours': case 'hour': return new static(null, null, null, null, $arg); - case 'minutes': case 'minute': return new static(null, null, null, null, null, $arg); - case 'seconds': case 'second': return new static(null, null, null, null, null, null, $arg); + + case 'millisecond': + case 'milli': + return new static(null, null, null, null, null, null, null, $arg * Carbon::MICROSECONDS_PER_MILLISECOND); + + case 'microsecond': + case 'micro': + return new static(null, null, null, null, null, null, null, $arg); } - if (static::hasMacro($name)) { - return call_user_func_array( - array(new static(0), $name), $args - ); + if (static::hasMacro($method)) { + return (new static(0))->$method(...$parameters); + } + + if (Carbon::isStrictModeEnabled()) { + throw new BadMethodCallException(sprintf("Unknown fluent constructor '%s'.", $method)); } + + return null; } /** @@ -413,66 +655,141 @@ class CarbonInterval extends DateInterval $hours = 0; $minutes = 0; $seconds = 0; + $milliseconds = 0; + $microseconds = 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; + + while ([$part, $value, $unit] = array_shift($parts)) { $intValue = intval($value); $fraction = floatval($value) - $intValue; - switch (strtolower($unit)) { + + // Fix calculation precision + switch (round($fraction, 6)) { + case 1: + $fraction = 0; + $intValue++; + + break; + case 0: + $fraction = 0; + + break; + } + + switch ($unit === 'µs' ? 'µs' : strtolower($unit)) { + case 'millennia': + case 'millennium': + $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; + + break; + + case 'century': + case 'centuries': + $years += $intValue * CarbonInterface::YEARS_PER_CENTURY; + + break; + + case 'decade': + case 'decades': + $years += $intValue * CarbonInterface::YEARS_PER_DECADE; + + break; + case 'year': case 'years': case 'y': $years += $intValue; + + break; + + case 'quarter': + case 'quarters': + $months += $intValue * CarbonInterface::MONTHS_PER_QUARTER; + 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'); + $parts[] = [null, $fraction * static::getDaysPerWeek(), 'd']; } + break; case 'day': case 'days': case 'd': $days += $intValue; + if ($fraction) { - $parts[] = array(null, $fraction * static::getHoursPerDay(), 'h'); + $parts[] = [null, $fraction * static::getHoursPerDay(), 'h']; } + break; case 'hour': case 'hours': case 'h': $hours += $intValue; + if ($fraction) { - $parts[] = array(null, $fraction * static::getMinutesPerHours(), 'm'); + $parts[] = [null, $fraction * static::getMinutesPerHour(), 'm']; } + break; case 'minute': case 'minutes': case 'm': $minutes += $intValue; + if ($fraction) { - $seconds += round($fraction * static::getSecondsPerMinutes()); + $parts[] = [null, $fraction * static::getSecondsPerMinute(), 's']; } + break; case 'second': case 'seconds': case 's': $seconds += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getMillisecondsPerSecond(), 'ms']; + } + + break; + + case 'millisecond': + case 'milliseconds': + case 'milli': + case 'ms': + $milliseconds += $intValue; + + if ($fraction) { + $microseconds += round($fraction * static::getMicrosecondsPerMillisecond()); + } + + break; + + case 'microsecond': + case 'microseconds': + case 'micro': + case 'µs': + $microseconds += $intValue; + break; default: @@ -482,37 +799,77 @@ class CarbonInterval extends DateInterval } } - return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds, $milliseconds * Carbon::MICROSECONDS_PER_MILLISECOND + $microseconds); } /** - * Create a CarbonInterval instance from a DateInterval one. Can not instance - * DateInterval objects created from DateTime::diff() as you can't externally - * set the $days field. - * - * Pass false as second argument to get a microseconds-precise interval. Else - * microseconds in the original interval will not be kept. + * Creates a CarbonInterval from string using a different locale. * - * @param DateInterval $di - * @param bool $trimMicroseconds (true by default) + * @param string $interval + * @param string $locale * * @return static */ - public static function instance(DateInterval $di, $trimMicroseconds = true) + public static function parseFromLocale($interval, $locale) + { + return static::fromString(Carbon::translateTimeString($interval, $locale, 'en')); + } + + private static function castIntervalToClass(DateInterval $interval, string $className) { - $microseconds = $trimMicroseconds || version_compare(PHP_VERSION, '7.1.0-dev', '<') ? 0 : $di->f; - $instance = new static(static::getDateIntervalSpec($di)); + $mainClass = DateInterval::class; + + if (!is_a($className, $mainClass, true)) { + throw new InvalidArgumentException("$className is not a sub-class of $mainClass."); + } + + $microseconds = $interval->f; + $instance = new $className(static::getDateIntervalSpec($interval)); + if ($microseconds) { $instance->f = $microseconds; } - $instance->invert = $di->invert; - foreach (array('y', 'm', 'd', 'h', 'i', 's') as $unit) { - if ($di->$unit < 0) { - $instance->$unit *= -1; + + static::copyNegativeUnits($interval, $instance); + + return $instance; + } + + private static function copyNegativeUnits(DateInterval $from, DateInterval $to) + { + $to->invert = $from->invert; + + foreach (['y', 'm', 'd', 'h', 'i', 's'] as $unit) { + if ($from->$unit < 0) { + $to->$unit *= -1; } } + } - return $instance; + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DateInterval + */ + public function cast(string $className) + { + return self::castIntervalToClass($this, $className); + } + + /** + * Create a CarbonInterval instance from a DateInterval one. Can not instance + * DateInterval objects created from DateTime::diff() as you can't externally + * set the $days field. + * + * @param DateInterval $interval + * + * @return static + */ + public static function instance(DateInterval $interval) + { + return self::castIntervalToClass($interval, static::class); } /** @@ -531,75 +888,56 @@ class CarbonInterval extends DateInterval return static::instance($var); } - if (is_string($var)) { - $var = trim($var); + if (!is_string($var)) { + return null; + } - if (substr($var, 0, 1) === 'P') { - return new static($var); - } + $var = trim($var); - if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $var)) { - return static::fromString($var); - } + if (preg_match('/^P[T0-9]/', $var)) { + return new static($var); } - } - /////////////////////////////////////////////////////////////////// - /////////////////////// LOCALIZATION ////////////////////////////// - /////////////////////////////////////////////////////////////////// - - /** - * Initialize the translator instance if necessary. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - protected static function translator() - { - if (static::$translator === null) { - static::$translator = Translator::get(); + if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $var)) { + return static::fromString($var); } - return static::$translator; - } + /** @var static $interval */ + $interval = static::createFromDateString($var); - /** - * Get the translator instance in use. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - public static function getTranslator() - { - return static::translator(); + return !$interval || $interval->isEmpty() ? null : $interval; } - /** - * Set the translator instance to use. - * - * @param TranslatorInterface $translator - */ - public static function setTranslator(TranslatorInterface $translator) + protected function resolveInterval($interval) { - static::$translator = $translator; - } + if (!($interval instanceof self)) { + return self::make($interval); + } - /** - * Get the current translator locale. - * - * @return string - */ - public static function getLocale() - { - return static::translator()->getLocale(); + return $interval; } /** - * Set the current translator locale. + * Sets up a DateInterval from the relative parts of the string. * - * @param string $locale + * @param string $time + * + * @return static + * + * @link http://php.net/manual/en/dateinterval.createfromdatestring.php */ - public static function setLocale($locale) + public static function createFromDateString($time) { - return static::translator()->setLocale($locale) !== false; + $interval = @parent::createFromDateString(strtr($time, [ + ',' => ' ', + ' and ' => ' ', + ])); + + if ($interval instanceof DateInterval) { + $interval = static::instance($interval); + } + + return $interval; } /////////////////////////////////////////////////////////////////// @@ -611,9 +949,9 @@ class CarbonInterval extends DateInterval * * @param string $name * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * - * @return int|float + * @return int|float|string */ public function __get($name) { @@ -640,6 +978,14 @@ class CarbonInterval extends DateInterval case 'seconds': return $this->s; + case 'milli': + case 'milliseconds': + return (int) floor(round($this->f * Carbon::MICROSECONDS_PER_SECOND) / Carbon::MICROSECONDS_PER_MILLISECOND); + + case 'micro': + case 'microseconds': + return (int) round($this->f * Carbon::MICROSECONDS_PER_SECOND); + case 'weeks': return (int) floor($this->d / static::getDaysPerWeek()); @@ -647,6 +993,9 @@ class CarbonInterval extends DateInterval case 'dayzExcludeWeeks': return $this->d % static::getDaysPerWeek(); + case 'locale': + return $this->getTranslatorLocale(); + default: throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); } @@ -656,47 +1005,73 @@ class CarbonInterval extends DateInterval * Set a part of the CarbonInterval object. * * @param string $name - * @param int $val + * @param int $value * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ - public function __set($name, $val) + public function __set($name, $value) { - switch ($name) { - case 'years': - $this->y = $val; + switch (Carbon::singularUnit(rtrim($name, 'z'))) { + case 'year': + $this->y = $value; + break; - case 'months': - $this->m = $val; + case 'month': + $this->m = $value; + break; - case 'weeks': - $this->d = $val * static::getDaysPerWeek(); + case 'week': + $this->d = $value * static::getDaysPerWeek(); + break; - case 'dayz': - $this->d = $val; + case 'day': + $this->d = $value; + break; - case 'hours': - $this->h = $val; + case 'hour': + $this->h = $value; + break; - case 'minutes': - $this->i = $val; + case 'minute': + $this->i = $value; + break; - case 'seconds': - $this->s = $val; + case 'second': + $this->s = $value; + break; - } - } - /** - * Allow setting of weeks and days to be cumulative. - * - * @param int $weeks Number of weeks to set + case 'milli': + case 'millisecond': + $this->microseconds = $value * Carbon::MICROSECONDS_PER_MILLISECOND + $this->microseconds % Carbon::MICROSECONDS_PER_MILLISECOND; + + break; + + case 'micro': + case 'microsecond': + $this->f = $value / Carbon::MICROSECONDS_PER_SECOND; + + break; + + default: + if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + throw new InvalidArgumentException(sprintf("Unknown setter '%s'", $name)); + } + + $this->$name = $value; + } + } + + /** + * Allow setting of weeks and days to be cumulative. + * + * @param int $weeks Number of weeks to set * @param int $days Number of days to set * * @return static @@ -708,9 +1083,34 @@ class CarbonInterval extends DateInterval return $this; } + /** + * Returns true if the interval is empty for each unit. + * + * @return bool + */ + public function isEmpty() + { + return $this->years === 0 && + $this->months === 0 && + $this->dayz === 0 && + !$this->days && + $this->hours === 0 && + $this->minutes === 0 && + $this->seconds === 0 && + $this->microseconds === 0; + } + /** * Register a custom macro. * + * @example + * ``` + * CarbonInterval::macro('twice', function () { + * return $this->times(2); + * }); + * echo CarbonInterval::hours(2)->twice(); + * ``` + * * @param string $name * @param object|callable $macro * @@ -721,18 +1121,34 @@ class CarbonInterval extends DateInterval static::$macros[$name] = $macro; } - /** - * Remove all macros. - */ - public static function resetMacros() - { - static::$macros = array(); - } - /** * Register macros from a mixin object. * - * @param object $mixin + * @example + * ``` + * CarbonInterval::mixin(new class { + * public function daysToHours() { + * return function () { + * $this->hours += $this->days; + * $this->days = 0; + * + * return $this; + * }; + * } + * public function hoursToDays() { + * return function () { + * $this->days += $this->hours; + * $this->hours = 0; + * + * return $this; + * }; + * } + * }); + * echo CarbonInterval::hours(5)->hoursToDays() . "\n"; + * echo CarbonInterval::days(5)->daysToHours() . "\n"; + * ``` + * + * @param object|string $mixin * * @throws \ReflectionException * @@ -740,17 +1156,7 @@ class CarbonInterval extends DateInterval */ 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)); - } + static::baseMixin($mixin); } /** @@ -777,23 +1183,10 @@ class CarbonInterval extends DateInterval { $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) { + $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class); - if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { - $macro = $macro->bindTo($this, get_class($this)); + return call_user_func_array($boundMacro ?: $macro, $parameters); } return call_user_func_array($macro, $parameters); @@ -805,359 +1198,1272 @@ class CarbonInterval extends DateInterval * Note: This is done using the magic method to allow static and instance methods to * have the same names. * - * @param string $name - * @param array $args + * @param string $method magic method name called + * @param array $parameters parameters list * * @return static */ - public function __call($name, $args) + public function __call($method, $parameters) { - if (static::hasMacro($name)) { - return $this->callMacro($name, $args); + if (static::hasMacro($method)) { + return static::bindMacroContext($this, function () use (&$method, &$parameters) { + return $this->callMacro($method, $parameters); + }); } - $arg = count($args) === 0 ? 1 : $args[0]; + $action = substr($method, 0, 4); - switch ($name) { - case 'years': + if ($action !== 'ceil') { + $action = substr($method, 0, 5); + } + + if (in_array($action, ['round', 'floor', 'ceil'])) { + return $this->{$action.'Unit'}(substr($method, strlen($action)), ...$parameters); + } + + $arg = count($parameters) === 0 ? 1 : $parameters[0]; + + switch (Carbon::singularUnit(rtrim($method, 'z'))) { case 'year': $this->years = $arg; + break; - case 'months': case 'month': $this->months = $arg; + break; - case 'weeks': case 'week': $this->dayz = $arg * static::getDaysPerWeek(); + break; - case 'days': - case 'dayz': case 'day': $this->dayz = $arg; + break; - case 'hours': case 'hour': $this->hours = $arg; + break; - case 'minutes': case 'minute': $this->minutes = $arg; + break; - case 'seconds': case 'second': $this->seconds = $arg; + break; - } - return $this; - } + case 'milli': + case 'millisecond': + $this->milliseconds = $arg; - /** - * 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($short = false) - { - $periods = array( - '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), - ); + break; - $parts = array(); - foreach ($periods as $unit => $options) { - list($shortUnit, $count) = $options; - if ($count > 0) { - $parts[] = static::translator()->transChoice($short ? $shortUnit : $unit, $count, array(':count' => $count)); - } + case 'micro': + case 'microsecond': + $this->microseconds = $arg; + + break; + + default: + if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + throw new BadMethodCallException(sprintf("Unknown fluent setter '%s'", $method)); + } } - return implode(' ', $parts); + return $this; } - /** - * Format the instance as a string using the forHumans() function. - * - * @return string - */ - public function __toString() + protected function getForHumansInitialVariables($syntax, $short) { - return $this->forHumans(); - } + if (is_array($syntax)) { + return $syntax; + } - /** - * Convert the interval to a CarbonPeriod. - * - * @return CarbonPeriod - */ - public function toPeriod() - { - return CarbonPeriod::createFromArray( - array_merge(array($this), func_get_args()) - ); - } + if (is_int($short)) { + return [ + 'parts' => $short, + 'short' => false, + ]; + } - /** - * Invert the interval. - * - * @return $this - */ - public function invert() - { - $this->invert = $this->invert ? 0 : 1; + if (is_bool($syntax)) { + return [ + 'short' => $syntax, + 'syntax' => CarbonInterface::DIFF_ABSOLUTE, + ]; + } - return $this; + return []; } /** - * Add the passed interval to the current instance. - * - * @param DateInterval $interval + * @param mixed $syntax + * @param mixed $short + * @param mixed $parts + * @param mixed $options * - * @return static + * @return array */ - public function add(DateInterval $interval) + protected function getForHumansParameters($syntax = null, $short = false, $parts = -1, $options = null) { - $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; - - if (static::wasCreatedFromDiff($interval)) { - $this->dayz += $interval->days * $sign; - } else { - $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; + $optionalSpace = ' '; + $default = $this->getTranslationMessage('list.0') ?? $this->getTranslationMessage('list') ?? ' '; + $join = $default === '' ? '' : ' '; + $altNumbers = false; + $aUnit = false; + extract($this->getForHumansInitialVariables($syntax, $short)); + + if (is_null($syntax)) { + $syntax = CarbonInterface::DIFF_ABSOLUTE; } - 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(); + if ($parts === -1) { + $parts = INF; } - return $this; - } + if (is_null($options)) { + $options = static::getHumanDiffOptions(); + } - /** - * 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; + if ($join === false) { + $join = ' '; + } elseif ($join === true) { + $join = [ + $default, + $this->getTranslationMessage('list.1') ?? $default, + ]; } - $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); + if ($altNumbers) { + if ($altNumbers !== true) { + $language = new Language($this->locale); + $altNumbers = in_array($language->getCode(), (array) $altNumbers); + } + } - return $this; - } + if (is_array($join)) { + [$default, $last] = $join; - /** - * 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), - )); + if ($default !== ' ') { + $optionalSpace = ''; + } - $time = array_filter(array( - static::PERIOD_HOURS => abs($interval->h), - static::PERIOD_MINUTES => abs($interval->i), - static::PERIOD_SECONDS => abs($interval->s), - )); + $join = function ($list) use ($default, $last) { + if (count($list) < 2) { + return implode('', $list); + } - $specString = static::PERIOD_PREFIX; + $end = array_pop($list); - foreach ($date as $key => $value) { - $specString .= $value.$key; + return implode($default, $list).$last.$end; + }; } - if (count($time) > 0) { - $specString .= static::PERIOD_TIME_PREFIX; - foreach ($time as $key => $value) { - $specString .= $value.$key; + if (is_string($join)) { + if ($join !== ' ') { + $optionalSpace = ''; } + + $glue = $join; + $join = function ($list) use ($glue) { + return implode($glue, $list); + }; } - return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString; - } + $interpolations = [ + ':optional-space' => $optionalSpace, + ]; - /** - * Get the interval_spec string. - * - * @return string - */ - public function spec() - { - return static::getDateIntervalSpec($this); + return [$syntax, $short, $parts, $options, $join, $aUnit, $altNumbers, $interpolations]; } - /** - * Comparing 2 date intervals. - * - * @param DateInterval $a - * @param DateInterval $b - * - * @return int - */ - public static function compareDateIntervals(DateInterval $a, DateInterval $b) + protected static function getRoundingMethodFromOptions(int $options): ?string { - $current = Carbon::now(); - $passed = $current->copy()->add($b); - $current->add($a); + if ($options & CarbonInterface::ROUND) { + return 'round'; + } - if ($current < $passed) { - return -1; + if ($options & CarbonInterface::CEIL) { + return 'ceil'; } - if ($current > $passed) { - return 1; + + if ($options & CarbonInterface::FLOOR) { + return 'floor'; } - return 0; + return null; } /** - * Comparing with passed interval. + * Returns interval values as an array where key are the unit names and values the counts. * - * @param DateInterval $interval + * @return int[] + */ + public function toArray() + { + return [ + 'years' => $this->years, + 'months' => $this->months, + 'weeks' => $this->weeks, + 'days' => $this->daysExcludeWeeks, + 'hours' => $this->hours, + 'minutes' => $this->minutes, + 'seconds' => $this->seconds, + 'microseconds' => $this->microseconds, + ]; + } + + /** + * Returns interval non-zero values as an array where key are the unit names and values the counts. * - * @return int + * @return int[] */ - public function compare(DateInterval $interval) + public function getNonZeroValues() { - return static::compareDateIntervals($this, $interval); + return array_filter($this->toArray(), 'intval'); } /** - * Convert overflowed values into bigger units. + * Returns interval values as an array where key are the unit names and values the counts + * from the biggest non-zero one the the smallest non-zero one. * - * @return $this + * @return int[] */ - public function cascade() + public function getValuesSequence() { - foreach (static::getFlipCascadeFactors() as $source => $cascade) { - list($target, $factor) = $cascade; + $nonZeroValues = $this->getNonZeroValues(); - if ($source === 'dayz' && $target === 'weeks') { - continue; + if ($nonZeroValues === []) { + return []; + } + + $keys = array_keys($nonZeroValues); + $firstKey = $keys[0]; + $lastKey = $keys[count($keys) - 1]; + $values = []; + $record = false; + + foreach ($this->toArray() as $unit => $count) { + if ($unit === $firstKey) { + $record = true; } - $value = $this->$source; - $this->$source = $modulo = $value % $factor; - $this->$target += ($value - $modulo) / $factor; + if ($record) { + $values[$unit] = $count; + } + + if ($unit === $lastKey) { + $record = false; + } } - return $this; + return $values; } /** - * Get amount of given unit equivalent to the interval. - * - * @param string $unit + * Get the current interval in a human readable format in the current locale. * - * @throws \InvalidArgumentException + * @example + * ``` + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans() . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 2]) . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 3, 'join' => true]) . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['short' => true]) . "\n"; + * echo CarbonInterval::fromString('1d 24h')->forHumans(['join' => ' or ']) . "\n"; + * ``` + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'aUnit' entry, prefer "an hour" over "1 hour" if true + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: -1: no limits) + * @param int $options human diff options * - * @return float + * @return string */ - public function total($unit) + public function forHumans($syntax = null, $short = false, $parts = -1, $options = null) { - $realUnit = $unit = strtolower($unit); + [$syntax, $short, $parts, $options, $join, $aUnit, $altNumbers, $interpolations] = $this->getForHumansParameters($syntax, $short, $parts, $options); - 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'."); - } + $interval = []; - $result = 0; - $cumulativeFactor = 0; - $unitFound = false; + $syntax = (int) ($syntax === null ? CarbonInterface::DIFF_ABSOLUTE : $syntax); + $absolute = $syntax === CarbonInterface::DIFF_ABSOLUTE; + $relativeToNow = $syntax === CarbonInterface::DIFF_RELATIVE_TO_NOW; + $count = 1; + $unit = $short ? 's' : 'second'; + $isFuture = $this->invert === 1; + $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); - foreach (static::getFlipCascadeFactors() as $source => $cascade) { - list($target, $factor) = $cascade; + /** @var \Symfony\Component\Translation\Translator $translator */ + $translator = $this->getLocalTranslator(); - if ($source === $realUnit) { - $unitFound = true; - $result += $this->$source; - $cumulativeFactor = 1; - } + $handleDeclensions = function ($unit, $count) use ($interpolations, $transId, $translator, $altNumbers, $absolute) { + if (!$absolute) { + // Some languages have special pluralization for past and future tense. + $key = $unit.'_'.$transId; + $result = $this->translate($key, $interpolations, $count, $translator, $altNumbers); - if ($factor === false) { - if ($unitFound) { - break; + if ($result !== $key) { + return $result; } + } - $result = 0; - $cumulativeFactor = 0; + $result = $this->translate($unit, $interpolations, $count, $translator, $altNumbers); - continue; + if ($result !== $unit) { + return $result; } - if ($target === $realUnit) { - $unitFound = true; - } + return null; + }; - if ($cumulativeFactor) { - $cumulativeFactor *= $factor; - $result += $this->$target * $cumulativeFactor; + $intervalValues = $this; + $method = static::getRoundingMethodFromOptions($options); - continue; + if ($method) { + while ( + count($intervalValues->getNonZeroValues()) > $parts && + ($count = count($keys = array_keys($intervalValues->getValuesSequence()))) > 1 + ) { + $intervalValues = $this->copy()->roundUnit($keys[$count - 2], 1, $method); } - - $result = ($result + $this->$source) / $factor; } - if (isset($target) && !$cumulativeFactor) { - $result += $this->$target; - } + $diffIntervalArray = [ + ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], + ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], + ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], + ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], + ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], + ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], + ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], + ]; - if (!$unitFound) { - throw new \InvalidArgumentException("Unit $unit have no configuration to get total from other units."); - } + $transChoice = function ($short, $unitData) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { + $count = $unitData['value']; - if ($unit === 'weeks') { - return $result / static::getDaysPerWeek(); + if ($short) { + $result = $handleDeclensions($unitData['unitShort'], $count); + + if ($result !== null) { + return $result; + } + } elseif ($aUnit) { + $result = $handleDeclensions('a_'.$unitData['unit'], $count); + + if ($result !== null) { + return $result; + } + } + + if (!$absolute) { + return $handleDeclensions($unitData['unit'], $count); + } + + return $this->translate($unitData['unit'], $interpolations, $count, $translator, $altNumbers); + }; + + foreach ($diffIntervalArray as $diffIntervalData) { + if ($diffIntervalData['value'] > 0) { + $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit']; + $count = $diffIntervalData['value']; + $interval[] = $transChoice($short, $diffIntervalData); + } elseif ($options & CarbonInterface::SEQUENTIAL_PARTS_ONLY && count($interval) > 0) { + break; + } + + // break the loop after we get the required number of parts in array + if (count($interval) >= $parts) { + break; + } + } + + if (count($interval) === 0) { + if ($relativeToNow && $options & CarbonInterface::JUST_NOW) { + $key = 'diff_now'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + + $count = $options & CarbonInterface::NO_ZERO_DIFF ? 1 : 0; + $unit = $short ? 's' : 'second'; + $interval[] = $this->translate($unit, $interpolations, $count, $translator, $altNumbers); + } + + // join the interval parts by a space + $time = $join($interval); + + unset($diffIntervalArray, $interval); + + if ($absolute) { + return $time; + } + + $isFuture = $this->invert === 1; + + $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + + if ($parts === 1) { + if ($relativeToNow && $unit === 'day') { + if ($count === 1 && $options & CarbonInterface::ONE_DAY_WORDS) { + $key = $isFuture ? 'diff_tomorrow' : 'diff_yesterday'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + + if ($count === 2 && $options & CarbonInterface::TWO_DAY_WORDS) { + $key = $isFuture ? 'diff_after_tomorrow' : 'diff_before_yesterday'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + } + + $aTime = $aUnit ? $handleDeclensions('a_'.$unit, $count) : null; + + $time = $aTime ?: $handleDeclensions($unit, $count) ?: $time; + } + + $time = [':time' => $time]; + + return $this->translate($transId, array_merge($time, $interpolations, $time), null, $translator); + } + + /** + * Format the instance as a string using the forHumans() function. + * + * @return string + */ + public function __toString() + { + $format = $this->localToStringFormat; + + if ($format) { + if ($format instanceof Closure) { + return $format($this); + } + + return $this->format($format); + } + + return $this->forHumans(); + } + + /** + * Return native DateInterval PHP object matching the current instance. + * + * @example + * ``` + * var_dump(CarbonInterval::hours(2)->toDateInterval()); + * ``` + * + * @return DateInterval + */ + public function toDateInterval() + { + return self::castIntervalToClass($this, DateInterval::class); + } + + /** + * Convert the interval to a CarbonPeriod. + * + * @return CarbonPeriod + */ + public function toPeriod(...$params) + { + return CarbonPeriod::create($this, ...$params); + } + + /** + * Invert the interval. + * + * @return $this + */ + public function invert() + { + $this->invert = $this->invert ? 0 : 1; + + return $this; + } + + protected function solveNegativeInterval() + { + if (!$this->isEmpty() && $this->years <= 0 && $this->months <= 0 && $this->dayz <= 0 && $this->hours <= 0 && $this->minutes <= 0 && $this->seconds <= 0 && $this->microseconds <= 0) { + $this->years *= -1; + $this->months *= -1; + $this->dayz *= -1; + $this->hours *= -1; + $this->minutes *= -1; + $this->seconds *= -1; + $this->microseconds *= -1; + $this->invert(); + } + + return $this; + } + + /** + * Add the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int $value + * + * @return static + */ + public function add($unit, $value = 1) + { + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + if (is_string($unit) && !preg_match('/^\s*\d/', $unit)) { + $unit = "$value $unit"; + $value = 1; + } + + $interval = static::make($unit); + + if (!$interval) { + throw new InvalidArgumentException('This type of data cannot be added/subtracted.'); + } + + if ($value !== 1) { + $interval->times($value); + } + + $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; + $this->years += $interval->y * $sign; + $this->months += $interval->m * $sign; + $this->dayz += ($interval->days === false ? $interval->d : $interval->days) * $sign; + $this->hours += $interval->h * $sign; + $this->minutes += $interval->i * $sign; + $this->seconds += $interval->s * $sign; + $this->microseconds += $interval->microseconds * $sign; + + $this->solveNegativeInterval(); + + return $this; + } + + /** + * Subtract the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int $value + * + * @return static + */ + public function sub($unit, $value = 1) + { + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + return $this->add($unit, -floatval($value)); + } + + /** + * Subtract the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int $value + * + * @return static + */ + public function subtract($unit, $value = 1) + { + return $this->sub($unit, $value); + } + + /** + * Multiply current instance given number of times. times() is naive, it multiplies each unit + * (so day can be greater than 31, hour can be greater than 23, etc.) and the result is rounded + * separately for each unit. + * + * Use times() when you want a fast and approximated calculation that does not cascade units. + * + * For a precise and cascaded calculation, + * + * @see multiply() + * + * @param float|int $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); + $this->microseconds = (int) round($this->microseconds * $factor); + + return $this; + } + + /** + * Divide current instance by a given divider. shares() is naive, it divides each unit separately + * and the result is rounded for each unit. So 5 hours and 20 minutes shared by 3 becomes 2 hours + * and 7 minutes. + * + * Use shares() when you want a fast and approximated calculation that does not cascade units. + * + * For a precise and cascaded calculation, + * + * @see divide() + * + * @param float|int $divider + * + * @return $this + */ + public function shares($divider) + { + return $this->times(1 / $divider); + } + + protected function copyProperties(self $interval, $ignoreSign = false) + { + $this->years = $interval->years; + $this->months = $interval->months; + $this->dayz = $interval->dayz; + $this->hours = $interval->hours; + $this->minutes = $interval->minutes; + $this->seconds = $interval->seconds; + $this->microseconds = $interval->microseconds; + + if (!$ignoreSign) { + $this->invert = $interval->invert; + } + + return $this; + } + + /** + * Multiply and cascade current instance by a given factor. + * + * @param float|int $factor + * + * @return $this + */ + public function multiply($factor) + { + if ($factor < 0) { + $this->invert = $this->invert ? 0 : 1; + $factor = -$factor; + } + + $yearPart = (int) floor($this->years * $factor); // Split calculation to prevent imprecision + + if ($yearPart) { + $this->years -= $yearPart / $factor; + } + + return $this->copyProperties( + static::__callStatic('years', [$yearPart]) + ->microseconds($this->totalMicroseconds * $factor) + ->cascade(), + true + ); + } + + /** + * Divide and cascade current instance by a given divider. + * + * @param float|int $divider + * + * @return $this + */ + public function divide($divider) + { + return $this->multiply(1 / $divider); + } + + /** + * Get the interval_spec string of a date interval. + * + * @param DateInterval $interval + * + * @return string + */ + public static function getDateIntervalSpec(DateInterval $interval) + { + $date = array_filter([ + static::PERIOD_YEARS => abs($interval->y), + static::PERIOD_MONTHS => abs($interval->m), + static::PERIOD_DAYS => abs($interval->d), + ]); + + $time = array_filter([ + 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 $first + * @param DateInterval $second + * + * @return int + */ + public static function compareDateIntervals(DateInterval $first, DateInterval $second) + { + $current = Carbon::now(); + $passed = $current->copy()->add($second); + $current->add($first); + + 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 => [$target, $factor]) { + if ($source === 'dayz' && $target === 'weeks') { + continue; + } + + $value = $this->$source; + $this->$source = $modulo = ($factor + ($value % $factor)) % $factor; + $this->$target += ($value - $modulo) / $factor; + if ($this->$source > 0 && $this->$target < 0) { + $this->$source -= $factor; + $this->$target++; + } + } + + return $this->solveNegativeInterval(); + } + + /** + * 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, ['days', 'weeks'])) { + $realUnit = 'dayz'; + } elseif (!in_array($unit, ['microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'dayz', 'months', 'years'])) { + throw new InvalidArgumentException("Unknown unit '$unit'."); + } + + $result = 0; + $cumulativeFactor = 0; + $unitFound = false; + $factors = static::getFlipCascadeFactors(); + $daysPerWeek = static::getDaysPerWeek(); + + $values = [ + 'years' => $this->years, + 'months' => $this->months, + 'weeks' => (int) floor($this->d / $daysPerWeek), + 'dayz' => (int) ($this->d % $daysPerWeek), + 'hours' => $this->hours, + 'minutes' => $this->minutes, + 'seconds' => $this->seconds, + 'milliseconds' => (int) floor($this->microseconds / Carbon::MICROSECONDS_PER_MILLISECOND), + 'microseconds' => (int) ($this->microseconds % Carbon::MICROSECONDS_PER_MILLISECOND), + ]; + + if (isset($factors['dayz']) && $factors['dayz'][0] !== 'weeks') { + $values['dayz'] += $values['weeks'] * $daysPerWeek; + $values['weeks'] = 0; + } + + foreach ($factors as $source => [$target, $factor]) { + if ($source === $realUnit) { + $unitFound = true; + $value = $values[$source]; + $result += $value; + $cumulativeFactor = 1; + } + + if ($factor === false) { + if ($unitFound) { + break; + } + + $result = 0; + $cumulativeFactor = 0; + + continue; + } + + if ($target === $realUnit) { + $unitFound = true; + } + + if ($cumulativeFactor) { + $cumulativeFactor *= $factor; + $result += $values[$target] * $cumulativeFactor; + + continue; + } + + $value = $values[$source]; + + $result = ($result + $value) / $factor; + } + + if (isset($target) && !$cumulativeFactor) { + $result += $values[$target]; + } + + if (!$unitFound) { + throw new InvalidArgumentException("Unit $unit have no configuration to get total from other units."); + } + + if ($unit === 'weeks') { + return $result / $daysPerWeek; } return $result; } + + /** + * Determines if the instance is equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see equalTo() + * + * @return bool + */ + public function eq($interval): bool + { + return $this->equalTo($interval); + } + + /** + * Determines if the instance is equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function equalTo($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval !== null && $this->totalMicroseconds === $interval->totalMicroseconds; + } + + /** + * Determines if the instance is not equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($interval): bool + { + return $this->notEqualTo($interval); + } + + /** + * Determines if the instance is not equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function notEqualTo($interval): bool + { + return !$this->eq($interval); + } + + /** + * Determines if the instance is greater (longer) than another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see greaterThan() + * + * @return bool + */ + public function gt($interval): bool + { + return $this->greaterThan($interval); + } + + /** + * Determines if the instance is greater (longer) than another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function greaterThan($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval === null || $this->totalMicroseconds > $interval->totalMicroseconds; + } + + /** + * Determines if the instance is greater (longer) than or equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see greaterThanOrEqualTo() + * + * @return bool + */ + public function gte($interval): bool + { + return $this->greaterThanOrEqualTo($interval); + } + + /** + * Determines if the instance is greater (longer) than or equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function greaterThanOrEqualTo($interval): bool + { + return $this->greaterThan($interval) || $this->equalTo($interval); + } + + /** + * Determines if the instance is less (shorter) than another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see lessThan() + * + * @return bool + */ + public function lt($interval): bool + { + return $this->lessThan($interval); + } + + /** + * Determines if the instance is less (shorter) than another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function lessThan($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval !== null && $this->totalMicroseconds < $interval->totalMicroseconds; + } + + /** + * Determines if the instance is less (shorter) than or equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @see lessThanOrEqualTo() + * + * @return bool + */ + public function lte($interval): bool + { + return $this->lessThanOrEqualTo($interval); + } + + /** + * Determines if the instance is less (shorter) than or equal to another + * + * @param \Carbon\CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function lessThanOrEqualTo($interval): bool + { + return $this->lessThan($interval) || $this->equalTo($interval); + } + + /** + * Determines if the instance is between two others. + * + * The third argument allow you to specify if bounds are included or not (true by default) + * but for when you including/excluding bounds may produce different results in your application, + * we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead. + * + * @example + * ``` + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2)); // true + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2), false); // false + * ``` + * + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval1 + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function between($interval1, $interval2, $equal = true): bool + { + return $equal + ? $this->greaterThanOrEqualTo($interval1) && $this->lessThanOrEqualTo($interval2) + : $this->greaterThan($interval1) && $this->lessThan($interval2); + } + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // true + * ``` + * + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval1 + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval2 + * + * @return bool + */ + public function betweenIncluded($interval1, $interval2): bool + { + return $this->between($interval1, $interval2, true); + } + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // false + * ``` + * + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval1 + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval2 + * + * @return bool + */ + public function betweenExcluded($interval1, $interval2): bool + { + return $this->between($interval1, $interval2, false); + } + + /** + * Determines if the instance is between two others + * + * @example + * ``` + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2)); // true + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2), false); // false + * ``` + * + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval1 + * @param \Carbon\CarbonInterval|\DateInterval|mixed $interval2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function isBetween($interval1, $interval2, $equal = true): bool + { + return $this->between($interval1, $interval2, $equal); + } + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return $this + */ + public function roundUnit($unit, $precision = 1, $function = 'round') + { + $base = CarbonImmutable::parse('2000-01-01 00:00:00', 'UTC') + ->roundUnit($unit, $precision, $function); + + return $this->copyProperties( + $base->add($this) + ->roundUnit($unit, $precision, $function) + ->diffAsCarbonInterval($base) + ); + } + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function floorUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'floor'); + } + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function ceilUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'ceil'); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return $this + */ + public function round($precision = 1, $function = 'round') + { + $unit = 'second'; + + if ($precision instanceof DateInterval) { + $precision = (string) self::instance($precision); + } + + if (is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) { + if (trim($match['other'] ?? '') !== '') { + throw new InvalidArgumentException('Rounding is only possible with single unit intervals.'); + } + + $precision = (int) ($match['precision'] ?: 1); + $unit = $match['unit']; + } + + return $this->roundUnit($unit, $precision, $function); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function floor($precision = 1) + { + return $this->round($precision, 'floor'); + } + + /** + * Ceil the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function ceil($precision = 1) + { + return $this->round($precision, 'ceil'); + } } diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php index 808e9d6acd7c8a7feae4c24de970d98068411705..f57c66873201e2dfa172a6b5a48818b88ca7da13 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,25 +8,25 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Carbon; use BadMethodCallException; +use Carbon\Exceptions\NotAPeriodException; +use Carbon\Traits\Mixin; +use Carbon\Traits\Options; use Closure; use Countable; use DateInterval; +use DatePeriod; use DateTime; use DateTimeInterface; use InvalidArgumentException; use Iterator; -use ReflectionClass; -use ReflectionFunction; -use ReflectionMethod; +use JsonSerializable; 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(). @@ -65,41 +65,123 @@ use RuntimeException; * @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(). + * @method $this start($date, $inclusive = null) Change the period start date. + * @method $this since($date, $inclusive = null) Alias for start(). + * @method $this sinceNow($inclusive = null) Change the period start date to now. + * @method $this end($date = null, $inclusive = null) Change the period end date. + * @method $this until($date = null, $inclusive = null) Alias for end(). + * @method $this untilNow($inclusive = null) Change the period end date to now. + * @method $this dates($start, $end = null) Change the period start and end date. + * @method $this recurrences($recurrences = null) Change the maximum number of recurrences. + * @method $this times($recurrences = null) Alias for recurrences(). + * @method $this options($options = null) Change the period options. + * @method $this toggle($options, $state = null) Toggle given options on or off. + * @method $this filter($callback, $name = null) Add a filter to the stack. + * @method $this push($callback, $name = null) Alias for filter(). + * @method $this prepend($callback, $name = null) Prepend a filter to the stack. + * @method $this filters(array $filters = []) Set filters stack. + * @method $this interval($interval) Change the period date interval. + * @method $this invert() Invert the period date interval. + * @method $this years($years = 1) Set the years portion of the date interval. + * @method $this year($years = 1) Alias for years(). + * @method $this months($months = 1) Set the months portion of the date interval. + * @method $this month($months = 1) Alias for months(). + * @method $this weeks($weeks = 1) Set the weeks portion of the date interval. + * @method $this week($weeks = 1) Alias for weeks(). + * @method $this days($days = 1) Set the days portion of the date interval. + * @method $this dayz($days = 1) Alias for days(). + * @method $this day($days = 1) Alias for days(). + * @method $this hours($hours = 1) Set the hours portion of the date interval. + * @method $this hour($hours = 1) Alias for hours(). + * @method $this minutes($minutes = 1) Set the minutes portion of the date interval. + * @method $this minute($minutes = 1) Alias for minutes(). + * @method $this seconds($seconds = 1) Set the seconds portion of the date interval. + * @method $this second($seconds = 1) Alias for seconds(). + * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundWeek(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundWeeks(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorWeek(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorWeeks(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilWeek(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilWeeks(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. */ -class CarbonPeriod implements Iterator, Countable +class CarbonPeriod implements Iterator, Countable, JsonSerializable { + use Options, Mixin { + Mixin::mixin as baseMixin; + } + /** * Built-in filters. * @@ -122,6 +204,7 @@ class CarbonPeriod implements Iterator, Countable */ const EXCLUDE_START_DATE = 1; const EXCLUDE_END_DATE = 2; + const IMMUTABLE = 4; /** * Number of maximum attempts before giving up on finding next valid date. @@ -135,7 +218,14 @@ class CarbonPeriod implements Iterator, Countable * * @var array */ - protected static $macros = array(); + protected static $macros = []; + + /** + * Date class of iteration items. + * + * @var string + */ + protected $dateClass = Carbon::class; /** * Underlying date interval instance. Always present, one day by default. @@ -156,19 +246,19 @@ class CarbonPeriod implements Iterator, Countable * * @var array */ - protected $filters = array(); + protected $filters = []; /** * Period start date. Applied on rewind. Always present, now by default. * - * @var Carbon + * @var CarbonInterface */ protected $startDate; /** * Period end date. For inverted interval should be before the start date. Applied via a filter. * - * @var Carbon|null + * @var CarbonInterface|null */ protected $endDate; @@ -198,7 +288,7 @@ class CarbonPeriod implements Iterator, Countable * Current date. May temporarily hold unaccepted value when looking for a next valid date. * Equal to null only before the first iteration. * - * @var Carbon + * @var CarbonInterface */ protected $current; @@ -216,14 +306,100 @@ class CarbonPeriod implements Iterator, Countable */ protected $validationResult; + /** + * Timezone handler for settings() method. + * + * @var mixed + */ + protected $tzName; + + /** + * Make a CarbonPeriod instance from given variable if possible. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + try { + return static::instance($var); + } catch (NotAPeriodException $e) { + return static::create($var); + } + } + + /** + * Create a new instance from a DatePeriod or CarbonPeriod object. + * + * @param CarbonPeriod|DatePeriod $period + * + * @return static + */ + public static function instance($period) + { + if ($period instanceof static) { + return $period->copy(); + } + + if ($period instanceof self) { + return new static( + $period->getStartDate(), + $period->getEndDate() ?: $period->getRecurrences(), + $period->getDateInterval(), + $period->getOptions() + ); + } + + if ($period instanceof DatePeriod) { + return new static( + $period->start, + $period->end ?: ($period->recurrences - 1), + $period->interval, + $period->include_start_date ? 0 : static::EXCLUDE_START_DATE + ); + } + + $class = get_called_class(); + $type = gettype($period); + + throw new NotAPeriodException( + 'Argument 1 passed to '.$class.'::'.__METHOD__.'() '. + 'must be an instance of DatePeriod or '.$class.', '. + ($type === 'object' ? 'instance of '.get_class($period) : $type).' given.' + ); + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * @alias copy + * + * Get a copy of the instance. + * + * @return static + */ + public function clone() + { + return clone $this; + } + /** * Create a new instance. * * @return static */ - public static function create() + public static function create(...$params) { - return static::createFromArray(func_get_args()); + return static::createFromArray($params); } /** @@ -235,12 +411,7 @@ class CarbonPeriod implements Iterator, Countable */ 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; + return new static(...$params); } /** @@ -273,23 +444,7 @@ class CarbonPeriod implements Iterator, Countable */ 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 $interval->h || $interval->i || $interval->s || $interval->f; } /** @@ -319,13 +474,15 @@ class CarbonPeriod implements Iterator, Countable /** * Parse given ISO 8601 string into an array of arguments. * + * @SuppressWarnings(PHPMD.ElseExpression) + * * @param string $iso * * @return array */ protected static function parseIso8601($iso) { - $result = array(); + $result = []; $interval = null; $start = null; @@ -370,6 +527,14 @@ class CarbonPeriod implements Iterator, Countable /** * Register a custom macro. * + * @example + * ``` + * CarbonPeriod::macro('middle', function () { + * return $this->getStartDate()->average($this->getEndDate()); + * }); + * echo CarbonPeriod::since('2011-05-12')->until('2011-06-03')->middle(); + * ``` + * * @param string $name * @param object|callable $macro * @@ -380,18 +545,35 @@ class CarbonPeriod implements Iterator, Countable static::$macros[$name] = $macro; } - /** - * Remove all macros. - */ - public static function resetMacros() - { - static::$macros = array(); - } - /** * Register macros from a mixin object. * - * @param object $mixin + * @example + * ``` + * CarbonPeriod::mixin(new class { + * public function addDays() { + * return function ($count = 1) { + * return $this->setStartDate( + * $this->getStartDate()->addDays($count) + * )->setEndDate( + * $this->getEndDate()->addDays($count) + * ); + * }; + * } + * public function subDays() { + * return function ($count = 1) { + * return $this->setStartDate( + * $this->getStartDate()->subDays($count) + * )->setEndDate( + * $this->getEndDate()->subDays($count) + * ); + * }; + * } + * }); + * echo CarbonPeriod::create('2000-01-01', '2000-02-01')->addDays(5)->subDays(3); + * ``` + * + * @param object|string $mixin * * @throws \ReflectionException * @@ -399,17 +581,7 @@ class CarbonPeriod implements Iterator, Countable */ 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)); - } + static::baseMixin($mixin); } /** @@ -434,28 +606,53 @@ class CarbonPeriod implements Iterator, Countable */ public static function __callStatic($method, $parameters) { - return call_user_func_array( - array(new static, $method), $parameters - ); + return (new static)->$method(...$parameters); } /** * CarbonPeriod constructor. * + * @SuppressWarnings(PHPMD.ElseExpression) + * * @throws InvalidArgumentException */ - public function __construct() + public function __construct(...$arguments) { // 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])) { + $agumentsCount = count($arguments); + + if ($agumentsCount && static::isIso8601($iso = $arguments[0])) { array_splice($arguments, 0, 1, static::parseIso8601($iso)); } + if ($agumentsCount === 1) { + if ($arguments[0] instanceof DatePeriod) { + $arguments = [ + $arguments[0]->start, + $arguments[0]->end ?: ($arguments[0]->recurrences - 1), + $arguments[0]->interval, + $arguments[0]->include_start_date ? 0 : static::EXCLUDE_START_DATE, + ]; + } elseif ($arguments[0] instanceof self) { + $arguments = [ + $arguments[0]->getStartDate(), + $arguments[0]->getEndDate() ?: $arguments[0]->getRecurrences(), + $arguments[0]->getDateInterval(), + $arguments[0]->getOptions(), + ]; + } + } + foreach ($arguments as $argument) { - if ($this->dateInterval === null && $parsed = CarbonInterval::make($argument)) { + if ($this->dateInterval === null && + ( + is_string($argument) && preg_match('/^(\d.*|P[T0-9].*|(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+)$/i', $argument) || + $argument instanceof DateInterval + ) && + $parsed = @CarbonInterval::make($argument) + ) { $this->setDateInterval($parsed); } elseif ($this->startDate === null && $parsed = Carbon::make($argument)) { $this->setStartDate($parsed); @@ -485,6 +682,57 @@ class CarbonPeriod implements Iterator, Countable } } + /** + * 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 function isCarbonPredicateMethod($callable) + { + return is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists($this->dateClass, $callable) || call_user_func([$this->dateClass, 'hasMacro'], $callable)); + } + + /** + * Set the iteration item class. + * + * @param string $dateClass + * + * @return $this + */ + public function setDateClass(string $dateClass) + { + if (!is_a($dateClass, CarbonInterface::class, true)) { + throw new InvalidArgumentException(sprintf( + 'Given class does not implement %s: %s', + CarbonInterface::class, + $dateClass + )); + } + + $this->dateClass = $dateClass; + + if (is_a($dateClass, Carbon::class, true)) { + $this->toggleOptions(static::IMMUTABLE, false); + } elseif (is_a($dateClass, CarbonImmutable::class, true)) { + $this->toggleOptions(static::IMMUTABLE, true); + } + + return $this; + } + + /** + * Returns iteration item date class. + * + * @return string + */ + public function getDateClass(): string + { + return $this->dateClass; + } + /** * Change the period date interval. * @@ -500,7 +748,7 @@ class CarbonPeriod implements Iterator, Countable throw new InvalidArgumentException('Invalid interval.'); } - if ($interval->spec() === 'PT0S') { + if ($interval->spec() === 'PT0S' && !$interval->f) { throw new InvalidArgumentException('Empty interval is not accepted.'); } @@ -589,7 +837,8 @@ class CarbonPeriod implements Iterator, Countable $state = ($this->options & $options) !== $options; } - return $this->setOptions($state ? + return $this->setOptions( + $state ? $this->options | $options : $this->options & ~$options ); @@ -632,23 +881,33 @@ class CarbonPeriod implements Iterator, Countable /** * Get start date of the period. * - * @return Carbon + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface */ - public function getStartDate() + public function getStartDate(string $rounding = null) { - return $this->startDate->copy(); + $date = $this->startDate->copy(); + + return $rounding ? $date->round($this->getDateInterval(), $rounding) : $date; } /** * Get end date of the period. * - * @return Carbon|null + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface|null */ - public function getEndDate() + public function getEndDate(string $rounding = null) { - if ($this->endDate) { - return $this->endDate->copy(); + if (!$this->endDate) { + return null; } + + $date = $this->endDate->copy(); + + return $rounding ? $date->round($this->getDateInterval(), $rounding) : $date; } /** @@ -681,9 +940,68 @@ class CarbonPeriod implements Iterator, Countable return ($this->options & static::EXCLUDE_END_DATE) !== 0; } + /** + * Returns true if the start date should be included. + * + * @return bool + */ + public function isStartIncluded() + { + return !$this->isStartExcluded(); + } + + /** + * Returns true if the end date should be included. + * + * @return bool + */ + public function isEndIncluded() + { + return !$this->isEndExcluded(); + } + + /** + * Return the start if it's included by option, else return the start + 1 period interval. + * + * @return CarbonInterface + */ + public function getIncludedStartDate() + { + $start = $this->getStartDate(); + + if ($this->isStartExcluded()) { + return $start->add($this->getDateInterval()); + } + + return $start; + } + + /** + * Return the end if it's included by option, else return the end - 1 period interval. + * Warning: if the period has no fixed end, this method will iterate the period to calculate it. + * + * @return CarbonInterface + */ + public function getIncludedEndDate() + { + $end = $this->getEndDate(); + + if (!$end) { + return $this->calculateEnd(); + } + + if ($this->isEndExcluded()) { + return $end->sub($this->getDateInterval()); + } + + return $end; + } + /** * Add a filter to the stack. * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param callable $callback * @param string $name * @@ -703,6 +1021,8 @@ class CarbonPeriod implements Iterator, Countable /** * Prepend a filter to the stack. * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param callable $callback * @param string $name * @@ -733,12 +1053,12 @@ class CarbonPeriod implements Iterator, Countable $method = array_shift($parameters); if (!$this->isCarbonPredicateMethod($method)) { - return array($method, array_shift($parameters)); + return [$method, array_shift($parameters)]; } - return array(function ($date) use ($method, $parameters) { - return call_user_func_array(array($date, $method), $parameters); - }, $method); + return [function ($date) use ($method, $parameters) { + return call_user_func_array([$date, $method], $parameters); + }, $method]; } /** @@ -821,14 +1141,14 @@ class CarbonPeriod implements Iterator, Countable */ public function resetFilters() { - $this->filters = array(); + $this->filters = []; if ($this->endDate !== null) { - $this->filters[] = array(static::END_DATE_FILTER, null); + $this->filters[] = [static::END_DATE_FILTER, null]; } if ($this->recurrences !== null) { - $this->filters[] = array(static::RECURRENCES_FILTER, null); + $this->filters[] = [static::RECURRENCES_FILTER, null]; } $this->handleChangedParameters(); @@ -885,6 +1205,8 @@ class CarbonPeriod implements Iterator, Countable /** * Recurrences filter callback (limits number of recurrences). * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * * @param \Carbon\Carbon $current * @param int $key * @@ -911,7 +1233,7 @@ class CarbonPeriod implements Iterator, Countable */ public function setStartDate($date, $inclusive = null) { - if (!$date = Carbon::make($date)) { + if (!$date = call_user_func([$this->dateClass, 'make'], $date)) { throw new InvalidArgumentException('Invalid start date.'); } @@ -936,7 +1258,7 @@ class CarbonPeriod implements Iterator, Countable */ public function setEndDate($date, $inclusive = null) { - if (!is_null($date) && !$date = Carbon::make($date)) { + if (!is_null($date) && !$date = call_user_func([$this->dateClass, 'make'], $date)) { throw new InvalidArgumentException('Invalid end date.'); } @@ -994,6 +1316,12 @@ class CarbonPeriod implements Iterator, Countable */ protected function handleChangedParameters() { + if (($this->getOptions() & static::IMMUTABLE) && $this->dateClass === Carbon::class) { + $this->setDateClass(CarbonImmutable::class); + } elseif (!($this->getOptions() & static::IMMUTABLE) && $this->dateClass === CarbonImmutable::class) { + $this->setDateClass(Carbon::class); + } + $this->validationResult = null; } @@ -1030,7 +1358,10 @@ class CarbonPeriod implements Iterator, Countable foreach ($this->filters as $tuple) { $result = call_user_func( - $tuple[0], $current->copy(), $this->key, $this + $tuple[0], + $current->copy(), + $this->key, + $this ); if ($result === static::END_ITERATION) { @@ -1048,16 +1379,16 @@ class CarbonPeriod implements Iterator, Countable /** * Prepare given date to be returned to the external logic. * - * @param Carbon $date + * @param CarbonInterface $date * - * @return Carbon + * @return CarbonInterface */ - protected function prepareForReturn(Carbon $date) + protected function prepareForReturn(CarbonInterface $date) { - $date = $date->copy(); + $date = call_user_func([$this->dateClass, 'make'], $date); if ($this->timezone) { - $date->setTimezone($this->timezone); + $date = $date->setTimezone($this->timezone); } return $date; @@ -1088,7 +1419,7 @@ class CarbonPeriod implements Iterator, Countable /** * Return the current date. * - * @return Carbon|null + * @return CarbonInterface|null */ public function current() { @@ -1133,11 +1464,18 @@ class CarbonPeriod implements Iterator, Countable public function rewind() { $this->key = 0; - $this->current = $this->startDate->copy(); + $this->current = call_user_func([$this->dateClass, 'make'], $this->startDate); + $settings = $this->getSettings(); + + if ($this->hasLocalTranslator()) { + $settings['locale'] = $this->getTranslatorLocale(); + } + + $this->current->settings($settings); $this->timezone = static::intervalHasTime($this->dateInterval) ? $this->current->getTimezone() : null; if ($this->timezone) { - $this->current->setTimezone('UTC'); + $this->current = $this->current->utc(); } $this->validationResult = null; @@ -1175,7 +1513,7 @@ class CarbonPeriod implements Iterator, Countable $attempts = 0; do { - $this->current->add($this->dateInterval); + $this->current = $this->current->add($this->dateInterval); $this->validationResult = null; @@ -1192,7 +1530,7 @@ class CarbonPeriod implements Iterator, Countable */ public function toIso8601String() { - $parts = array(); + $parts = []; if ($this->recurrences !== null) { $parts[] = 'R'.$this->recurrences; @@ -1216,24 +1554,26 @@ class CarbonPeriod implements Iterator, Countable */ public function toString() { - $translator = Carbon::getTranslator(); + $translator = call_user_func([$this->dateClass, 'getTranslator']); - $parts = array(); + $parts = []; $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[] = $this->translate('period_recurrences', [], $this->recurrences, $translator); } - $parts[] = $translator->trans('period_interval', array(':interval' => $this->dateInterval->forHumans())); + $parts[] = $this->translate('period_interval', [':interval' => $this->dateInterval->forHumans([ + 'join' => true, + ])], null, $translator); - $parts[] = $translator->trans('period_start_date', array(':date' => $this->startDate->format($format))); + $parts[] = $this->translate('period_start_date', [':date' => $this->startDate->rawFormat($format)], null, $translator); if ($this->endDate !== null) { - $parts[] = $translator->trans('period_end_date', array(':date' => $this->endDate->format($format))); + $parts[] = $this->translate('period_end_date', [':date' => $this->endDate->rawFormat($format)], null, $translator); } $result = implode(' ', $parts); @@ -1251,26 +1591,66 @@ class CarbonPeriod implements Iterator, Countable return $this->toIso8601String(); } + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DatePeriod + */ + public function cast(string $className) + { + if (!method_exists($className, 'instance')) { + if (is_a($className, DatePeriod::class, true)) { + return new $className( + $this->getStartDate(), + $this->getDateInterval(), + $this->getEndDate() ? $this->getIncludedEndDate() : $this->getRecurrences(), + $this->isStartExcluded() ? DatePeriod::EXCLUDE_START_DATE : 0 + ); + } + + throw new InvalidArgumentException("$className has not the instance() method needed to cast the date."); + } + + return $className::instance($this); + } + + /** + * Return native DatePeriod PHP object matching the current instance. + * + * @example + * ``` + * var_dump(CarbonPeriod::create('2021-01-05', '2021-02-15')->toDatePeriod()); + * ``` + * + * @return DatePeriod + */ + public function toDatePeriod() + { + return $this->cast(DatePeriod::class); + } + /** * Convert the date period into an array without changing current iteration state. * - * @return array + * @return CarbonInterface[] */ public function toArray() { - $state = array( + $state = [ $this->key, $this->current ? $this->current->copy() : null, $this->validationResult, - ); + ]; $result = iterator_to_array($this); - list( + [ $this->key, $this->current, $this->validationResult - ) = $state; + ] = $state; return $result; } @@ -1288,7 +1668,7 @@ class CarbonPeriod implements Iterator, Countable /** * Return the first date in the date period. * - * @return Carbon|null + * @return CarbonInterface|null */ public function first() { @@ -1300,7 +1680,7 @@ class CarbonPeriod implements Iterator, Countable /** * Return the last date in the date period. * - * @return Carbon|null + * @return CarbonInterface|null */ public function last() { @@ -1321,23 +1701,10 @@ class CarbonPeriod implements Iterator, Countable { $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) { + $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class); - if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { - $macro = $macro->bindTo($this, get_class($this)); + return call_user_func_array($boundMacro ?: $macro, $parameters); } return call_user_func_array($macro, $parameters); @@ -1371,7 +1738,19 @@ class CarbonPeriod implements Iterator, Countable public function __call($method, $parameters) { if (static::hasMacro($method)) { - return $this->callMacro($method, $parameters); + return static::bindMacroContext($this, function () use (&$method, &$parameters) { + return $this->callMacro($method, $parameters); + }); + } + + $action = substr($method, 0, 4); + + if ($action !== 'ceil') { + $action = substr($method, 0, 5); + } + + if (in_array($action, ['round', 'floor', 'ceil'])) { + return $this->{$action.'Unit'}(substr($method, strlen($action)), ...$parameters); } $first = count($parameters) >= 1 ? $parameters[0] : null; @@ -1414,7 +1793,7 @@ class CarbonPeriod implements Iterator, Countable return $this->prependFilter($first, $second); case 'filters': - return $this->setFilters($first ?: array()); + return $this->setFilters($first ?: []); case 'interval': case 'each': @@ -1443,11 +1822,550 @@ class CarbonPeriod implements Iterator, Countable 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), + [$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method], count($parameters) === 0 ? 1 : $first )); } - throw new BadMethodCallException("Method $method does not exist."); + if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + throw new BadMethodCallException("Method $method does not exist."); + } + + return $this; + } + + /** + * Set the instance's timezone from a string or object and add/subtract the offset difference. + * + * @param \DateTimeZone|string $timezone + * + * @return static + */ + public function shiftTimezone($timezone) + { + $this->tzName = $timezone; + $this->timezone = $timezone; + + return $this; + } + + /** + * Returns the end is set, else calculated from start an recurrences. + * + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface + */ + public function calculateEnd(string $rounding = null) + { + if ($end = $this->getEndDate($rounding)) { + return $end; + } + + $dates = iterator_to_array($this); + + $date = end($dates); + + if ($date && $rounding) { + $date = $date->copy()->round($this->getDateInterval(), $rounding); + } + + return $date; + } + + /** + * Returns true if the current period overlaps the given one (if 1 parameter passed) + * or the period between 2 dates (if 2 parameters passed). + * + * @param CarbonPeriod|\DateTimeInterface|Carbon|CarbonImmutable|string $rangeOrRangeStart + * @param \DateTimeInterface|Carbon|CarbonImmutable|string|null $rangeEnd + * + * @return bool + */ + public function overlaps($rangeOrRangeStart, $rangeEnd = null) + { + $range = $rangeEnd ? static::create($rangeOrRangeStart, $rangeEnd) : $rangeOrRangeStart; + + if (!($range instanceof self)) { + $range = static::create($range); + } + + return $this->calculateEnd() > $range->getStartDate() && $range->calculateEnd() > $this->getStartDate(); + } + + /** + * Execute a given function on each date of the period. + * + * @example + * ``` + * Carbon::create('2020-11-29')->daysUntil('2020-12-24')->forEach(function (Carbon $date) { + * echo $date->diffInDays('2020-12-25')." days before Christmas!\n"; + * }); + * ``` + * + * @param callable $callback + */ + public function forEach(callable $callback) + { + foreach ($this as $date) { + $callback($date); + } + } + + /** + * Execute a given function on each date of the period and yield the result of this function. + * + * @example + * ``` + * $period = Carbon::create('2020-11-29')->daysUntil('2020-12-24'); + * echo implode("\n", iterator_to_array($period->map(function (Carbon $date) { + * return $date->diffInDays('2020-12-25').' days before Christmas!'; + * }))); + * ``` + * + * @param callable $callback + * + * @return \Generator + */ + public function map(callable $callback) + { + foreach ($this as $date) { + yield $callback($date); + } + } + + /** + * Determines if the instance is equal to another. + * Warning: if options differ, instances wil never be equal. + * + * @param mixed $period + * + * @see equalTo() + * + * @return bool + */ + public function eq($period): bool + { + return $this->equalTo($period); + } + + /** + * Determines if the instance is equal to another. + * Warning: if options differ, instances wil never be equal. + * + * @param mixed $period + * + * @return bool + */ + public function equalTo($period): bool + { + if (!($period instanceof self)) { + $period = self::make($period); + } + + $end = $this->getEndDate(); + + return $period !== null + && $this->getDateInterval()->eq($period->getDateInterval()) + && $this->getStartDate()->eq($period->getStartDate()) + && ($end ? $end->eq($period->getEndDate()) : $this->getRecurrences() === $period->getRecurrences()) + && ($this->getOptions() & (~static::IMMUTABLE)) === ($period->getOptions() & (~static::IMMUTABLE)); + } + + /** + * Determines if the instance is not equal to another. + * Warning: if options differ, instances wil never be equal. + * + * @param mixed $period + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($period): bool + { + return $this->notEqualTo($period); + } + + /** + * Determines if the instance is not equal to another. + * Warning: if options differ, instances wil never be equal. + * + * @param mixed $period + * + * @return bool + */ + public function notEqualTo($period): bool + { + return !$this->eq($period); + } + + /** + * Determines if the start date is before an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsBefore($date = null): bool + { + return $this->getStartDate()->lessThan($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is before or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsBeforeOrAt($date = null): bool + { + return $this->getStartDate()->lessThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is after an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAfter($date = null): bool + { + return $this->getStartDate()->greaterThan($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is after or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAfterOrAt($date = null): bool + { + return $this->getStartDate()->greaterThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAt($date = null): bool + { + return $this->getStartDate()->equalTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is before an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsBefore($date = null): bool + { + return $this->calculateEnd()->lessThan($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is before or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsBeforeOrAt($date = null): bool + { + return $this->calculateEnd()->lessThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is after an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAfter($date = null): bool + { + return $this->calculateEnd()->greaterThan($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is after or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAfterOrAt($date = null): bool + { + return $this->calculateEnd()->greaterThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAt($date = null): bool + { + return $this->calculateEnd()->equalTo($this->resolveCarbon($date)); + } + + /** + * Return true if start date is now or later. + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isStarted(): bool + { + return $this->startsBeforeOrAt(); + } + + /** + * Return true if end date is now or later. + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isEnded(): bool + { + return $this->endsBeforeOrAt(); + } + + /** + * Return true if now is between start date (included) and end date (excluded). + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isInProgress(): bool + { + return $this->isStarted() && !$this->isEnded(); + } + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return $this + */ + public function roundUnit($unit, $precision = 1, $function = 'round') + { + $this->setStartDate($this->getStartDate()->roundUnit($unit, $precision, $function)); + + if ($this->endDate) { + $this->setEndDate($this->getEndDate()->roundUnit($unit, $precision, $function)); + } + + $this->setDateInterval($this->getDateInterval()->roundUnit($unit, $precision, $function)); + + return $this; + } + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function floorUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'floor'); + } + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function ceilUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'ceil'); + } + + /** + * Round the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return $this + */ + public function round($precision = null, $function = 'round') + { + $unit = 'second'; + + if ($precision === null || $precision instanceof DateInterval) { + $precision = (string) ($precision === null ? $this->getDateInterval() : CarbonInterval::instance($precision)); + } + + if (is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) { + if (trim($match['other'] ?? '') !== '') { + throw new InvalidArgumentException('Rounding is only possible with single unit intervals.'); + } + + $precision = (int) ($match['precision'] ?: 1); + $unit = $match['unit']; + } + + return $this->roundUnit($unit, $precision, $function); + } + + /** + * Round the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function floor($precision = null) + { + return $this->round($precision, 'floor'); + } + + /** + * Ceil the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * + * @return $this + */ + public function ceil($precision = null) + { + return $this->round($precision, 'ceil'); + } + + /** + * 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|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|\DateTimeInterface|string|null $date + * + * @return \Carbon\CarbonInterface + */ + protected function resolveCarbon($date = null) + { + return $this->getStartDate()->nowWithSameTz()->carbonize($date); + } + + /** + * Resolve passed arguments or DatePeriod to a CarbonPeriod object. + * + * @param mixed $period + * @param mixed ...$arguments + * + * @return static + */ + protected function resolveCarbonPeriod($period, ...$arguments) + { + if ($period instanceof self) { + return $period; + } + + return $period instanceof DatePeriod + ? static::instance($period) + : static::create($period, ...$arguments); + } + + /** + * Specify data which should be serialized to JSON. + * + * @link https://php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return CarbonInterface[] + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Return true if the given date is between start and end. + * + * @param \Carbon\Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|\DateTimeInterface|string|null $date + * + * @return bool + */ + public function contains($date = null): bool + { + $startMethod = 'startsBefore'.($this->isStartIncluded() ? 'OrAt' : ''); + $endMethod = 'endsAfter'.($this->isEndIncluded() ? 'OrAt' : ''); + + return $this->$startMethod($date) && $this->$endMethod($date); + } + + /** + * Return true if the current period follows a given other period (with no overlap). + * For instance, [2019-08-01 -> 2019-08-12] follows [2019-07-29 -> 2019-07-31] + * Note than in this example, follows() would be false if 2019-08-01 or 2019-07-31 was excluded by options. + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function follows($period, ...$arguments): bool + { + $period = $this->resolveCarbonPeriod($period, ...$arguments); + + return $this->getIncludedStartDate()->equalTo($period->getIncludedEndDate()->add($period->getDateInterval())); + } + + /** + * Return true if the given other period follows the current one (with no overlap). + * For instance, [2019-07-29 -> 2019-07-31] is followed by [2019-08-01 -> 2019-08-12] + * Note than in this example, isFollowedBy() would be false if 2019-08-01 or 2019-07-31 was excluded by options. + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function isFollowedBy($period, ...$arguments): bool + { + $period = $this->resolveCarbonPeriod($period, ...$arguments); + + return $period->follows($this); + } + + /** + * Return true if the given period either follows or is followed by the current one. + * + * @see follows() + * @see isFollowedBy() + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function isConsecutiveWith($period, ...$arguments): bool + { + return $this->follows($period, ...$arguments) || $this->isFollowedBy($period, ...$arguments); } } diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php index 1b0d47377772e1d3f7d5f2b37f54c01c28c908b8..3560c047833f020c5bed83a2931a38435d1b1940 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,7 +8,6 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Carbon\Exceptions; use Exception; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/af.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/af.php index 5cf6a8d94f306d1471c6a1402521332a46ac3b22..401758994bad81182cd9e464c4f0bf9fb2e328ff 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/af.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/af.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,67 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count jaar|:count jare', - 'y' => ':count jaar|:count jare', +/* + * Authors: + * - François B + * - JD Isaacks + * - Pierre du Plessis + */ +return [ + 'year' => ':count jaar', + 'a_year' => '\'n jaar|:count jaar', + 'y' => ':count j.', 'month' => ':count maand|:count maande', - 'm' => ':count maand|:count maande', + 'a_month' => '\'n maand|:count maande', + 'm' => ':count maa.', 'week' => ':count week|:count weke', - 'w' => ':count week|:count weke', + 'a_week' => '\'n week|:count weke', + 'w' => ':count w.', 'day' => ':count dag|:count dae', - 'd' => ':count dag|:count dae', - 'hour' => ':count uur|:count ure', - 'h' => ':count uur|:count ure', + 'a_day' => '\'n dag|:count dae', + 'd' => ':count d.', + 'hour' => ':count uur', + 'a_hour' => '\'n uur|:count uur', + 'h' => ':count u.', 'minute' => ':count minuut|:count minute', - 'min' => ':count minuut|:count minute', + 'a_minute' => '\'n minuut|:count minute', + 'min' => ':count min.', 'second' => ':count sekond|:count sekondes', - 's' => ':count sekond|:count sekondes', - 'ago' => ':time terug', - 'from_now' => ':time van nou af', + 'a_second' => '\'n paar sekondes|:count sekondes', + 's' => ':count s.', + 'ago' => ':time gelede', + 'from_now' => 'oor :time', 'after' => ':time na', 'before' => ':time voor', -); + 'diff_now' => 'Nou', + 'diff_yesterday' => 'Gister', + 'diff_tomorrow' => 'Môre', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Vandag om] LT', + 'nextDay' => '[Môre om] LT', + 'nextWeek' => 'dddd [om] LT', + 'lastDay' => '[Gister om] LT', + 'lastWeek' => '[Laas] dddd [om] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.(($number === 1 || $number === 8 || $number >= 20) ? 'ste' : 'de'); + }, + 'meridiem' => ['VM', 'NM'], + 'months' => ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'], + 'months_short' => ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'], + 'weekdays_short' => ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'], + 'weekdays_min' => ['So', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' en '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar.php index de8f6b85b7bf52a8f80298102d1befa8cf892207..b3bc12206c5ed89e945bc871a273ff7549c7aa44 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,81 @@ * 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 ثانية', +/* + * Authors: + * - Atef Ben Ali (atefBB) + * - Ibrahim AshShohail + * - MLTDev + * - Mohamed Sabil (mohamedsabil83) + * - Yazan Alnugnugh (yazan-alnugnugh) + */ +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), 'ago' => 'منذ :time', 'from_now' => ':time من الآن', 'after' => 'بعد :time', 'before' => 'قبل :time', -); + 'diff_now' => 'الآن', + 'diff_yesterday' => 'أمس', + 'diff_tomorrow' => 'غداً', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم عند الساعة] LT', + 'nextDay' => '[غدًا عند الساعة] LT', + 'nextWeek' => 'dddd [عند الساعة] LT', + 'lastDay' => '[أمس عند الساعة] LT', + 'lastWeek' => 'dddd [عند الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php index 846ae0247702113d6a2c4f3d05359ec5a887c77b..14909e804537e3868e7e6651bc374bd4799f7bea 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php @@ -9,23 +9,83 @@ * 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 ثَانِيَة', +/* + * Authors: + * - Abdellah Chadidi + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + */ +// Same for long and short +$months = [ + // @TODO add shakl to months + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']), + 'a_year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']), + 'month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']), + 'a_month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']), + 'week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']), + 'a_week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']), + 'day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']), + 'a_day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']), + 'hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']), + 'a_hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']), + 'minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']), + 'a_minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']), + 'second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']), + 'a_second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']), 'ago' => 'مُنْذُ :time', 'from_now' => 'مِنَ الْآن :time', 'after' => 'بَعْدَ :time', 'before' => 'قَبْلَ :time', -); + + // @TODO add shakl to translations below + 'diff_now' => 'الآن', + 'diff_yesterday' => 'أمس', + 'diff_tomorrow' => 'غداً', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم عند الساعة] LT', + 'nextDay' => '[غدًا عند الساعة] LT', + 'nextWeek' => 'dddd [عند الساعة] LT', + 'lastDay' => '[أمس عند الساعة] LT', + 'lastWeek' => 'dddd [عند الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/az.php index 25f5c4a4dba30f009d68aa4455048b33531eaefc..131daac052ecd969c17159531e4ae8b5402497df 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/az.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/az.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,20 +9,37 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - Kunal Marwaha + * - François B + * - JD Isaacks + * - Orxan + * - Şəhriyar İmanov + * - Baran Şengül + */ +return [ 'year' => ':count il', + 'a_year' => '{1}bir il|]1,Inf[:count il', 'y' => ':count il', 'month' => ':count ay', + 'a_month' => '{1}bir ay|]1,Inf[:count ay', 'm' => ':count ay', 'week' => ':count həftə', - 'w' => ':count həftə', + 'a_week' => '{1}bir həftə|]1,Inf[:count həftə', + 'w' => ':count h.', 'day' => ':count gün', - 'd' => ':count gün', + 'a_day' => '{1}bir gün|]1,Inf[:count gün', + 'd' => ':count g.', 'hour' => ':count saat', + 'a_hour' => '{1}bir saat|]1,Inf[:count saat', 'h' => ':count saat', - 'minute' => ':count dəqiqə', + 'minute' => ':count d.', + 'a_minute' => '{1}bir dəqiqə|]1,Inf[:count dəqiqə', 'min' => ':count dəqiqə', - 'second' => ':count saniyə', + 'second' => ':count san.', + 'a_second' => '{1}birneçə saniyə|]1,Inf[:count saniyə', 's' => ':count saniyə', 'ago' => ':time əvvəl', 'from_now' => ':time sonra', @@ -37,4 +54,72 @@ return array( 'period_interval' => 'hər :interval', 'period_start_date' => ':date tarixindən başlayaraq', 'period_end_date' => ':date tarixinədək', -); + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[bugün saat] LT', + 'nextDay' => '[sabah saat] LT', + 'nextWeek' => '[gələn həftə] dddd [saat] LT', + 'lastDay' => '[dünən] LT', + 'lastWeek' => '[keçən həftə] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + if ($number === 0) { // special case for zero + return "$number-ıncı"; + } + + static $suffixes = [ + 1 => '-inci', + 5 => '-inci', + 8 => '-inci', + 70 => '-inci', + 80 => '-inci', + 2 => '-nci', + 7 => '-nci', + 20 => '-nci', + 50 => '-nci', + 3 => '-üncü', + 4 => '-üncü', + 100 => '-üncü', + 6 => '-ncı', + 9 => '-uncu', + 10 => '-uncu', + 30 => '-uncu', + 60 => '-ıncı', + 90 => '-ıncı', + ]; + + $lastDigit = $number % 10; + + return $number.($suffixes[$lastDigit] ?? $suffixes[$number % 100 - $lastDigit] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'gecə'; + } + if ($hour < 12) { + return 'səhər'; + } + if ($hour < 17) { + return 'gündüz'; + } + + return 'axşam'; + }, + 'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], + 'months_short' => ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'], + 'months_standalone' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'], + 'weekdays' => ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'], + 'weekdays_short' => ['baz', 'bze', 'çax', 'çər', 'cax', 'cüm', 'şən'], + 'weekdays_min' => ['bz', 'be', 'ça', 'çə', 'ca', 'cü', 'şə'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' və '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bg.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bg.php index d9e510be862c70d7e131d39adc48a26c9d955fb2..2d082d0fecee9b782e6e96c7179bee1d6adbed40 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bg.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bg.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,99 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - François B + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + */ +return [ 'year' => ':count година|:count години', + 'a_year' => 'година|:count години', 'y' => ':count година|:count години', 'month' => ':count месец|:count месеца', + 'a_month' => 'месец|:count месеца', 'm' => ':count месец|:count месеца', 'week' => ':count седмица|:count седмици', + 'a_week' => 'седмица|:count седмици', 'w' => ':count седмица|:count седмици', 'day' => ':count ден|:count дни', + 'a_day' => 'ден|:count дни', 'd' => ':count ден|:count дни', 'hour' => ':count час|:count часа', + 'a_hour' => 'час|:count часа', 'h' => ':count час|:count часа', 'minute' => ':count минута|:count минути', + 'a_minute' => 'минута|:count минути', 'min' => ':count минута|:count минути', 'second' => ':count секунда|:count секунди', + 'a_second' => 'няколко секунди|:count секунди', 's' => ':count секунда|:count секунди', 'ago' => 'преди :time', - 'from_now' => ':time от сега', + 'from_now' => 'след :time', 'after' => 'след :time', 'before' => 'преди :time', -); + 'diff_now' => 'сега', + 'diff_yesterday' => 'вчера', + 'diff_tomorrow' => 'утре', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Днес в] LT', + 'nextDay' => '[Утре в] LT', + 'nextWeek' => 'dddd [в] LT', + 'lastDay' => '[Вчера в] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 0: + case 3: + case 6: + return '[В изминалата] dddd [в] LT'; + default: + return '[В изминалия] dddd [в] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + $last2Digits = $number % 100; + if ($number === 0) { + return "$number-ев"; + } + if ($last2Digits === 0) { + return "$number-ен"; + } + if ($last2Digits > 10 && $last2Digits < 20) { + return "$number-ти"; + } + if ($lastDigit === 1) { + return "$number-ви"; + } + if ($lastDigit === 2) { + return "$number-ри"; + } + if ($lastDigit === 7 || $lastDigit === 8) { + return "$number-ми"; + } + + return "$number-ти"; + }, + 'months' => ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септември', 'октомври', 'ноември', 'декември'], + 'months_short' => ['яну', 'фев', 'мар', 'апр', 'май', 'юни', 'юли', 'авг', 'сеп', 'окт', 'ное', 'дек'], + 'weekdays' => ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота'], + 'weekdays_short' => ['нед', 'пон', 'вто', 'сря', 'чет', 'пет', 'съб'], + 'weekdays_min' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['преди обяд', 'следобед'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bn.php index 5817599c64d7a06a58d72a7c1d8c1bbbe17ae114..5e0ada0ef1b5eda3d0b38b82ebef9bb7ad49baa0 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bn.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bn.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,40 @@ * file that was distributed with this source code. */ -return array( - 'year' => '১ বছর|:count বছর', +/* + * Authors: + * - Josh Soref + * - Shakib Hossain + * - Raju + * - Aniruddha Adhikary + * - JD Isaacks + * - Saiful Islam + * - Faisal Islam + */ +return [ + 'year' => ':count বছর', + 'a_year' => 'এক বছর|:count বছর', 'y' => '১ বছর|:count বছর', - 'month' => '১ মাস|:count মাস', + 'month' => ':count মাস', + 'a_month' => 'এক মাস|:count মাস', 'm' => '১ মাস|:count মাস', - 'week' => '১ সপ্তাহ|:count সপ্তাহ', + 'week' => ':count সপ্তাহ', + 'a_week' => '১ সপ্তাহ|:count সপ্তাহ', 'w' => '১ সপ্তাহ|:count সপ্তাহ', - 'day' => '১ দিন|:count দিন', + 'day' => ':count দিন', + 'a_day' => 'এক দিন|:count দিন', 'd' => '১ দিন|:count দিন', - 'hour' => '১ ঘন্টা|:count ঘন্টা', + 'hour' => ':count ঘন্টা', + 'a_hour' => 'এক ঘন্টা|:count ঘন্টা', 'h' => '১ ঘন্টা|:count ঘন্টা', - 'minute' => '১ মিনিট|:count মিনিট', + 'minute' => ':count মিনিট', + 'a_minute' => 'এক মিনিট|:count মিনিট', 'min' => '১ মিনিট|:count মিনিট', - 'second' => '১ সেকেন্ড|:count সেকেন্ড', + 'second' => ':count সেকেন্ড', + 'a_second' => 'কয়েক সেকেন্ড|:count সেকেন্ড', 's' => '১ সেকেন্ড|:count সেকেন্ড', - 'ago' => ':time পূর্বে', - 'from_now' => 'এখন থেকে :time', + 'ago' => ':time আগে', + 'from_now' => ':time পরে', 'after' => ':time পরে', 'before' => ':time আগে', 'diff_now' => 'এখন', @@ -35,4 +52,48 @@ return array( 'period_interval' => 'প্রতি :interval', 'period_start_date' => ':date থেকে', 'period_end_date' => ':date পর্যন্ত', -); + 'formats' => [ + 'LT' => 'A Oh:Om সময়', + 'LTS' => 'A Oh:Om:Os সময়', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY, A Oh:Om সময়', + 'LLLL' => 'dddd, OD MMMM OY, A Oh:Om সময়', + ], + 'calendar' => [ + 'sameDay' => '[আজ] LT', + 'nextDay' => '[আগামীকাল] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[গতকাল] LT', + 'lastWeek' => '[গত] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'রাত'; + } + if ($hour < 10) { + return 'সকাল'; + } + if ($hour < 17) { + return 'দুপুর'; + } + if ($hour < 20) { + return 'বিকাল'; + } + + return 'রাত'; + }, + 'months' => ['জানুয়ারী', 'ফেব্রুয়ারি', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'months_short' => ['জানু', 'ফেব', 'মার্চ', 'এপ্র', 'মে', 'জুন', 'জুল', 'আগ', 'সেপ্ট', 'অক্টো', 'নভে', 'ডিসে'], + 'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'], + 'weekdays_min' => ['রবি', 'সোম', 'মঙ্গ', 'বুধ', 'বৃহঃ', 'শুক্র', 'শনি'], + 'list' => [', ', ' এবং '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekdays_standalone' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহষ্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_min_standalone' => ['রঃ', 'সোঃ', 'মঃ', 'বুঃ', 'বৃঃ', 'শুঃ', 'শনি'], + 'months_short_standalone' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'alt_numbers' => ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php index 7a9b05aa45216cded26e1bf56e5d74e1c83ce890..4dd21babb5b0752e93d320cc19c0294acddb2ba7 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,24 +8,4 @@ * 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', -); +return require __DIR__.'/bs.php'; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ca.php index c854b5a91ac946a73f29ba2f5d4027997d9bd30b..c41649203043744064c0e50fb02655dba8e2ae42 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ca.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ca.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,32 +9,102 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - mestremuten + * - François B + * - Marc Ordinas i Llopis + * - Pere Orga + * - JD Isaacks + * - Quentí + * - Víctor Díaz + * - Xavi + * - qcardona + */ +return [ 'year' => ':count any|:count anys', + 'a_year' => 'un any|:count anys', 'y' => ':count any|:count anys', 'month' => ':count mes|:count mesos', + 'a_month' => 'un mes|:count mesos', 'm' => ':count mes|:count mesos', 'week' => ':count setmana|:count setmanes', + 'a_week' => 'una setmana|:count setmanes', 'w' => ':count setmana|:count setmanes', 'day' => ':count dia|:count dies', - 'd' => ':count dia|:count dies', + 'a_day' => 'un dia|:count dies', + 'd' => ':count d', 'hour' => ':count hora|:count hores', - 'h' => ':count hora|:count hores', + 'a_hour' => 'una hora|:count hores', + 'h' => ':count h', 'minute' => ':count minut|:count minuts', - 'min' => ':count minut|:count minuts', + 'a_minute' => 'un minut|:count minuts', + 'min' => ':count min', 'second' => ':count segon|:count segons', - 's' => ':count segon|:count segons', + 'a_second' => 'uns segons|:count segons', + 's' => ':count s', 'ago' => 'fa :time', - 'from_now' => 'd\'aquí :time', + 'from_now' => 'd\'aquí a :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_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', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [de] YYYY', + 'LLL' => 'D MMMM [de] YYYY [a les] H:mm', + 'LLLL' => 'dddd D MMMM [de] YYYY [a les] H:mm', + ], + 'calendar' => [ + 'sameDay' => function (\Carbon\CarbonInterface $current) { + return '[avui a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'nextDay' => function (\Carbon\CarbonInterface $current) { + return '[demà a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'nextWeek' => function (\Carbon\CarbonInterface $current) { + return 'dddd [a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'lastDay' => function (\Carbon\CarbonInterface $current) { + return '[ahir a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'lastWeek' => function (\Carbon\CarbonInterface $current) { + return '[el] dddd [passat a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + return $number.( + ($period === 'w' || $period === 'W') ? 'a' : ( + ($number === 1) ? 'r' : ( + ($number === 2) ? 'n' : ( + ($number === 3) ? 'r' : ( + ($number === 4) ? 't' : 'è' + ) + ) + ) + ) + ); + }, + 'months' => ['de gener', 'de febrer', 'de març', 'd\'abril', 'de maig', 'de juny', 'de juliol', 'd\'agost', 'de setembre', 'd\'octubre', 'de novembre', 'de desembre'], + 'months_standalone' => ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octubre', 'novembre', 'desembre'], + 'months_short' => ['de gen.', 'de febr.', 'de març', 'd\'abr.', 'de maig', 'de juny', 'de jul.', 'd\'ag.', 'de set.', 'd\'oct.', 'de nov.', 'de des.'], + 'months_short_standalone' => ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'], + 'months_regexp' => '/(D[oD]?[\s,]+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte'], + 'weekdays_short' => ['dg.', 'dl.', 'dt.', 'dc.', 'dj.', 'dv.', 'ds.'], + 'weekdays_min' => ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' i '], + 'meridiem' => ['a. m.', 'p. m.'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cs.php index a447ce2980db2e18003985eb843e6f56b12b51ad..8cff9a0192cdcbd8c469665ca0a14c852456057f 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cs.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cs.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,114 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Jakub Tesinsky + * - Martin Suja + * - Nikos Timiopulos + * - Bohuslav Blín + * - Tsutomu Kuroda + * - tjku + * - Lukas Svoboda + * - Max Melentiev + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Václav Pávek + * - CodeSkills + * - Tlapi + * - newman101 + * - Petr Kadlec + * - tommaskraus + * - Karel Sommer (calvera) + */ +$za = function ($time) { + return 'za '.strtr($time, [ + 'hodina' => 'hodinu', + 'minuta' => 'minutu', + 'sekunda' => 'sekundu', + ]); +}; + +$pred = function ($time) { + $time = strtr($time, [ + 'hodina' => 'hodinou', + 'minuta' => 'minutou', + 'sekunda' => 'sekundou', + ]); + $time = preg_replace('/hodiny?(?!\w)/', 'hodinami', $time); + $time = preg_replace('/minuty?(?!\w)/', 'minutami', $time); + $time = preg_replace('/sekundy?(?!\w)/', 'sekundami', $time); + + return "před $time"; +}; + +return [ 'year' => ':count rok|:count roky|:count let', 'y' => ':count rok|:count roky|:count let', + 'a_year' => '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ů', + 'm' => ':count měs.', + 'a_month' => '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ů', + 'w' => ':count týd.', + 'a_week' => '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', -); + 'a_day' => 'den|:count dny|:count dní', + 'hour' => ':count hodina|:count hodiny|:count hodin', + 'h' => ':count hod.', + 'a_hour' => 'hodina|:count hodiny|:count hodin', + 'minute' => ':count minuta|:count minuty|:count minut', + 'min' => ':count min.', + 'a_minute' => 'minuta|:count minuty|:count minut', + 'second' => ':count sekunda|:count sekundy|:count sekund', + 's' => ':count sek.', + 'a_second' => 'pár sekund|:count sekundy|:count sekund', + + 'month_ago' => ':count měsícem|:count měsíci|:count měsíci', + 'a_month_ago' => 'měsícem|:count měsíci|:count měsíci', + 'day_ago' => ':count dnem|:count dny|:count dny', + 'a_day_ago' => 'dnem|:count dny|:count dny', + 'week_ago' => ':count týdnem|:count týdny|:count týdny', + 'a_week_ago' => 'týdnem|:count týdny|:count týdny', + 'year_ago' => ':count rokem|:count roky|:count lety', + 'y_ago' => ':count rok.|:count rok.|:count let.', + 'a_year_ago' => 'rokem|:count roky|:count lety', + + 'month_before' => ':count měsícem|:count měsíci|:count měsíci', + 'a_month_before' => 'měsícem|:count měsíci|:count měsíci', + 'day_before' => ':count dnem|:count dny|:count dny', + 'a_day_before' => 'dnem|:count dny|:count dny', + 'week_before' => ':count týdnem|:count týdny|:count týdny', + 'a_week_before' => 'týdnem|:count týdny|:count týdny', + 'year_before' => ':count rokem|:count roky|:count lety', + 'y_before' => ':count rok.|:count rok.|:count let.', + 'a_year_before' => 'rokem|:count roky|:count lety', + + 'ago' => $pred, + 'from_now' => $za, + 'before' => $pred, + 'after' => $za, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'months' => ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], + 'months_short' => ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'], + 'weekdays' => ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], + 'weekdays_short' => ['ned', 'pon', 'úte', 'stř', 'čtv', 'pát', 'sob'], + 'weekdays_min' => ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], + 'list' => [', ', ' a '], + 'diff_now' => 'nyní', + 'diff_yesterday' => 'včera', + 'diff_tomorrow' => 'zítra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD. MM. YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY HH:mm', + ], + 'meridiem' => ['dopoledne', 'odpoledne'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cy.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cy.php index c93750e25f0018f301b037d63800d152e8440ae2..5137a4271cb070fd774a0e43b7990746112bea77 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cy.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/cy.php @@ -1,5 +1,6 @@ <?php -/* + +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -7,23 +8,68 @@ * 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', + +/* + * Authors: + * - François B + * - JD Isaacks + * - Daniel Monaghan + */ +return [ + 'year' => '{1}blwyddyn|]1,Inf[:count flynedd', 'y' => ':countbl', - 'month' => '1 mis|:count fis', + 'month' => '{1}mis|]1,Inf[:count mis', 'm' => ':countmi', 'week' => ':count wythnos', 'w' => ':countw', - 'day' => ':count diwrnod', + 'day' => '{1}diwrnod|]1,Inf[:count diwrnod', 'd' => ':countd', - 'hour' => ':count awr', + 'hour' => '{1}awr|]1,Inf[:count awr', 'h' => ':counth', - 'minute' => ':count munud', + 'minute' => '{1}munud|]1,Inf[:count munud', 'min' => ':countm', - 'second' => ':count eiliad', + 'second' => '{1}ychydig eiliadau|]1,Inf[:count eiliad', 's' => ':counts', 'ago' => ':time yn ôl', - 'from_now' => ':time o hyn ymlaen', + 'from_now' => 'mewn :time', 'after' => ':time ar ôl', 'before' => ':time o\'r blaen', -); + 'diff_now' => 'nawr', + 'diff_yesterday' => 'ddoe', + 'diff_tomorrow' => 'yfory', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Heddiw am] LT', + 'nextDay' => '[Yfory am] LT', + 'nextWeek' => 'dddd [am] LT', + 'lastDay' => '[Ddoe am] LT', + 'lastWeek' => 'dddd [diwethaf am] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.( + $number > 20 + ? (in_array($number, [40, 50, 60, 80, 100]) ? 'fed' : 'ain') + : ([ + '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed + 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed', // 11eg to 20fed + ])[$number] ?? '' + ); + }, + 'months' => ['Ionawr', 'Chwefror', 'Mawrth', 'Ebrill', 'Mai', 'Mehefin', 'Gorffennaf', 'Awst', 'Medi', 'Hydref', 'Tachwedd', 'Rhagfyr'], + 'months_short' => ['Ion', 'Chwe', 'Maw', 'Ebr', 'Mai', 'Meh', 'Gor', 'Aws', 'Med', 'Hyd', 'Tach', 'Rhag'], + 'weekdays' => ['Dydd Sul', 'Dydd Llun', 'Dydd Mawrth', 'Dydd Mercher', 'Dydd Iau', 'Dydd Gwener', 'Dydd Sadwrn'], + 'weekdays_short' => ['Sul', 'Llun', 'Maw', 'Mer', 'Iau', 'Gwe', 'Sad'], + 'weekdays_min' => ['Su', 'Ll', 'Ma', 'Me', 'Ia', 'Gw', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' a '], + 'meridiem' => ['yb', 'yh'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/da.php index 86507b0fe6ee6ee0495e465e48ec682fa5536027..452fc6ba3e497a89c85632a6a1163593ee8986a5 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/da.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/da.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,68 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Rune Mønnike + * - François B + * - codenhagen + * - JD Isaacks + * - Jens Herlevsen + * - Ulrik McArdle (mcardle) + * - Frederik Sauer (FrittenKeeZ) + */ +return [ 'year' => ':count år|:count år', + 'a_year' => 'et år|:count år', 'y' => ':count år|:count år', 'month' => ':count måned|:count måneder', - 'm' => ':count måned|:count måneder', + 'a_month' => 'en måned|:count måneder', + 'm' => ':count mdr.', 'week' => ':count uge|:count uger', - 'w' => ':count uge|:count uger', + 'a_week' => 'en uge|:count uger', + 'w' => ':count u.', 'day' => ':count dag|:count dage', - 'd' => ':count dag|:count dage', + 'a_day' => ':count dag|:count dage', + 'd' => ':count d.', 'hour' => ':count time|:count timer', - 'h' => ':count time|:count timer', + 'a_hour' => 'en time|:count timer', + 'h' => ':count t.', 'minute' => ':count minut|:count minutter', - 'min' => ':count minut|:count minutter', + 'a_minute' => 'et minut|:count minutter', + 'min' => ':count min.', 'second' => ':count sekund|:count sekunder', - 's' => ':count sekund|:count sekunder', + 'a_second' => 'få sekunder|:count sekunder', + 's' => ':count s.', 'ago' => ':time siden', 'from_now' => 'om :time', 'after' => ':time efter', 'before' => ':time før', -); + 'diff_now' => 'nu', + 'diff_yesterday' => 'i går', + 'diff_tomorrow' => 'i morgen', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[i dag kl.] LT', + 'nextDay' => '[i morgen kl.] LT', + 'nextWeek' => 'på dddd [kl.] LT', + 'lastDay' => '[i går kl.] LT', + 'lastWeek' => '[i] dddd[s kl.] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], + 'weekdays_short' => ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'], + 'weekdays_min' => ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/de.php index 5ea2a03ad11b6d8da07a93aaca46b50194e64f5d..0fb939995ec4fc3e51a48ca991339dc1e2b33d50 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/de.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,21 +9,36 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Michael Hohl + * - sheriffmarley + * - dennisoderwald + * - Timo + * - Karag2006 + */ +return [ 'year' => ':count Jahr|:count Jahre', - 'y' => ':countJ|:countJ', + 'a_year' => 'ein Jahr|:count Jahre', + 'y' => ':count J.', 'month' => ':count Monat|:count Monate', - 'm' => ':countMon|:countMon', + 'a_month' => 'ein Monat|:count Monate', + 'm' => ':count Mon.', 'week' => ':count Woche|:count Wochen', - 'w' => ':countWo|:countWo', + 'a_week' => 'eine Woche|:count Wochen', + 'w' => ':count Wo.', 'day' => ':count Tag|:count Tage', - 'd' => ':countTg|:countTg', + 'a_day' => 'ein Tag|:count Tage', + 'd' => ':count Tg.', 'hour' => ':count Stunde|:count Stunden', - 'h' => ':countStd|:countStd', + 'a_hour' => 'eine Stunde|:count Stunden', + 'h' => ':count Std.', 'minute' => ':count Minute|:count Minuten', - 'min' => ':countMin|:countMin', + 'a_minute' => 'eine Minute|:count Minuten', + 'min' => ':count Min.', 'second' => ':count Sekunde|:count Sekunden', - 's' => ':countSek|:countSek', + 'a_second' => 'ein paar Sekunden|:count Sekunden', + 's' => ':count Sek.', 'ago' => 'vor :time', 'from_now' => 'in :time', 'after' => ':time später', @@ -37,10 +52,46 @@ return array( 'month_ago' => ':count Monat|:count Monaten', 'week_ago' => ':count Woche|:count Wochen', 'day_ago' => ':count Tag|:count Tagen', + 'a_year_from_now' => 'ein Jahr|:count Jahren', + 'a_month_from_now' => 'ein Monat|:count Monaten', + 'a_week_from_now' => 'eine Woche|:count Wochen', + 'a_day_from_now' => 'ein Tag|:count Tagen', + 'a_year_ago' => 'ein Jahr|:count Jahren', + 'a_month_ago' => 'ein Monat|:count Monaten', + 'a_week_ago' => 'eine Woche|:count Wochen', + 'a_day_ago' => 'ein Tag|:count Tagen', 'diff_now' => 'Gerade eben', 'diff_yesterday' => 'Gestern', - 'diff_tomorrow' => 'Heute', + 'diff_tomorrow' => 'Morgen', 'diff_before_yesterday' => 'Vorgestern', 'diff_after_tomorrow' => 'Übermorgen', -); + + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY HH:mm', + ], + + 'calendar' => [ + 'sameDay' => '[heute um] LT [Uhr]', + 'nextDay' => '[morgen um] LT [Uhr]', + 'nextWeek' => 'dddd [um] LT [Uhr]', + 'lastDay' => '[gestern um] LT [Uhr]', + 'lastWeek' => '[letzten] dddd [um] LT [Uhr]', + 'sameElse' => 'L', + ], + + 'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + 'months_short' => ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + 'weekdays' => ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], + 'weekdays_short' => ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'], + 'weekdays_min' => ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], + 'ordinal' => ':number.', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' und '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php index e3c50b39688cbd8433fd1376c251cd853df2cdf0..5df95dca4e8d617362025c6e0056f9a20a9feb87 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Ahmed Ali <ajaaibu@gmail.com> @@ -9,7 +9,37 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Ahmed Ali + */ + +$months = [ + 'ޖެނުއަރީ', + 'ފެބްރުއަރީ', + 'މާރިޗު', + 'އޭޕްރީލު', + 'މޭ', + 'ޖޫން', + 'ޖުލައި', + 'އޯގަސްޓު', + 'ސެޕްޓެމްބަރު', + 'އޮކްޓޯބަރު', + 'ނޮވެމްބަރު', + 'ޑިސެމްބަރު', +]; + +$weekdays = [ + 'އާދިއްތަ', + 'ހޯމަ', + 'އަންގާރަ', + 'ބުދަ', + 'ބުރާސްފަތި', + 'ހުކުރު', + 'ހޮނިހިރު', +]; + +return [ 'year' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', 'y' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', 'month' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', @@ -28,4 +58,29 @@ return array( 'from_now' => ':time ފަހުން', 'after' => ':time ފަހުން', 'before' => ':time ކުރި', -); + 'diff_yesterday' => 'އިއްޔެ', + 'diff_tomorrow' => 'މާދަމާ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[މިއަދު] LT', + 'nextDay' => '[މާދަމާ] LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '[އިއްޔެ] LT', + 'lastWeek' => '[ފާއިތުވި] dddd LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['މކ', 'މފ'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => ['އާދި', 'ހޯމަ', 'އަން', 'ބުދަ', 'ބުރާ', 'ހުކު', 'ހޮނި'], + 'list' => [', ', ' އަދި '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/el.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/el.php index 16b3f44272f4a30baed50917106cb9b79d6ea9a6..7303c14d92688faad769eb0b6dc509114beb6eba 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/el.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/el.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,78 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Alessandro Di Felice + * - François B + * - Tim Fish + * - Gabriel Monteagudo + * - JD Isaacks + * - yiannisdesp + * - Ilias Kasmeridis (iliaskasm) + */ +return [ 'year' => ':count χρόνος|:count χρόνια', - 'y' => ':count χρόνος|:count χρόνια', + 'a_year' => 'ένας χρόνος|:count χρόνια', + 'y' => ':count χρ.', 'month' => ':count μήνας|:count μήνες', - 'm' => ':count μήνας|:count μήνες', + 'a_month' => 'ένας μήνας|:count μήνες', + 'm' => ':count μήν.', 'week' => ':count εβδομάδα|:count εβδομάδες', - 'w' => ':count εβδομάδα|:count εβδομάδες', + 'a_week' => 'μια εβδομάδα|:count εβδομάδες', + 'w' => ':count εβδ.', 'day' => ':count μέρα|:count μέρες', - 'd' => ':count μέρα|:count μέρες', + 'a_day' => 'μία μέρα|:count μέρες', + 'd' => ':count μέρ.', 'hour' => ':count ώρα|:count ώρες', + 'a_hour' => 'μία ώρα|:count ώρες', 'h' => ':count ώρα|:count ώρες', 'minute' => ':count λεπτό|:count λεπτά', - 'min' => ':count λεπτό|:count λεπτά', + 'a_minute' => 'ένα λεπτό|:count λεπτά', + 'min' => ':count λεπ.', 'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα', - 's' => ':count δευτερόλεπτο|:count δευτερόλεπτα', - 'ago' => 'πριν από :time', - 'from_now' => 'σε :time από τώρα', + 'a_second' => 'λίγα δευτερόλεπτα|:count δευτερόλεπτα', + 's' => ':count δευ.', + 'ago' => 'πριν :time', + 'from_now' => 'σε :time', 'after' => ':time μετά', 'before' => ':time πριν', -); + 'diff_now' => 'τώρα', + 'diff_yesterday' => 'χθες', + 'diff_tomorrow' => 'αύριο', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'calendar' => [ + 'sameDay' => '[Σήμερα {}] LT', + 'nextDay' => '[Αύριο {}] LT', + 'nextWeek' => 'dddd [{}] LT', + 'lastDay' => '[Χθες {}] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 6: + return '[το προηγούμενο] dddd [{}] LT'; + default: + return '[την προηγούμενη] dddd [{}] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberη', + 'meridiem' => ['ΠΜ', 'ΜΜ', 'πμ', 'μμ'], + 'months' => ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου'], + 'months_standalone' => ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'], + 'months_regexp' => '/(D[oD]?[\s,]+MMMM|L{2,4}|l{2,4})/', + 'months_short' => ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], + 'weekdays' => ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], + 'weekdays_short' => ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], + 'weekdays_min' => ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' και '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/en.php index a15c131fb2d4aed54ece06449fd594d696d03eb8..39f0f76adc8e8d0e829866db68ba21ee957939cb 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/en.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,21 +9,33 @@ * file that was distributed with this source code. */ -return array( - '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', +/* + * Authors: + * - Milos Sakovic + * - Paul + */ +return [ + 'year' => '{1}:count year|{0}:count years|]1,Inf[:count years', + 'a_year' => '{1}a year|{0}:count years|]1,Inf[:count years', + 'y' => '{1}:countyr|{0}:countyrs|]1,Inf[:countyrs', + 'month' => '{1}:count month|{0}:count months|]1,Inf[:count months', + 'a_month' => '{1}a month|{0}:count months|]1,Inf[:count months', + 'm' => '{1}:countmo|{0}:countmos|]1,Inf[:countmos', + 'week' => '{1}:count week|{0}:count weeks|]1,Inf[:count weeks', + 'a_week' => '{1}a week|{0}:count weeks|]1,Inf[:count weeks', + 'w' => ':countw', + 'day' => '{1}:count day|{0}:count days|]1,Inf[:count days', + 'a_day' => '{1}a day|{0}:count days|]1,Inf[:count days', + 'd' => ':countd', + 'hour' => '{1}:count hour|{0}:count hours|]1,Inf[:count hours', + 'a_hour' => '{1}an hour|{0}:count hours|]1,Inf[:count hours', + 'h' => ':counth', + 'minute' => '{1}:count minute|{0}:count minutes|]1,Inf[:count minutes', + 'a_minute' => '{1}a minute|{0}:count minutes|]1,Inf[:count minutes', + 'min' => ':countm', + 'second' => '{1}:count second|{0}:count seconds|]1,Inf[:count seconds', + 'a_second' => '{1}a few seconds|{0}:count seconds|]1,Inf[:count seconds', + 's' => ':counts', 'ago' => ':time ago', 'from_now' => ':time from now', 'after' => ':time after', @@ -33,8 +45,29 @@ return array( 'diff_tomorrow' => 'tomorrow', 'diff_before_yesterday' => 'before yesterday', 'diff_after_tomorrow' => 'after tomorrow', - 'period_recurrences' => 'once|:count times', + 'period_recurrences' => '{1}once|{0}:count times|]1,Inf[:count times', 'period_interval' => 'every :interval', 'period_start_date' => 'from :date', 'period_end_date' => 'to :date', -); + 'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'weekdays' => ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + 'weekdays_short' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'weekdays_min' => ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + + return $number.( + (~~($number % 100 / 10) === 1) ? 'th' : ( + ($lastDigit === 1) ? 'st' : ( + ($lastDigit === 2) ? 'nd' : ( + ($lastDigit === 3) ? 'rd' : 'th' + ) + ) + ) + ); + }, + 'list' => [', ', ' and '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eo.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eo.php index c5b90b3e73a2179688d828aed68e3531d3005469..b9a4443d62eb61170c4548fdd39839d9995a888d 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eo.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eo.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,65 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - François B + * - Mia Nordentoft + * - JD Isaacks + */ +return [ 'year' => ':count jaro|:count jaroj', - 'y' => ':count jaro|:count jaroj', + 'a_year' => 'jaro|:count jaroj', + 'y' => ':count j.', 'month' => ':count monato|:count monatoj', - 'm' => ':count monato|:count monatoj', + 'a_month' => 'monato|:count monatoj', + 'm' => ':count mo.', 'week' => ':count semajno|:count semajnoj', - 'w' => ':count semajno|:count semajnoj', + 'a_week' => 'semajno|:count semajnoj', + 'w' => ':count sem.', 'day' => ':count tago|:count tagoj', - 'd' => ':count tago|:count tagoj', + 'a_day' => 'tago|:count tagoj', + 'd' => ':count t.', 'hour' => ':count horo|:count horoj', - 'h' => ':count horo|:count horoj', + 'a_hour' => 'horo|:count horoj', + 'h' => ':count h.', 'minute' => ':count minuto|:count minutoj', - 'min' => ':count minuto|:count minutoj', + 'a_minute' => 'minuto|:count minutoj', + 'min' => ':count min.', 'second' => ':count sekundo|:count sekundoj', - 's' => ':count sekundo|:count sekundoj', + 'a_second' => 'sekundoj|:count sekundoj', + 's' => ':count sek.', 'ago' => 'antaŭ :time', - 'from_now' => 'je :time', + 'from_now' => 'post :time', 'after' => ':time poste', 'before' => ':time antaŭe', -); + 'diff_yesterday' => 'Hieraŭ', + 'diff_tomorrow' => 'Morgaŭ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'D[-a de] MMMM, YYYY', + 'LLL' => 'D[-a de] MMMM, YYYY HH:mm', + 'LLLL' => 'dddd, [la] D[-a de] MMMM, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hodiaŭ je] LT', + 'nextDay' => '[Morgaŭ je] LT', + 'nextWeek' => 'dddd [je] LT', + 'lastDay' => '[Hieraŭ je] LT', + 'lastWeek' => '[pasinta] dddd [je] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numbera', + 'meridiem' => ['a.t.m.', 'p.t.m.'], + 'months' => ['januaro', 'februaro', 'marto', 'aprilo', 'majo', 'junio', 'julio', 'aŭgusto', 'septembro', 'oktobro', 'novembro', 'decembro'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aŭg', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['dimanĉo', 'lundo', 'mardo', 'merkredo', 'ĵaŭdo', 'vendredo', 'sabato'], + 'weekdays_short' => ['dim', 'lun', 'mard', 'merk', 'ĵaŭ', 'ven', 'sab'], + 'weekdays_min' => ['di', 'lu', 'ma', 'me', 'ĵa', 've', 'sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' kaj '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/es.php index 567a280f323a47dc1043be155db83c8ae563b208..f6537c79e9d48f573f9e262595e30c78e5dc08d8 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/es.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,47 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Kunal Marwaha + * - kostas + * - François B + * - Tim Fish + * - Claire Coloma + * - Steven Heinrich + * - JD Isaacks + * - Raphael Amorim + * - Jorge Y. Castillo + * - Víctor Díaz + * - Diego + * - Sebastian Thierer + * - quinterocesar + * - Daniel Commesse Liévanos (danielcommesse) + */ +return [ 'year' => ':count año|:count años', + 'a_year' => 'un año|:count años', 'y' => ':count año|:count años', 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', 'm' => ':count mes|:count meses', 'week' => ':count semana|:count semanas', - 'w' => ':count semana|:count semanas', + 'a_week' => 'una semana|:count semanas', + 'w' => ':countsem', 'day' => ':count día|:count días', - 'd' => ':count día|:count días', + 'a_day' => 'un día|:count días', + 'd' => ':countd', 'hour' => ':count hora|:count horas', - 'h' => ':count hora|:count horas', + 'a_hour' => 'una hora|:count horas', + 'h' => ':counth', 'minute' => ':count minuto|:count minutos', - 'min' => ':count minuto|:count minutos', + 'a_minute' => 'un minuto|:count minutos', + 'min' => ':countm', 'second' => ':count segundo|:count segundos', - 's' => ':count segundo|:count segundos', + 'a_second' => 'unos segundos|:count segundos', + 's' => ':counts', 'ago' => 'hace :time', - 'from_now' => 'dentro de :time', + 'from_now' => 'en :time', 'after' => ':time después', 'before' => ':time antes', 'diff_now' => 'ahora mismo', @@ -33,4 +57,41 @@ return array( 'diff_tomorrow' => 'mañana', 'diff_before_yesterday' => 'antier', 'diff_after_tomorrow' => 'pasado mañana', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY H:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => function (\Carbon\CarbonInterface $current) { + return '[hoy a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'nextDay' => function (\Carbon\CarbonInterface $current) { + return '[mañana a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'nextWeek' => function (\Carbon\CarbonInterface $current) { + return 'dddd [a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'lastDay' => function (\Carbon\CarbonInterface $current) { + return '[ayer a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'lastWeek' => function (\Carbon\CarbonInterface $current) { + return '[el] dddd [pasado a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'sameElse' => 'L', + ], + 'months' => ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], + 'months_short' => ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'], + 'mmm_suffix' => '.', + 'ordinal' => ':numberº', + 'weekdays' => ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'], + 'weekdays_short' => ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'], + 'weekdays_min' => ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' y '], + 'meridiem' => ['a. m.', 'p. m.'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/et.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/et.php index 2d9291e041bb4de417198a5382b59320ca8eb080..2bd0fa926f4b239d7fd9611ac9c2412ced31e1fb 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/et.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/et.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,29 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Andres Ivanov + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - RM87 + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Esko Lehtme + * - Mart Karu + * - Nicolás Hock Isaza + * - Kevin Valdek + * - Zahhar Kirillov + * - João Magalhães + * - Ingmar + */ +return [ 'year' => ':count aasta|:count aastat', 'y' => ':count aasta|:count aastat', 'month' => ':count kuu|:count kuud', @@ -35,4 +57,34 @@ return array( 'hour_from_now' => ':count tunni', 'minute_from_now' => ':count minuti', 'second_from_now' => ':count sekundi', -); + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'diff_now' => 'nüüd', + 'diff_yesterday' => 'eile', + 'diff_tomorrow' => 'homme', + 'diff_before_yesterday' => 'üleeile', + 'diff_after_tomorrow' => 'ülehomme', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'DD. MMMM YYYY', + 'LLL' => 'DD. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, DD. MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[täna] LT', + 'nextDay' => '[homme] LT', + 'lastDay' => '[eile] LT', + 'nextWeek' => 'dddd LT', + 'lastWeek' => '[eelmine] dddd LT', + 'sameElse' => 'L', + ], + 'months' => ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'], + 'months_short' => ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'], + 'weekdays' => ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'], + 'weekdays_short' => ['P', 'E', 'T', 'K', 'N', 'R', 'L'], + 'weekdays_min' => ['P', 'E', 'T', 'K', 'N', 'R', 'L'], + 'list' => [', ', ' ja '], + 'meridiem' => ['enne lõunat', 'pärast lõunat'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eu.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eu.php index 1cb6b7cd669e01bb08d84601bb2a13b328275544..9f7c9f637ce23e11e961dd2928c541a166214bf2 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eu.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/eu.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,58 @@ * file that was distributed with this source code. */ -return array( - 'year' => 'Urte 1|:count urte', +/* + * Authors: + * - Josh Soref + * - François B + * - JD Isaacks + */ +return [ + 'year' => 'urte bat|:count urte', 'y' => 'Urte 1|:count urte', - 'month' => 'Hile 1|:count hile', + 'month' => 'hilabete bat|:count hilabete', 'm' => 'Hile 1|:count hile', 'week' => 'Aste 1|:count aste', 'w' => 'Aste 1|:count aste', - 'day' => 'Egun 1|:count egun', + 'day' => 'egun bat|:count egun', 'd' => 'Egun 1|:count egun', - 'hour' => 'Ordu 1|:count ordu', + 'hour' => 'ordu bat|:count ordu', 'h' => 'Ordu 1|:count ordu', - 'minute' => 'Minutu 1|:count minutu', + 'minute' => 'minutu bat|:count minutu', 'min' => 'Minutu 1|:count minutu', - 'second' => 'Segundu 1|:count segundu', + 'second' => 'segundo batzuk|:count segundo', 's' => 'Segundu 1|:count segundu', - 'ago' => 'Orain dela :time', + 'ago' => 'duela :time', 'from_now' => ':time barru', 'after' => ':time geroago', 'before' => ':time lehenago', -); + 'diff_now' => 'orain', + 'diff_yesterday' => 'atzo', + 'diff_tomorrow' => 'bihar', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY[ko] MMMM[ren] D[a]', + 'LLL' => 'YYYY[ko] MMMM[ren] D[a] HH:mm', + 'LLLL' => 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[gaur] LT[etan]', + 'nextDay' => '[bihar] LT[etan]', + 'nextWeek' => 'dddd LT[etan]', + 'lastDay' => '[atzo] LT[etan]', + 'lastWeek' => '[aurreko] dddd LT[etan]', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['urtarrila', 'otsaila', 'martxoa', 'apirila', 'maiatza', 'ekaina', 'uztaila', 'abuztua', 'iraila', 'urria', 'azaroa', 'abendua'], + 'months_short' => ['urt.', 'ots.', 'mar.', 'api.', 'mai.', 'eka.', 'uzt.', 'abu.', 'ira.', 'urr.', 'aza.', 'abe.'], + 'weekdays' => ['igandea', 'astelehena', 'asteartea', 'asteazkena', 'osteguna', 'ostirala', 'larunbata'], + 'weekdays_short' => ['ig.', 'al.', 'ar.', 'az.', 'og.', 'ol.', 'lr.'], + 'weekdays_min' => ['ig', 'al', 'ar', 'az', 'og', 'ol', 'lr'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' eta '], + 'meridiem' => ['g', 'a'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fa.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fa.php index 31bec886942da179beb83a13c97438acb95ea29a..6495fb90a31cf8edf923b1e222ba272738d94323 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fa.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fa.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,72 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - François B + * - Nasser Ghiasi + * - JD Isaacks + * - Hossein Jabbari + * - nimamo + * - hafezdivandari + * - Hassan Pezeshk (hpez) + */ +return [ 'year' => ':count سال', + 'a_year' => 'یک سال'.'|:count '.'سال', 'y' => ':count سال', 'month' => ':count ماه', + 'a_month' => 'یک ماه'.'|:count '.'ماه', 'm' => ':count ماه', 'week' => ':count هفته', + 'a_week' => 'یک هفته'.'|:count '.'هفته', 'w' => ':count هفته', 'day' => ':count روز', + 'a_day' => 'یک روز'.'|:count '.'روز', 'd' => ':count روز', 'hour' => ':count ساعت', + 'a_hour' => 'یک ساعت'.'|:count '.'ساعت', 'h' => ':count ساعت', 'minute' => ':count دقیقه', + 'a_minute' => 'یک دقیقه'.'|:count '.'دقیقه', 'min' => ':count دقیقه', 'second' => ':count ثانیه', 's' => ':count ثانیه', 'ago' => ':time پیش', - 'from_now' => ':time بعد', + 'from_now' => ':time دیگر', 'after' => ':time پس از', 'before' => ':time پیش از', -); + 'diff_now' => 'اکنون', + 'diff_yesterday' => 'دیروز', + 'diff_tomorrow' => 'فردا', + 'formats' => [ + 'LT' => 'OH:Om', + 'LTS' => 'OH:Om:Os', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY OH:Om', + 'LLLL' => 'dddd, OD MMMM OY OH:Om', + ], + 'calendar' => [ + 'sameDay' => '[امروز ساعت] LT', + 'nextDay' => '[فردا ساعت] LT', + 'nextWeek' => 'dddd [ساعت] LT', + 'lastDay' => '[دیروز ساعت] LT', + 'lastWeek' => 'dddd [پیش] [ساعت] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':timeم', + 'meridiem' => ['قبل از ظهر', 'بعد از ظهر'], + 'months' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'months_short' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'weekdays' => ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], + 'weekdays_short' => ['یکشنبه', 'دوشنبه', 'سهشنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], + 'weekdays_min' => ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'list' => ['، ', ' و '], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹'], + 'months_short_standalone' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'weekend' => [5, 5], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fi.php index 481880444f498c2e2ddbdbf227df02b5ac83e32e..2003e1eab7a7e42805e45629684f2c30159783ba 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fi.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fi.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,78 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Janne Warén + * - digitalfrost + * - Tsutomu Kuroda + * - Roope Salmi + * - tjku + * - Max Melentiev + * - Sami Haahtinen + * - Teemu Leisti + * - Artem Ignatyev + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Robert Bjarnason + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Tom Hughes + * - Sven Fuchs + * - Petri Kivikangas + * - Nizar Jouini + * - Marko Seppae + * - Tomi Mynttinen (Pikseli) + * - Petteri (powergrip) + */ +return [ 'year' => ':count vuosi|:count vuotta', - 'y' => ':count vuosi|:count vuotta', + 'y' => ':count v', 'month' => ':count kuukausi|:count kuukautta', - 'm' => ':count kuukausi|:count kuukautta', + 'm' => ':count kk', 'week' => ':count viikko|:count viikkoa', - 'w' => ':count viikko|:count viikkoa', + 'w' => ':count vk', 'day' => ':count päivä|:count päivää', - 'd' => ':count päivä|:count päivää', + 'd' => ':count pv', 'hour' => ':count tunti|:count tuntia', - 'h' => ':count tunti|:count tuntia', + 'h' => ':count t', 'minute' => ':count minuutti|:count minuuttia', - 'min' => ':count minuutti|:count minuuttia', + 'min' => ':count min', 'second' => ':count sekunti|:count sekuntia', - 's' => ':count sekunti|:count sekuntia', + 'a_second' => 'muutama sekunti|:count sekuntia', + 's' => ':count s', 'ago' => ':time sitten', - 'from_now' => ':time tästä hetkestä', + 'from_now' => ':time päästä', + 'year_from_now' => ':count vuoden', + 'month_from_now' => ':count kuukauden', + 'week_from_now' => ':count viikon', + 'day_from_now' => ':count päivän', + 'hour_from_now' => ':count tunnin', + 'minute_from_now' => ':count minuutin', + 'second_from_now' => ':count sekunnin', 'after' => ':time sen jälkeen', 'before' => ':time ennen', -); + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ja '], + 'diff_now' => 'nyt', + 'diff_yesterday' => 'eilen', + 'diff_tomorrow' => 'huomenna', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm:ss', + 'L' => 'D.M.YYYY', + 'LL' => 'dddd D. MMMM[ta] YYYY', + 'LLL' => 'D.MM. HH.mm', + 'LLLL' => 'D. MMMM[ta] YYYY HH.mm', + ], + 'weekdays' => ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'], + 'weekdays_short' => ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'], + 'weekdays_min' => ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'], + 'months' => ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'], + 'months_short' => ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'loka', 'marras', 'joulu'], + 'meridiem' => ['aamupäivä', 'iltapäivä'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fo.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fo.php index d91104b78fed68d887d4b686c68d94e5c3d4d0f8..931bdfc37d21ba74bd2f44818ace4e3570203040 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fo.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fo.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,55 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count ár|:count ár', +/* + * Authors: + * - Kristian Sakarisson + * - François B + * - JD Isaacks + * - Sverri Mohr Olsen + */ +return [ + 'year' => 'eitt ár|:count ár', 'y' => ':count ár|:count ár', - 'month' => ':count mánaður|:count mánaðir', + 'month' => 'ein mánaði|: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', + 'day' => 'ein dagur|:count dagar', 'd' => ':count dag|:count dagar', - 'hour' => ':count tími|:count tímar', + 'hour' => 'ein tími|:count tímar', 'h' => ':count tími|:count tímar', - 'minute' => ':count minutt|:count minuttir', + 'minute' => 'ein minutt|:count minuttir', 'min' => ':count minutt|:count minuttir', - 'second' => ':count sekund|:count sekundir', + 'second' => 'fá sekund|:count sekundir', 's' => ':count sekund|:count sekundir', - 'ago' => ':time síðan', + 'ago' => ':time síðani', 'from_now' => 'um :time', 'after' => ':time aftaná', 'before' => ':time áðrenn', -); + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D. MMMM, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Í dag kl.] LT', + 'nextDay' => '[Í morgin kl.] LT', + 'nextWeek' => 'dddd [kl.] LT', + 'lastDay' => '[Í gjár kl.] LT', + 'lastWeek' => '[síðstu] dddd [kl] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mars', 'apríl', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['sunnudagur', 'mánadagur', 'týsdagur', 'mikudagur', 'hósdagur', 'fríggjadagur', 'leygardagur'], + 'weekdays_short' => ['sun', 'mán', 'týs', 'mik', 'hós', 'frí', 'ley'], + 'weekdays_min' => ['su', 'má', 'tý', 'mi', 'hó', 'fr', 'le'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fr.php index 0b20cdd29d40b401b37db9354ff6472dc799d7e1..87c43d27d31d86d4b9dc017e0408f394c66b5c36 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fr.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,26 +9,45 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Dieter Sting + * - François B + * - Maxime VALY + * - JD Isaacks + * - Dieter Sting + * - François B + * - JD Isaacks + * - Sebastian Thierer + * - Fastfuel + */ +return [ 'year' => ':count an|:count ans', + 'a_year' => 'un an|:count ans', 'y' => ':count an|:count ans', - 'month' => ':count mois', + 'month' => ':count mois|:count mois', + 'a_month' => 'un mois|:count mois', 'm' => ':count mois', 'week' => ':count semaine|:count semaines', + 'a_week' => 'une semaine|:count semaines', 'w' => ':count sem.', 'day' => ':count jour|:count jours', - 'd' => ':count j.', + 'a_day' => 'un jour|:count jours', + 'd' => ':count j', 'hour' => ':count heure|:count heures', - 'h' => ':count h.', + 'a_hour' => 'une heure|:count heures', + 'h' => ':count h', 'minute' => ':count minute|:count minutes', - 'min' => ':count min.', + 'a_minute' => 'une minute|:count minutes', + 'min' => ':count min', 'second' => ':count seconde|:count secondes', - 's' => ':count sec.', + 'a_second' => 'quelques secondes|:count secondes', + 's' => ':count s', 'ago' => 'il y a :time', 'from_now' => 'dans :time', 'after' => ':time après', 'before' => ':time avant', - 'diff_now' => "à l'instant", + 'diff_now' => 'à l\'instant', 'diff_yesterday' => 'hier', 'diff_tomorrow' => 'demain', 'diff_before_yesterday' => 'avant-hier', @@ -37,4 +56,48 @@ return array( 'period_interval' => 'tous les :interval', 'period_start_date' => 'de :date', 'period_end_date' => 'à :date', -); + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Aujourd’hui à] LT', + 'nextDay' => '[Demain à] LT', + 'nextWeek' => 'dddd [à] LT', + 'lastDay' => '[Hier à] LT', + 'lastWeek' => 'dddd [dernier à] LT', + 'sameElse' => 'L', + ], + 'months' => ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], + 'months_short' => ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], + 'weekdays' => ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], + 'weekdays_short' => ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], + 'weekdays_min' => ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'], + 'ordinal' => function ($number, $period) { + switch ($period) { + // In french, only the first has be ordinal, other number remains cardinal + // @link https://fr.wikihow.com/%C3%A9crire-la-date-en-fran%C3%A7ais + case 'D': + return $number.($number === 1 ? 'er' : ''); + + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + return $number.($number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return $number.($number === 1 ? 're' : 'e'); + } + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' et '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gl.php index cd22a31e7538fcc16cd72f45572e0f4dbb17d6ab..2f608113b2a3dd04b57cc354dbc0f5f8f769d30e 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gl.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,16 +9,83 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - François B + * - Fidel Pita + * - JD Isaacks + * - Diego Vilariño + * - Sebastian Thierer + */ +return [ 'year' => ':count ano|:count anos', + 'a_year' => 'un ano|:count anos', + 'y' => ':count a.', 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', + 'm' => ':count mes.', 'week' => ':count semana|:count semanas', + 'a_week' => 'unha semana|:count semanas', + 'w' => ':count sem.', 'day' => ':count día|:count días', + 'a_day' => 'un día|:count días', + 'd' => ':count d.', 'hour' => ':count hora|:count horas', + 'a_hour' => 'unha hora|:count horas', + 'h' => ':count h.', 'minute' => ':count minuto|:count minutos', + 'a_minute' => 'un minuto|:count minutos', + 'min' => ':count min.', 'second' => ':count segundo|:count segundos', - 'ago' => 'fai :time', - 'from_now' => 'dentro de :time', + 'a_second' => 'uns segundos|:count segundos', + 's' => ':count seg.', + 'ago' => 'hai :time', + 'from_now' => function ($time) { + if (substr($time, 0, 2) === 'un') { + return "n$time"; + } + + return "en $time"; + }, + 'diff_now' => 'agora', + 'diff_yesterday' => 'onte', + 'diff_tomorrow' => 'mañá', 'after' => ':time despois', 'before' => ':time antes', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY H:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => function (\Carbon\CarbonInterface $current) { + return '[hoxe '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'nextDay' => function (\Carbon\CarbonInterface $current) { + return '[mañá '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'nextWeek' => function (\Carbon\CarbonInterface $current) { + return 'dddd ['.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'lastDay' => function (\Carbon\CarbonInterface $current) { + return '[onte '.($current->hour !== 1 ? 'á' : 'a').'] LT'; + }, + 'lastWeek' => function (\Carbon\CarbonInterface $current) { + return '[o] dddd [pasado '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['xaneiro', 'febreiro', 'marzo', 'abril', 'maio', 'xuño', 'xullo', 'agosto', 'setembro', 'outubro', 'novembro', 'decembro'], + 'months_short' => ['xan.', 'feb.', 'mar.', 'abr.', 'mai.', 'xuñ.', 'xul.', 'ago.', 'set.', 'out.', 'nov.', 'dec.'], + 'weekdays' => ['domingo', 'luns', 'martes', 'mércores', 'xoves', 'venres', 'sábado'], + 'weekdays_short' => ['dom.', 'lun.', 'mar.', 'mér.', 'xov.', 'ven.', 'sáb.'], + 'weekdays_min' => ['do', 'lu', 'ma', 'mé', 'xo', 've', 'sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], + 'meridiem' => ['a.m.', 'p.m.'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gu.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gu.php index 7759dfcb5c518a0ce01a939b2b41b1e85e2cdac5..797e5d24cdb95b0c03728d7d093c327f931653a8 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gu.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/gu.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,73 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count વર્ષ|:count વર્ષો', +/* + * Authors: + * - Josh Soref + * - Kaushik Thanki + * - Josh Soref + */ +return [ + 'year' => 'એક વર્ષ|:count વર્ષ', 'y' => ':countવર્ષ|:countવર્ષો', - 'month' => ':count મહિનો|:count મહિના', + 'month' => 'એક મહિનો|:count મહિનો', 'm' => ':countમહિનો|:countમહિના', 'week' => ':count અઠવાડિયું|:count અઠવાડિયા', 'w' => ':countઅઠ.|:countઅઠ.', - 'day' => ':count દિવસ|:count દિવસો', + 'day' => 'એક દિવસ|:count દિવસ', 'd' => ':countદિ.|:countદિ.', - 'hour' => ':count કલાક|:count કલાકો', + 'hour' => 'એક કલાક|:count કલાક', 'h' => ':countક.|:countક.', - 'minute' => ':count મિનિટ|:count મિનિટ', + 'minute' => 'એક મિનિટ|:count મિનિટ', 'min' => ':countમિ.|:countમિ.', - 'second' => ':count સેકેન્ડ|:count સેકેન્ડ', + 'second' => 'અમુક પળો|:count સેકંડ', 's' => ':countસે.|:countસે.', - 'ago' => ':time પહેલા', - 'from_now' => ':time અત્યારથી', + 'ago' => ':time પેહલા', + 'from_now' => ':time મા', 'after' => ':time પછી', 'before' => ':time પહેલા', -); + 'diff_now' => 'હમણાં', + 'diff_yesterday' => 'ગઇકાલે', + 'diff_tomorrow' => 'કાલે', + 'formats' => [ + 'LT' => 'A h:mm વાગ્યે', + 'LTS' => 'A h:mm:ss વાગ્યે', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm વાગ્યે', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm વાગ્યે', + ], + 'calendar' => [ + 'sameDay' => '[આજ] LT', + 'nextDay' => '[કાલે] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[ગઇકાલે] LT', + 'lastWeek' => '[પાછલા] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'રાત'; + } + if ($hour < 10) { + return 'સવાર'; + } + if ($hour < 17) { + return 'બપોર'; + } + if ($hour < 20) { + return 'સાંજ'; + } + + return 'રાત'; + }, + 'months' => ['જાન્યુઆરી', 'ફેબ્રુઆરી', 'માર્ચ', 'એપ્રિલ', 'મે', 'જૂન', 'જુલાઈ', 'ઑગસ્ટ', 'સપ્ટેમ્બર', 'ઑક્ટ્બર', 'નવેમ્બર', 'ડિસેમ્બર'], + 'months_short' => ['જાન્યુ.', 'ફેબ્રુ.', 'માર્ચ', 'એપ્રિ.', 'મે', 'જૂન', 'જુલા.', 'ઑગ.', 'સપ્ટે.', 'ઑક્ટ્.', 'નવે.', 'ડિસે.'], + 'weekdays' => ['રવિવાર', 'સોમવાર', 'મંગળવાર', 'બુધ્વાર', 'ગુરુવાર', 'શુક્રવાર', 'શનિવાર'], + 'weekdays_short' => ['રવિ', 'સોમ', 'મંગળ', 'બુધ્', 'ગુરુ', 'શુક્ર', 'શનિ'], + 'weekdays_min' => ['ર', 'સો', 'મં', 'બુ', 'ગુ', 'શુ', 'શ'], + 'list' => [', ', ' અને '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/he.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/he.php index 2d4f4f880d9935a89946472af2d45b698c03032a..2833a60ce94b7f50398378b1350cf6a94a2263ab 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/he.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/he.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,14 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Daniel Cohen Gindi + * - JD Isaacks + * - Itai Nathaniel + * - GabMic + */ +return [ 'year' => 'שנה|{2}שנתיים|:count שנים', 'y' => 'שנה|{2}שנתיים|:count שנים', 'month' => 'חודש|{2}חודשיים|:count חודשים', @@ -20,12 +27,55 @@ return array( 'd' => 'יום|{2}יומיים|:count ימים', 'hour' => 'שעה|{2}שעתיים|:count שעות', 'h' => 'שעה|{2}שעתיים|:count שעות', - 'minute' => 'דקה|{2}דקותיים|:count דקות', - 'min' => 'דקה|{2}דקותיים|:count דקות', - 'second' => 'שניה|:count שניות', + 'minute' => 'דקה|{2}שתי דקות|:count דקות', + 'min' => 'דקה|{2}שתי דקות|:count דקות', + 'second' => 'שנייה|:count שניות', + 'a_second' => 'כמה שניות|:count שניות', 's' => 'שניה|:count שניות', 'ago' => 'לפני :time', - 'from_now' => 'בעוד :time', + 'from_now' => 'בעוד :time מעכשיו', 'after' => 'אחרי :time', 'before' => 'לפני :time', -); + 'diff_now' => 'עכשיו', + 'diff_yesterday' => 'אתמול', + 'diff_tomorrow' => 'מחר', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [ב]MMMM YYYY', + 'LLL' => 'D [ב]MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D [ב]MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[היום ב־]LT', + 'nextDay' => '[מחר ב־]LT', + 'nextWeek' => 'dddd [בשעה] LT', + 'lastDay' => '[אתמול ב־]LT', + 'lastWeek' => '[ביום] dddd [האחרון בשעה] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour, $minute, $isLower) { + if ($hour < 5) { + return 'לפנות בוקר'; + } + if ($hour < 10) { + return 'בבוקר'; + } + if ($hour < 12) { + return $isLower ? 'לפנה"צ' : 'לפני הצהריים'; + } + if ($hour < 18) { + return $isLower ? 'אחה"צ' : 'אחרי הצהריים'; + } + + return 'בערב'; + }, + 'months' => ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], + 'months_short' => ['ינו׳', 'פבר׳', 'מרץ', 'אפר׳', 'מאי', 'יוני', 'יולי', 'אוג׳', 'ספט׳', 'אוק׳', 'נוב׳', 'דצמ׳'], + 'weekdays' => ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'], + 'weekdays_short' => ['א׳', 'ב׳', 'ג׳', 'ד׳', 'ה׳', 'ו׳', 'ש׳'], + 'weekdays_min' => ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש'], + 'list' => [', ', ' ו -'], + 'weekend' => [5, 6], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hi.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hi.php index 6c670ee8cdbea6f888bb00b75cea47ef84259080..db352d199687e4f5f924613c045c6d07e2cd079b 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hi.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hi.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,73 @@ * file that was distributed with this source code. */ -return array( - 'year' => '1 वर्ष|:count वर्षों', +/* + * Authors: + * - abhimanyu003 + * - Josh Soref + * - JD Isaacks + */ +return [ + 'year' => 'एक वर्ष|:count वर्ष', 'y' => '1 वर्ष|:count वर्षों', - 'month' => '1 माह|:count महीने', + 'month' => 'एक महीने|:count महीने', 'm' => '1 माह|:count महीने', 'week' => '1 सप्ताह|:count सप्ताह', 'w' => '1 सप्ताह|:count सप्ताह', - 'day' => '1 दिन|:count दिनों', + 'day' => 'एक दिन|:count दिन', 'd' => '1 दिन|:count दिनों', - 'hour' => '1 घंटा|:count घंटे', + 'hour' => 'एक घंटा|:count घंटे', 'h' => '1 घंटा|:count घंटे', - 'minute' => '1 मिनट|:count मिनटों', + 'minute' => 'एक मिनट|:count मिनट', 'min' => '1 मिनट|:count मिनटों', - 'second' => '1 सेकंड|:count सेकंड', + 'second' => 'कुछ ही क्षण|:count सेकंड', 's' => '1 सेकंड|:count सेकंड', - 'ago' => ':time पूर्व', - 'from_now' => ':time से', + 'ago' => ':time पहले', + 'from_now' => ':time में', 'after' => ':time के बाद', 'before' => ':time के पहले', -); + 'diff_now' => 'अब', + 'diff_yesterday' => 'कल', + 'diff_tomorrow' => 'कल', + 'formats' => [ + 'LT' => 'A h:mm बजे', + 'LTS' => 'A h:mm:ss बजे', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm बजे', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm बजे', + ], + 'calendar' => [ + 'sameDay' => '[आज] LT', + 'nextDay' => '[कल] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[कल] LT', + 'lastWeek' => '[पिछले] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'रात'; + } + if ($hour < 10) { + return 'सुबह'; + } + if ($hour < 17) { + return 'दोपहर'; + } + if ($hour < 20) { + return 'शाम'; + } + + return 'रात'; + }, + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'], + 'weekdays_min' => ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'], + 'list' => [', ', ' और '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hr.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hr.php index 1a339de7bfd0438e0916a5063a8ea8d949021b98..35666977abe14f0b7db83a33c2136a561bae5b6b 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hr.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hr.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,96 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - François B + * - Tim Fish + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - tomhorvat + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - tomhorvat + * - Stjepan + * - Vanja Retkovac (vr00) + */ +return [ 'year' => ':count godinu|:count godine|:count godina', - 'y' => ':count godinu|:count godine|:count godina', + 'y' => ':count god.|:count god.|:count god.', 'month' => ':count mjesec|:count mjeseca|:count mjeseci', - 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mj.|:count mj.|:count mj.', 'week' => ':count tjedan|:count tjedna|:count tjedana', - 'w' => ':count tjedan|:count tjedna|:count tjedana', + 'w' => ':count tj.|:count tj.|:count tj.', 'day' => ':count dan|:count dana|:count dana', - 'd' => ':count dan|:count dana|:count dana', + 'd' => ':count d.|:count d.|:count d.', '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', + 'minute' => ':count minutu|:count minute|:count minuta', + 'min' => ':count min.|:count min.|:count min.', 'second' => ':count sekundu|:count sekunde|:count sekundi', - 's' => ':count sekundu|:count sekunde|:count sekundi', + 'a_second' => 'nekoliko sekundi|:count sekunde|:count sekundi', + 's' => ':count sek.|:count sek.|:count sek.', 'ago' => 'prije :time', 'from_now' => 'za :time', - 'after' => 'za :time', - 'before' => 'prije :time', -); + 'after' => ':time poslije', + 'before' => ':time prije', + 'diff_now' => 'sad', + 'diff_yesterday' => 'jučer', + 'diff_tomorrow' => 'sutra', + 'diff_before_yesterday' => 'prekjučer', + 'diff_after_tomorrow' => 'prekosutra', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danas u] LT', + 'nextDay' => '[sutra u] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastDay' => '[jučer u] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + default: + return '[prošli] dddd [u] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['siječnja', 'veljače', 'ožujka', 'travnja', 'svibnja', 'lipnja', 'srpnja', 'kolovoza', 'rujna', 'listopada', 'studenoga', 'prosinca'], + 'months_standalone' => ['siječanj', 'veljača', 'ožujak', 'travanj', 'svibanj', 'lipanj', 'srpanj', 'kolovoz', 'rujan', 'listopad', 'studeni', 'prosinac'], + 'months_short' => ['sij.', 'velj.', 'ožu.', 'tra.', 'svi.', 'lip.', 'srp.', 'kol.', 'ruj.', 'lis.', 'stu.', 'pro.'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['nedjelju', 'ponedjeljak', 'utorak', 'srijedu', 'četvrtak', 'petak', 'subotu'], + 'weekdays_standalone' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'], + 'weekdays_min' => ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hu.php index 45daf41a100f796e6f98f1fa42231d3b753fd263..58af385b418da18ac6cd31263a7142d8d497c150 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hu.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hu.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,15 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Adam Brunner + * - Brett Johnson + * - balping + */ +$huWeekEndings = ['vasárnap', 'hétfőn', 'kedden', 'szerdán', 'csütörtökön', 'pénteken', 'szombaton']; + +return [ 'year' => ':count év', 'y' => ':count év', 'month' => ':count hónap', @@ -29,24 +37,78 @@ return array( 'after' => ':time később', 'before' => ':time korábban', 'year_ago' => ':count éve', + 'y_ago' => ':count éve', 'month_ago' => ':count hónapja', + 'm_ago' => ':count hónapja', 'week_ago' => ':count hete', + 'w_ago' => ':count hete', 'day_ago' => ':count napja', + 'd_ago' => ':count napja', 'hour_ago' => ':count órája', + 'h_ago' => ':count órája', 'minute_ago' => ':count perce', + 'min_ago' => ':count perce', 'second_ago' => ':count másodperce', + 's_ago' => ':count másodperce', 'year_after' => ':count évvel', + 'y_after' => ':count évvel', 'month_after' => ':count hónappal', + 'm_after' => ':count hónappal', 'week_after' => ':count héttel', + 'w_after' => ':count héttel', 'day_after' => ':count nappal', + 'd_after' => ':count nappal', 'hour_after' => ':count órával', + 'h_after' => ':count órával', 'minute_after' => ':count perccel', + 'min_after' => ':count perccel', 'second_after' => ':count másodperccel', + 's_after' => ':count másodperccel', 'year_before' => ':count évvel', + 'y_before' => ':count évvel', 'month_before' => ':count hónappal', + 'm_before' => ':count hónappal', 'week_before' => ':count héttel', + 'w_before' => ':count héttel', 'day_before' => ':count nappal', + 'd_before' => ':count nappal', 'hour_before' => ':count órával', + 'h_before' => ':count órával', 'minute_before' => ':count perccel', + 'min_before' => ':count perccel', 'second_before' => ':count másodperccel', -); + 's_before' => ':count másodperccel', + 'months' => ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], + 'months_short' => ['jan.', 'feb.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], + 'weekdays_short' => ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'], + 'weekdays_min' => ['v', 'h', 'k', 'sze', 'cs', 'p', 'sz'], + 'ordinal' => ':number.', + 'diff_now' => 'most', + 'diff_yesterday' => 'tegnap', + 'diff_tomorrow' => 'holnap', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'YYYY.MM.DD.', + 'LL' => 'YYYY. MMMM D.', + 'LLL' => 'YYYY. MMMM D. H:mm', + 'LLLL' => 'YYYY. MMMM D., dddd H:mm', + ], + 'calendar' => [ + 'sameDay' => '[ma] LT[-kor]', + 'nextDay' => '[holnap] LT[-kor]', + 'nextWeek' => function (\Carbon\CarbonInterface $date) use ($huWeekEndings) { + return '['.$huWeekEndings[$date->dayOfWeek].'] LT[-kor]'; + }, + 'lastDay' => '[tegnap] LT[-kor]', + 'lastWeek' => function (\Carbon\CarbonInterface $date) use ($huWeekEndings) { + return '[múlt '.$huWeekEndings[$date->dayOfWeek].'] LT[-kor]'; + }, + 'sameElse' => 'L', + ], + 'meridiem' => ['DE', 'DU'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' és '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hy.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hy.php index d2665f27aadd4ff6c06e11b37884ef4f75aa4800..b69a3709fb03ee791987d49dc382fecc271c71af 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hy.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/hy.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,86 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - mhamlet + */ +return [ 'year' => ':count տարի', + 'a_year' => 'տարի|:count տարի', 'y' => ':countտ', 'month' => ':count ամիս', + 'a_month' => 'ամիս|:count ամիս', 'm' => ':countամ', 'week' => ':count շաբաթ', + 'a_week' => 'շաբաթ|:count շաբաթ', 'w' => ':countշ', 'day' => ':count օր', + 'a_day' => 'օր|:count օր', 'd' => ':countօր', 'hour' => ':count ժամ', + 'a_hour' => 'ժամ|:count ժամ', 'h' => ':countժ', 'minute' => ':count րոպե', + 'a_minute' => 'րոպե|:count րոպե', 'min' => ':countր', - 'second' => ':count վարկյան', + 'second' => ':count վայրկյան', + 'a_second' => 'մի քանի վայրկյան|:count վայրկյան', 's' => ':countվրկ', 'ago' => ':time առաջ', - 'from_now' => ':time ներկա պահից', + 'from_now' => ':timeից', 'after' => ':time հետո', 'before' => ':time առաջ', -); + 'diff_now' => 'հիմա', + 'diff_yesterday' => 'երեկ', + 'diff_tomorrow' => 'վաղը', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY թ.', + 'LLL' => 'D MMMM YYYY թ., HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY թ., HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[այսօր] LT', + 'nextDay' => '[վաղը] LT', + 'nextWeek' => 'dddd [օրը ժամը] LT', + 'lastDay' => '[երեկ] LT', + 'lastWeek' => '[անցած] dddd [օրը ժամը] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'DDD': + case 'w': + case 'W': + case 'DDDo': + return $number.($number === 1 ? '-ին' : '-րդ'); + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'գիշերվա'; + } + if ($hour < 12) { + return 'առավոտվա'; + } + if ($hour < 17) { + return 'ցերեկվա'; + } + + return 'երեկոյան'; + }, + 'months' => ['հունվարի', 'փետրվարի', 'մարտի', 'ապրիլի', 'մայիսի', 'հունիսի', 'հուլիսի', 'օգոստոսի', 'սեպտեմբերի', 'հոկտեմբերի', 'նոյեմբերի', 'դեկտեմբերի'], + 'months_standalone' => ['հունվար', 'փետրվար', 'մարտ', 'ապրիլ', 'մայիս', 'հունիս', 'հուլիս', 'օգոստոս', 'սեպտեմբեր', 'հոկտեմբեր', 'նոյեմբեր', 'դեկտեմբեր'], + 'months_short' => ['հնվ', 'փտր', 'մրտ', 'ապր', 'մյս', 'հնս', 'հլս', 'օգս', 'սպտ', 'հկտ', 'նմբ', 'դկտ'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['կիրակի', 'երկուշաբթի', 'երեքշաբթի', 'չորեքշաբթի', 'հինգշաբթի', 'ուրբաթ', 'շաբաթ'], + 'weekdays_short' => ['կրկ', 'երկ', 'երք', 'չրք', 'հնգ', 'ուրբ', 'շբթ'], + 'weekdays_min' => ['կրկ', 'երկ', 'երք', 'չրք', 'հնգ', 'ուրբ', 'շբթ'], + 'list' => [', ', ' եւ '], + 'first_day_of_week' => 1, +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/id.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/id.php index 7f7114fad4fd64fcb25ff4cb20db4d8506fe13d7..5a38263720b614d5eb35f45fe8343190cd0cce27 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/id.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/id.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,80 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - du + * - JD Isaacks + * - Nafies Luthfi + * - Raymundus Jati Primanda (mundusjp) + * - diankur313 + * - a-wip0 + */ +return [ 'year' => ':count tahun', - 'y' => ':count tahun', + 'a_year' => '{1}setahun|]1,Inf[:count tahun', + 'y' => ':countthn', 'month' => ':count bulan', - 'm' => ':count bulan', + 'a_month' => '{1}sebulan|]1,Inf[:count bulan', + 'm' => ':countbln', 'week' => ':count minggu', - 'w' => ':count minggu', + 'a_week' => '{1}seminggu|]1,Inf[:count minggu', + 'w' => ':countmgg', 'day' => ':count hari', - 'd' => ':count hari', + 'a_day' => '{1}sehari|]1,Inf[:count hari', + 'd' => ':counthr', 'hour' => ':count jam', - 'h' => ':count jam', + 'a_hour' => '{1}sejam|]1,Inf[:count jam', + 'h' => ':countj', 'minute' => ':count menit', - 'min' => ':count menit', + 'a_minute' => '{1}semenit|]1,Inf[:count menit', + 'min' => ':countmnt', 'second' => ':count detik', - 's' => ':count detik', + 'a_second' => '{1}beberapa detik|]1,Inf[:count detik', + 's' => ':countdt', 'ago' => ':time yang lalu', 'from_now' => ':time dari sekarang', - 'after' => ':time setelah', - 'before' => ':time sebelum', -); + 'after' => ':time setelahnya', + 'before' => ':time sebelumnya', + 'diff_now' => 'sekarang', + 'diff_yesterday' => 'kemarin', + 'diff_tomorrow' => 'besok', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [pukul] HH.mm', + 'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm', + ], + 'calendar' => [ + 'sameDay' => '[Hari ini pukul] LT', + 'nextDay' => '[Besok pukul] LT', + 'nextWeek' => 'dddd [pukul] LT', + 'lastDay' => '[Kemarin pukul] LT', + 'lastWeek' => 'dddd [lalu pukul] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 11) { + return 'pagi'; + } + if ($hour < 15) { + return 'siang'; + } + if ($hour < 19) { + return 'sore'; + } + + return 'malam'; + }, + 'months' => ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agt', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'], + 'weekdays_short' => ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'], + 'weekdays_min' => ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' dan '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/is.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/is.php index 94c76a7f26488abd4c9522872ee84e37c0eb70dd..9990168c2d4df485ee7a68d6fee83d18c5e56f27 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/is.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/is.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,11 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Kristján Ingi Geirsson + */ +return [ 'year' => '1 ár|:count ár', 'y' => '1 ár|:count ár', 'month' => '1 mánuður|:count mánuðir', @@ -28,4 +32,24 @@ return array( 'from_now' => ':time síðan', 'after' => ':time eftir', 'before' => ':time fyrir', -); + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], + 'meridiem' => ['fh', 'eh'], + 'diff_now' => 'núna', + 'diff_yesterday' => 'í gær', + 'diff_tomorrow' => 'á morgun', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM [kl.] HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY [kl.] HH:mm', + ], + 'weekdays' => ['sunnudaginn', 'mánudaginn', 'þriðjudaginn', 'miðvikudaginn', 'fimmtudaginn', 'föstudaginn', 'laugardaginn'], + 'weekdays_short' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], + 'weekdays_min' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], + 'months' => ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/it.php index 70bc6d7b34e73b248fbb024759bff33189bf50e1..6000595773c8ec440df5808d0245f80abb39fb88 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/it.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/it.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,28 +9,84 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Ash + * - François B + * - Marco Perrando + * - Massimiliano Caniparoli + * - JD Isaacks + * - Andrea Martini + * - Francesco Marasco + * - Tizianoz93 + * - Davide Casiraghi (davide-casiraghi) + */ +return [ 'year' => ':count anno|:count anni', + 'a_year' => 'un anno|:count anni', 'y' => ':count anno|:count anni', 'month' => ':count mese|:count mesi', + 'a_month' => 'un mese|:count mesi', 'm' => ':count mese|:count mesi', 'week' => ':count settimana|:count settimane', - 'w' => ':count settimana|:count settimane', + 'a_week' => 'una settimana|:count settimane', + 'w' => ':count set.', 'day' => ':count giorno|:count giorni', - 'd' => ':count giorno|:count giorni', + 'a_day' => 'un giorno|:count giorni', + 'd' => ':count g|:count gg', 'hour' => ':count ora|:count ore', - 'h' => ':count ora|:count ore', + 'a_hour' => 'un\'ora|:count ore', + 'h' => ':count h', 'minute' => ':count minuto|:count minuti', - 'min' => ':count minuto|:count minuti', + 'a_minute' => 'un minuto|:count minuti', + 'min' => ':count min.', 'second' => ':count secondo|:count secondi', - 's' => ':count secondo|:count secondi', + 'a_second' => 'alcuni secondi|:count secondi', + 's' => ':count sec.', 'ago' => ':time fa', - 'from_now' => 'tra :time', + 'from_now' => function ($time) { + return (preg_match('/^[0-9].+$/', $time) ? 'tra' : 'in')." $time"; + }, 'after' => ':time dopo', 'before' => ':time prima', 'diff_now' => 'proprio ora', 'diff_yesterday' => 'ieri', 'diff_tomorrow' => 'domani', - 'diff_before_yesterday' => "l'altro ieri", + 'diff_before_yesterday' => 'l\'altro ieri', 'diff_after_tomorrow' => 'dopodomani', -); + 'period_interval' => 'ogni :interval', + 'period_start_date' => 'dal :date', + 'period_end_date' => 'al :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Oggi alle] LT', + 'nextDay' => '[Domani alle] LT', + 'nextWeek' => 'dddd [alle] LT', + 'lastDay' => '[Ieri alle] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], + 'months_short' => ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], + 'weekdays' => ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'], + 'weekdays_short' => ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'], + 'weekdays_min' => ['do', 'lu', 'ma', 'me', 'gi', 've', 'sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ja.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ja.php index 71195475d802516f1cf2d7c0fffb5e455b2ffb78..7c709158501b8c2bd2684a4ff3c722fe508503d0 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ja.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ja.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,19 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Takuya Sawada + * - Atsushi Tanaka + * - François B + * - Jason Katz-Brown + * - Serhan Apaydın + * - XueWei + * - JD Isaacks + * - toyama satoshi + * - atakigawa + */ +return [ 'year' => ':count年', 'y' => ':count年', 'month' => ':countヶ月', @@ -23,9 +35,64 @@ return array( 'minute' => ':count分', 'min' => ':count分', 'second' => ':count秒', + 'a_second' => '{1}数秒|]1,Inf[:count秒', 's' => ':count秒', 'ago' => ':time前', - 'from_now' => '今から:time', + 'from_now' => ':time後', 'after' => ':time後', 'before' => ':time前', -); + 'diff_now' => '今', + 'diff_yesterday' => '昨日', + 'diff_tomorrow' => '明日', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 HH:mm', + 'LLLL' => 'YYYY年M月D日 dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[今日] LT', + 'nextDay' => '[明日] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $current, \Carbon\CarbonInterface $other) { + if ($other->week !== $current->week) { + return '[来週]dddd LT'; + } + + return 'dddd LT'; + }, + 'lastDay' => '[昨日] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $current, \Carbon\CarbonInterface $other) { + if ($other->week !== $current->week) { + return '[先週]dddd LT'; + } + + return 'dddd LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'日'; + default: + return $number; + } + }, + 'meridiem' => ['午前', '午後'], + 'months' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' => ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], + 'weekdays_short' => ['日', '月', '火', '水', '木', '金', '土'], + 'weekdays_min' => ['日', '月', '火', '水', '木', '金', '土'], + 'list' => '、', + 'alt_numbers' => ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '二十一', '二十二', '二十三', '二十四', '二十五', '二十六', '二十七', '二十八', '二十九', '三十', '三十一', '三十二', '三十三', '三十四', '三十五', '三十六', '三十七', '三十八', '三十九', '四十', '四十一', '四十二', '四十三', '四十四', '四十五', '四十六', '四十七', '四十八', '四十九', '五十', '五十一', '五十二', '五十三', '五十四', '五十五', '五十六', '五十七', '五十八', '五十九', '六十', '六十一', '六十二', '六十三', '六十四', '六十五', '六十六', '六十七', '六十八', '六十九', '七十', '七十一', '七十二', '七十三', '七十四', '七十五', '七十六', '七十七', '七十八', '七十九', '八十', '八十一', '八十二', '八十三', '八十四', '八十五', '八十六', '八十七', '八十八', '八十九', '九十', '九十一', '九十二', '九十三', '九十四', '九十五', '九十六', '九十七', '九十八', '九十九'], + 'alt_numbers_pow' => [ + 10000 => '万', + 1000 => '千', + 100 => '百', + ], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ka.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ka.php index a8dde7ebc768b3c38ae28b243a87694affcdef80..da05fbdaae7101293432db1d96062a0f3c505de0 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ka.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ka.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,191 @@ * 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 უკან', -); +/* + * Authors: + * - Tornike Razmadze + * - François B + * - Lasha Dolidze + * - Tim Fish + * - JD Isaacks + * - Tornike Razmadze + * - François B + * - Lasha Dolidze + * - JD Isaacks + * - LONGMAN + * - Avtandil Kikabidze (akalongman) + */ +return [ + 'year' => ':count წელი', + 'y' => ':count წელი', + 'a_year' => '{1}წელი|]1,Inf[:count წელი', + 'month' => ':count თვე', + 'm' => ':count თვე', + 'a_month' => '{1}თვე|]1,Inf[:count თვე', + 'week' => ':count კვირა', + 'w' => ':count კვირა', + 'a_week' => '{1}კვირა|]1,Inf[:count კვირა', + 'day' => ':count დღე', + 'd' => ':count დღე', + 'a_day' => '{1}დღე|]1,Inf[:count დღე', + 'hour' => ':count საათი', + 'h' => ':count საათი', + 'a_hour' => '{1}საათი|]1,Inf[:count საათი', + 'minute' => ':count წუთი', + 'min' => ':count წუთი', + 'a_minute' => '{1}წუთი|]1,Inf[:count წუთი', + 'second' => ':count წამი', + 's' => ':count წამი', + 'a_second' => '{1}რამდენიმე წამი|]1,Inf[:count წამი', + 'ago' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლის', + // month + 'თვე' => 'თვის', + // week + 'კვირა' => 'კვირის', + // day + 'დღე' => 'დღის', + // hour + 'საათი' => 'საათის', + // minute + 'წუთი' => 'წუთის', + // second + 'წამი' => 'წამის', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time წინ"; + }, + 'from_now' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წელიწადში', + // week + 'კვირა' => 'კვირაში', + // day + 'დღე' => 'დღეში', + // month + 'თვე' => 'თვეში', + // hour + 'საათი' => 'საათში', + // minute + 'წუთი' => 'წუთში', + // second + 'წამი' => 'წამში', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return $time; + }, + 'after' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლის', + // month + 'თვე' => 'თვის', + // week + 'კვირა' => 'კვირის', + // day + 'დღე' => 'დღის', + // hour + 'საათი' => 'საათის', + // minute + 'წუთი' => 'წუთის', + // second + 'წამი' => 'წამის', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time შემდეგ"; + }, + 'before' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლის', + // month + 'თვე' => 'თვის', + // week + 'კვირი' => 'კვირის', + // day + 'დღე' => 'დღის', + // hour + 'საათი' => 'საათის', + // minute + 'წუთი' => 'წუთის', + // second + 'წამი' => 'წამის', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time უკან"; + }, + 'diff_now' => 'ახლა', + 'diff_yesterday' => 'გუშინ', + 'diff_tomorrow' => 'ხვალ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[დღეს], LT[-ზე]', + 'nextDay' => '[ხვალ], LT[-ზე]', + 'nextWeek' => function (\Carbon\CarbonInterface $current, \Carbon\CarbonInterface $other) { + return ($current->isSameWeek($other) ? '' : '[შემდეგ] ').'dddd, LT[-ზე]'; + }, + 'lastDay' => '[გუშინ], LT[-ზე]', + 'lastWeek' => '[წინა] dddd, LT-ზე', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + if ($number === 0) { + return $number; + } + if ($number === 1) { + return $number.'-ლი'; + } + if (($number < 20) || ($number <= 100 && ($number % 20 === 0)) || ($number % 100 === 0)) { + return 'მე-'.$number; + } + + return $number.'-ე'; + }, + 'months' => ['იანვარს', 'თებერვალს', 'მარტს', 'აპრილის', 'მაისს', 'ივნისს', 'ივლისს', 'აგვისტს', 'სექტემბერს', 'ოქტომბერს', 'ნოემბერს', 'დეკემბერს'], + 'months_standalone' => ['იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'], + 'months_short' => ['იან', 'თებ', 'მარ', 'აპრ', 'მაი', 'ივნ', 'ივლ', 'აგვ', 'სექ', 'ოქტ', 'ნოე', 'დეკ'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['კვირას', 'ორშაბათს', 'სამშაბათს', 'ოთხშაბათს', 'ხუთშაბათს', 'პარასკევს', 'შაბათს'], + 'weekdays_standalone' => ['კვირა', 'ორშაბათი', 'სამშაბათი', 'ოთხშაბათი', 'ხუთშაბათი', 'პარასკევი', 'შაბათი'], + 'weekdays_short' => ['კვი', 'ორშ', 'სამ', 'ოთხ', 'ხუთ', 'პარ', 'შაბ'], + 'weekdays_min' => ['კვ', 'ორ', 'სა', 'ოთ', 'ხუ', 'პა', 'შა'], + 'weekdays_regexp' => '/^([^d].*|.*[^d])$/', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' და '], + 'meridiem' => function ($hour) { + if ($hour >= 4) { + if ($hour < 11) { + return 'დილის'; + } + + if ($hour < 16) { + return 'შუადღის'; + } + + if ($hour < 22) { + return 'საღამოს'; + } + } + + return 'ღამის'; + }, +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/kk.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/kk.php index 8d113afedeb0ddf4a4330cb608d5d39a7c6fcf46..50268470e073d4c2cd74b267582382e993f36743 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/kk.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/kk.php @@ -1,5 +1,6 @@ <?php -/* + +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -7,23 +8,92 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -return array( + +/* + * Authors: + * - Josh Soref + * - François B + * - Talat Uspanov + * - Нурлан Рахимжанов + * - Toleugazy Kali + */ +return [ 'year' => ':count жыл', - 'y' => ':count жыл', + 'a_year' => '{1}бір жыл|:count жыл', + 'y' => ':count ж.', 'month' => ':count ай', + 'a_month' => '{1}бір ай|:count ай', 'm' => ':count ай', 'week' => ':count апта', - 'w' => ':count апта', + 'a_week' => '{1}бір апта', + 'w' => ':count ап.', 'day' => ':count күн', - 'd' => ':count күн', + 'a_day' => '{1}бір күн|:count күн', + 'd' => ':count к.', 'hour' => ':count сағат', - 'h' => ':count сағат', + 'a_hour' => '{1}бір сағат|:count сағат', + 'h' => ':count са.', 'minute' => ':count минут', - 'min' => ':count минут', + 'a_minute' => '{1}бір минут|:count минут', + 'min' => ':count м.', 'second' => ':count секунд', - 's' => ':count секунд', + 'a_second' => '{1}бірнеше секунд|:count секунд', + 's' => ':count се.', 'ago' => ':time бұрын', - 'from_now' => ':time кейін', + 'from_now' => ':time ішінде', 'after' => ':time кейін', 'before' => ':time бұрын', -); + 'diff_now' => 'қазір', + 'diff_yesterday' => 'кеше', + 'diff_tomorrow' => 'ертең', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Бүгін сағат] LT', + 'nextDay' => '[Ертең сағат] LT', + 'nextWeek' => 'dddd [сағат] LT', + 'lastDay' => '[Кеше сағат] LT', + 'lastWeek' => '[Өткен аптаның] dddd [сағат] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + static $suffixes = [ + 0 => '-ші', + 1 => '-ші', + 2 => '-ші', + 3 => '-ші', + 4 => '-ші', + 5 => '-ші', + 6 => '-шы', + 7 => '-ші', + 8 => '-ші', + 9 => '-шы', + 10 => '-шы', + 20 => '-шы', + 30 => '-шы', + 40 => '-шы', + 50 => '-ші', + 60 => '-шы', + 70 => '-ші', + 80 => '-ші', + 90 => '-шы', + 100 => '-ші', + ]; + + return $number.($suffixes[$number] ?? $suffixes[$number % 10] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'months' => ['қаңтар', 'ақпан', 'наурыз', 'сәуір', 'мамыр', 'маусым', 'шілде', 'тамыз', 'қыркүйек', 'қазан', 'қараша', 'желтоқсан'], + 'months_short' => ['қаң', 'ақп', 'нау', 'сәу', 'мам', 'мау', 'шіл', 'там', 'қыр', 'қаз', 'қар', 'жел'], + 'weekdays' => ['жексенбі', 'дүйсенбі', 'сейсенбі', 'сәрсенбі', 'бейсенбі', 'жұма', 'сенбі'], + 'weekdays_short' => ['жек', 'дүй', 'сей', 'сәр', 'бей', 'жұм', 'сен'], + 'weekdays_min' => ['жк', 'дй', 'сй', 'ср', 'бй', 'жм', 'сн'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' және '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/km.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/km.php index a104e06ebb6a0f18c6eb8d7cc7bce1a774fa1e51..11d8c46b350a27898bb0315d57fe3e30fd4c5a6c 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/km.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/km.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,59 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count ឆ្នាំ', +/* + * Authors: + * - Kruy Vanna + * - Sereysethy Touch + * - JD Isaacks + * - Sovichet Tep + */ +return [ + 'year' => '{1}មួយឆ្នាំ|]1,Inf[:count ឆ្នាំ', 'y' => ':count ឆ្នាំ', - 'month' => ':count ខែ', + 'month' => '{1}មួយខែ|]1,Inf[:count ខែ', 'm' => ':count ខែ', 'week' => ':count សប្ដាហ៍', 'w' => ':count សប្ដាហ៍', - 'day' => ':count ថ្ងៃ', + 'day' => '{1}មួយថ្ងៃ|]1,Inf[:count ថ្ងៃ', 'd' => ':count ថ្ងៃ', - 'hour' => ':count ម៉ោង', + 'hour' => '{1}មួយម៉ោង|]1,Inf[:count ម៉ោង', 'h' => ':count ម៉ោង', - 'minute' => ':count នាទី', + 'minute' => '{1}មួយនាទី|]1,Inf[:count នាទី', 'min' => ':count នាទី', - 'second' => ':count វិនាទី', + 'second' => '{1}ប៉ុន្មានវិនាទី|]1,Inf[:count វិនាទី', 's' => ':count វិនាទី', 'ago' => ':timeមុន', - 'from_now' => ':timeពីឥឡូវ', + 'from_now' => ':timeទៀត', 'after' => 'នៅក្រោយ :time', 'before' => 'នៅមុន :time', -); + 'diff_now' => 'ឥឡូវ', + 'diff_yesterday' => 'ម្សិលមិញ', + 'diff_tomorrow' => 'ថ្ងៃស្អែក', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ថ្ងៃនេះ ម៉ោង] LT', + 'nextDay' => '[ស្អែក ម៉ោង] LT', + 'nextWeek' => 'dddd [ម៉ោង] LT', + 'lastDay' => '[ម្សិលមិញ ម៉ោង] LT', + 'lastWeek' => 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', + 'sameElse' => 'L', + ], + 'ordinal' => 'ទី:number', + 'meridiem' => ['ព្រឹក', 'ល្ងាច'], + 'months' => ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], + 'months_short' => ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], + 'weekdays' => ['អាទិត្យ', 'ច័ន្ទ', 'អង្គារ', 'ពុធ', 'ព្រហស្បតិ៍', 'សុក្រ', 'សៅរ៍'], + 'weekdays_short' => ['អា', 'ច', 'អ', 'ព', 'ព្រ', 'សុ', 'ស'], + 'weekdays_min' => ['អា', 'ច', 'អ', 'ព', 'ព្រ', 'សុ', 'ស'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', 'និង '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ko.php index 020916442d50fb9330b0da1bbcfb7150698ea3c5..f009c6df7781e3a9aac7fb72dace7700de29aee9 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ko.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ko.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,82 @@ * 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 초', +/* + * Authors: + * - Kunal Marwaha + * - FourwingsY + * - François B + * - Jason Katz-Brown + * - Seokjun Kim + * - Junho Kim + * - JD Isaacks + * - Juwon Kim + */ +return [ + 'year' => ':count년', + 'a_year' => '{1}일년|]1,Inf[:count년', + 'y' => ':count년', + 'month' => ':count개월', + 'a_month' => '{1}한달|]1,Inf[:count개월', + 'm' => ':count개월', + 'week' => ':count주', + 'a_week' => '{1}일주일|]1,Inf[:count 주', + 'w' => ':count주일', + 'day' => ':count일', + 'a_day' => '{1}하루|]1,Inf[:count일', + 'd' => ':count일', + 'hour' => ':count시간', + 'a_hour' => '{1}한시간|]1,Inf[:count시간', + 'h' => ':count시간', + 'minute' => ':count분', + 'a_minute' => '{1}일분|]1,Inf[:count분', + 'min' => ':count분', + 'second' => ':count초', + 'a_second' => '{1}몇초|]1,Inf[:count초', + 's' => ':count초', 'ago' => ':time 전', 'from_now' => ':time 후', - 'after' => ':time 이후', - 'before' => ':time 이전', -); + 'after' => ':time 후', + 'before' => ':time 전', + 'diff_now' => '지금', + 'diff_yesterday' => '어제', + 'diff_tomorrow' => '내일', + 'formats' => [ + 'LT' => 'A h:mm', + 'LTS' => 'A h:mm:ss', + 'L' => 'YYYY.MM.DD.', + 'LL' => 'YYYY년 MMMM D일', + 'LLL' => 'YYYY년 MMMM D일 A h:mm', + 'LLLL' => 'YYYY년 MMMM D일 dddd A h:mm', + ], + 'calendar' => [ + 'sameDay' => '오늘 LT', + 'nextDay' => '내일 LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '어제 LT', + 'lastWeek' => '지난주 dddd LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'일'; + case 'M': + return $number.'월'; + case 'w': + case 'W': + return $number.'주'; + default: + return $number; + } + }, + 'meridiem' => ['오전', '오후'], + 'months' => ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], + 'months_short' => ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], + 'weekdays' => ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], + 'weekdays_short' => ['일', '월', '화', '수', '목', '금', '토'], + 'weekdays_min' => ['일', '월', '화', '수', '목', '금', '토'], + 'list' => ' ', +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lt.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lt.php index 3f2fd1ec97403f3259cb069c7b2e39c97bd11ce2..66027f2005158504cf621ba0fec7af2653ef7785 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lt.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lt.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,30 +9,122 @@ * file that was distributed with this source code. */ -return array( - '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ų', +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - valdas406 + * - Justas Palumickas + * - Max Melentiev + * - Andrius Janauskas + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Laurynas Butkus + * - Sven Fuchs + * - Dominykas Tijūnaitis + * - Justinas Bolys + * - Ričardas + * - Kirill Chalkin + * - Rolandas + * - Justinas (Gamesh) + */ +return [ + 'year' => ':count metai|:count metai|:count metų', + 'y' => ':count m.', + 'month' => ':count mėnuo|:count mėnesiai|:count mėnesį', + 'm' => ':count mėn.', + 'week' => ':count savaitė|:count savaitės|:count savaitę', + 'w' => ':count sav.', + 'day' => ':count diena|:count dienos|:count dienų', + 'd' => ':count d.', + 'hour' => ':count valanda|:count valandos|:count valandų', + 'h' => ':count val.', + 'minute' => ':count minutė|:count minutės|:count minutę', + 'min' => ':count min.', + 'second' => ':count sekundė|:count sekundės|:count sekundžių', + 's' => ':count sek.', + + 'year_ago' => ':count metus|:count metus|:count metų', + 'month_ago' => ':count mėnesį|:count mėnesius|:count mėnesių', + 'week_ago' => ':count savaitę|:count savaites|:count savaičių', + 'day_ago' => ':count dieną|:count dienas|:count dienų', + 'hour_ago' => ':count valandą|:count valandas|:count valandų', + 'minute_ago' => ':count minutę|:count minutes|:count minučių', + 'second_ago' => ':count sekundę|:count sekundes|:count sekundžių', + 'year_from_now' => ':count metų', + 'month_from_now' => ':count mėnesio|:count mėnesių|:count mėnesių', + 'week_from_now' => ':count savaitės|:count savaičių|:count savaičių', + 'day_from_now' => ':count dienos|:count dienų|:count dienų', + 'hour_from_now' => ':count valandos|:count valandų|:count valandų', + 'minute_from_now' => ':count minutės|:count minučių|:count minučių', + 'second_from_now' => ':count sekundės|:count sekundžių|:count sekundžių', + + 'year_after' => ':count metų', + 'month_after' => ':count mėnesio|:count mėnesių|:count mėnesių', + 'week_after' => ':count savaitės|:count savaičių|:count savaičių', + 'day_after' => ':count dienos|:count dienų|:count dienų', + 'hour_after' => ':count valandos|:count valandų|:count valandų', + 'minute_after' => ':count minutės|:count minučių|:count minučių', + 'second_after' => ':count sekundės|:count sekundžių|:count sekundžių', + 'ago' => 'prieš :time', 'from_now' => 'už :time', 'after' => 'po :time', 'before' => ':time nuo dabar', -); + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'diff_now' => 'ką tik', + 'diff_yesterday' => 'vakar', + 'diff_tomorrow' => 'rytoj', + 'diff_before_yesterday' => 'užvakar', + 'diff_after_tomorrow' => 'poryt', + + 'period_recurrences' => 'kartą|:count kartų', + 'period_interval' => 'kiekvieną :interval', + 'period_start_date' => 'nuo :date', + 'period_end_date' => 'iki :date', + + 'months' => ['sausis', 'vasaris', 'kovas', 'balandis', 'gegužė', 'birželis', 'liepa', 'rugpjūtis', 'rugsėjis', 'spalis', 'lapkritis', 'gruodis'], + 'months_short' => ['sau', 'vas', 'kov', 'bal', 'geg', 'bir', 'lie', 'rgp', 'rgs', 'spa', 'lap', 'gru'], + 'weekdays' => ['sekmadienį', 'pirmadienį', 'antradienį', 'trečiadienį', 'ketvirtadienį', 'penktadienį', 'šeštadienį'], + 'weekdays_standalone' => ['sekmadienis', 'pirmadienis', 'antradienis', 'trečiadienis', 'ketvirtadienis', 'penktadienis', 'šeštadienis'], + 'weekdays_short' => ['sek', 'pir', 'ant', 'tre', 'ket', 'pen', 'šeš'], + 'weekdays_min' => ['se', 'pi', 'an', 'tr', 'ke', 'pe', 'še'], + 'list' => [', ', ' ir '], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Šiandien] LT', + 'nextDay' => '[Rytoj] LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '[Vakar] LT', + 'lastWeek' => '[Paskutinį] dddd LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + switch ($number) { + case 0: + return '0-is'; + case 3: + return '3-ias'; + default: + return "$number-as"; + } + }, + 'meridiem' => ['priešpiet', 'popiet'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lv.php index 363193db9afb853fc04ffff69c21ce5801a98832..3688bd395d337e228d57cbb84b02712315c972fe 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lv.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/lv.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,39 +9,106 @@ * file that was distributed with this source code. */ -return array( - 'year' => '0 gadiem|:count gada|:count gadiem', - 'y' => '0 gadiem|:count gada|:count gadiem', +/* + * Authors: + * - Philippe Vaucher + * - pirminis + * - Tsutomu Kuroda + * - tjku + * - Andris Zāģeris + * - Max Melentiev + * - Edgars Beigarts + * - Juanito Fatas + * - Vitauts Stočka + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Kaspars Bankovskis + * - Nicolás Hock Isaza + * - Viesturs Kavacs (Kavacky) + * - zakse + * - Janis Eglitis (janiseglitis) + * - Guntars + */ +return [ + 'year' => '0 gadiem|:count gads|:count gadiem', + 'y' => '0 gadiem|:count gads|:count gadiem', + 'a_year' => '{1}gads|0 gadiem|:count gads|: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', + 'm' => ':count mēn.', + 'a_month' => '{1}mēneša|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', + 'w' => ':count ned.', + 'a_week' => '{1}nedēļas|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', + 'a_day' => '{1}dienas|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', + 'h' => ':count st.', + 'a_hour' => '{1}stundas|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', + 'min' => ':count min.', + 'a_minute' => '{1}minūtes|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', + 's' => ':count sek.', + 'a_second' => '{1}dažas sekundes|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', + 'a_year_after' => '{1}gadu|0 gadus|:count gadu|:count gadus', 'month_after' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'a_month_after' => '{1}mēnesi|0 mēnešus|:count mēnesi|:count mēnešus', 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'a_week_after' => '{1}nedēļu|0 nedēļas|:count nedēļu|:count nedēļas', 'day_after' => '0 dienas|:count dienu|:count dienas', + 'a_day_after' => '{1}dienu|0 dienas|:count dienu|:count dienas', 'hour_after' => '0 stundas|:count stundu|:count stundas', + 'a_hour_after' => '{1}stundu|0 stundas|:count stundu|:count stundas', 'minute_after' => '0 minūtes|:count minūti|:count minūtes', + 'a_minute_after' => '{1}minūti|0 minūtes|:count minūti|:count minūtes', 'second_after' => '0 sekundes|:count sekundi|:count sekundes', + 'a_second_after' => '{1}sekundi|0 sekundes|:count sekundi|:count sekundes', 'year_before' => '0 gadus|:count gadu|:count gadus', + 'a_year_before' => '{1}gadu|0 gadus|:count gadu|:count gadus', 'month_before' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'a_month_before' => '{1}mēnesi|0 mēnešus|:count mēnesi|:count mēnešus', 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'a_week_before' => '{1}nedēļu|0 nedēļas|:count nedēļu|:count nedēļas', 'day_before' => '0 dienas|:count dienu|:count dienas', + 'a_day_before' => '{1}dienu|0 dienas|:count dienu|:count dienas', 'hour_before' => '0 stundas|:count stundu|:count stundas', + 'a_hour_before' => '{1}stundu|0 stundas|:count stundu|:count stundas', 'minute_before' => '0 minūtes|:count minūti|:count minūtes', + 'a_minute_before' => '{1}minūti|0 minūtes|:count minūti|:count minūtes', 'second_before' => '0 sekundes|:count sekundi|:count sekundes', -); + 'a_second_before' => '{1}sekundi|0 sekundes|:count sekundi|:count sekundes', + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' un '], + 'diff_now' => 'tagad', + 'diff_yesterday' => 'vakar', + 'diff_tomorrow' => 'rīt', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY.', + 'LL' => 'YYYY. [gada] D. MMMM', + 'LLL' => 'DD.MM.YYYY., HH:mm', + 'LLLL' => 'YYYY. [gada] D. MMMM, HH:mm', + ], + 'weekdays' => ['svētdiena', 'pirmdiena', 'otrdiena', 'trešdiena', 'ceturtdiena', 'piektdiena', 'sestdiena'], + 'weekdays_short' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], + 'weekdays_min' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], + 'months' => ['janvārī', 'februārī', 'martā', 'aprīlī', 'maijā', 'jūnijā', 'jūlijā', 'augustā', 'septembrī', 'oktobrī', 'novembrī', 'decembrī'], + 'months_short' => ['Janv', 'Feb', 'Mar', 'Apr', 'Mai', 'Jūn', 'Jūl', 'Aug', 'Sept', 'Okt', 'Nov', 'Dec'], + 'meridiem' => ['priekšpusdiena', 'pēcpusdiena'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mk.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mk.php index c5ec12df755095b34f7de44e539201b26e3a7917..975b1a4eea1f8801a51ba1f967d2b4db8192a10e 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mk.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mk.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,16 +9,101 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Sashko Todorov + * - Josh Soref + * - François B + * - Serhan Apaydın + * - Borislav Mickov + * - JD Isaacks + * - Tomi Atanasoski + */ +return [ 'year' => ':count година|:count години', + 'a_year' => 'година|:count години', + 'y' => ':count год.', 'month' => ':count месец|:count месеци', + 'a_month' => 'месец|:count месеци', + 'm' => ':count месец|:count месеци', 'week' => ':count седмица|:count седмици', + 'a_week' => 'седмица|:count седмици', + 'w' => ':count седмица|:count седмици', 'day' => ':count ден|:count дена', + 'a_day' => 'ден|:count дена', + 'd' => ':count ден|:count дена', 'hour' => ':count час|:count часа', + 'a_hour' => 'час|:count часа', + 'h' => ':count час|:count часа', 'minute' => ':count минута|:count минути', + 'a_minute' => 'минута|:count минути', + 'min' => ':count мин.', 'second' => ':count секунда|:count секунди', + 'a_second' => 'неколку секунди|:count секунди', + 's' => ':count сек.', 'ago' => 'пред :time', - 'from_now' => ':time од сега', + 'from_now' => 'после :time', 'after' => 'по :time', 'before' => 'пред :time', -); + 'diff_now' => 'сега', + 'diff_yesterday' => 'вчера', + 'diff_tomorrow' => 'утре', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Денес во] LT', + 'nextDay' => '[Утре во] LT', + 'nextWeek' => '[Во] dddd [во] LT', + 'lastDay' => '[Вчера во] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 3: + case 6: + return '[Изминатата] dddd [во] LT'; + default: + return '[Изминатиот] dddd [во] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + $last2Digits = $number % 100; + if ($number === 0) { + return $number.'-ев'; + } + if ($last2Digits === 0) { + return $number.'-ен'; + } + if ($last2Digits > 10 && $last2Digits < 20) { + return $number.'-ти'; + } + if ($lastDigit === 1) { + return $number.'-ви'; + } + if ($lastDigit === 2) { + return $number.'-ри'; + } + if ($lastDigit === 7 || $lastDigit === 8) { + return $number.'-ми'; + } + + return $number.'-ти'; + }, + 'months' => ['јануари', 'февруари', 'март', 'април', 'мај', 'јуни', 'јули', 'август', 'септември', 'октомври', 'ноември', 'декември'], + 'months_short' => ['јан', 'фев', 'мар', 'апр', 'мај', 'јун', 'јул', 'авг', 'сеп', 'окт', 'ное', 'дек'], + 'weekdays' => ['недела', 'понеделник', 'вторник', 'среда', 'четврток', 'петок', 'сабота'], + 'weekdays_short' => ['нед', 'пон', 'вто', 'сре', 'чет', 'пет', 'саб'], + 'weekdays_min' => ['нe', 'пo', 'вт', 'ср', 'че', 'пе', 'сa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mn.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mn.php index b26dce5571948d1b3af3310da1492cca63593b22..25f65b332cfc0975740e3bb23d314c522952612d 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mn.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/mn.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -12,7 +12,25 @@ * @translator Batmandakh Erdenebileg <batmandakh.e@icloud.com> */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Zolzaya Erdenebaatar + * - Tom Hughes + * - Akira Matsuda + * - Christopher Dell + * - Michael Kessler + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Ochirkhuyag + * - Batmandakh + */ +return [ 'year' => ':count жил', 'y' => ':count жил', 'month' => ':count сар', @@ -52,6 +70,7 @@ return array( 'hour_after' => ':count цагий', 'minute_after' => ':count минуты', 'second_after' => ':count секунды', + 'before' => ':timeн өмнө', 'year_before' => ':count жилий', 'month_before' => ':count сары', @@ -59,4 +78,24 @@ return array( 'hour_before' => ':count цагий', 'minute_before' => ':count минуты', 'second_before' => ':count секунды', -); + + 'list' => ', ', + 'diff_now' => 'одоо', + 'diff_yesterday' => 'өчигдөр', + 'diff_tomorrow' => 'маргааш', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY MMMM DD', + 'LLL' => 'YY-MM-DD, HH:mm', + 'LLLL' => 'YYYY MMMM DD, HH:mm', + ], + 'weekdays' => ['Ням', 'Даваа', 'Мягмар', 'Лхагва', 'Пүрэв', 'Баасан', 'Бямба'], + 'weekdays_short' => ['Ня', 'Да', 'Мя', 'Лх', 'Пү', 'Ба', 'Бя'], + 'weekdays_min' => ['Ня', 'Да', 'Мя', 'Лх', 'Пү', 'Ба', 'Бя'], + 'months' => ['1 сар', '2 сар', '3 сар', '4 сар', '5 сар', '6 сар', '7 сар', '8 сар', '9 сар', '10 сар', '11 сар', '12 сар'], + 'months_short' => ['1 сар', '2 сар', '3 сар', '4 сар', '5 сар', '6 сар', '7 сар', '8 сар', '9 сар', '10 сар', '11 сар', '12 сар'], + 'meridiem' => ['өглөө', 'орой'], + 'first_day_of_week' => 1, +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ms.php index ef574228aeb8a9a6c1236f7b21d3cc416911e23d..55368aa798a19a679690a17da6bfc4908529dd54 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ms.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ms.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,72 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count tahun', +/* + * Authors: + * - Josh Soref + * - Azri Jamil + * - JD Isaacks + * - Josh Soref + * - Azri Jamil + * - Hariadi Hinta + */ +return [ + 'year' => '{1}setahun|]1,Inf[:count tahun', 'y' => ':count tahun', - 'month' => ':count bulan', + 'month' => '{1}sebulan|]1,Inf[:count bulan', 'm' => ':count bulan', - 'week' => ':count minggu', + 'week' => '{1}seminggu|]1,Inf[:count minggu', 'w' => ':count minggu', - 'day' => ':count hari', + 'day' => '{1}sehari|]1,Inf[:count hari', 'd' => ':count hari', - 'hour' => ':count jam', + 'hour' => '{1}sejam|]1,Inf[:count jam', 'h' => ':count jam', - 'minute' => ':count minit', + 'minute' => '{1}seminit|]1,Inf[:count minit', 'min' => ':count minit', - 'second' => ':count saat', + 'second' => '{1}beberapa saat|]1,Inf[:count saat', 's' => ':count saat', - 'ago' => ':time yang lalu', + 'ago' => ':time yang lepas', 'from_now' => ':time dari sekarang', 'after' => ':time selepas', 'before' => ':time sebelum', -); + 'diff_now' => 'sekarang', + 'diff_yesterday' => 'semalam', + 'diff_tomorrow' => 'esok', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [pukul] HH.mm', + 'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm', + ], + 'calendar' => [ + 'sameDay' => '[Hari ini pukul] LT', + 'nextDay' => '[Esok pukul] LT', + 'nextWeek' => 'dddd [pukul] LT', + 'lastDay' => '[Kelmarin pukul] LT', + 'lastWeek' => 'dddd [lepas pukul] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 11) { + return 'pagi'; + } + if ($hour < 15) { + return 'tengahari'; + } + if ($hour < 19) { + return 'petang'; + } + + return 'malam'; + }, + 'months' => ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ogs', 'Sep', 'Okt', 'Nov', 'Dis'], + 'weekdays' => ['Ahad', 'Isnin', 'Selasa', 'Rabu', 'Khamis', 'Jumaat', 'Sabtu'], + 'weekdays_short' => ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'], + 'weekdays_min' => ['Ah', 'Is', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' dan '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/my.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/my.php index e8e491ecfce6d45787c84cd2f94732e182622523..ce4380022e133b7d42506a819b5780feedac9074 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/my.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/my.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,29 @@ * 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 စက္ကန့်', +/* + * Authors: + * - Josh Soref + * - JD Isaacks + * - Nay Lin Aung + */ +return [ + 'year' => '{1}တစ်နှစ်|]1,Inf[:count နှစ်', + 'y' => ':count နှစ်', + 'month' => '{1}တစ်လ|]1,Inf[:count လ', + 'm' => ':count လ', + 'week' => ':count ပတ်', + 'w' => ':count ပတ်', + 'day' => '{1}တစ်ရက်|]1,Inf[:count ရက်', + 'd' => ':count ရက်', + 'hour' => '{1}တစ်နာရီ|]1,Inf[:count နာရီ', + 'h' => ':count နာရီ', + 'minute' => '{1}တစ်မိနစ်|]1,Inf[:count မိနစ်', + 'min' => ':count မိနစ်', + 'second' => '{1}စက္ကန်.အနည်းငယ်|]1,Inf[:count စက္ကန့်', + 's' => ':count စက္ကန့်', 'ago' => 'လွန်ခဲ့သော :time က', - 'from_now' => 'ယခုမှစ၍နောက် :time အကြာ', + 'from_now' => 'လာမည့် :time မှာ', 'after' => ':time ကြာပြီးနောက်', 'before' => ':time မတိုင်ခင်', 'diff_now' => 'အခုလေးတင်', @@ -34,4 +40,29 @@ return array( 'diff_before_yesterday' => 'တမြန်နေ့က', 'diff_after_tomorrow' => 'တဘက်ခါ', 'period_recurrences' => ':count ကြိမ်', -); + 'formats' => [ + 'LT' => 'Oh:Om A', + 'LTS' => 'Oh:Om:Os A', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY Oh:Om A', + 'LLLL' => 'dddd OD MMMM OY Oh:Om A', + ], + 'calendar' => [ + 'sameDay' => '[ယနေ.] LT [မှာ]', + 'nextDay' => '[မနက်ဖြန်] LT [မှာ]', + 'nextWeek' => 'dddd LT [မှာ]', + 'lastDay' => '[မနေ.က] LT [မှာ]', + 'lastWeek' => '[ပြီးခဲ့သော] dddd LT [မှာ]', + 'sameElse' => 'L', + ], + 'months' => ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], + 'months_short' => ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'], + 'weekdays' => ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'], + 'weekdays_short' => ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], + 'weekdays_min' => ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'alt_numbers' => ['၀၀', '၀၁', '၀၂', '၀၃', '၀၄', '၀၅', '၀၆', '၀၇', '၀၈', '၀၉', '၁၀', '၁၁', '၁၂', '၁၃', '၁၄', '၁၅', '၁၆', '၁၇', '၁၈', '၁၉', '၂၀', '၂၁', '၂၂', '၂၃', '၂၄', '၂၅', '၂၆', '၂၇', '၂၈', '၂၉', '၃၀', '၃၁', '၃၂', '၃၃', '၃၄', '၃၅', '၃၆', '၃၇', '၃၈', '၃၉', '၄၀', '၄၁', '၄၂', '၄၃', '၄၄', '၄၅', '၄၆', '၄၇', '၄၈', '၄၉', '၅၀', '၅၁', '၅၂', '၅၃', '၅၄', '၅၅', '၅၆', '၅၇', '၅၈', '၅၉', '၆၀', '၆၁', '၆၂', '၆၃', '၆၄', '၆၅', '၆၆', '၆၇', '၆၈', '၆၉', '၇၀', '၇၁', '၇၂', '၇၃', '၇၄', '၇၅', '၇၆', '၇၇', '၇၈', '၇၉', '၈၀', '၈၁', '၈၂', '၈၃', '၈၄', '၈၅', '၈၆', '၈၇', '၈၈', '၈၉', '၉၀', '၉၁', '၉၂', '၉၃', '၉၄', '၉၅', '၉၆', '၉၇', '၉၈', '၉၉'], + 'meridiem' => ['နံနက်', 'ညနေ'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ne.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ne.php index 0b528dfa4df8be6cb53c84c24d7a68049934fdcf..3efafdbbe227c2cba123a6c574d0cca73b8bff76 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ne.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ne.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,73 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count वर्ष', +/* + * Authors: + * - nootanghimire + * - Josh Soref + * - Nj Subedi + * - JD Isaacks + */ +return [ + 'year' => 'एक बर्ष|:count बर्ष', 'y' => ':count वर्ष', - 'month' => ':count महिना', + 'month' => 'एक महिना|:count महिना', 'm' => ':count महिना', 'week' => ':count हप्ता', 'w' => ':count हप्ता', - 'day' => ':count दिन', + 'day' => 'एक दिन|:count दिन', 'd' => ':count दिन', - 'hour' => ':count घण्टा', + 'hour' => 'एक घण्टा|:count घण्टा', 'h' => ':count घण्टा', - 'minute' => ':count मिनेट', + 'minute' => 'एक मिनेट|:count मिनेट', 'min' => ':count मिनेट', - 'second' => ':count सेकेण्ड', + 'second' => 'केही क्षण|:count सेकेण्ड', 's' => ':count सेकेण्ड', - 'ago' => ':time पहिले', - 'from_now' => ':time देखि', + 'ago' => ':time अगाडि', + 'from_now' => ':timeमा', 'after' => ':time पछि', 'before' => ':time अघि', -); + 'diff_now' => 'अहिले', + 'diff_yesterday' => 'हिजो', + 'diff_tomorrow' => 'भोलि', + 'formats' => [ + 'LT' => 'Aको h:mm बजे', + 'LTS' => 'Aको h:mm:ss बजे', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, Aको h:mm बजे', + 'LLLL' => 'dddd, D MMMM YYYY, Aको h:mm बजे', + ], + 'calendar' => [ + 'sameDay' => '[आज] LT', + 'nextDay' => '[भोलि] LT', + 'nextWeek' => '[आउँदो] dddd[,] LT', + 'lastDay' => '[हिजो] LT', + 'lastWeek' => '[गएको] dddd[,] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 3) { + return 'राति'; + } + if ($hour < 12) { + return 'बिहान'; + } + if ($hour < 16) { + return 'दिउँसो'; + } + if ($hour < 20) { + return 'साँझ'; + } + + return 'राति'; + }, + 'months' => ['जनवरी', 'फेब्रुवरी', 'मार्च', 'अप्रिल', 'मई', 'जुन', 'जुलाई', 'अगष्ट', 'सेप्टेम्बर', 'अक्टोबर', 'नोभेम्बर', 'डिसेम्बर'], + 'months_short' => ['जन.', 'फेब्रु.', 'मार्च', 'अप्रि.', 'मई', 'जुन', 'जुलाई.', 'अग.', 'सेप्ट.', 'अक्टो.', 'नोभे.', 'डिसे.'], + 'weekdays' => ['आइतबार', 'सोमबार', 'मङ्गलबार', 'बुधबार', 'बिहिबार', 'शुक्रबार', 'शनिबार'], + 'weekdays_short' => ['आइत.', 'सोम.', 'मङ्गल.', 'बुध.', 'बिहि.', 'शुक्र.', 'शनि.'], + 'weekdays_min' => ['आ.', 'सो.', 'मं.', 'बु.', 'बि.', 'शु.', 'श.'], + 'list' => [', ', ' र '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/nl.php index ec5a88edf9dfd0b76c9671a336d9c30f90eb53d1..c1785284cee43a97030db9c3e7cb8e19af1aa85c 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/nl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/nl.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,21 +9,52 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count jaar', - 'y' => ':count jaar', +/* + * Authors: + * - Roy + * - Stephan + * - François B + * - Tim Fish + * - Kevin Huang + * - Jacob Middag + * - JD Isaacks + * - Roy + * - Stephan + * - François B + * - Tim Fish + * - Jacob Middag + * - JD Isaacks + * - Propaganistas + * - MegaXLR + * - adriaanzon + * - MonkeyPhysics + * - JeroenG + * - RikSomers + * - proclame + * - Rik de Groot (hwdegroot) + */ +return [ + 'year' => ':count jaar|:count jaar', + 'a_year' => 'een jaar|:count jaar', + 'y' => ':countj', 'month' => ':count maand|:count maanden', - 'm' => ':count maand|:count maanden', + 'a_month' => 'een maand|:count maanden', + 'm' => ':countmnd', 'week' => ':count week|:count weken', - 'w' => ':count week|:count weken', + 'a_week' => 'een week|:count weken', + 'w' => ':countw', 'day' => ':count dag|:count dagen', - 'd' => ':count dag|:count dagen', - 'hour' => ':count uur', - 'h' => ':count uur', + 'a_day' => 'een dag|:count dagen', + 'd' => ':countd', + 'hour' => ':count uur|:count uur', + 'a_hour' => 'een uur|:count uur', + 'h' => ':countu', 'minute' => ':count minuut|:count minuten', - 'min' => ':count minuut|:count minuten', + 'a_minute' => 'een minuut|:count minuten', + 'min' => ':countmin', 'second' => ':count seconde|:count seconden', - 's' => ':count seconde|:count seconden', + 'a_second' => 'een paar seconden|:count seconden', + 's' => ':counts', 'ago' => ':time geleden', 'from_now' => 'over :time', 'after' => ':time later', @@ -33,4 +64,46 @@ return array( 'diff_tomorrow' => 'morgen', 'diff_after_tomorrow' => 'overmorgen', 'diff_before_yesterday' => 'eergisteren', -); + 'period_recurrences' => ':count keer', + 'period_interval' => function ($interval) { + /** @var string $output */ + $output = preg_replace('/^(een|één|1)\s+/', '', $interval); + + if (preg_match('/^(een|één|1)( jaar|j| uur|u)/', $interval)) { + return "elk $output"; + } + + return "elke $output"; + }, + 'period_start_date' => 'van :date', + 'period_end_date' => 'tot :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[vandaag om] LT', + 'nextDay' => '[morgen om] LT', + 'nextWeek' => 'dddd [om] LT', + 'lastDay' => '[gisteren om] LT', + 'lastWeek' => '[afgelopen] dddd [om] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.(($number === 1 || $number === 8 || $number >= 20) ? 'ste' : 'de'); + }, + 'months' => ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'mmm_suffix' => '.', + 'weekdays' => ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + 'weekdays_short' => ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'], + 'weekdays_min' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' en '], + 'meridiem' => ['\'s ochtends', '\'s middags'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/no.php index a6ece06a0b81b1ebcf4f633564bb436a64b7c26a..f4497c7596091413fa5a6fa283c54d7e2d5030aa 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/no.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/no.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,28 +9,20 @@ * file that was distributed with this source code. */ -return array( - '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', -); +/* + * Authors: + * - Daniel S. Billing + * - Paul + * - Jimmie Johansson + * - Jens Herlevsen + */ +return array_replace_recursive(require __DIR__.'/nb.php', [ + 'formats' => [ + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'nextWeek' => 'på dddd [kl.] LT', + 'lastWeek' => '[i] dddd[s kl.] LT', + ], +]); diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/oc.php index e89e94c3b6e1385787e584e59e7296ecea8c706b..af8f814c831e816c6c39f94c02ebae1c1a30db55 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/oc.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,27 +9,42 @@ * file that was distributed with this source code. */ -\Symfony\Component\Translation\PluralizationRules::set(function ($number) { - return $number == 1 ? 0 : 1; -}, 'oc'); +/* + * Authors: + * - Quentí + */ +// @codeCoverageIgnoreStart +if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { + \Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return $number == 1 ? 0 : 1; + }, 'oc'); +} +// @codeCoverageIgnoreEnd -return array( +return [ 'year' => ':count an|:count ans', + 'a_year' => 'un an|:count ans', 'y' => ':count an|:count ans', 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', 'm' => ':count mes|:count meses', 'week' => ':count setmana|:count setmanas', + 'a_week' => 'una setmana|:count setmanas', 'w' => ':count setmana|:count setmanas', 'day' => ':count jorn|:count jorns', + 'a_day' => 'un jorn|:count jorns', 'd' => ':count jorn|:count jorns', 'hour' => ':count ora|:count oras', + 'a_hour' => 'una ora|:count oras', 'h' => ':count ora|:count oras', 'minute' => ':count minuta|:count minutas', + 'a_minute' => 'una minuta|:count minutas', 'min' => ':count minuta|:count minutas', 'second' => ':count segonda|:count segondas', + 'a_second' => 'una segonda|:count segondas', 's' => ':count segonda|:count segondas', 'ago' => 'fa :time', - 'from_now' => 'dins :time', + 'from_now' => 'd\'aquí :time', 'after' => ':time aprèp', 'before' => ':time abans', 'diff_now' => 'ara meteis', @@ -41,4 +56,42 @@ return array( 'period_interval' => 'cada :interval', 'period_start_date' => 'de :date', 'period_end_date' => 'fins a :date', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [de] YYYY', + 'LLL' => 'D MMMM [de] YYYY [a] H:mm', + 'LLLL' => 'dddd D MMMM [de] YYYY [a] H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Uèi a] LT', + 'nextDay' => '[Deman a] LT', + 'nextWeek' => 'dddd [a] LT', + 'lastDay' => '[Ièr a] LT', + 'lastWeek' => 'dddd [passat a] LT', + 'sameElse' => 'L', + ], + 'months' => ['de genièr', 'de febrièr', 'de març', 'd\'abrial', 'de mai', 'de junh', 'de julhet', 'd\'agost', 'de setembre', 'd’octòbre', 'de novembre', 'de decembre'], + 'months_standalone' => ['genièr', 'febrièr', 'març', 'abrial', 'mai', 'junh', 'julh', 'agost', 'setembre', 'octòbre', 'novembre', 'decembre'], + 'months_short' => ['gen.', 'feb.', 'març', 'abr.', 'mai', 'junh', 'julh', 'ago.', 'sep.', 'oct.', 'nov.', 'dec.'], + 'weekdays' => ['dimenge', 'diluns', 'dimars', 'dimècres', 'dijòus', 'divendres', 'dissabte'], + 'weekdays_short' => ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], + 'weekdays_min' => ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], + 'ordinal' => function ($number, $period) { + return $number.( + ($period === 'w' || $period === 'W') ? 'a' : ( + ($number === 1) ? 'r' : ( + ($number === 2) ? 'n' : ( + ($number === 3) ? 'r' : ( + ($number === 4) ? 't' : 'è' + ) + ) + ) + ) + ); + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pl.php index 2308af2d0a878ebffd94ed7ff60597b1ed0776c2..4ee70a51e891d83da37e8e5a1f36b2a21ed07384 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,47 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Wacław Jacek + * - François B + * - Tim Fish + * - Serhan Apaydın + * - Massimiliano Caniparoli + * - JD Isaacks + * - Jakub Szwacz + * - Jan + * - Paul + * - damlys + * - Marek (marast78) + * - Peter (UnrulyNatives) + * - Qrzysio + * - Jan (aso824) + */ +return [ 'year' => ':count rok|:count lata|:count lat', - 'y' => ':countr|:countl', + 'a_year' => 'rok|:count lata|:count lat', + 'y' => ':count r|:count l', 'month' => ':count miesiąc|:count miesiące|:count miesięcy', - 'm' => ':countmies', + 'a_month' => 'miesiąc|:count miesiące|:count miesięcy', + 'm' => ':count mies.', 'week' => ':count tydzień|:count tygodnie|:count tygodni', - 'w' => ':counttyg', + 'a_week' => 'tydzień|:count tygodnie|:count tygodni', + 'w' => ':count tyg.', 'day' => ':count dzień|:count dni|:count dni', - 'd' => ':countd', + 'a_day' => 'dzień|:count dni|:count dni', + 'd' => ':count d', 'hour' => ':count godzina|:count godziny|:count godzin', - 'h' => ':countg', + 'a_hour' => 'godzina|:count godziny|:count godzin', + 'h' => ':count godz.', 'minute' => ':count minuta|:count minuty|:count minut', - 'min' => ':countm', + 'a_minute' => 'minuta|:count minuty|:count minut', + 'min' => ':count min.', 'second' => ':count sekunda|:count sekundy|:count sekund', - 's' => ':counts', + 'a_second' => '{1}kilka sekund|:count sekunda|:count sekundy|:count sekund', + 's' => ':count sek.', 'ago' => ':time temu', - 'from_now' => ':time od teraz', + 'from_now' => 'za :time', 'after' => ':time po', 'before' => ':time przed', 'diff_now' => 'przed chwilą', @@ -33,4 +57,56 @@ return array( 'diff_tomorrow' => 'jutro', 'diff_before_yesterday' => 'przedwczoraj', 'diff_after_tomorrow' => 'pojutrze', -); + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Dziś o] LT', + 'nextDay' => '[Jutro o] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[W niedzielę o] LT'; + case 2: + return '[We wtorek o] LT'; + case 3: + return '[W środę o] LT'; + case 6: + return '[W sobotę o] LT'; + default: + return '[W] dddd [o] LT'; + } + }, + 'lastDay' => '[Wczoraj o] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[W zeszłą niedzielę o] LT'; + case 3: + return '[W zeszłą środę o] LT'; + case 6: + return '[W zeszłą sobotę o] LT'; + default: + return '[W zeszły] dddd [o] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia'], + 'months_standalone' => ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'], + 'months_short' => ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'], + 'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'], + 'weekdays_short' => ['ndz', 'pon', 'wt', 'śr', 'czw', 'pt', 'sob'], + 'weekdays_min' => ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' i '], + 'meridiem' => ['przed południem', 'po południu'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ps.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ps.php index 15c3296e2439eb912866cecfcd21fbdab81a8c2a..a928b28e37005ae4f6f69596e4f6d47862b7a14a 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ps.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ps.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,12 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Muhammad Nasir Rahimi + * - Nassim Nasibullah (spinzar) + */ +return [ 'year' => ':count کال|:count کاله', 'y' => ':countکال|:countکاله', 'month' => ':count مياشت|:count مياشتي', @@ -28,4 +33,23 @@ return array( 'from_now' => ':time له اوس څخه', 'after' => ':time وروسته', 'before' => ':time دمخه', -); + 'list' => ['، ', ' او '], + 'meridiem' => ['غ.م.', 'غ.و.'], + 'weekdays' => ['اتوار', 'ګل', 'نهه', 'شورو', 'زيارت', 'جمعه', 'خالي'], + 'weekdays_short' => ['ا', 'ګ', 'ن', 'ش', 'ز', 'ج', 'خ'], + 'weekdays_min' => ['ا', 'ګ', 'ن', 'ش', 'ز', 'ج', 'خ'], + 'months' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سېپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سېپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_standalone' => ['جنوري', 'فېبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short_standalone' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'first_day_of_week' => 6, + 'weekend' => [4, 5], + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'YYYY/M/d', + 'LL' => 'YYYY MMM D', + 'LLL' => 'د YYYY د MMMM D H:mm', + 'LLLL' => 'dddd د YYYY د MMMM D H:mm', + ], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt.php index 392b12159db274f6c502b84ed549a3363176d95f..728650ead61570323788657867cea6adbaeab350 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,86 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Cassiano Montanari + * - Matt Pope + * - François B + * - Prodis + * - JD Isaacks + * - Raphael Amorim + * - João Magalhães + * - victortobias + * - Paulo Freitas + * - Sebastian Thierer + * - Claudson Martins (claudsonm) + */ +return [ 'year' => ':count ano|:count anos', - 'y' => ':count ano|:count anos', + 'a_year' => 'um ano|:count anos', + 'y' => ':counta', 'month' => ':count mês|:count meses', - 'm' => ':count mês|:count meses', + 'a_month' => 'um mês|:count meses', + 'm' => ':countm', 'week' => ':count semana|:count semanas', - 'w' => ':count semana|:count semanas', + 'a_week' => 'uma semana|:count semanas', + 'w' => ':countsem', 'day' => ':count dia|:count dias', - 'd' => ':count dia|:count dias', + 'a_day' => 'um dia|:count dias', + 'd' => ':countd', 'hour' => ':count hora|:count horas', - 'h' => ':count hora|:count horas', + 'a_hour' => 'uma hora|:count horas', + 'h' => ':counth', 'minute' => ':count minuto|:count minutos', - 'min' => ':count minuto|:count minutos', + 'a_minute' => 'um minuto|:count minutos', + 'min' => ':countmin', 'second' => ':count segundo|:count segundos', - 's' => ':count segundo|:count segundos', - 'ago' => ':time atrás', + 'a_second' => 'alguns segundos|:count segundos', + 's' => ':counts', + 'ago' => 'há :time', 'from_now' => 'em :time', 'after' => ':time depois', 'before' => ':time antes', -); + 'diff_now' => 'agora', + 'diff_yesterday' => 'ontem', + 'diff_tomorrow' => 'amanhã', + 'diff_before_yesterday' => 'anteontem', + 'diff_after_tomorrow' => 'depois de amanhã', + 'period_recurrences' => 'uma vez|:count vezes', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'até :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY HH:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hoje às] LT', + 'nextDay' => '[Amanhã às] LT', + 'nextWeek' => 'dddd [às] LT', + 'lastDay' => '[Ontem às] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 6: + return '[Último] dddd [às] LT'; + default: + return '[Última] dddd [às] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], + 'months_short' => ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'], + 'weekdays' => ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'], + 'weekdays_short' => ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'], + 'weekdays_min' => ['Do', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php index 1f84eac5f50288d74db77f90c676374aadc4453b..e917c5cde30fbfdd71619ad8facd6d0bf70046c4 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,32 +9,31 @@ * file that was distributed with this source code. */ -return array( - '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ã', +/* + * Authors: + * - Cassiano Montanari + * - Eduardo Dalla Vecchia + * - David Rodrigues + * - Matt Pope + * - François B + * - Prodis + * - Marlon Maxwel + * - JD Isaacks + * - Raphael Amorim + * - Rafael Raupp + * - felipeleite1 + * - swalker + * - Lucas Macedo + * - Paulo Freitas + * - Sebastian Thierer + */ +return array_replace_recursive(require __DIR__.'/pt.php', [ 'period_recurrences' => 'uma|:count vez', 'period_interval' => 'toda :interval', - 'period_start_date' => 'de :date', - 'period_end_date' => 'até :date', -); + 'formats' => [ + 'LLL' => 'D [de] MMMM [de] YYYY [às] HH:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY [às] HH:mm', + ], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ro.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ro.php index cc1672406f40112b519bb60be79c55fdf281b49e..03022d191b5e59f4d91292302e35cb661f92f3c6 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ro.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ro.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,65 @@ * file that was distributed with this source code. */ -return array( - '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', +/* + * Authors: + * - Josh Soref + * - JD Isaacks + * - Cătălin Georgescu + * - Valentin Ivaşcu (oriceon) + */ +return [ + 'year' => ':count an|:count ani|:count ani', + 'a_year' => 'un an|:count ani|:count ani', + 'y' => ':count a.', + 'month' => ':count lună|:count luni|:count luni', + 'a_month' => 'o lună|:count luni|:count luni', + 'm' => ':count l.', + 'week' => ':count săptămână|:count săptămâni|:count săptămâni', + 'a_week' => 'o săptămână|:count săptămâni|:count săptămâni', + 'w' => ':count săp.', + 'day' => ':count zi|:count zile|:count zile', + 'a_day' => 'o zi|:count zile|:count zile', + 'd' => ':count z.', + 'hour' => ':count oră|:count ore|:count ore', + 'a_hour' => 'o oră|:count ore|:count ore', + 'h' => ':count o.', + 'minute' => ':count minut|:count minute|:count minute', + 'a_minute' => 'un minut|:count minute|:count minute', + 'min' => ':count m.', + 'second' => ':count secundă|:count secunde|:count secunde', + 'a_second' => 'câteva secunde|:count secunde|:count secunde', + 's' => ':count sec.', + 'ago' => ':time în urmă', + 'from_now' => 'peste :time', 'after' => 'peste :time', 'before' => 'acum :time', -); + 'diff_now' => 'acum', + 'diff_yesterday' => 'ieri', + 'diff_tomorrow' => 'mâine', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[azi la] LT', + 'nextDay' => '[mâine la] LT', + 'nextWeek' => 'dddd [la] LT', + 'lastDay' => '[ieri la] LT', + 'lastWeek' => '[fosta] dddd [la] LT', + 'sameElse' => 'L', + ], + 'months' => ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], + 'months_short' => ['ian.', 'feb.', 'mar.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'], + 'weekdays' => ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'], + 'weekdays_short' => ['dum', 'lun', 'mar', 'mie', 'joi', 'vin', 'sâm'], + 'weekdays_min' => ['du', 'lu', 'ma', 'mi', 'jo', 'vi', 'sâ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' și '], + 'meridiem' => ['a.m.', 'p.m.'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ru.php index 6a83fb131ad89a1320ace2e8f5942caff2917c74..2daea3d6c557f518a19be8b770991d25850bac9f 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ru.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ru.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,176 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Bari Badamshin + * - Jørn Ølmheim + * - François B + * - Tim Fish + * - Коренберг Марк (imac) + * - Serhan Apaydın + * - RomeroMsk + * - vsn4ik + * - JD Isaacks + * - Bari Badamshin + * - Jørn Ølmheim + * - François B + * - Коренберг Марк (imac) + * - Serhan Apaydın + * - RomeroMsk + * - vsn4ik + * - JD Isaacks + * - Fellzo + * - andrey-helldar + * - Pavel Skripkin (psxx) + * - AlexWalkerson + * - Vladislav UnsealedOne + * - dima-bzz + */ +$transformDiff = function ($input) { + return strtr($input, [ + 'неделя' => 'неделю', + 'секунда' => 'секунду', + 'минута' => 'минуту', + ]); +}; + +return [ 'year' => ':count год|:count года|:count лет', - 'y' => ':count г|:count г|:count л', + 'y' => ':count г.|:count г.|:count л.', + 'a_year' => '{1}год|:count год|:count года|:count лет', 'month' => ':count месяц|:count месяца|:count месяцев', - 'm' => ':count м|:count м|:count м', - 'week' => ':count неделю|:count недели|:count недель', - 'w' => ':count н|:count н|:count н', + 'm' => ':count мес.', + 'a_month' => '{1}месяц|:count месяц|:count месяца|:count месяцев', + 'week' => ':count неделя|:count недели|:count недель', + 'w' => ':count нед.', + 'a_week' => '{1}неделя|:count неделю|:count недели|:count недель', 'day' => ':count день|:count дня|:count дней', - 'd' => ':count д|:count д|:count д', + 'd' => ':count д.', + 'a_day' => '{1}день|: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 до', -); + 'h' => ':count ч.', + 'a_hour' => '{1}час|:count час|:count часа|:count часов', + 'minute' => ':count минута|:count минуты|:count минут', + 'min' => ':count мин.', + 'a_minute' => '{1}минута|:count минута|:count минуты|:count минут', + 'second' => ':count секунда|:count секунды|:count секунд', + 's' => ':count сек.', + 'a_second' => '{1}несколько секунд|:count секунду|:count секунды|:count секунд', + 'ago' => function ($time) use ($transformDiff) { + return $transformDiff($time).' назад'; + }, + 'from_now' => function ($time) use ($transformDiff) { + return 'через '.$transformDiff($time); + }, + 'after' => function ($time) use ($transformDiff) { + return $transformDiff($time).' после'; + }, + 'before' => function ($time) use ($transformDiff) { + return $transformDiff($time).' до'; + }, + 'diff_now' => 'только что', + 'diff_yesterday' => 'вчера', + 'diff_tomorrow' => 'завтра', + 'diff_before_yesterday' => 'позавчера', + 'diff_after_tomorrow' => 'послезавтра', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY г.', + 'LLL' => 'D MMMM YYYY г., H:mm', + 'LLLL' => 'dddd, D MMMM YYYY г., H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Сегодня, в] LT', + 'nextDay' => '[Завтра, в] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $current, \Carbon\CarbonInterface $other) { + if ($current->week !== $other->week) { + switch ($current->dayOfWeek) { + case 0: + return '[В следующее] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В следующий] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В следующую] dddd, [в] LT'; + } + } + + if ($current->dayOfWeek === 2) { + return '[Во] dddd, [в] LT'; + } + + return '[В] dddd, [в] LT'; + }, + 'lastDay' => '[Вчера, в] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $current, \Carbon\CarbonInterface $other) { + if ($current->week !== $other->week) { + switch ($current->dayOfWeek) { + case 0: + return '[В прошлое] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В прошлый] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В прошлую] dddd, [в] LT'; + } + } + + if ($current->dayOfWeek === 2) { + return '[Во] dddd, [в] LT'; + } + + return '[В] dddd, [в] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'M': + case 'd': + case 'DDD': + return $number.'-й'; + case 'D': + return $number.'-го'; + case 'w': + case 'W': + return $number.'-я'; + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ночи'; + } + if ($hour < 12) { + return 'утра'; + } + if ($hour < 17) { + return 'дня'; + } + + return 'вечера'; + }, + 'months' => ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'], + 'months_standalone' => ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'мая', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'months_short_standalone' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['воскресенье', 'понедельник', 'вторник', 'среду', 'четверг', 'пятницу', 'субботу'], + 'weekdays_standalone' => ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'], + 'weekdays_short' => ['вск', 'пнд', 'втр', 'срд', 'чтв', 'птн', 'сбт'], + 'weekdays_min' => ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'weekdays_regexp' => '/\[\s*(В|в)\s*((?:прошлую|следующую|эту)\s*)?\]\s*dddd/', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sh.php index 57f287a7c616a981ecde1fd54fe97d7e690d7197..aaf82026baa2eccd926e2f6b8a1e1d2f8b35b015 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sh.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,28 +8,58 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ +// @codeCoverageIgnoreStart +if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { + \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'); +} +// @codeCoverageIgnoreEnd -\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( +/* + * Authors: + * - Томица Кораћ + * - Enrique Vidal + * - Christopher Dell + * - dmilisic + * - danijel + * - Miroslav Matkovic (mikki021) + */ +return [ + 'diff_now' => 'sada', + 'diff_yesterday' => 'juče', + 'diff_tomorrow' => 'sutra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'MMMM D, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], 'year' => ':count godina|:count godine|:count godina', - 'y' => ':count godina|:count godine|:count godina', + 'y' => ':count g.', 'month' => ':count mesec|:count meseca|:count meseci', - 'm' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count m.', 'week' => ':count nedelja|:count nedelje|:count nedelja', - 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count n.', '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', + 'd' => ':count d.', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count č.', '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', + 'min' => ':count min.', + 'second' => ':count sekund|:count sekunde|:count sekundi', + 's' => ':count s.', 'ago' => 'pre :time', 'from_now' => 'za :time', 'after' => 'nakon :time', 'before' => ':time raniјe', -); + 'weekdays' => ['Nedelja', 'Ponedeljak', 'Utorak', 'Sreda', 'Četvrtak', 'Petak', 'Subota'], + 'weekdays_short' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'], + 'weekdays_min' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'], + 'months' => ['Januar', 'Februar', 'Mart', 'April', 'Maj', 'Jun', 'Jul', 'Avgust', 'Septembar', 'Oktobar', 'Novembar', 'Decembar'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'], + 'list' => [', ', ' i '], + 'meridiem' => ['pre podne', 'po podne'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sk.php index 61013448d3616b7464d160c4ae741c8a4da3f35f..fd0f6b3e9aebf422cd16934f5fd151d5151433e4 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sk.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sk.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,21 +9,44 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Martin Suja + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Ivan Stana + * - Akira Matsuda + * - Christopher Dell + * - James McKinney + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Jozef Fulop + * - Nicolás Hock Isaza + * - Tom Hughes + * - Simon Hürlimann (CyT) + * - jofi + * - Jakub ADAMEC + * - Marek Adamický + */ +return [ 'year' => 'rok|:count roky|:count rokov', - 'y' => 'rok|:count roky|:count rokov', + 'y' => ':count r', 'month' => 'mesiac|:count mesiace|:count mesiacov', - 'm' => 'mesiac|:count mesiace|:count mesiacov', + 'm' => ':count m', 'week' => 'týždeň|:count týždne|:count týždňov', - 'w' => 'týždeň|:count týždne|:count týždňov', + 'w' => ':count t', 'day' => 'deň|:count dni|:count dní', - 'd' => 'deň|:count dni|:count dní', + 'd' => ':count d', 'hour' => 'hodinu|:count hodiny|:count hodín', - 'h' => 'hodinu|:count hodiny|:count hodín', + 'h' => ':count h', 'minute' => 'minútu|:count minúty|:count minút', - 'min' => 'minútu|:count minúty|:count minút', + 'min' => ':count min', 'second' => 'sekundu|:count sekundy|:count sekúnd', - 's' => 'sekundu|:count sekundy|:count sekúnd', + 's' => ':count s', 'ago' => 'pred :time', 'from_now' => 'za :time', 'after' => 'o :time neskôr', @@ -35,4 +58,24 @@ return array( 'hour_ago' => 'hodinou|:count hodinami|:count hodinami', 'minute_ago' => 'minútou|:count minútami|:count minútami', 'second_ago' => 'sekundou|:count sekundami|:count sekundami', -); + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' a '], + 'diff_now' => 'teraz', + 'diff_yesterday' => 'včera', + 'diff_tomorrow' => 'zajtra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'DD. MMMM YYYY', + 'LLL' => 'D. M. HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY HH:mm', + ], + 'weekdays' => ['nedeľa', 'pondelok', 'utorok', 'streda', 'štvrtok', 'piatok', 'sobota'], + 'weekdays_short' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'], + 'weekdays_min' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'], + 'months' => ['január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'máj', 'jún', 'júl', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'meridiem' => ['dopoludnia', 'popoludní'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sl.php index 06686d1354dd706f625911762718a193d75bb0e9..320975fcf2d39183770a557dc68e397aeb820d03 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,35 +9,114 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Miha Rebernik + * - Gal Jakič (morpheus7CS) + * - Glavić + * - Anže Časar + * - Lovro Tramšek (Lovro1107) + * - burut13 + */ +return [ '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', + 'm' => ':count mes.', 'week' => ':count teden|:count tedna|:count tedne|:count tednov', - 'w' => ':count teden|:count tedna|:count tedne|:count tednov', + 'w' => ':count ted.', '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', + 'hour' => ':count ura|:count uri|:count ure|:count ur', + 'h' => ':count h', + 'minute' => ':count minuta|:count minuti|:count minute|:count minut', + 'min' => ':count min.', + 'second' => ':count sekunda|:count sekundi|:count sekunde|:count sekund', + 'a_second' => '{1}nekaj sekund|:count sekunda|:count sekundi|:count sekunde|:count sekund', + 's' => ':count s', + 'year_ago' => ':count letom|:count leti|:count leti|:count leti', + 'y_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', + 'd_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', + + 'day_from_now' => ':count dan|:count dneva|:count dni|:count dni', + 'd_from_now' => ':count dan|:count dneva|:count dni|:count dni', + 'hour_from_now' => ':count uro|:count uri|:count ure|:count ur', + 'minute_from_now' => ':count minuto|:count minuti|:count minute|:count minut', + 'second_from_now' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + 'ago' => 'pred :time', 'from_now' => 'čez :time', - 'after' => 'čez :time', - 'before' => 'pred :time', + 'after' => ':time kasneje', + 'before' => ':time prej', + 'diff_now' => 'ravnokar', 'diff_yesterday' => 'včeraj', 'diff_tomorrow' => 'jutri', 'diff_before_yesterday' => 'predvčerajšnjim', 'diff_after_tomorrow' => 'pojutrišnjem', -); + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'period_start_date' => 'od :date', + 'period_end_date' => 'do :date', + + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danes ob] LT', + 'nextDay' => '[jutri ob] LT', + 'nextWeek' => 'dddd [ob] LT', + 'lastDay' => '[včeraj ob] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[preteklo] [nedeljo] [ob] LT'; + case 1: + return '[pretekli] [ponedeljek] [ob] LT'; + case 2: + return '[pretekli] [torek] [ob] LT'; + case 3: + return '[preteklo] [sredo] [ob] LT'; + case 4: + return '[pretekli] [četrtek] [ob] LT'; + case 5: + return '[pretekli] [petek] [ob] LT'; + case 6: + return '[preteklo] [soboto] [ob] LT'; + } + }, + 'sameElse' => 'L', + ], + 'months' => ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'], + 'weekdays_short' => ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'], + 'weekdays_min' => ['ne', 'po', 'to', 'sr', 'če', 'pe', 'so'], + 'list' => [', ', ' in '], + 'meridiem' => ['dopoldan', 'popoldan'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sq.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sq.php index 6e138a0412e78138e0699eaee892f7a326b70fef..ed1eab4912bb53cb30ba9f884d82e5b5a13622f0 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sq.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sq.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,67 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - François B + * - JD Isaacks + * - Fadion Dashi + */ +return [ '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ë', + 'a_year' => 'një vit|:count vite', + 'y' => ':count v.', + 'month' => ':count muaj', + 'a_month' => 'një muaj|:count muaj', + 'm' => ':count muaj', + 'week' => ':count javë', + 'a_week' => ':count javë|:count javë', + 'w' => ':count j.', + 'day' => ':count ditë', + 'a_day' => 'një ditë|:count ditë', + 'd' => ':count d.', + 'hour' => ':count orë', + 'a_hour' => 'një orë|:count orë', + 'h' => ':count o.', 'minute' => ':count minutë|:count minuta', - 'min' => ':count minutë|:count minuta', + 'a_minute' => 'një minutë|:count minuta', + 'min' => ':count min.', 'second' => ':count sekondë|:count sekonda', - 's' => ':count sekondë|:count sekonda', + 'a_second' => 'disa sekonda|:count sekonda', + 's' => ':count s.', 'ago' => ':time më parë', - 'from_now' => ':time nga tani', + 'from_now' => 'në :time', 'after' => ':time pas', 'before' => ':time para', -); + 'diff_now' => 'tani', + 'diff_yesterday' => 'dje', + 'diff_tomorrow' => 'nesër', + 'diff_before_yesterday' => 'pardje', + 'diff_after_tomorrow' => 'pasnesër', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Sot në] LT', + 'nextDay' => '[Nesër në] LT', + 'nextWeek' => 'dddd [në] LT', + 'lastDay' => '[Dje në] LT', + 'lastWeek' => 'dddd [e kaluar në] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'meridiem' => ['PD', 'MD'], + 'months' => ['janar', 'shkurt', 'mars', 'prill', 'maj', 'qershor', 'korrik', 'gusht', 'shtator', 'tetor', 'nëntor', 'dhjetor'], + 'months_short' => ['jan', 'shk', 'mar', 'pri', 'maj', 'qer', 'kor', 'gus', 'sht', 'tet', 'nën', 'dhj'], + 'weekdays' => ['e diel', 'e hënë', 'e martë', 'e mërkurë', 'e enjte', 'e premte', 'e shtunë'], + 'weekdays_short' => ['die', 'hën', 'mar', 'mër', 'enj', 'pre', 'sht'], + 'weekdays_min' => ['d', 'h', 'ma', 'më', 'e', 'p', 'sh'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' dhe '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr.php index 5a1064212ec756a20e3a281e8261eba7dbc7017a..41232c81eeb82b66ff00f4c28e9eae7e45672420 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,29 +9,97 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + * - Milos Sakovic + */ +return [ 'year' => ':count godina|:count godine|:count godina', - 'y' => ':count godina|:count godine|:count godina', + 'y' => ':count g.', 'month' => ':count mesec|:count meseca|:count meseci', - 'm' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mj.', 'week' => ':count nedelja|:count nedelje|:count nedelja', - 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count ned.', 'day' => ':count dan|:count dana|:count dana', - 'd' => ':count dan|:count dana|:count dana', + 'd' => ':count d.', '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', + 'h' => ':count č.', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count min.', + 'second' => ':count sekundu|:count sekunde|:count sekundi', + 's' => ':count sek.', 'ago' => 'pre :time', - 'from_now' => ':time od sada', + 'from_now' => 'za :time', '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', + 'year_from_now' => ':count godinu|:count godine|:count godina', + 'year_ago' => ':count godinu|:count godine|:count godina', + 'week_from_now' => ':count nedelju|:count nedelje|:count nedelja', + 'week_ago' => ':count nedelju|:count nedelje|:count nedelja', - '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_now' => 'upravo sada', + 'diff_yesterday' => 'juče', + 'diff_tomorrow' => 'sutra', + 'diff_before_yesterday' => 'prekjuče', + 'diff_after_tomorrow' => 'preksutra', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danas u] LT', + 'nextDay' => '[sutra u] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u nedelju u] LT'; + case 3: + return '[u sredu u] LT'; + case 6: + return '[u subotu u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastDay' => '[juče u] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[prošle nedelje u] LT'; + case 1: + return '[prošlog ponedeljka u] LT'; + case 2: + return '[prošlog utorka u] LT'; + case 3: + return '[prošle srede u] LT'; + case 4: + return '[prošlog četvrtka u] LT'; + case 5: + return '[prošlog petka u] LT'; + default: + return '[prošle subote u] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], + 'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'], + 'weekdays_min' => ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php index 2db83edd9e33e2ca82f9ebdeb53fb5d01c04770c..af64d8b13d026d281dbc9c80ffcd8847028e3924 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -1,43 +1,105 @@ <?php -/* +/** * This file is part of the Carbon package. * - * (c) Nikola Zeravcic <office@bytenet.rs> + * (c) Brian Nesbitt <brian@nesbot.com> * * 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 година', +/* + * Authors: + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + * - Nikola Zeravcic + * - Milos Sakovic + */ +return [ + '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 месеци', + 'month' => '{1}:count месец|{2,3,4}:count месеца|[0,Inf[:count месеци', 'm' => ':count м.', - 'week' => '{1} :count недеља|{2,3,4}:count недеље|[5,Inf[ :count недеља', + 'week' => '{1}:count недеља|{2,3,4}:count недеље|[0,Inf[:count недеља', 'w' => ':count нед.', - 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', 'd' => ':count д.', - 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', + 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'minute' => '{1,21,31,41,51}:count минут|[0,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 секунди', + 'second' => '{1,21,31,41,51}:count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[0,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 недеља', - + '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 године|[0,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 године|[0,Inf[:count година', + 'week_from_now' => '{1}:count недељу|{2,3,4}:count недеље|[0,Inf[:count недеља', + 'week_ago' => '{1}:count недељу|{2,3,4}:count недеље|[0,Inf[:count недеља', 'diff_now' => 'управо сада', 'diff_yesterday' => 'јуче', 'diff_tomorrow' => 'сутра', 'diff_before_yesterday' => 'прекјуче', 'diff_after_tomorrow' => 'прекосутра', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[данас у] LT', + 'nextDay' => '[сутра у] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[у недељу у] LT'; + case 3: + return '[у среду у] LT'; + case 6: + return '[у суботу у] LT'; + default: + return '[у] dddd [у] LT'; + } + }, + 'lastDay' => '[јуче у] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[прошле недеље у] LT'; + case 1: + return '[прошлог понедељка у] LT'; + case 2: + return '[прошлог уторка у] LT'; + case 3: + return '[прошле среде у] LT'; + case 4: + return '[прошлог четвртка у] LT'; + case 5: + return '[прошлог петка у] LT'; + default: + return '[прошле суботе у] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], + 'months_short' => ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'], + 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'], + 'weekdays_min' => ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php index 18214c44c3c8a0a7416539acfb302c46a58e0699..e819c5e2353715df2abb1c3e3fe5349f07799fcb 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,35 +9,94 @@ * 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 година', +/* + * Authors: + * - Glavić + * - Milos Sakovic + */ +return [ + '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 мјесеци', + 'month' => '{1}:count мјесец|{2,3,4}:count мјесеца|[0,Inf[:count мјесеци', 'm' => ':count мј.', - 'week' => '{1} :count недјеља|{2,3,4}:count недјеље|[5,Inf[ :count недјеља', + 'week' => '{1}:count недјеља|{2,3,4}:count недјеље|[0,Inf[:count недјеља', 'w' => ':count нед.', - 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', 'd' => ':count д.', - 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', + 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'minute' => '{1,21,31,41,51}:count минут|[0,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 секунди', + 'second' => '{1,21,31,41,51}:count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[0,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 година', + '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 године|[0,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 године|[0,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 недјеља', + 'week_from_now' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', + 'week_ago' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', 'diff_now' => 'управо сада', 'diff_yesterday' => 'јуче', 'diff_tomorrow' => 'сутра', 'diff_before_yesterday' => 'прекјуче', 'diff_after_tomorrow' => 'прекосјутра', -); + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[данас у] LT', + 'nextDay' => '[сутра у] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[у недељу у] LT'; + case 3: + return '[у среду у] LT'; + case 6: + return '[у суботу у] LT'; + default: + return '[у] dddd [у] LT'; + } + }, + 'lastDay' => '[јуче у] LT', + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[прошле недеље у] LT'; + case 1: + return '[прошлог понедељка у] LT'; + case 2: + return '[прошлог уторка у] LT'; + case 3: + return '[прошле среде у] LT'; + case 4: + return '[прошлог четвртка у] LT'; + case 5: + return '[прошлог петка у] LT'; + default: + return '[прошле суботе у] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], + 'months_short' => ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'], + 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'], + 'weekdays_min' => ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php index 2d2e28814d2c26df1561a54d95de453178df1cc5..de20f21cdb1d06bafff5b14430bd8de6ffcaecba 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,35 +9,55 @@ * 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.', +/* + * Authors: + * - Glavić + * - Milos Sakovic + */ +return array_replace_recursive(require __DIR__.'/sr.php', [ + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'second' => ':count sekund|:count sekunde|:count sekundi', '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', -); + 'week_from_now' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'week_ago' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'diff_tomorrow' => 'sjutra', + 'calendar' => [ + 'nextDay' => '[sjutra u] LT', + 'nextWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u nedjelju u] LT'; + case 3: + return '[u srijedu u] LT'; + case 6: + return '[u subotu u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastWeek' => function (\Carbon\CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[prošle nedjelje u] LT'; + case 1: + return '[prošle nedjelje u] LT'; + case 2: + return '[prošlog utorka u] LT'; + case 3: + return '[prošle srijede u] LT'; + case 4: + return '[prošlog četvrtka u] LT'; + case 5: + return '[prošlog petka u] LT'; + default: + return '[prošle subote u] LT'; + } + }, + ], + 'weekdays' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'], +]); diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php index 7ebf6f041e7002ce02fa03cb713520e2e0621dd5..b668ee1ba796fe538cf66e17b4f4ceedc0c4d2f3 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,5 +8,4 @@ * 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/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sv.php index 89a03b432287cee6c754c2d42de7612e5a62df54..7b50932875622161340b01172175e722243be48a 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sv.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sv.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,76 @@ * file that was distributed with this source code. */ -return array( - 'year' => ':count år|:count år', - 'y' => ':count år|:count år', +/* + * Authors: + * - François B + * - Kristoffer Snabb + * - JD Isaacks + * - Jens Herlevsen + * - Nightpine + * - Anders Nygren (litemerafrukt) + */ +return [ + 'year' => ':count år', + 'a_year' => 'ett år|:count år', + 'y' => ':count år', 'month' => ':count månad|:count månader', - 'm' => ':count månad|:count månader', + 'a_month' => 'en månad|:count månader', + 'm' => ':count mån', 'week' => ':count vecka|:count veckor', - 'w' => ':count vecka|:count veckor', + 'a_week' => 'en vecka|:count veckor', + 'w' => ':count v', 'day' => ':count dag|:count dagar', - 'd' => ':count dag|:count dagar', + 'a_day' => 'en dag|:count dagar', + 'd' => ':count dgr', 'hour' => ':count timme|:count timmar', - 'h' => ':count timme|:count timmar', + 'a_hour' => 'en timme|:count timmar', + 'h' => ':count tim', 'minute' => ':count minut|:count minuter', - 'min' => ':count minut|:count minuter', + 'a_minute' => 'en minut|:count minuter', + 'min' => ':count min', 'second' => ':count sekund|:count sekunder', - 's' => ':count sekund|:count sekunder', - 'ago' => ':time sedan', + 'a_second' => 'några sekunder|:count sekunder', + 's' => ':count s', + 'ago' => 'för :time sedan', 'from_now' => 'om :time', 'after' => ':time efter', 'before' => ':time före', -); + 'diff_now' => 'nu', + 'diff_yesterday' => 'i går', + 'diff_tomorrow' => 'i morgon', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [kl.] HH:mm', + 'LLLL' => 'dddd D MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[I dag] LT', + 'nextDay' => '[I morgon] LT', + 'nextWeek' => '[På] dddd LT', + 'lastDay' => '[I går] LT', + 'lastWeek' => '[I] dddd[s] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + + return $number.( + (~~($number % 100 / 10) === 1) ? 'e' : ( + ($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e' + ) + ); + }, + 'months' => ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'], + 'weekdays_short' => ['sön', 'mån', 'tis', 'ons', 'tors', 'fre', 'lör'], + 'weekdays_min' => ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' och '], + 'meridiem' => ['fm', 'em'], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sw.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sw.php index 52f03429efb41417c9816225b352b1fdde8a1a67..a8ecfcab42148b0fd586729054e1c64a795f609f 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sw.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/sw.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,63 @@ * 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', +/* + * Authors: + * - leyluj + * - Josh Soref + * - ryanhart2 + */ +return [ + 'year' => 'mwaka :count|miaka :count', + 'a_year' => 'mwaka mmoja|miaka :count', + 'y' => 'mwaka :count|miaka :count', + 'month' => 'mwezi :count|miezi :count', + 'a_month' => 'mwezi mmoja|miezi :count', + 'm' => 'mwezi :count|miezi :count', + 'week' => 'wiki :count', + 'a_week' => 'wiki mmoja|wiki :count', + 'w' => 'w. :count', + 'day' => 'siku :count', + 'a_day' => 'siku moja|masiku :count', + 'd' => 'si. :count', + 'hour' => 'saa :count|masaa :count', + 'a_hour' => 'saa limoja|masaa :count', + 'h' => 'saa :count|masaa :count', + 'minute' => 'dakika :count', + 'a_minute' => 'dakika moja|dakika :count', + 'min' => 'd. :count', + 'second' => 'sekunde :count', + 'a_second' => 'hivi punde|sekunde :count', + 's' => 'se. :count', + 'ago' => 'tokea :time', + 'from_now' => ':time baadaye', 'after' => ':time baada', 'before' => ':time kabla', -); + 'diff_now' => 'sasa hivi', + 'diff_yesterday' => 'jana', + 'diff_tomorrow' => 'kesho', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[leo saa] LT', + 'nextDay' => '[kesho saa] LT', + 'nextWeek' => '[wiki ijayo] dddd [saat] LT', + 'lastDay' => '[jana] LT', + 'lastWeek' => '[wiki iliyopita] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpl', 'Jtat', 'Jnne', 'Jtan', 'Alh', 'Ijm', 'Jmos'], + 'weekdays_min' => ['J2', 'J3', 'J4', 'J5', 'Al', 'Ij', 'J1'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' na '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/th.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/th.php index 88bb4ac40cccd479c54487c07d162fab3ca47825..02d5a178d96e8f24bd44977ef1e9a736c13e4f51 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/th.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/th.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,7 +9,18 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Nate Whittaker + * - John MacAslan + * - Chanintorn Asavavichairoj + * - JD Isaacks + * - ROKAISAKKON + * - RO'KAISAKKON + * - Andreas Möller + * - nithisa + */ +return [ 'year' => ':count ปี', 'y' => ':count ปี', 'month' => ':count เดือน', @@ -23,9 +34,36 @@ return array( 'minute' => ':count นาที', 'min' => ':count นาที', 'second' => ':count วินาที', + 'a_second' => '{1}ไม่กี่วินาที|]1,Inf[:count วินาที', 's' => ':count วินาที', 'ago' => ':timeที่แล้ว', - 'from_now' => ':timeต่อจากนี้', + 'from_now' => 'อีก :time', 'after' => ':timeหลังจากนี้', 'before' => ':timeก่อน', -); + 'diff_now' => 'ขณะนี้', + 'diff_yesterday' => 'เมื่อวาน', + 'diff_tomorrow' => 'พรุ่งนี้', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY เวลา H:mm', + 'LLLL' => 'วันddddที่ D MMMM YYYY เวลา H:mm', + ], + 'calendar' => [ + 'sameDay' => '[วันนี้ เวลา] LT', + 'nextDay' => '[พรุ่งนี้ เวลา] LT', + 'nextWeek' => 'dddd[หน้า เวลา] LT', + 'lastDay' => '[เมื่อวานนี้ เวลา] LT', + 'lastWeek' => '[วัน]dddd[ที่แล้ว เวลา] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ก่อนเที่ยง', 'หลังเที่ยง'], + 'months' => ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], + 'months_short' => ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'], + 'weekdays' => ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'], + 'weekdays_short' => ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'], + 'weekdays_min' => ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'], + 'list' => [', ', ' และ '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/tr.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/tr.php index 6a9dfed8700548b27c62e4684066c9d50eba6b7c..528ff3a8bc2f88788ff926848d5f9d12c5f167d9 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/tr.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/tr.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,110 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - Josh Soref + * - Alan Agius + * - Erhan Gundogan + * - François B + * - JD Isaacks + * - Murat Yüksel + * - Baran Şengül + * - Selami (selamialtin) + * - TeomanBey + */ +return [ 'year' => ':count yıl', - 'y' => ':count yıl', + 'a_year' => '{1}bir yıl|]1,Inf[:count yıl', + 'y' => ':county', 'month' => ':count ay', - 'm' => ':count ay', + 'a_month' => '{1}bir ay|]1,Inf[:count ay', + 'm' => ':countay', 'week' => ':count hafta', - 'w' => ':count hafta', + 'a_week' => '{1}bir hafta|]1,Inf[:count hafta', + 'w' => ':counth', 'day' => ':count gün', - 'd' => ':count gün', + 'a_day' => '{1}bir gün|]1,Inf[:count gün', + 'd' => ':countg', 'hour' => ':count saat', - 'h' => ':count saat', + 'a_hour' => '{1}bir saat|]1,Inf[:count saat', + 'h' => ':countsa', 'minute' => ':count dakika', - 'min' => ':count dakika', + 'a_minute' => '{1}bir dakika|]1,Inf[:count dakika', + 'min' => ':countdk', 'second' => ':count saniye', - 's' => ':count saniye', + 'a_second' => '{1}birkaç saniye|]1,Inf[:count saniye', + 's' => ':countsn', 'ago' => ':time önce', 'from_now' => ':time sonra', 'after' => ':time sonra', 'before' => ':time önce', -); + 'diff_now' => 'şimdi', + 'diff_yesterday' => 'dün', + 'diff_tomorrow' => 'yarın', + 'diff_before_yesterday' => 'evvelsi gün', + 'diff_after_tomorrow' => 'öbür gün', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[bugün saat] LT', + 'nextDay' => '[yarın saat] LT', + 'nextWeek' => '[gelecek] dddd [saat] LT', + 'lastDay' => '[dün] LT', + 'lastWeek' => '[geçen] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return $number; + default: + if ($number === 0) { // special case for zero + return "$number'ıncı"; + } + + static $suffixes = [ + 1 => '\'inci', + 5 => '\'inci', + 8 => '\'inci', + 70 => '\'inci', + 80 => '\'inci', + 2 => '\'nci', + 7 => '\'nci', + 20 => '\'nci', + 50 => '\'nci', + 3 => '\'üncü', + 4 => '\'üncü', + 100 => '\'üncü', + 6 => '\'ncı', + 9 => '\'uncu', + 10 => '\'uncu', + 30 => '\'uncu', + 60 => '\'ıncı', + 90 => '\'ıncı', + ]; + + $lastDigit = $number % 10; + + return $number.($suffixes[$lastDigit] ?? $suffixes[$number % 100 - $lastDigit] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + } + }, + 'meridiem' => ['ÖÖ', 'ÖS', 'öö', 'ös'], + 'months' => ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], + 'months_short' => ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'], + 'weekdays' => ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], + 'weekdays_short' => ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'], + 'weekdays_min' => ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ve '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uk.php index 8d08eaa4e8940382e63438b07f14bdcd2fe54c53..6ca025d6650f2bf681d0b49ffdbc98e52e5e44f2 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uk.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,24 +8,101 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ +$processHoursFunction = function (\Carbon\CarbonInterface $date, string $format) { + return $format.'о'.($date->hour === 11 ? 'б' : '').'] LT'; +}; -return array( +/* + * Authors: + * - Kunal Marwaha + * - Josh Soref + * - François B + * - Tim Fish + * - Serhan Apaydın + * - Max Mykhailenko + * - JD Isaacks + * - Max Kovpak + * - AucT + * - Philippe Vaucher + * - Ilya Shaplyko + * - Vadym Ievsieiev + * - Denys Kurets + * - Igor Kasyanchuk + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Oleh + * - epaminond + * - Juanito Fatas + * - Vitalii Khustochka + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Andriy Tyurnikov + * - Nicolás Hock Isaza + * - Iwakura Taro + * - Andrii Ponomarov + * - alecrabbit + * - vystepanenko + * - AlexWalkerson + * - Andre Havryliuk (Andrend) + * - Max Datsenko (datsenko-md) + */ +return [ 'year' => ':count рік|:count роки|:count років', - 'y' => ':count рік|:count роки|:count років', + 'y' => ':countр', + 'a_year' => '{1}рік|:count рік|:count роки|:count років', 'month' => ':count місяць|:count місяці|:count місяців', - 'm' => ':count місяць|:count місяці|:count місяців', + 'm' => ':countм', + 'a_month' => '{1}місяць|:count місяць|:count місяці|:count місяців', 'week' => ':count тиждень|:count тижні|:count тижнів', - 'w' => ':count тиждень|:count тижні|:count тижнів', + 'w' => ':countт', + 'a_week' => '{1}тиждень|:count тиждень|:count тижні|:count тижнів', 'day' => ':count день|:count дні|:count днів', - 'd' => ':count день|:count дні|:count днів', + 'd' => ':countд', + 'a_day' => '{1}день|: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 секунд', + 'h' => ':countг', + 'a_hour' => '{1}година|:count година|:count години|:count годин', + 'minute' => ':count хвилина|:count хвилини|:count хвилин', + 'min' => ':countхв', + 'a_minute' => '{1}хвилина|:count хвилина|:count хвилини|:count хвилин', + 'second' => ':count секунда|:count секунди|:count секунд', + 's' => ':countсек', + 'a_second' => '{1}кілька секунд|:count секунда|:count секунди|:count секунд', + + 'hour_ago' => ':count годину|:count години|:count годин', + 'a_hour_ago' => '{1}годину|:count годину|:count години|:count годин', + 'minute_ago' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_ago' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_ago' => ':count секунду|:count секунди|:count секунд', + 'a_second_ago' => '{1}кілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_from_now' => ':count годину|:count години|:count годин', + 'a_hour_from_now' => '{1}годину|:count годину|:count години|:count годин', + 'minute_from_now' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_from_now' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_from_now' => ':count секунду|:count секунди|:count секунд', + 'a_second_from_now' => '{1}кілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_after' => ':count годину|:count години|:count годин', + 'a_hour_after' => '{1}годину|:count годину|:count години|:count годин', + 'minute_after' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_after' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_after' => ':count секунду|:count секунди|:count секунд', + 'a_second_after' => '{1}кілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_before' => ':count годину|:count години|:count годин', + 'a_hour_before' => '{1}годину|:count годину|:count години|:count годин', + 'minute_before' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_before' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_before' => ':count секунду|:count секунди|:count секунд', + 'a_second_before' => '{1}кілька секунд|:count секунду|:count секунди|:count секунд', + 'ago' => ':time тому', - 'from_now' => 'через :time', + 'from_now' => 'за :time', 'after' => ':time після', 'before' => ':time до', 'diff_now' => 'щойно', @@ -37,4 +114,91 @@ return array( 'period_interval' => 'кожні :interval', 'period_start_date' => 'з :date', 'period_end_date' => 'до :date', -); + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], + 'calendar' => [ + 'sameDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Сьогодні '); + }, + 'nextDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Завтра '); + }, + 'nextWeek' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[У] dddd ['); + }, + 'lastDay' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Вчора '); + }, + 'lastWeek' => function (\Carbon\CarbonInterface $date) use ($processHoursFunction) { + switch ($date->dayOfWeek) { + case 0: + case 3: + case 5: + case 6: + return $processHoursFunction($date, '[Минулої] dddd ['); + default: + return $processHoursFunction($date, '[Минулого] dddd ['); + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return $number.'-й'; + case 'D': + return $number.'-го'; + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ночі'; + } + if ($hour < 12) { + return 'ранку'; + } + if ($hour < 17) { + return 'дня'; + } + + return 'вечора'; + }, + 'months' => ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'], + 'months_standalone' => ['січень', 'лютий', 'березень', 'квітень', 'травень', 'червень', 'липень', 'серпень', 'вересень', 'жовтень', 'листопад', 'грудень'], + 'months_short' => ['січ', 'лют', 'бер', 'кві', 'тра', 'чер', 'лип', 'сер', 'вер', 'жов', 'лис', 'гру'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => function (\Carbon\CarbonInterface $date, $format, $index) { + static $words = [ + 'nominative' => ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'], + 'accusative' => ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'], + 'genitive' => ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'], + ]; + + $nounCase = preg_match('/(\[(В|в|У|у)\])\s+dddd/', $format) + ? 'accusative' + : ( + preg_match('/\[?(?:минулої|наступної)?\s*\]\s+dddd/', $format) + ? 'genitive' + : 'nominative' + ); + + return $words[$nounCase][$index] ?? null; + }, + 'weekdays_short' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'weekdays_min' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ur.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ur.php index 3c5f7ed91b49ae5029db77a8ce8a5a900f3302e4..272f0b650c08cf439bd8c6e2d6f74d64d3862618 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ur.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/ur.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -8,17 +8,82 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ +$months = [ + 'جنوری', + 'فروری', + 'مارچ', + 'اپریل', + 'مئی', + 'جون', + 'جولائی', + 'اگست', + 'ستمبر', + 'اکتوبر', + 'نومبر', + 'دسمبر', +]; + +$weekdays = [ + 'اتوار', + 'پیر', + 'منگل', + 'بدھ', + 'جمعرات', + 'جمعہ', + 'ہفتہ', +]; -return array( - 'year' => ':count سال', - 'month' => ':count ماه', +/* + * Authors: + * - Sawood Alam + * - Mehshan + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Zaid Akram + * - Max Melentiev + * - hafezdivandari + * - Hossein Jabbari + * - nimamo + */ +return [ + 'year' => 'ایک سال|:count سال', + 'month' => 'ایک ماہ|:count ماہ', 'week' => ':count ہفتے', - 'day' => ':count روز', - 'hour' => ':count گھنٹے', - 'minute' => ':count منٹ', - 'second' => ':count سیکنڈ', - 'ago' => ':time پہلے', + 'day' => 'ایک دن|:count دن', + 'hour' => 'ایک گھنٹہ|:count گھنٹے', + 'minute' => 'ایک منٹ|:count منٹ', + 'second' => 'چند سیکنڈ|:count سیکنڈ', + 'ago' => ':time قبل', 'from_now' => ':time بعد', 'after' => ':time بعد', 'before' => ':time پہلے', -); + 'diff_now' => 'اب', + 'diff_yesterday' => 'گزشتہ کل', + 'diff_tomorrow' => 'آئندہ کل', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd، D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[آج بوقت] LT', + 'nextDay' => '[کل بوقت] LT', + 'nextWeek' => 'dddd [بوقت] LT', + 'lastDay' => '[گذشتہ روز بوقت] LT', + 'lastWeek' => '[گذشتہ] dddd [بوقت] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['صبح', 'شام'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => $weekdays, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => ['، ', ' اور '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uz.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uz.php index 1cb6f713ec4575dde1d4c98d35ef1a2c0e58a2b1..69361a1753a8d6b0cd2fb8502acc6a69e00ea5a2 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uz.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/uz.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,73 @@ * file that was distributed with this source code. */ -return array( - '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', -); +/* + * Authors: + * - Dmitriy Shabanov + * - JD Isaacks + * - Inoyatulloh + * - Jamshid + * - aarkhipov + * - Philippe Vaucher + * - felixthemagnificent + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Alisher Ulugbekov + */ +return [ + 'year' => ':count йил', + 'a_year' => '{1}бир йил|:count йил', + 'y' => ':count й', + 'month' => ':count ой', + 'a_month' => '{1}бир ой|:count ой', + 'm' => ':count о', + 'week' => ':count ҳафта', + 'a_week' => '{1}бир ҳафта|:count ҳафта', + 'w' => ':count ҳ', + 'day' => ':count кун', + 'a_day' => '{1}бир кун|:count кун', + 'd' => ':count к', + 'hour' => ':count соат', + 'a_hour' => '{1}бир соат|:count соат', + 'h' => ':count с', + 'minute' => ':count дакика', + 'a_minute' => '{1}бир дакика|:count дакика', + 'min' => ':count д', + 'second' => ':count фурсат', + 'a_second' => '{1}фурсат|:count фурсат', + 's' => ':count ф', + 'ago' => 'Бир неча :time олдин', + 'from_now' => 'Якин :time ичида', + 'after' => ':time пас аз он', + 'before' => ':time пеш аз он', + 'diff_now' => 'hozir', + 'diff_yesterday' => 'Кеча', + 'diff_tomorrow' => 'Эртага', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'D MMMM YYYY, dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Бугун соат] LT [да]', + 'nextDay' => '[Эртага] LT [да]', + 'nextWeek' => 'dddd [куни соат] LT [да]', + 'lastDay' => '[Кеча соат] LT [да]', + 'lastWeek' => '[Утган] dddd [куни соат] LT [да]', + 'sameElse' => 'L', + ], + 'months' => ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['якшанба', 'душанба', 'сешанба', 'чоршанба', 'пайшанба', 'жума', 'шанба'], + 'weekdays_short' => ['якш', 'душ', 'сеш', 'чор', 'пай', 'жум', 'шан'], + 'weekdays_min' => ['як', 'ду', 'се', 'чо', 'па', 'жу', 'ша'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ertalab', 'kechasi'], + 'list' => [', ', ' va '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/vi.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/vi.php index 3f9838d665039a003c5ea7ea1f9b0488294aaf92..2a12a11c55855ebd7d03536e0ab7dc68282de603 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/vi.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/vi.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,64 @@ * file that was distributed with this source code. */ -return array( +/* + * Authors: + * - François B + * - Andre Polykanine A.K.A. Menelion Elensúlë + * - JD Isaacks + */ +return [ 'year' => ':count năm', + 'a_year' => '{1}một năm|]1, Inf[:count năm', 'y' => ':count năm', 'month' => ':count tháng', + 'a_month' => '{1}một tháng|]1, Inf[:count tháng', 'm' => ':count tháng', 'week' => ':count tuần', + 'a_week' => '{1}một tuần|]1, Inf[:count tuần', 'w' => ':count tuần', 'day' => ':count ngày', + 'a_day' => '{1}một ngày|]1, Inf[:count ngày', 'd' => ':count ngày', 'hour' => ':count giờ', + 'a_hour' => '{1}một giờ|]1, Inf[:count giờ', 'h' => ':count giờ', 'minute' => ':count phút', + 'a_minute' => '{1}một phút|]1, Inf[:count phút', 'min' => ':count phút', 'second' => ':count giây', + 'a_second' => '{1}vài giây|]1, Inf[:count giây', 's' => ':count giây', 'ago' => ':time trước', - 'from_now' => ':time từ bây giờ', + 'from_now' => ':time tới', 'after' => ':time sau', 'before' => ':time trước', -); + 'diff_now' => 'bây giờ', + 'diff_yesterday' => 'Hôm qua', + 'diff_tomorrow' => 'Ngày mai', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [năm] YYYY', + 'LLL' => 'D MMMM [năm] YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM [năm] YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hôm nay lúc] LT', + 'nextDay' => '[Ngày mai lúc] LT', + 'nextWeek' => 'dddd [tuần tới lúc] LT', + 'lastDay' => '[Hôm qua lúc] LT', + 'lastWeek' => 'dddd [tuần trước lúc] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['SA', 'CH'], + 'months' => ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], + 'months_short' => ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'], + 'weekdays' => ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'], + 'weekdays_short' => ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + 'weekdays_min' => ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' và '], +]; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh.php index 9e1f6cad5a583a910f9a3f403da30b970bf37734..1187c3d77fff01bea74f3e8e1c583f6b05cddbd2 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,21 @@ * 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前', -); +/* + * Authors: + * - xuri + * - sycuato + * - bokideckonja + * - Luo Ning + * - William Yang (williamyang233) + */ +return array_merge(require __DIR__.'/zh_Hans.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 A h点mm分', + 'LLLL' => 'YYYY年M月D日dddd A h点mm分', + ], +]); diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php index c848723bc2e0174a7af99a2af5fed9a7f44899fc..c6789ed2f5295624376d6748979ec9a783d8d98c 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php @@ -1,6 +1,6 @@ <?php -/* +/** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> @@ -9,23 +9,4 @@ * 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前', -); +return require __DIR__.'/zh_Hant_TW.php'; diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php index 4d83b0c65f5880d625dd096e783f9e9601976f87..2c6290c5a58d9b3bcf1f09ccbbcac38d761f3e45 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -3,35 +3,70 @@ namespace Carbon\Laravel; use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; +use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Events\Dispatcher; use Illuminate\Events\EventDispatcher; -use Illuminate\Translation\Translator as IlluminateTranslator; -use Symfony\Component\Translation\Translator; +use Illuminate\Support\Carbon as IlluminateCarbon; +use Illuminate\Support\Facades\Date; +use Throwable; class ServiceProvider extends \Illuminate\Support\ServiceProvider { public function boot() { + $this->updateLocale(); + + if (!$this->app->bound('events')) { + return; + } + $service = $this; $events = $this->app['events']; - if ($events instanceof EventDispatcher || $events instanceof Dispatcher) { + + if ($this->isEventDispatcher($events)) { $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()); + $app = $this->app && method_exists($this->app, 'getLocale') ? $this->app : app('translator'); + $locale = $app->getLocale(); + Carbon::setLocale($locale); + CarbonImmutable::setLocale($locale); + CarbonPeriod::setLocale($locale); + CarbonInterval::setLocale($locale); + + // @codeCoverageIgnoreStart + if (class_exists(IlluminateCarbon::class)) { + IlluminateCarbon::setLocale($locale); } + + if (class_exists(Date::class)) { + try { + $root = Date::getFacadeRoot(); + $root->setLocale($locale); + } catch (Throwable $e) { + // Non Carbon class in use in Date facade + } + } + // @codeCoverageIgnoreEnd } public function register() { // Needed for Laravel < 5.3 compatibility } + + protected function isEventDispatcher($instance) + { + return $instance instanceof EventDispatcher + || $instance instanceof Dispatcher + || $instance instanceof DispatcherContract; + } } diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Translator.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Translator.php index 12115b0083f060233e2d9b94b34a0b8ad341ac4b..70d20f7d09e1cc1ca13f5c382e2b92d189559919 100644 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Translator.php +++ b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Translator.php @@ -1,24 +1,59 @@ <?php +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Carbon; +use Closure; +use ReflectionException; +use ReflectionFunction; use Symfony\Component\Translation; class Translator extends Translation\Translator { /** - * Singleton for Translator. + * Translator singletons for each language. * - * @var static + * @var array */ - protected static $singleton; + protected static $singletons = []; /** * List of custom localized messages. * * @var array */ - protected static $messages = array(); + protected $messages = []; + + /** + * List of custom directories that contain translation files. + * + * @var string[] + */ + protected $directories = []; + + /** + * Set to true while constructing. + * + * @var bool + */ + protected $initializing = false; + + /** + * List of locales aliases. + * + * @var string[] + */ + protected $aliases = [ + 'me' => 'sr_Latn_ME', + 'scr' => 'sh', + ]; /** * Return a singleton instance of Translator. @@ -29,17 +64,112 @@ class Translator extends Translation\Translator */ public static function get($locale = null) { - if (static::$singleton === null) { - static::$singleton = new static($locale ?: 'en'); + $locale = $locale ?: 'en'; + + if (!isset(static::$singletons[$locale])) { + static::$singletons[$locale] = new static($locale ?: 'en'); } - return static::$singleton; + return static::$singletons[$locale]; } public function __construct($locale, Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) { + $this->initializing = true; + $this->directories = [__DIR__.'/Lang']; $this->addLoader('array', new Translation\Loader\ArrayLoader()); parent::__construct($locale, $formatter, $cacheDir, $debug); + $this->initializing = false; + } + + /** + * Returns the list of directories translation files are searched in. + * + * @return array + */ + public function getDirectories(): array + { + return $this->directories; + } + + /** + * Set list of directories translation files are searched in. + * + * @param array $directories new directories list + * + * @return $this + */ + public function setDirectories(array $directories) + { + $this->directories = $directories; + + return $this; + } + + /** + * Add a directory to the list translation files are searched in. + * + * @param string $directory new directory + * + * @return $this + */ + public function addDirectory(string $directory) + { + $this->directories[] = $directory; + + return $this; + } + + /** + * Remove a directory from the list translation files are searched in. + * + * @param string $directory directory path + * + * @return $this + */ + public function removeDirectory(string $directory) + { + $search = rtrim(strtr($directory, '\\', '/'), '/'); + + return $this->setDirectories(array_filter($this->getDirectories(), function ($item) use ($search) { + return rtrim(strtr($item, '\\', '/'), '/') !== $search; + })); + } + + /** + * Returns the translation. + * + * @param string $id + * @param array $parameters + * @param string $domain + * @param string $locale + * + * @return string + */ + public function trans($id, array $parameters = [], $domain = null, $locale = null) + { + if (null === $domain) { + $domain = 'messages'; + } + + $format = $this->getCatalogue($locale)->get((string) $id, $domain); + + if ($format instanceof Closure) { + // @codeCoverageIgnoreStart + try { + $count = (new ReflectionFunction($format))->getNumberOfRequiredParameters(); + } catch (ReflectionException $exception) { + $count = 0; + } + // @codeCoverageIgnoreEnd + + return $format( + ...array_values($parameters), + ...array_fill(0, max(0, $count - count($parameters)), null) + ); + } + + return parent::trans($id, $parameters, $domain, $locale); } /** @@ -54,21 +184,65 @@ class Translator extends Translation\Translator public function resetMessages($locale = null) { if ($locale === null) { - static::$messages = array(); + $this->messages = []; return true; } - if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) { - static::$messages[$locale] = require $filename; - $this->addResource('array', static::$messages[$locale], $locale); + foreach ($this->getDirectories() as $directory) { + $data = @include sprintf('%s/%s.php', rtrim($directory, '\\/'), $locale); - return true; + if ($data !== false) { + $this->messages[$locale] = $data; + $this->addResource('array', $this->messages[$locale], $locale); + + return true; + } } return false; } + /** + * Returns the list of files matching a given locale prefix (or all if empty). + * + * @param string $prefix prefix required to filter result + * + * @return array + */ + public function getLocalesFiles($prefix = '') + { + $files = []; + + foreach ($this->getDirectories() as $directory) { + $directory = rtrim($directory, '\\/'); + + foreach (glob("$directory/$prefix*.php") as $file) { + $files[] = $file; + } + } + + return array_unique($files); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @param string $prefix prefix required to filter result + * + * @return array + */ + public function getAvailableLocales($prefix = '') + { + $locales = []; + foreach ($this->getLocalesFiles($prefix) as $file) { + $locales[] = substr($file, strrpos($file, '/') + 1, -4); + } + + return array_unique(array_merge($locales, array_keys($this->messages))); + } + /** * Init messages language from matching file in Lang directory. * @@ -78,7 +252,7 @@ class Translator extends Translation\Translator */ protected function loadMessagesFromFile($locale) { - if (isset(static::$messages[$locale])) { + if (isset($this->messages[$locale])) { return true; } @@ -97,14 +271,26 @@ class Translator extends Translation\Translator { $this->loadMessagesFromFile($locale); $this->addResource('array', $messages, $locale); - static::$messages[$locale] = array_merge( - isset(static::$messages[$locale]) ? static::$messages[$locale] : array(), + $this->messages[$locale] = array_merge( + isset($this->messages[$locale]) ? $this->messages[$locale] : [], $messages ); return $this; } + /** + * Set messages of the current locale and take file first if present. + * + * @param array $messages + * + * @return $this + */ + public function setTranslations($messages) + { + return $this->setMessages($this->getLocale(), $messages); + } + /** * Get messages of a locale, if none given, return all the * languages. @@ -115,7 +301,7 @@ class Translator extends Translation\Translator */ public function getMessages($locale = null) { - return $locale === null ? static::$messages : static::$messages[$locale]; + return $locale === null ? $this->messages : $this->messages[$locale]; } /** @@ -128,11 +314,76 @@ class Translator extends Translation\Translator 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]); + // _2-letters or YUE is a region, _3+-letters is a variant + $upper = strtoupper($matches[1]); + + if ($upper === 'YUE' || $upper === 'ISO' || strlen($upper) < 3) { + return "_$upper"; + } + + return '_'.ucfirst($matches[1]); }, strtolower($locale)); - if ($this->loadMessagesFromFile($locale)) { + $previousLocale = $this->getLocale(); + + if ($previousLocale === $locale) { + return true; + } + + unset(static::$singletons[$previousLocale]); + + if ($locale === 'auto') { + $completeLocale = setlocale(LC_TIME, '0'); + $locale = preg_replace('/^([^_.-]+).*$/', '$1', $completeLocale); + $locales = $this->getAvailableLocales($locale); + + $completeLocaleChunks = preg_split('/[_.-]+/', $completeLocale); + + $getScore = function ($language) use ($completeLocaleChunks) { + $chunks = preg_split('/[_.-]+/', $language); + $score = 0; + + foreach ($completeLocaleChunks as $index => $chunk) { + if (!isset($chunks[$index])) { + $score++; + + continue; + } + + if (strtolower($chunks[$index]) === strtolower($chunk)) { + $score += 10; + } + } + + return $score; + }; + + usort($locales, function ($first, $second) use ($getScore) { + $first = $getScore($first); + $second = $getScore($second); + + if ($first === $second) { + return 0; + } + + return $first < $second ? 1 : -1; + }); + + $locale = $locales[0]; + } + + if (isset($this->aliases[$locale])) { + $locale = $this->aliases[$locale]; + } + + // If subtag (ex: en_CA) first load the macro (ex: en) to have a fallback + if (strpos($locale, '_') !== false && + $this->loadMessagesFromFile($macroLocale = preg_replace('/^([^_]+).*$/', '$1', $locale)) + ) { + parent::setLocale($macroLocale); + } + + if ($this->loadMessagesFromFile($locale) || $this->initializing) { parent::setLocale($locale); return true; @@ -140,4 +391,16 @@ class Translator extends Translation\Translator return false; } + + /** + * Show locale on var_dump(). + * + * @return array + */ + public function __debugInfo() + { + return [ + 'locale' => $this->getLocale(), + ]; + } } diff --git a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Upgrade.php b/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Upgrade.php deleted file mode 100644 index 26449ff74b2f7801efa5440a7a944de8ddc68e46..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/Carbon/Upgrade.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -namespace Carbon; - -use Composer\Composer; -use Composer\Config; -use Composer\IO\ConsoleIO; -use Composer\Script\Event as ScriptEvent; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Input\StringInput; -use Symfony\Component\Console\Output\ConsoleOutput; -use UpdateHelper\UpdateHelper; -use UpdateHelper\UpdateHelperInterface; - -class Upgrade implements UpdateHelperInterface -{ - const ASK_ON_UPDATE = false; - const SUGGEST_ON_UPDATE = false; - - protected static $laravelLibraries = array( - 'laravel/framework' => '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/Seance5-6/seance/vendor/nesbot/carbon/src/JsonSerializable.php b/Seance5-6/seance/vendor/nesbot/carbon/src/JsonSerializable.php deleted file mode 100644 index d34060b4405469001a5c2cd960a1bc792d6f6887..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/nesbot/carbon/src/JsonSerializable.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -if (!interface_exists('JsonSerializable')) { - interface JsonSerializable - { - /** - * Specify data which should be serialized to JSON. - * - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed data which can be serialized by <b>json_encode</b>, - * which is a value of any type other than a resource. - * - * @since 5.4.0 - */ - public function jsonSerialize(); - } -} diff --git a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/README.md b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/README.md index 342e8286dbf694422c31e61b1a5bdf16f71785b4..4efb599d81fcc2374cbf42273628660f40c6c683 100644 --- a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/README.md +++ b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/README.md @@ -2,7 +2,7 @@ Symfony Polyfill / Mbstring =========================== This component provides a partial, native PHP implementation for the -[Mbstring](http://php.net/mbstring) extension. +[Mbstring](https://php.net/mbstring) extension. More information can be found in the [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). diff --git a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/bootstrap.php b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/bootstrap.php index 204a41ba271e343369ecf9a63d617aae7f5271bc..8c8225c5249e01038e71f6ec714cf51de352b28e 100644 --- a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -11,11 +11,13 @@ use Symfony\Polyfill\Mbstring as p; -if (!function_exists('mb_strlen')) { +if (!defined('MB_CASE_UPPER')) { define('MB_CASE_UPPER', 0); define('MB_CASE_LOWER', 1); define('MB_CASE_TITLE', 2); +} +if (!function_exists('mb_strlen')) { function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } diff --git a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/composer.json b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/composer.json index 1a8bec5c012f5f143f1ee077bfa398bf4e3f5679..02b8896f740318e00b6c7a34451615a2b5461f7b 100644 --- a/Seance5-6/seance/vendor/symfony/polyfill-mbstring/composer.json +++ b/Seance5-6/seance/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.15-dev" } } } diff --git a/Seance5-6/seance/vendor/symfony/translation/CHANGELOG.md b/Seance5-6/seance/vendor/symfony/translation/CHANGELOG.md index 97845322e113170b8c5e3ad532fa11258138cbea..b1de62a32ae368cc8d86faf9905eeb875a2340c8 100644 --- a/Seance5-6/seance/vendor/symfony/translation/CHANGELOG.md +++ b/Seance5-6/seance/vendor/symfony/translation/CHANGELOG.md @@ -1,6 +1,21 @@ CHANGELOG ========= +5.0.0 +----- + + * removed support for using `null` as the locale in `Translator` + * removed `TranslatorInterface` + * removed `MessageSelector` + * removed `ChoiceMessageFormatterInterface` + * removed `PluralizationRule` + * removed `Interval` + * removed `transChoice()` methods, use the trans() method instead with a %count% parameter + * removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()` + * removed `MessageFormatter::choiceFormat()` + * added argument `$filename` to `PhpExtractor::parseTokens()` + * removed support for implicit STDIN usage in the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. + 4.4.0 ----- diff --git a/Seance5-6/seance/vendor/symfony/translation/Catalogue/AbstractOperation.php b/Seance5-6/seance/vendor/symfony/translation/Catalogue/AbstractOperation.php index 919bab8fff97fb25be11ed25ded3b35d93e8b2ab..17c257fde458e3f3a958e144a94bc0dddd3f57a7 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ b/Seance5-6/seance/vendor/symfony/translation/Catalogue/AbstractOperation.php @@ -88,10 +88,10 @@ abstract class AbstractOperation implements OperationInterface /** * {@inheritdoc} */ - public function getMessages($domain) + public function getMessages(string $domain) { if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); + throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); } if (!isset($this->messages[$domain]['all'])) { @@ -104,10 +104,10 @@ abstract class AbstractOperation implements OperationInterface /** * {@inheritdoc} */ - public function getNewMessages($domain) + public function getNewMessages(string $domain) { if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); + throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); } if (!isset($this->messages[$domain]['new'])) { @@ -120,10 +120,10 @@ abstract class AbstractOperation implements OperationInterface /** * {@inheritdoc} */ - public function getObsoleteMessages($domain) + public function getObsoleteMessages(string $domain) { if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); + throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); } if (!isset($this->messages[$domain]['obsolete'])) { @@ -153,5 +153,5 @@ abstract class AbstractOperation implements OperationInterface * * @param string $domain The domain which the operation will be performed for */ - abstract protected function processDomain($domain); + abstract protected function processDomain(string $domain); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Catalogue/MergeOperation.php b/Seance5-6/seance/vendor/symfony/translation/Catalogue/MergeOperation.php index d2f4abd13ff4f8d15ecf9ce43bbd90a7dc78c853..2a23e8599093a784cbdfa57b4fc24f6c2b394384 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Catalogue/MergeOperation.php +++ b/Seance5-6/seance/vendor/symfony/translation/Catalogue/MergeOperation.php @@ -27,7 +27,7 @@ class MergeOperation extends AbstractOperation /** * {@inheritdoc} */ - protected function processDomain($domain) + protected function processDomain(string $domain) { $this->messages[$domain] = [ 'all' => [], diff --git a/Seance5-6/seance/vendor/symfony/translation/Catalogue/OperationInterface.php b/Seance5-6/seance/vendor/symfony/translation/Catalogue/OperationInterface.php index 87d888efb76ec3d3d9a7c5e8e72329d756056213..9ffac88d28d4d88a1b19cc8ff705d3489e7c074c 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Catalogue/OperationInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Catalogue/OperationInterface.php @@ -44,29 +44,23 @@ interface OperationInterface /** * Returns all valid messages ('all') after operation. * - * @param string $domain - * * @return array */ - public function getMessages($domain); + public function getMessages(string $domain); /** * Returns new messages ('new') after operation. * - * @param string $domain - * * @return array */ - public function getNewMessages($domain); + public function getNewMessages(string $domain); /** * Returns obsolete messages ('obsolete') after operation. * - * @param string $domain - * * @return array */ - public function getObsoleteMessages($domain); + public function getObsoleteMessages(string $domain); /** * Returns resulting catalogue ('result'). diff --git a/Seance5-6/seance/vendor/symfony/translation/Catalogue/TargetOperation.php b/Seance5-6/seance/vendor/symfony/translation/Catalogue/TargetOperation.php index 22aa9a3911177c775c26e792f59adfe68469b863..249a521bb8d0e861cc2e90f41aae77c57393a03f 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Catalogue/TargetOperation.php +++ b/Seance5-6/seance/vendor/symfony/translation/Catalogue/TargetOperation.php @@ -28,7 +28,7 @@ class TargetOperation extends AbstractOperation /** * {@inheritdoc} */ - protected function processDomain($domain) + protected function processDomain(string $domain) { $this->messages[$domain] = [ 'all' => [], diff --git a/Seance5-6/seance/vendor/symfony/translation/Command/XliffLintCommand.php b/Seance5-6/seance/vendor/symfony/translation/Command/XliffLintCommand.php index 3f8fe7321836bcd74186afdf2fc94fa2da8c251a..4376804296c76aebe5c0fcee219a6a7d6ee5586e 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/Seance5-6/seance/vendor/symfony/translation/Command/XliffLintCommand.php @@ -89,15 +89,8 @@ EOF return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]); } - // @deprecated to be removed in 5.0 if (!$filenames) { - if (0 !== ftell(STDIN)) { - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - @trigger_error('Piping content from STDIN to the "lint:xliff" command without passing the dash symbol "-" as argument is deprecated since Symfony 4.4.', E_USER_DEPRECATED); - - return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]); + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } $filesInfo = []; diff --git a/Seance5-6/seance/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/Seance5-6/seance/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index 9b6da11027882209ed97db8d0266aa6dba2132f9..3b0042946f01f7e2366ad065c31150867e1ed1f5 100644 --- a/Seance5-6/seance/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/Seance5-6/seance/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -21,7 +21,7 @@ use Symfony\Component\VarDumper\Cloner\Data; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> * - * @final since Symfony 4.4 + * @final */ class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface { @@ -47,10 +47,8 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto /** * {@inheritdoc} - * - * @param \Throwable|null $exception */ - public function collect(Request $request, Response $response/*, \Throwable $exception = null*/) + public function collect(Request $request, Response $response, \Throwable $exception = null) { $this->data['locale'] = $this->translator->getLocale(); $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); @@ -102,7 +100,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto } /** - * @internal since Symfony 4.2 + * @internal */ public function getFallbackLocales() { diff --git a/Seance5-6/seance/vendor/symfony/translation/DataCollectorTranslator.php b/Seance5-6/seance/vendor/symfony/translation/DataCollectorTranslator.php index 1c672b7f4fb07cf1295f0ad990d36d97006403a8..87ad168a98e86e5382672083f81a376604bb0424 100644 --- a/Seance5-6/seance/vendor/symfony/translation/DataCollectorTranslator.php +++ b/Seance5-6/seance/vendor/symfony/translation/DataCollectorTranslator.php @@ -13,14 +13,13 @@ namespace Symfony\Component\Translation; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; use Symfony\Contracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorInterface, TranslatorBagInterface, WarmableInterface +class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface, WarmableInterface { const MESSAGE_DEFINED = 0; const MESSAGE_MISSING = 1; @@ -36,11 +35,8 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface */ - public function __construct($translator) + public function __construct(TranslatorInterface $translator) { - if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) { - throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); - } if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator))); } @@ -51,36 +47,18 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * {@inheritdoc} */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null) { - $trans = $this->translator->trans($id, $parameters, $domain, $locale); + $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, $parameters); return $trans; } - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter - */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) - { - if ($this->translator instanceof TranslatorInterface) { - $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); - } else { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - } - - $this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters); - - return $trans; - } - /** * {@inheritdoc} */ - public function setLocale($locale) + public function setLocale(string $locale) { $this->translator->setLocale($locale); } @@ -96,7 +74,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * {@inheritdoc} */ - public function getCatalogue($locale = null) + public function getCatalogue(string $locale = null) { return $this->translator->getCatalogue($locale); } @@ -104,7 +82,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * {@inheritdoc} */ - public function warmUp($cacheDir) + public function warmUp(string $cacheDir) { if ($this->translator instanceof WarmableInterface) { $this->translator->warmUp($cacheDir); @@ -128,7 +106,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * Passes through all unknown calls onto the translator object. */ - public function __call($method, $args) + public function __call(string $method, array $args) { return $this->translator->{$method}(...$args); } @@ -141,13 +119,12 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn return $this->messages; } - private function collectMessage(?string $locale, ?string $domain, ?string $id, string $translation, ?array $parameters = []) + private function collectMessage(?string $locale, ?string $domain, string $id, string $translation, ?array $parameters = []) { if (null === $domain) { $domain = 'messages'; } - $id = (string) $id; $catalogue = $this->translator->getCatalogue($locale); $locale = $catalogue->getLocale(); $fallbackLocale = null; diff --git a/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index ed4a840d86127db750dd5813bfd5bcde9928e110..27315f61526e33d2c1c02bafb232a91f08d37b28 100644 --- a/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -68,7 +68,7 @@ class TranslatorPass implements CompilerPassInterface return; } - $paths = array_keys($container->getDefinition('twig.template_iterator')->getArgument(2)); + $paths = array_keys($container->getDefinition('twig.template_iterator')->getArgument(1)); if ($container->hasDefinition($this->debugCommandServiceId)) { $definition = $container->getDefinition($this->debugCommandServiceId); $definition->replaceArgument(4, $container->getParameter('twig.default_path')); diff --git a/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php b/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php index 8ff2587dd53e162845d3b8230da16c73c69034e2..04975b171f56368f1c7dce6c9d96f1b74f01436a 100644 --- a/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php +++ b/Seance5-6/seance/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php @@ -79,7 +79,7 @@ class TranslatorPathsPass extends AbstractRecursivePass } } - protected function processValue($value, $isRoot = false) + protected function processValue($value, bool $isRoot = false) { if ($value instanceof Reference) { if ((string) $value === $this->translatorServiceId) { diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/CsvFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/CsvFileDumper.php index bfa8db61adefc202464e289e752862d079dd4370..32accb66bddee29f55beb540415f9f11412c04d8 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/CsvFileDumper.php @@ -26,7 +26,7 @@ class CsvFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $handle = fopen('php://memory', 'r+b'); @@ -43,11 +43,8 @@ class CsvFileDumper extends FileDumper /** * Sets the delimiter and escape character for CSV. - * - * @param string $delimiter Delimiter character - * @param string $enclosure Enclosure character */ - public function setCsvControl($delimiter = ';', $enclosure = '"') + public function setCsvControl(string $delimiter = ';', string $enclosure = '"') { $this->delimiter = $delimiter; $this->enclosure = $enclosure; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/DumperInterface.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/DumperInterface.php index 445b70189d509a4da5c65f089194358e96073c9e..7cdaef5151c8a11f29d0b8934f13f28318486aef 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/DumperInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/DumperInterface.php @@ -26,5 +26,5 @@ interface DumperInterface * * @param array $options Options that are used by the dumper */ - public function dump(MessageCatalogue $messages, $options = []); + public function dump(MessageCatalogue $messages, array $options = []); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/FileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/FileDumper.php index 2009c53403f25454f4a695b004fd868b2f3139e3..e257e722461d02ea57f961ed2b798ac71894e05a 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/FileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/FileDumper.php @@ -37,31 +37,15 @@ abstract class FileDumper implements DumperInterface * * @param string $relativePathTemplate A template for the relative paths to files */ - public function setRelativePathTemplate($relativePathTemplate) + public function setRelativePathTemplate(string $relativePathTemplate) { $this->relativePathTemplate = $relativePathTemplate; } - /** - * Sets backup flag. - * - * @param bool $backup - * - * @deprecated since Symfony 4.1 - */ - public function setBackup($backup) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); - - if (false !== $backup) { - throw new \LogicException('The backup feature is no longer supported.'); - } - } - /** * {@inheritdoc} */ - public function dump(MessageCatalogue $messages, $options = []) + public function dump(MessageCatalogue $messages, array $options = []) { if (!\array_key_exists('path', $options)) { throw new InvalidArgumentException('The file dumper needs a path option.'); @@ -103,11 +87,9 @@ abstract class FileDumper implements DumperInterface /** * Transforms a domain of a message catalogue to its string representation. * - * @param string $domain - * * @return string representation */ - abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []); + abstract public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []); /** * Gets the file extension of the dumper. diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/IcuResFileDumper.php index 829e0d0c25ce680d696478c685b60c638e8866a0..cdc59913b3a3f7c6dbe53ebceb4f72425220c04c 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -28,7 +28,7 @@ class IcuResFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $data = $indexes = $resources = ''; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/IniFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/IniFileDumper.php index 45ff9614b146b815c273ecf49fa8e7f402758c64..93c900a4a9fbccc42199cc15d4394e44585e05c6 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/IniFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/IniFileDumper.php @@ -23,7 +23,7 @@ class IniFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $output = ''; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/JsonFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/JsonFileDumper.php index 2af8231bd6fd425ecb5738a65e61e1754a51bbbe..c6700ae153f1d9fff2612207472fa80dd264db82 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -23,7 +23,7 @@ class JsonFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $flags = $options['json_encoding'] ?? JSON_PRETTY_PRINT; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/MoFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/MoFileDumper.php index 5a96dacec0b395cc71ca96d251678b8bc6c5d774..54d0da8754ed77bdb765910f0bfe917e46384641 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -24,7 +24,7 @@ class MoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $sources = $targets = $sourceOffsets = $targetOffsets = ''; $offsets = []; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/PhpFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/PhpFileDumper.php index e77afc2fbfde34055383126beca85635ba8c6452..6163b5297c10415bd6b3ab7ee18d4115b75e0515 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/PhpFileDumper.php @@ -23,7 +23,7 @@ class PhpFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n"; } diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/PoFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/PoFileDumper.php index 2cc9e8895def6b3311ddfc5e6499c17bb726af3a..3b18138420a7b8d1ab7d6d2133137cc304255e63 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/PoFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/PoFileDumper.php @@ -23,7 +23,7 @@ class PoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $output = 'msgid ""'."\n"; $output .= 'msgstr ""'."\n"; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/QtFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/QtFileDumper.php index 79a64b2430c58d56e15f09cb1f7ca08a19345ff8..406e9f0060b76baf2e90175af9b05a8b52422859 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/QtFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/QtFileDumper.php @@ -23,7 +23,7 @@ class QtFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/XliffFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/XliffFileDumper.php index dd9d788badc68a9bd751e107d318299a914932c8..d9dfd436bf7954aef6a56fdfd4539874479d5b8f 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -24,7 +24,7 @@ class XliffFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { $xliffVersion = '1.2'; if (\array_key_exists('xliff_version', $options)) { diff --git a/Seance5-6/seance/vendor/symfony/translation/Dumper/YamlFileDumper.php b/Seance5-6/seance/vendor/symfony/translation/Dumper/YamlFileDumper.php index d6e4af8fb6ff94c2b2bb2b3bda2c9721451dc967..ac589c975ec5ab93c800a515c335e87edf25be46 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/Seance5-6/seance/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -33,7 +33,7 @@ class YamlFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) { if (!class_exists('Symfony\Component\Yaml\Yaml')) { throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); diff --git a/Seance5-6/seance/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/Seance5-6/seance/vendor/symfony/translation/Extractor/AbstractFileExtractor.php index 618df732472c6d6aa85b6ae6dd2b47d4ad6ec323..729dd178126e3c1ee3767177ddc50190f742aa70 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ b/Seance5-6/seance/vendor/symfony/translation/Extractor/AbstractFileExtractor.php @@ -49,13 +49,11 @@ abstract class AbstractFileExtractor } /** - * @param string $file - * * @return bool * * @throws InvalidArgumentException */ - protected function isFile($file) + protected function isFile(string $file) { if (!is_file($file)) { throw new InvalidArgumentException(sprintf('The "%s" file does not exist.', $file)); @@ -65,11 +63,9 @@ abstract class AbstractFileExtractor } /** - * @param string $file - * * @return bool */ - abstract protected function canBeExtracted($file); + abstract protected function canBeExtracted(string $file); /** * @param string|array $resource Files, a file or a directory diff --git a/Seance5-6/seance/vendor/symfony/translation/Extractor/ChainExtractor.php b/Seance5-6/seance/vendor/symfony/translation/Extractor/ChainExtractor.php index 2683f5d248414c2edcbc1c091290c4805cf5fa24..6b6e18277d04a98bcaa1925c5d41aa7427ad2ae0 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Extractor/ChainExtractor.php +++ b/Seance5-6/seance/vendor/symfony/translation/Extractor/ChainExtractor.php @@ -32,7 +32,7 @@ class ChainExtractor implements ExtractorInterface * * @param string $format The format of the loader */ - public function addExtractor($format, ExtractorInterface $extractor) + public function addExtractor(string $format, ExtractorInterface $extractor) { $this->extractors[$format] = $extractor; } @@ -40,7 +40,7 @@ class ChainExtractor implements ExtractorInterface /** * {@inheritdoc} */ - public function setPrefix($prefix) + public function setPrefix(string $prefix) { foreach ($this->extractors as $extractor) { $extractor->setPrefix($prefix); diff --git a/Seance5-6/seance/vendor/symfony/translation/Extractor/ExtractorInterface.php b/Seance5-6/seance/vendor/symfony/translation/Extractor/ExtractorInterface.php index 91de20192eee9d247872978c718a1dcfa4fcce69..39cc006c5b9e49a60865ba04b0a7383a557a0f59 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Extractor/ExtractorInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Extractor/ExtractorInterface.php @@ -33,5 +33,5 @@ interface ExtractorInterface * * @param string $prefix The prefix */ - public function setPrefix($prefix); + public function setPrefix(string $prefix); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpExtractor.php b/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpExtractor.php index 5237bf6625f2c485efe7842654d91a385c2c5b1a..549754a506c097cf4d818a06362af2fe3d64a08f 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -48,30 +48,12 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface ',', self::DOMAIN_TOKEN, ], - [ - '->', - 'transChoice', - '(', - self::MESSAGE_TOKEN, - ',', - self::METHOD_ARGUMENTS_TOKEN, - ',', - self::METHOD_ARGUMENTS_TOKEN, - ',', - self::DOMAIN_TOKEN, - ], [ '->', 'trans', '(', self::MESSAGE_TOKEN, ], - [ - '->', - 'transChoice', - '(', - self::MESSAGE_TOKEN, - ], ]; /** @@ -90,7 +72,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * {@inheritdoc} */ - public function setPrefix($prefix) + public function setPrefix(string $prefix) { $this->prefix = $prefix; } @@ -194,17 +176,9 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * Extracts trans message from PHP tokens. - * - * @param array $tokens - * @param string $filename */ - protected function parseTokens($tokens, MessageCatalogue $catalog/*, string $filename*/) + protected function parseTokens(array $tokens, MessageCatalogue $catalog, string $filename) { - if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { - @trigger_error(sprintf('The "%s()" method will have a new "string $filename" argument in version 5.0, not defining it is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED); - } - $filename = 2 < \func_num_args() ? func_get_arg(2) : ''; - $tokenIterator = new \ArrayIterator($tokens); for ($key = 0; $key < $tokenIterator->count(); ++$key) { @@ -252,13 +226,11 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface } /** - * @param string $file - * * @return bool * * @throws \InvalidArgumentException */ - protected function canBeExtracted($file) + protected function canBeExtracted(string $file) { return $this->isFile($file) && 'php' === pathinfo($file, PATHINFO_EXTENSION); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index 4531e91222469bde1b3dbba17f5f677c67ce4878..e68b0e598c5f4b9a3b01f1edd1c041dd7960b7c2 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/Seance5-6/seance/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -67,7 +67,7 @@ class PhpStringTokenParser * * @return string The parsed string */ - public static function parse($str) + public static function parse(string $str) { $bLength = 0; if ('b' === $str[0]) { @@ -93,7 +93,7 @@ class PhpStringTokenParser * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences($str, $quote) + public static function parseEscapeSequences(string $str, string $quote = null) { if (null !== $quote) { $str = str_replace('\\'.$quote, $quote, $str); @@ -127,7 +127,7 @@ class PhpStringTokenParser * * @return string Parsed string */ - public static function parseDocString($startToken, $str) + public static function parseDocString(string $startToken, string $str) { // strip last newline (thanks tokenizer for sticking it into the string!) $str = preg_replace('~(\r\n|\n|\r)$~', '', $str); diff --git a/Seance5-6/seance/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php b/Seance5-6/seance/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php deleted file mode 100644 index 621dbb292da420d2c48da5fba5cf9a457920d6ef..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Formatter; - -/** - * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> - * - * @deprecated since Symfony 4.2, use MessageFormatterInterface::format() with a %count% parameter instead - */ -interface ChoiceMessageFormatterInterface -{ - /** - * Formats a localized message pattern with given arguments. - * - * @param string $message The message (may also be an object that can be cast to string) - * @param int $number The number to use to find the indice of the message - * @param string $locale The message locale - * @param array $parameters An array of parameters for the message - * - * @return string - */ - public function choiceFormat($message, $number, $locale, array $parameters = []); -} diff --git a/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatter.php b/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatter.php index 030d7a5c3e8ec142098f5014844f5131e55e8656..04079648338c8c8b8dd93e382a5060f97ff6fb18 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatter.php +++ b/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatter.php @@ -12,14 +12,15 @@ namespace Symfony\Component\Translation\Formatter; use Symfony\Component\Translation\IdentityTranslator; -use Symfony\Component\Translation\MessageSelector; -use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; +// Help opcache.preload discover always-needed symbols +class_exists(IntlFormatter::class); + /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface, ChoiceMessageFormatterInterface +class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface { private $translator; private $intlFormatter; @@ -27,14 +28,8 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf /** * @param TranslatorInterface|null $translator An identity translator to use as selector for pluralization */ - public function __construct($translator = null, IntlFormatterInterface $intlFormatter = null) + public function __construct(TranslatorInterface $translator = null, IntlFormatterInterface $intlFormatter = null) { - if ($translator instanceof MessageSelector) { - $translator = new IdentityTranslator($translator); - } elseif (null !== $translator && !$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslatorInterface) { - throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); - } - $this->translator = $translator ?? new IdentityTranslator(); $this->intlFormatter = $intlFormatter ?? new IntlFormatter(); } @@ -42,7 +37,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf /** * {@inheritdoc} */ - public function format($message, $locale, array $parameters = []) + public function format(string $message, string $locale, array $parameters = []) { if ($this->translator instanceof TranslatorInterface) { return $this->translator->trans($message, $parameters, null, $locale); @@ -58,22 +53,4 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf { return $this->intlFormatter->formatIntl($message, $locale, $parameters); } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use format() with a %count% parameter instead - */ - public function choiceFormat($message, $number, $locale, array $parameters = []) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the format() one instead with a %%count%% parameter.', __METHOD__), E_USER_DEPRECATED); - - $parameters = ['%count%' => $number] + $parameters; - - if ($this->translator instanceof TranslatorInterface) { - return $this->format($message, $locale, $parameters); - } - - return $this->format($this->translator->transChoice($message, $number, [], null, $locale), $locale, $parameters); - } } diff --git a/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatterInterface.php b/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatterInterface.php index 370c055866c0f266fd944f0aae0b3de08d419790..b85dbfd115c1767a5090c415bdc27f994587404f 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatterInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Formatter/MessageFormatterInterface.php @@ -26,5 +26,5 @@ interface MessageFormatterInterface * * @return string */ - public function format($message, $locale, array $parameters = []); + public function format(string $message, string $locale, array $parameters = []); } diff --git a/Seance5-6/seance/vendor/symfony/translation/IdentityTranslator.php b/Seance5-6/seance/vendor/symfony/translation/IdentityTranslator.php index 87b40bf8faa6e35c5c9a026d3da8ce79dc83298d..46875edf2ac88a7cec41581ea4017f29d32ea35e 100644 --- a/Seance5-6/seance/vendor/symfony/translation/IdentityTranslator.php +++ b/Seance5-6/seance/vendor/symfony/translation/IdentityTranslator.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Translation; -use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorTrait; @@ -20,58 +20,7 @@ use Symfony\Contracts\Translation\TranslatorTrait; * * @author Fabien Potencier <fabien@symfony.com> */ -class IdentityTranslator implements LegacyTranslatorInterface, TranslatorInterface +class IdentityTranslator implements TranslatorInterface, LocaleAwareInterface { - use TranslatorTrait { - trans as private doTrans; - setLocale as private doSetLocale; - } - - private $selector; - - public function __construct(MessageSelector $selector = null) - { - $this->selector = $selector; - - if (__CLASS__ !== static::class) { - @trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); - } - } - - /** - * {@inheritdoc} - */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) - { - return $this->doTrans($id, $parameters, $domain, $locale); - } - - /** - * {@inheritdoc} - */ - public function setLocale($locale) - { - $this->doSetLocale($locale); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter - */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); - - if ($this->selector) { - return strtr($this->selector->choose((string) $id, $number, $locale ?: $this->getLocale()), $parameters); - } - - return $this->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); - } - - private function getPluralizationRule(int $number, string $locale): int - { - return PluralizationRules::get($number, $locale, false); - } + use TranslatorTrait; } diff --git a/Seance5-6/seance/vendor/symfony/translation/Interval.php b/Seance5-6/seance/vendor/symfony/translation/Interval.php deleted file mode 100644 index 1adc43fbd5fc1138b5a30a987b1952cd1b3cf03a..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/symfony/translation/Interval.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use IdentityTranslator instead.', Interval::class), E_USER_DEPRECATED); - -use Symfony\Component\Translation\Exception\InvalidArgumentException; - -/** - * Tests if a given number belongs to a given math interval. - * - * An interval can represent a finite set of numbers: - * - * {1,2,3,4} - * - * An interval can represent numbers between two numbers: - * - * [1, +Inf] - * ]-1,2[ - * - * The left delimiter can be [ (inclusive) or ] (exclusive). - * The right delimiter can be [ (exclusive) or ] (inclusive). - * Beside numbers, you can use -Inf and +Inf for the infinite. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @see http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation - * @deprecated since Symfony 4.2, use IdentityTranslator instead - */ -class Interval -{ - /** - * Tests if the given number is in the math interval. - * - * @param int $number A number - * @param string $interval An interval - * - * @return bool - * - * @throws InvalidArgumentException - */ - public static function test($number, $interval) - { - $interval = trim($interval); - - if (!preg_match('/^'.self::getIntervalRegexp().'$/x', $interval, $matches)) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid interval.', $interval)); - } - - if ($matches[1]) { - foreach (explode(',', $matches[2]) as $n) { - if ($number == $n) { - return true; - } - } - } else { - $leftNumber = self::convertNumber($matches['left']); - $rightNumber = self::convertNumber($matches['right']); - - return - ('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber) - && (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber) - ; - } - - return false; - } - - /** - * Returns a Regexp that matches valid intervals. - * - * @return string A Regexp (without the delimiters) - */ - public static function getIntervalRegexp() - { - return <<<EOF - ({\s* - (\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*) - \s*}) - - | - - (?P<left_delimiter>[\[\]]) - \s* - (?P<left>-Inf|\-?\d+(\.\d+)?) - \s*,\s* - (?P<right>\+?Inf|\-?\d+(\.\d+)?) - \s* - (?P<right_delimiter>[\[\]]) -EOF; - } - - private static function convertNumber(string $number): float - { - if ('-Inf' === $number) { - return log(0); - } elseif ('+Inf' === $number || 'Inf' === $number) { - return -log(0); - } - - return (float) $number; - } -} diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/ArrayLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/ArrayLoader.php index 2e9a4285ec97f0901d8ed911da4ef3d3071404d6..0758da8b59a548f7539d445a28a2631f036971c7 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/ArrayLoader.php @@ -23,7 +23,7 @@ class ArrayLoader implements LoaderInterface /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { $resource = $this->flatten($resource); $catalogue = new MessageCatalogue($locale); diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/CsvFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/CsvFileLoader.php index db17bd563111ab84f36e4cab37a87011c9f5e15c..25ac2f566239575a403a77f3e7746c3eba2b6e2c 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/CsvFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/CsvFileLoader.php @@ -55,12 +55,8 @@ class CsvFileLoader extends FileLoader /** * Sets the delimiter, enclosure, and escape character for CSV. - * - * @param string $delimiter Delimiter character - * @param string $enclosure Enclosure character - * @param string $escape Escape character */ - public function setCsvControl($delimiter = ';', $enclosure = '"', $escape = '\\') + public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') { $this->delimiter = $delimiter; $this->enclosure = $enclosure; diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/FileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/FileLoader.php index 7ec54a3c874fb6d6cb5e6eb4328d77ec87a0ff45..60c5b348e8afe2e39c66fa8b8b31200d341d52c6 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/FileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/FileLoader.php @@ -23,7 +23,7 @@ abstract class FileLoader extends ArrayLoader /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/IcuDatFileLoader.php index 7bbf4c200647496b335dd6386fb2207d502641d4..0b7168181df2dd034f8f57a72b02018164e5f774 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/IcuDatFileLoader.php @@ -26,7 +26,7 @@ class IcuDatFileLoader extends IcuResFileLoader /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { if (!stream_is_local($resource.'.dat')) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); @@ -43,7 +43,7 @@ class IcuDatFileLoader extends IcuResFileLoader } if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); + throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); } elseif (intl_is_failure($rb->getErrorCode())) { throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/IcuResFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/IcuResFileLoader.php index 005f26084d84fde0fee2344c53c28ffe80f55be9..9aa30bd6522cce7466e319e4bb1c71aa8ba23120 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -26,7 +26,7 @@ class IcuResFileLoader implements LoaderInterface /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); @@ -43,7 +43,7 @@ class IcuResFileLoader implements LoaderInterface } if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); + throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); } elseif (intl_is_failure($rb->getErrorCode())) { throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); } @@ -75,7 +75,7 @@ class IcuResFileLoader implements LoaderInterface * * @return array the flattened ResourceBundle */ - protected function flatten(\ResourceBundle $rb, array &$messages = [], $path = null) + protected function flatten(\ResourceBundle $rb, array &$messages = [], string $path = null) { foreach ($rb as $key => $value) { $nodePath = $path ? $path.'.'.$key : $key; diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/JsonFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/JsonFileLoader.php index e3e7c75d1a6b3dcc47e0c829a4c18fc805cb84f1..fe6747e8aabd45b8dc56114099236b898a3243f3 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/JsonFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/JsonFileLoader.php @@ -30,7 +30,7 @@ class JsonFileLoader extends FileLoader $messages = json_decode($data, true); if (0 < $errorCode = json_last_error()) { - throw new InvalidResourceException(sprintf('Error parsing JSON - %s', $this->getJSONErrorMessage($errorCode))); + throw new InvalidResourceException(sprintf('Error parsing JSON - %s.', $this->getJSONErrorMessage($errorCode))); } } diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/LoaderInterface.php b/Seance5-6/seance/vendor/symfony/translation/Loader/LoaderInterface.php index 1785402d9cb20bd1b0cd4145701283c8984891a2..2073f2b24acef85a25204a5847279538e7af28cf 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/LoaderInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/LoaderInterface.php @@ -34,5 +34,5 @@ interface LoaderInterface * @throws NotFoundResourceException when the resource cannot be found * @throws InvalidResourceException when the resource cannot be loaded */ - public function load($resource, $locale, $domain = 'messages'); + public function load($resource, string $locale, string $domain = 'messages'); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/QtFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/QtFileLoader.php index 2d4a4c084fe48b0b4e99054165bec36b1d2b8106..f5cdec69726150a4b4305a27b47a3594027b2d55 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/QtFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/QtFileLoader.php @@ -27,7 +27,7 @@ class QtFileLoader implements LoaderInterface /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/XliffFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/XliffFileLoader.php index 15a6ee5cfb93376a79a38782f41a55b7fafe900b..cf26386d9263d3131fa72c732d570ee8fb039ad4 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -28,7 +28,7 @@ class XliffFileLoader implements LoaderInterface /** * {@inheritdoc} */ - public function load($resource, $locale, $domain = 'messages') + public function load($resource, string $locale, string $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); @@ -53,12 +53,12 @@ class XliffFileLoader implements LoaderInterface try { $dom = XmlUtils::loadFile($resource); } catch (\InvalidArgumentException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s": %s', $resource, $e->getMessage()), $e->getCode(), $e); + throw new InvalidResourceException(sprintf('Unable to load "%s": %s.', $resource, $e->getMessage()), $e->getCode(), $e); } $xliffVersion = XliffUtils::getVersionNumber($dom); if ($errors = XliffUtils::validateSchema($dom)) { - throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $resource, XliffUtils::getErrorsAsString($errors))); + throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s.', $resource, XliffUtils::getErrorsAsString($errors))); } if ('1.2' === $xliffVersion) { diff --git a/Seance5-6/seance/vendor/symfony/translation/Loader/YamlFileLoader.php b/Seance5-6/seance/vendor/symfony/translation/Loader/YamlFileLoader.php index 438d7d76421b5291009674e0d79b9a70f7792b78..9502e167cd339c7480f08fa5d75818f547d751d1 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Loader/YamlFileLoader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Loader/YamlFileLoader.php @@ -42,7 +42,7 @@ class YamlFileLoader extends FileLoader try { $messages = $this->yamlParser->parseFile($resource, Yaml::PARSE_CONSTANT); } catch (ParseException $e) { - throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e); + throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s".', $resource), 0, $e); } if (null !== $messages && !\is_array($messages)) { diff --git a/Seance5-6/seance/vendor/symfony/translation/LoggingTranslator.php b/Seance5-6/seance/vendor/symfony/translation/LoggingTranslator.php index 812136fcd1971b9cd3c1b98466ee84f5408cccab..c6e8078fd2f3d478dcb1f435548675b63796788b 100644 --- a/Seance5-6/seance/vendor/symfony/translation/LoggingTranslator.php +++ b/Seance5-6/seance/vendor/symfony/translation/LoggingTranslator.php @@ -13,14 +13,13 @@ namespace Symfony\Component\Translation; use Psr\Log\LoggerInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; use Symfony\Contracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Abdellatif Ait boudad <a.aitboudad@gmail.com> */ -class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterface, TranslatorBagInterface +class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface { /** * @var TranslatorInterface|TranslatorBagInterface @@ -32,11 +31,8 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface */ - public function __construct($translator, LoggerInterface $logger) + public function __construct(TranslatorInterface $translator, LoggerInterface $logger) { - if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) { - throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); - } if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator))); } @@ -48,29 +44,9 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * {@inheritdoc} */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null) { - $trans = $this->translator->trans($id, $parameters, $domain, $locale); - $this->log($id, $domain, $locale); - - return $trans; - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter - */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); - - if ($this->translator instanceof TranslatorInterface) { - $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); - } else { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - } - + $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); $this->log($id, $domain, $locale); return $trans; @@ -79,7 +55,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * {@inheritdoc} */ - public function setLocale($locale) + public function setLocale(string $locale) { $prev = $this->translator->getLocale(); $this->translator->setLocale($locale); @@ -101,7 +77,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * {@inheritdoc} */ - public function getCatalogue($locale = null) + public function getCatalogue(string $locale = null) { return $this->translator->getCatalogue($locale); } @@ -123,7 +99,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * Passes through all unknown calls onto the translator object. */ - public function __call($method, $args) + public function __call(string $method, array $args) { return $this->translator->{$method}(...$args); } @@ -131,13 +107,12 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * Logs for missing translations. */ - private function log(?string $id, ?string $domain, ?string $locale) + private function log(string $id, ?string $domain, ?string $locale) { if (null === $domain) { $domain = 'messages'; } - $id = (string) $id; $catalogue = $this->translator->getCatalogue($locale); if ($catalogue->defines($id, $domain)) { return; diff --git a/Seance5-6/seance/vendor/symfony/translation/MessageCatalogue.php b/Seance5-6/seance/vendor/symfony/translation/MessageCatalogue.php index cde056a73609a991f1ec41dd18fca2e42e8008a8..becc4a655c0a2c4dd356be8bf05c36106f2b4975 100644 --- a/Seance5-6/seance/vendor/symfony/translation/MessageCatalogue.php +++ b/Seance5-6/seance/vendor/symfony/translation/MessageCatalogue.php @@ -30,12 +30,8 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf * @param string $locale The locale * @param array $messages An array of messages classified by domain */ - public function __construct(?string $locale, array $messages = []) + public function __construct(string $locale, array $messages = []) { - if (null === $locale) { - @trigger_error(sprintf('Passing "null" to the first argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); - } - $this->locale = $locale; $this->messages = $messages; } @@ -69,7 +65,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function all($domain = null) + public function all(string $domain = null) { if (null !== $domain) { return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); @@ -93,7 +89,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function set($id, $translation, $domain = 'messages') + public function set(string $id, string $translation, string $domain = 'messages') { $this->add([$id => $translation], $domain); } @@ -101,7 +97,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function has($id, $domain = 'messages') + public function has(string $id, string $domain = 'messages') { if (isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { return true; @@ -117,7 +113,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function defines($id, $domain = 'messages') + public function defines(string $id, string $domain = 'messages') { return isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]); } @@ -125,7 +121,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function get($id, $domain = 'messages') + public function get(string $id, string $domain = 'messages') { if (isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { return $this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]; @@ -145,7 +141,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function replace($messages, $domain = 'messages') + public function replace(array $messages, string $domain = 'messages') { unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]); @@ -155,7 +151,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function add($messages, $domain = 'messages') + public function add(array $messages, string $domain = 'messages') { if (!isset($this->messages[$domain])) { $this->messages[$domain] = []; @@ -180,7 +176,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf public function addCatalogue(MessageCatalogueInterface $catalogue) { if ($catalogue->getLocale() !== $this->locale) { - throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s"', $catalogue->getLocale(), $this->locale)); + throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s".', $catalogue->getLocale(), $this->locale)); } foreach ($catalogue->all() as $domain => $messages) { @@ -260,7 +256,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function getMetadata($key = '', $domain = 'messages') + public function getMetadata(string $key = '', string $domain = 'messages') { if ('' == $domain) { return $this->metadata; @@ -282,7 +278,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function setMetadata($key, $value, $domain = 'messages') + public function setMetadata(string $key, $value, string $domain = 'messages') { $this->metadata[$domain][$key] = $value; } @@ -290,7 +286,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf /** * {@inheritdoc} */ - public function deleteMetadata($key = '', $domain = 'messages') + public function deleteMetadata(string $key = '', string $domain = 'messages') { if ('' == $domain) { $this->metadata = []; diff --git a/Seance5-6/seance/vendor/symfony/translation/MessageCatalogueInterface.php b/Seance5-6/seance/vendor/symfony/translation/MessageCatalogueInterface.php index f3d3f5ea9c9b6c23d87dcd880a9c5c490af90210..6683eeb834b882dfa6e27f73a1cb15bb456271b0 100644 --- a/Seance5-6/seance/vendor/symfony/translation/MessageCatalogueInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/MessageCatalogueInterface.php @@ -45,7 +45,7 @@ interface MessageCatalogueInterface * * @return array An array of messages */ - public function all($domain = null); + public function all(string $domain = null); /** * Sets a message translation. @@ -54,7 +54,7 @@ interface MessageCatalogueInterface * @param string $translation The messages translation * @param string $domain The domain name */ - public function set($id, $translation, $domain = 'messages'); + public function set(string $id, string $translation, string $domain = 'messages'); /** * Checks if a message has a translation. @@ -64,7 +64,7 @@ interface MessageCatalogueInterface * * @return bool true if the message has a translation, false otherwise */ - public function has($id, $domain = 'messages'); + public function has(string $id, string $domain = 'messages'); /** * Checks if a message has a translation (it does not take into account the fallback mechanism). @@ -74,7 +74,7 @@ interface MessageCatalogueInterface * * @return bool true if the message has a translation, false otherwise */ - public function defines($id, $domain = 'messages'); + public function defines(string $id, string $domain = 'messages'); /** * Gets a message translation. @@ -84,7 +84,7 @@ interface MessageCatalogueInterface * * @return string The message translation */ - public function get($id, $domain = 'messages'); + public function get(string $id, string $domain = 'messages'); /** * Sets translations for a given domain. @@ -92,7 +92,7 @@ interface MessageCatalogueInterface * @param array $messages An array of translations * @param string $domain The domain name */ - public function replace($messages, $domain = 'messages'); + public function replace(array $messages, string $domain = 'messages'); /** * Adds translations for a given domain. @@ -100,7 +100,7 @@ interface MessageCatalogueInterface * @param array $messages An array of translations * @param string $domain The domain name */ - public function add($messages, $domain = 'messages'); + public function add(array $messages, string $domain = 'messages'); /** * Merges translations from the given Catalogue into the current one. diff --git a/Seance5-6/seance/vendor/symfony/translation/MessageSelector.php b/Seance5-6/seance/vendor/symfony/translation/MessageSelector.php deleted file mode 100644 index 0f0febb8b25a70ca906296bb37af7e96ee658abf..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/symfony/translation/MessageSelector.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use IdentityTranslator instead.', MessageSelector::class), E_USER_DEPRECATED); - -use Symfony\Component\Translation\Exception\InvalidArgumentException; - -/** - * MessageSelector. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Bernhard Schussek <bschussek@gmail.com> - * - * @deprecated since Symfony 4.2, use IdentityTranslator instead. - */ -class MessageSelector -{ - /** - * Given a message with different plural translations separated by a - * pipe (|), this method returns the correct portion of the message based - * on the given number, locale and the pluralization rules in the message - * itself. - * - * The message supports two different types of pluralization rules: - * - * interval: {0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples - * indexed: There is one apple|There are %count% apples - * - * The indexed solution can also contain labels (e.g. one: There is one apple). - * This is purely for making the translations more clear - it does not - * affect the functionality. - * - * The two methods can also be mixed: - * {0} There are no apples|one: There is one apple|more: There are %count% apples - * - * @param string $message The message being translated - * @param int|float $number The number of items represented for the message - * @param string $locale The locale to use for choosing - * - * @return string - * - * @throws InvalidArgumentException - */ - public function choose($message, $number, $locale) - { - $parts = []; - if (preg_match('/^\|++$/', $message)) { - $parts = explode('|', $message); - } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { - $parts = $matches[0]; - } - - $explicitRules = []; - $standardRules = []; - foreach ($parts as $part) { - $part = trim(str_replace('||', '|', $part)); - - if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/xs', $part, $matches)) { - $explicitRules[$matches['interval']] = $matches['message']; - } elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) { - $standardRules[] = $matches[1]; - } else { - $standardRules[] = $part; - } - } - - // try to match an explicit rule, then fallback to the standard ones - foreach ($explicitRules as $interval => $m) { - if (Interval::test($number, $interval)) { - return $m; - } - } - - $position = PluralizationRules::get($number, $locale); - - if (!isset($standardRules[$position])) { - // when there's exactly one rule given, and that rule is a standard - // rule, use this rule - if (1 === \count($parts) && isset($standardRules[0])) { - return $standardRules[0]; - } - - throw new InvalidArgumentException(sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $message, $locale, $number)); - } - - return $standardRules[$position]; - } -} diff --git a/Seance5-6/seance/vendor/symfony/translation/MetadataAwareInterface.php b/Seance5-6/seance/vendor/symfony/translation/MetadataAwareInterface.php index e93c6fbc713114d79dfa40f653b6878c5f3a3bc0..d157a072eb845e82d4b1798c490fc4e56bc166e7 100644 --- a/Seance5-6/seance/vendor/symfony/translation/MetadataAwareInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/MetadataAwareInterface.php @@ -30,7 +30,7 @@ interface MetadataAwareInterface * * @return mixed The value that was set or an array with the domains/keys or null */ - public function getMetadata($key = '', $domain = 'messages'); + public function getMetadata(string $key = '', string $domain = 'messages'); /** * Adds metadata to a message domain. @@ -39,7 +39,7 @@ interface MetadataAwareInterface * @param mixed $value The value * @param string $domain The domain name */ - public function setMetadata($key, $value, $domain = 'messages'); + public function setMetadata(string $key, $value, string $domain = 'messages'); /** * Deletes metadata for the given key and domain. @@ -50,5 +50,5 @@ interface MetadataAwareInterface * @param string $key The key * @param string $domain The domain name */ - public function deleteMetadata($key = '', $domain = 'messages'); + public function deleteMetadata(string $key = '', string $domain = 'messages'); } diff --git a/Seance5-6/seance/vendor/symfony/translation/PluralizationRules.php b/Seance5-6/seance/vendor/symfony/translation/PluralizationRules.php deleted file mode 100644 index 77c276073f3f0b0155606e318e50cf895de7ddc6..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/symfony/translation/PluralizationRules.php +++ /dev/null @@ -1,218 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * Returns the plural rules for a given locale. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @deprecated since Symfony 4.2, use IdentityTranslator instead - */ -class PluralizationRules -{ - private static $rules = []; - - /** - * Returns the plural position to use for the given locale and number. - * - * @param int $number The number - * @param string $locale The locale - * - * @return int The plural position - */ - public static function get($number, $locale/*, bool $triggerDeprecation = true*/) - { - if (3 > \func_num_args() || func_get_arg(2)) { - @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED); - } - - if ('pt_BR' === $locale) { - // temporary set a locale for brazilian - $locale = 'xbr'; - } - - if (\strlen($locale) > 3) { - $locale = substr($locale, 0, -\strlen(strrchr($locale, '_'))); - } - - if (isset(self::$rules[$locale])) { - $return = self::$rules[$locale]($number); - - if (!\is_int($return) || $return < 0) { - return 0; - } - - return $return; - } - - /* - * The plural rules are derived from code of the Zend Framework (2010-09-25), - * which is subject to the new BSD license (http://framework.zend.com/license/new-bsd). - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - */ - switch ($locale) { - case 'az': - case 'bo': - case 'dz': - case 'id': - case 'ja': - case 'jv': - case 'ka': - case 'km': - case 'kn': - case 'ko': - case 'ms': - case 'th': - case 'tr': - case 'vi': - case 'zh': - return 0; - - case 'af': - case 'bn': - case 'bg': - case 'ca': - case 'da': - case 'de': - case 'el': - case 'en': - case 'eo': - case 'es': - case 'et': - case 'eu': - case 'fa': - case 'fi': - case 'fo': - case 'fur': - case 'fy': - case 'gl': - case 'gu': - case 'ha': - case 'he': - case 'hu': - case 'is': - case 'it': - case 'ku': - case 'lb': - case 'ml': - case 'mn': - case 'mr': - case 'nah': - case 'nb': - case 'ne': - case 'nl': - case 'nn': - case 'no': - case 'oc': - case 'om': - case 'or': - case 'pa': - case 'pap': - case 'ps': - case 'pt': - case 'so': - case 'sq': - case 'sv': - case 'sw': - case 'ta': - case 'te': - case 'tk': - case 'ur': - case 'zu': - return (1 == $number) ? 0 : 1; - - case 'am': - case 'bh': - case 'fil': - case 'fr': - case 'gun': - case 'hi': - case 'hy': - case 'ln': - case 'mg': - case 'nso': - case 'xbr': - case 'ti': - case 'wa': - return ((0 == $number) || (1 == $number)) ? 0 : 1; - - case 'be': - case 'bs': - case 'hr': - case 'ru': - case 'sh': - case 'sr': - case 'uk': - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'cs': - case 'sk': - return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - - case 'ga': - return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2); - - case 'lt': - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'sl': - return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)); - - case 'mk': - return (1 == $number % 10) ? 0 : 1; - - case 'mt': - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - - case 'lv': - return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2); - - case 'pl': - return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - - case 'cy': - return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)); - - case 'ro': - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - - case 'ar': - return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); - - default: - return 0; - } - } - - /** - * Overrides the default plural rule for a given locale. - * - * @param callable $rule A PHP callable - * @param string $locale The locale - */ - public static function set(callable $rule, $locale) - { - @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED); - - if ('pt_BR' === $locale) { - // temporary set a locale for brazilian - $locale = 'xbr'; - } - - if (\strlen($locale) > 3) { - $locale = substr($locale, 0, -\strlen(strrchr($locale, '_'))); - } - - self::$rules[$locale] = $rule; - } -} diff --git a/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReader.php b/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReader.php index 2b9834521921f925d28f69772f93936d5d0ae778..9e51b15b5982682cca4453924dc59517608f1053 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReader.php +++ b/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReader.php @@ -34,7 +34,7 @@ class TranslationReader implements TranslationReaderInterface * * @param string $format The format of the loader */ - public function addLoader($format, LoaderInterface $loader) + public function addLoader(string $format, LoaderInterface $loader) { $this->loaders[$format] = $loader; } @@ -42,7 +42,7 @@ class TranslationReader implements TranslationReaderInterface /** * {@inheritdoc} */ - public function read($directory, MessageCatalogue $catalogue) + public function read(string $directory, MessageCatalogue $catalogue) { if (!is_dir($directory)) { return; diff --git a/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReaderInterface.php b/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReaderInterface.php index 0b2ad332a94ef58c47d5f5be0f7d93183831638d..bc37204f95cb7c06b853a5789e55a6036c644953 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReaderInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Reader/TranslationReaderInterface.php @@ -22,8 +22,6 @@ interface TranslationReaderInterface { /** * Reads translation messages from a directory to the catalogue. - * - * @param string $directory */ - public function read($directory, MessageCatalogue $catalogue); + public function read(string $directory, MessageCatalogue $catalogue); } diff --git a/Seance5-6/seance/vendor/symfony/translation/Translator.php b/Seance5-6/seance/vendor/symfony/translation/Translator.php index 9876051eaf60ca87291a481a431a990fc9a30a00..24910f0827c0431c56d8d0649c40ffec0b73f51f 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Translator.php +++ b/Seance5-6/seance/vendor/symfony/translation/Translator.php @@ -15,21 +15,19 @@ use Symfony\Component\Config\ConfigCacheFactory; use Symfony\Component\Config\ConfigCacheFactoryInterface; use Symfony\Component\Config\ConfigCacheInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Exception\LogicException; use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; use Symfony\Component\Translation\Formatter\IntlFormatterInterface; use Symfony\Component\Translation\Formatter\MessageFormatter; use Symfony\Component\Translation\Formatter\MessageFormatterInterface; use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * @author Fabien Potencier <fabien@symfony.com> */ -class Translator implements LegacyTranslatorInterface, TranslatorInterface, TranslatorBagInterface +class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface { /** * @var MessageCatalogueInterface[] @@ -88,13 +86,9 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * @throws InvalidArgumentException If a locale contains invalid characters */ - public function __construct(?string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = []) + public function __construct(string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = []) { - if (null === $locale) { - @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); - } - - $this->setLocale($locale, false); + $this->setLocale($locale); if (null === $formatter) { $formatter = new MessageFormatter(); @@ -117,7 +111,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran * * @param string $format The name of the loader (@see addResource()) */ - public function addLoader($format, LoaderInterface $loader) + public function addLoader(string $format, LoaderInterface $loader) { $this->loaders[$format] = $loader; } @@ -127,21 +121,15 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran * * @param string $format The name of the loader (@see addLoader()) * @param mixed $resource The resource name - * @param string $locale The locale - * @param string $domain The domain * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function addResource($format, $resource, $locale, $domain = null) + public function addResource(string $format, $resource, string $locale, string $domain = null) { if (null === $domain) { $domain = 'messages'; } - if (null === $locale) { - @trigger_error(sprintf('Passing "null" to the third argument of the "%s" method has been deprecated since Symfony 4.4 and will throw an error in 5.0.', __METHOD__), E_USER_DEPRECATED); - } - $this->assertValidLocale($locale); $this->resources[$locale][] = [$format, $resource, $domain]; @@ -156,12 +144,8 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * {@inheritdoc} */ - public function setLocale($locale) + public function setLocale(string $locale) { - if (null === $locale && (2 > \func_num_args() || func_get_arg(1))) { - @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); - } - $this->assertValidLocale($locale); $this->locale = $locale; } @@ -187,9 +171,6 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran $this->catalogues = []; foreach ($locales as $locale) { - if (null === $locale) { - @trigger_error(sprintf('Passing "null" as the $locale argument to %s() is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); - } $this->assertValidLocale($locale); } @@ -199,11 +180,9 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * Gets the fallback locales. * - * @internal since Symfony 4.2 - * - * @return array The fallback locales + * @internal */ - public function getFallbackLocales() + public function getFallbackLocales(): array { return $this->fallbackLocales; } @@ -211,9 +190,9 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * {@inheritdoc} */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null) { - if ('' === $id = (string) $id) { + if (null === $id || '' === $id) { return ''; } @@ -241,47 +220,8 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); - - if ('' === $id = (string) $id) { - return ''; - } - - if (!$this->formatter instanceof ChoiceMessageFormatterInterface) { - throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter))); - } - - if (null === $domain) { - $domain = 'messages'; - } - - $catalogue = $this->getCatalogue($locale); - $locale = $catalogue->getLocale(); - while (!$catalogue->defines($id, $domain)) { - if ($cat = $catalogue->getFallbackCatalogue()) { - $catalogue = $cat; - $locale = $catalogue->getLocale(); - } else { - break; - } - } - - if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { - return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, ['%count%' => $number] + $parameters); - } - - return $this->formatter->choiceFormat($catalogue->get($id, $domain), $number, $locale, $parameters); - } - - /** - * {@inheritdoc} - */ - public function getCatalogue($locale = null) + public function getCatalogue(string $locale = null) { if (null === $locale) { $locale = $this->getLocale(); @@ -306,10 +246,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran return $this->loaders; } - /** - * @param string $locale - */ - protected function loadCatalogue($locale) + protected function loadCatalogue(string $locale) { if (null === $this->cacheDir) { $this->initializeCatalogue($locale); @@ -318,10 +255,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran } } - /** - * @param string $locale - */ - protected function initializeCatalogue($locale) + protected function initializeCatalogue(string $locale) { $this->assertValidLocale($locale); @@ -453,7 +387,7 @@ EOF } } - protected function computeFallbackLocales($locale) + protected function computeFallbackLocales(string $locale) { if (null === $this->parentLocales) { $parentLocales = json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); @@ -497,11 +431,9 @@ EOF /** * Asserts that the locale is valid, throws an Exception if not. * - * @param string $locale Locale to tests - * * @throws InvalidArgumentException If the locale contains invalid characters */ - protected function assertValidLocale($locale) + protected function assertValidLocale(string $locale) { if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) { throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale)); diff --git a/Seance5-6/seance/vendor/symfony/translation/TranslatorBagInterface.php b/Seance5-6/seance/vendor/symfony/translation/TranslatorBagInterface.php index 5e49e2ddc545526dad43331416179eae0b2c1a4b..e40ca8a23bf4900008c039dbb8b91a42532740d4 100644 --- a/Seance5-6/seance/vendor/symfony/translation/TranslatorBagInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/TranslatorBagInterface.php @@ -29,5 +29,5 @@ interface TranslatorBagInterface * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function getCatalogue($locale = null); + public function getCatalogue(string $locale = null); } diff --git a/Seance5-6/seance/vendor/symfony/translation/TranslatorInterface.php b/Seance5-6/seance/vendor/symfony/translation/TranslatorInterface.php deleted file mode 100644 index f677d2455fe89871d425f8150e34bfce3b821d0e..0000000000000000000000000000000000000000 --- a/Seance5-6/seance/vendor/symfony/translation/TranslatorInterface.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Contracts\Translation\LocaleAwareInterface; - -/** - * TranslatorInterface. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @deprecated since Symfony 4.2, use Symfony\Contracts\Translation\TranslatorInterface instead - */ -interface TranslatorInterface extends LocaleAwareInterface -{ - /** - * Translates the given message. - * - * @param string $id The message id (may also be an object that can be cast to string) - * @param array $parameters An array of parameters for the message - * @param string|null $domain The domain for the message or null to use the default - * @param string|null $locale The locale or null to use the default - * - * @return string The translated string - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - public function trans($id, array $parameters = [], $domain = null, $locale = null); - - /** - * Translates the given choice message by choosing a translation according to a number. - * - * @param string $id The message id (may also be an object that can be cast to string) - * @param int $number The number to use to find the index of the message - * @param array $parameters An array of parameters for the message - * @param string|null $domain The domain for the message or null to use the default - * @param string|null $locale The locale or null to use the default - * - * @return string The translated string - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null); - - /** - * Sets the current locale. - * - * @param string $locale The locale - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - public function setLocale($locale); - - /** - * Returns the current locale. - * - * @return string The locale - */ - public function getLocale(); -} diff --git a/Seance5-6/seance/vendor/symfony/translation/Util/ArrayConverter.php b/Seance5-6/seance/vendor/symfony/translation/Util/ArrayConverter.php index 22c602e7197e2d064479b3efbabab75208ece250..acfbfc363e8b7d57efc5d2b3ca34c1fd82774829 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Util/ArrayConverter.php +++ b/Seance5-6/seance/vendor/symfony/translation/Util/ArrayConverter.php @@ -84,7 +84,7 @@ class ArrayConverter return $elem; } - private static function cancelExpand(array &$tree, $prefix, array $node) + private static function cancelExpand(array &$tree, string $prefix, array $node) { $prefix .= '.'; diff --git a/Seance5-6/seance/vendor/symfony/translation/Util/XliffUtils.php b/Seance5-6/seance/vendor/symfony/translation/Util/XliffUtils.php index 3ace285bfac5f47d69fb911e174d8aaeec8bb147..b5ff4ef4a4eacb01d6b4387044dcbcd57b0a68b9 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Util/XliffUtils.php +++ b/Seance5-6/seance/vendor/symfony/translation/Util/XliffUtils.php @@ -41,7 +41,7 @@ class XliffUtils $namespace = $xliff->attributes->getNamedItem('xmlns'); if ($namespace) { if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) { - throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s"', $namespace)); + throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s".', $namespace)); } return substr($namespace, 34); diff --git a/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriter.php b/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriter.php index d402443133745927791634c1b1b83109c3fb22eb..e0260b7a30593c36388db60073df8a25ec87cbed 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriter.php @@ -35,22 +35,6 @@ class TranslationWriter implements TranslationWriterInterface $this->dumpers[$format] = $dumper; } - /** - * Disables dumper backup. - * - * @deprecated since Symfony 4.1 - */ - public function disableBackup() - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); - - foreach ($this->dumpers as $dumper) { - if (method_exists($dumper, 'setBackup')) { - $dumper->setBackup(false); - } - } - } - /** * Obtains the list of supported formats. * @@ -69,7 +53,7 @@ class TranslationWriter implements TranslationWriterInterface * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = []) + public function write(MessageCatalogue $catalogue, string $format, array $options = []) { if (!isset($this->dumpers[$format])) { throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); @@ -79,7 +63,7 @@ class TranslationWriter implements TranslationWriterInterface $dumper = $this->dumpers[$format]; if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0777, true) && !is_dir($options['path'])) { - throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s"', $options['path'])); + throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s".', $options['path'])); } // save diff --git a/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriterInterface.php b/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriterInterface.php index f7c56bed09e7dfc59ef49b4e96ce036ef4da743e..43213097e34ffad4caa01686a397c3147a507acc 100644 --- a/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriterInterface.php +++ b/Seance5-6/seance/vendor/symfony/translation/Writer/TranslationWriterInterface.php @@ -29,5 +29,5 @@ interface TranslationWriterInterface * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = []); + public function write(MessageCatalogue $catalogue, string $format, array $options = []); } diff --git a/Seance5-6/seance/vendor/symfony/translation/composer.json b/Seance5-6/seance/vendor/symfony/translation/composer.json index 5b01b6ddc0ef1c2ec4e187f6abd3c10b49d794bf..d38c33a29df2d54c1124b4475fbd8621ccc40919 100644 --- a/Seance5-6/seance/vendor/symfony/translation/composer.json +++ b/Seance5-6/seance/vendor/symfony/translation/composer.json @@ -16,29 +16,30 @@ } ], "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6|^2" + "symfony/translation-contracts": "^2" }, "require-dev": { - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", + "symfony/yaml": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", "psr/log": "~1.0" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" }, "provide": { - "symfony/translation-implementation": "1.0" + "symfony/translation-implementation": "2.0" }, "suggest": { "symfony/config": "", @@ -54,7 +55,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } } }