From f4df5200ca75a5567b57e1c2386826f66e06e6ba Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Feb 2023 09:39:19 +0500 Subject: [PATCH] from server 27.02 --- composer.json | 11 +- config/app.php | 3 +- config/meilisearch.php | 38 + config/scout.php | 119 + .../controllers/api/postsController.php | 2 +- plugins/rainlab/blog/Plugin.php | 3 +- .../rainlab/blog/components/Meilisearch.php | 87 + .../blog/components/meilisearch/default.htm | 62 + plugins/rainlab/blog/models/Post.php | 7 + plugins/rainlab/blog/routes.php | 9 + .../controllers/StatisticsController.php | 3 - .../statisticscontroller/_linechart.htm | 2 +- plugins/tps/reklama/models/Statistika.php | 2 +- themes/modern2/meta/menus/new-top-menui.yaml | 12 +- themes/modern2/meta/menus/top-menu.yaml | 6 +- themes/modern2/pages/404.htm | 10 +- themes/modern2/pages/new/demosearch.htm | 25 + themes/modern2/pages/new/home.htm | 2 +- themes/modern2/partials/new/footer.htm | 2 +- vendor/clue/stream-filter/.github/FUNDING.yml | 2 + vendor/clue/stream-filter/CHANGELOG.md | 86 + vendor/clue/stream-filter/LICENSE | 21 + vendor/clue/stream-filter/README.md | 326 + vendor/clue/stream-filter/composer.json | 26 + .../clue/stream-filter/src/CallbackFilter.php | 120 + vendor/clue/stream-filter/src/functions.php | 327 + .../stream-filter/src/functions_include.php | 6 + vendor/composer/ClassLoader.php | 38 +- vendor/composer/InstalledVersions.php | 1668 ++ vendor/composer/autoload_classmap.php | 352 +- vendor/composer/autoload_files.php | 6 + vendor/composer/autoload_psr4.php | 18 + vendor/composer/autoload_real.php | 6 +- vendor/composer/autoload_static.php | 456 +- vendor/composer/installed.json | 15042 +++++++++------- vendor/composer/installed.php | 1407 ++ vendor/composer/platform_check.php | 4 +- vendor/doctrine/instantiator/README.md | 2 +- vendor/doctrine/instantiator/composer.json | 4 +- vendor/doctrine/instantiator/psalm.xml | 2 +- .../Doctrine/Instantiator/Instantiator.php | 10 +- vendor/guzzlehttp/guzzle/CHANGELOG.md | 1519 ++ vendor/guzzlehttp/guzzle/LICENSE | 27 + vendor/guzzlehttp/guzzle/README.md | 94 + vendor/guzzlehttp/guzzle/UPGRADING.md | 1253 ++ vendor/guzzlehttp/guzzle/composer.json | 105 + .../guzzlehttp/guzzle/src/BodySummarizer.php | 28 + .../guzzle/src/BodySummarizerInterface.php | 13 + vendor/guzzlehttp/guzzle/src/Client.php | 477 + .../guzzlehttp/guzzle/src/ClientInterface.php | 84 + vendor/guzzlehttp/guzzle/src/ClientTrait.php | 241 + .../guzzle/src/Cookie/CookieJar.php | 317 + .../guzzle/src/Cookie/CookieJarInterface.php | 79 + .../guzzle/src/Cookie/FileCookieJar.php | 101 + .../guzzle/src/Cookie/SessionCookieJar.php | 77 + .../guzzle/src/Cookie/SetCookie.php | 446 + .../src/Exception/BadResponseException.php | 39 + .../guzzle/src/Exception/ClientException.php | 10 + .../guzzle/src/Exception/ConnectException.php | 56 + .../guzzle/src/Exception/GuzzleException.php | 9 + .../Exception/InvalidArgumentException.php | 7 + .../guzzle/src/Exception/RequestException.php | 166 + .../guzzle/src/Exception/ServerException.php | 10 + .../Exception/TooManyRedirectsException.php | 7 + .../src/Exception/TransferException.php | 7 + .../guzzle/src/Handler/CurlFactory.php | 595 + .../src/Handler/CurlFactoryInterface.php | 25 + .../guzzle/src/Handler/CurlHandler.php | 49 + .../guzzle/src/Handler/CurlMultiHandler.php | 262 + .../guzzle/src/Handler/EasyHandle.php | 112 + .../guzzle/src/Handler/HeaderProcessor.php | 42 + .../guzzle/src/Handler/MockHandler.php | 211 + .../guzzlehttp/guzzle/src/Handler/Proxy.php | 51 + .../guzzle/src/Handler/StreamHandler.php | 593 + vendor/guzzlehttp/guzzle/src/HandlerStack.php | 275 + .../guzzle/src/MessageFormatter.php | 198 + .../guzzle/src/MessageFormatterInterface.php | 18 + vendor/guzzlehttp/guzzle/src/Middleware.php | 260 + vendor/guzzlehttp/guzzle/src/Pool.php | 125 + .../guzzle/src/PrepareBodyMiddleware.php | 104 + .../guzzle/src/RedirectMiddleware.php | 228 + .../guzzlehttp/guzzle/src/RequestOptions.php | 264 + .../guzzlehttp/guzzle/src/RetryMiddleware.php | 116 + .../guzzlehttp/guzzle/src/TransferStats.php | 133 + vendor/guzzlehttp/guzzle/src/Utils.php | 385 + vendor/guzzlehttp/guzzle/src/functions.php | 167 + .../guzzle/src/functions_include.php | 6 + vendor/guzzlehttp/promises/CHANGELOG.md | 110 + vendor/guzzlehttp/promises/LICENSE | 24 + vendor/guzzlehttp/promises/README.md | 546 + vendor/guzzlehttp/promises/composer.json | 58 + .../promises/src/AggregateException.php | 17 + .../promises/src/CancellationException.php | 10 + vendor/guzzlehttp/promises/src/Coroutine.php | 169 + vendor/guzzlehttp/promises/src/Create.php | 84 + vendor/guzzlehttp/promises/src/Each.php | 90 + .../guzzlehttp/promises/src/EachPromise.php | 247 + .../promises/src/FulfilledPromise.php | 84 + vendor/guzzlehttp/promises/src/Is.php | 46 + vendor/guzzlehttp/promises/src/Promise.php | 278 + .../promises/src/PromiseInterface.php | 97 + .../promises/src/PromisorInterface.php | 16 + .../promises/src/RejectedPromise.php | 91 + .../promises/src/RejectionException.php | 48 + vendor/guzzlehttp/promises/src/TaskQueue.php | 67 + .../promises/src/TaskQueueInterface.php | 24 + vendor/guzzlehttp/promises/src/Utils.php | 276 + vendor/guzzlehttp/promises/src/functions.php | 363 + .../promises/src/functions_include.php | 6 + vendor/guzzlehttp/psr7/CHANGELOG.md | 396 + vendor/guzzlehttp/psr7/LICENSE | 26 + vendor/guzzlehttp/psr7/README.md | 872 + vendor/guzzlehttp/psr7/composer.json | 96 + vendor/guzzlehttp/psr7/src/AppendStream.php | 248 + vendor/guzzlehttp/psr7/src/BufferStream.php | 149 + vendor/guzzlehttp/psr7/src/CachingStream.php | 153 + vendor/guzzlehttp/psr7/src/DroppingStream.php | 49 + .../src/Exception/MalformedUriException.php | 14 + vendor/guzzlehttp/psr7/src/FnStream.php | 180 + vendor/guzzlehttp/psr7/src/Header.php | 134 + vendor/guzzlehttp/psr7/src/HttpFactory.php | 100 + vendor/guzzlehttp/psr7/src/InflateStream.php | 37 + vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 41 + vendor/guzzlehttp/psr7/src/LimitStream.php | 157 + vendor/guzzlehttp/psr7/src/Message.php | 246 + vendor/guzzlehttp/psr7/src/MessageTrait.php | 264 + vendor/guzzlehttp/psr7/src/MimeType.php | 1237 ++ .../guzzlehttp/psr7/src/MultipartStream.php | 159 + vendor/guzzlehttp/psr7/src/NoSeekStream.php | 28 + vendor/guzzlehttp/psr7/src/PumpStream.php | 179 + vendor/guzzlehttp/psr7/src/Query.php | 113 + vendor/guzzlehttp/psr7/src/Request.php | 157 + vendor/guzzlehttp/psr7/src/Response.php | 160 + vendor/guzzlehttp/psr7/src/Rfc7230.php | 23 + vendor/guzzlehttp/psr7/src/ServerRequest.php | 344 + vendor/guzzlehttp/psr7/src/Stream.php | 282 + .../psr7/src/StreamDecoratorTrait.php | 155 + vendor/guzzlehttp/psr7/src/StreamWrapper.php | 175 + vendor/guzzlehttp/psr7/src/UploadedFile.php | 211 + vendor/guzzlehttp/psr7/src/Uri.php | 740 + vendor/guzzlehttp/psr7/src/UriComparator.php | 52 + vendor/guzzlehttp/psr7/src/UriNormalizer.php | 220 + vendor/guzzlehttp/psr7/src/UriResolver.php | 211 + vendor/guzzlehttp/psr7/src/Utils.php | 459 + .../.github/workflows/ci.yaml | 60 + .../http-interop/http-factory-guzzle/LICENSE | 21 + .../http-factory-guzzle/README.md | 7 + .../http-factory-guzzle/composer.json | 37 + .../src/RequestFactory.php | 15 + .../src/ResponseFactory.php | 15 + .../src/ServerRequestFactory.php | 24 + .../http-factory-guzzle/src/StreamFactory.php | 26 + .../src/UploadedFileFactory.php | 25 + .../http-factory-guzzle/src/UriFactory.php | 15 + vendor/laravel/framework/composer.json | 30 +- .../src/Illuminate/Auth/composer.json | 2 +- .../Broadcasters/PusherBroadcaster.php | 2 +- .../src/Illuminate/Broadcasting/composer.json | 2 +- .../src/Illuminate/Bus/composer.json | 2 +- .../src/Illuminate/Cache/CacheManager.php | 36 +- .../src/Illuminate/Cache/DynamoDbStore.php | 10 + .../framework/src/Illuminate/Cache/Lock.php | 2 +- .../src/Illuminate/Cache/RateLimiter.php | 25 + .../src/Illuminate/Cache/RedisTaggedCache.php | 2 +- .../src/Illuminate/Cache/Repository.php | 2 +- .../src/Illuminate/Cache/composer.json | 2 +- .../src/Illuminate/Config/composer.json | 2 +- .../src/Illuminate/Console/Application.php | 2 +- .../Console/Concerns/HasParameters.php | 4 +- .../Console/Scheduling/CallbackEvent.php | 5 +- .../Illuminate/Console/Scheduling/Event.php | 12 +- .../src/Illuminate/Console/composer.json | 6 +- .../src/Illuminate/Container/BoundMethod.php | 15 +- .../src/Illuminate/Container/Container.php | 1 - .../src/Illuminate/Container/composer.json | 2 +- .../src/Illuminate/Contracts/Cache/Lock.php | 4 +- .../Contracts/Foundation/Application.php | 6 +- .../src/Illuminate/Contracts/composer.json | 2 +- .../src/Illuminate/Cookie/CookieJar.php | 2 +- .../src/Illuminate/Cookie/composer.json | 2 +- .../Database/DetectsLostConnections.php | 14 +- .../Illuminate/Database/Eloquent/Builder.php | 53 +- .../Database/Eloquent/Collection.php | 23 +- .../Eloquent/Concerns/HasRelationships.php | 2 +- .../Database/Eloquent/Relations/BelongsTo.php | 1 - .../Eloquent/Relations/Concerns/AsPivot.php | 2 + .../Concerns/InteractsWithPivotTable.php | 8 +- .../Eloquent/Relations/MorphPivot.php | 2 + .../Database/MigrationServiceProvider.php | 2 +- .../Illuminate/Database/MySqlConnection.php | 7 + .../Database/PostgresConnection.php | 7 + .../src/Illuminate/Database/Query/Builder.php | 35 +- .../Query/Grammars/SqlServerGrammar.php | 8 +- .../Illuminate/Database/SQLiteConnection.php | 7 + .../Database/Schema/Grammars/RenameColumn.php | 15 +- .../Schema/Grammars/SQLiteGrammar.php | 1 + .../Schema/Grammars/SqlServerGrammar.php | 8 +- .../Database/SqlServerConnection.php | 7 + .../src/Illuminate/Database/composer.json | 4 +- .../src/Illuminate/Encryption/composer.json | 2 +- .../Illuminate/Events/CallQueuedListener.php | 12 +- .../src/Illuminate/Events/Dispatcher.php | 8 +- .../src/Illuminate/Events/composer.json | 2 +- .../Filesystem/FilesystemAdapter.php | 2 +- .../src/Illuminate/Filesystem/composer.json | 4 +- .../src/Illuminate/Foundation/Application.php | 12 +- .../Foundation/Console/QueuedCommand.php | 2 +- .../Foundation/Console/StorageLinkCommand.php | 4 + .../stubs/exception-render-report.stub | 2 +- .../Console/stubs/exception-report.stub | 2 +- .../Foundation/Console/stubs/job.stub | 3 +- .../Foundation/Exceptions/Handler.php | 9 +- .../Http/Middleware/VerifyCsrfToken.php | 7 +- .../Providers/ArtisanServiceProvider.php | 2 +- .../InteractsWithExceptionHandling.php | 3 +- .../Testing/Concerns/MakesHttpRequests.php | 3 +- .../Testing/Constraints/ArraySubset.php | 16 +- .../src/Illuminate/Hashing/composer.json | 2 +- .../Concerns/InteractsWithContentTypes.php | 2 +- .../src/Illuminate/Http/ResponseTrait.php | 4 +- .../src/Illuminate/Http/composer.json | 2 +- .../src/Illuminate/Log/LogManager.php | 9 - .../src/Illuminate/Log/composer.json | 2 +- .../framework/src/Illuminate/Mail/Mailer.php | 4 +- .../src/Illuminate/Mail/PendingMail.php | 2 +- .../src/Illuminate/Mail/composer.json | 6 +- .../Notifications/NotificationSender.php | 2 +- .../Illuminate/Notifications/composer.json | 2 +- .../Pagination/AbstractPaginator.php | 2 +- .../Pagination/LengthAwarePaginator.php | 2 +- .../src/Illuminate/Pagination/Paginator.php | 2 +- .../src/Illuminate/Pagination/composer.json | 2 +- .../src/Illuminate/Pipeline/composer.json | 2 +- .../Illuminate/Queue/SerializableClosure.php | 4 +- .../src/Illuminate/Queue/composer.json | 6 +- .../Redis/Connections/PhpRedisConnection.php | 34 +- .../Redis/Connections/PredisConnection.php | 2 +- .../Redis/Connectors/PhpRedisConnector.php | 12 + .../src/Illuminate/Redis/RedisManager.php | 2 +- .../src/Illuminate/Redis/composer.json | 2 +- .../src/Illuminate/Routing/Controller.php | 2 +- .../src/Illuminate/Routing/Pipeline.php | 2 +- .../src/Illuminate/Routing/Route.php | 4 +- .../src/Illuminate/Routing/RouteAction.php | 5 +- .../src/Illuminate/Routing/RouteRegistrar.php | 10 + .../Routing/RouteSignatureParameters.php | 2 +- .../src/Illuminate/Routing/Router.php | 23 + .../Illuminate/Routing/SortedMiddleware.php | 2 +- .../src/Illuminate/Routing/UrlGenerator.php | 31 +- .../src/Illuminate/Routing/composer.json | 2 +- .../src/Illuminate/Session/composer.json | 2 +- .../src/Illuminate/Support/Collection.php | 4 +- .../src/Illuminate/Support/Facades/App.php | 1 + .../src/Illuminate/Support/Facades/DB.php | 5 + .../Illuminate/Support/Facades/Request.php | 3 + .../src/Illuminate/Support/LazyCollection.php | 2 +- .../src/Illuminate/Support/Reflector.php | 48 + .../framework/src/Illuminate/Support/Str.php | 4 + .../Support/Testing/Fakes/MailFake.php | 2 +- .../Support/Testing/Fakes/PendingMailFake.php | 6 +- .../Support/Traits/EnumeratesValues.php | 2 +- .../Support/Traits/ForwardsCalls.php | 2 +- .../Illuminate/Support/Traits/Macroable.php | 4 +- .../src/Illuminate/Support/composer.json | 4 +- .../src/Illuminate/Translation/composer.json | 2 +- .../Validation/Concerns/FormatsMessages.php | 8 +- .../Concerns/ValidatesAttributes.php | 95 +- .../Validation/Rules/Dimensions.php | 2 +- .../Validation/Rules/RequiredIf.php | 8 +- .../src/Illuminate/Validation/Validator.php | 7 +- .../src/Illuminate/Validation/composer.json | 2 +- .../Illuminate/View/Compilers/Compiler.php | 2 +- .../Compilers/Concerns/CompilesLayouts.php | 6 +- .../View/Concerns/ManagesEvents.php | 4 +- .../View/Concerns/ManagesLayouts.php | 26 +- .../View/Engines/CompilerEngine.php | 4 +- .../src/Illuminate/View/ViewException.php | 41 + .../src/Illuminate/View/composer.json | 2 +- vendor/laravel/scout/LICENSE.md | 21 + vendor/laravel/scout/README.md | 32 + vendor/laravel/scout/UPGRADE.md | 33 + vendor/laravel/scout/composer.json | 58 + vendor/laravel/scout/config/scout.php | 119 + vendor/laravel/scout/src/Builder.php | 366 + .../scout/src/Console/FlushCommand.php | 38 + .../scout/src/Console/ImportCommand.php | 51 + vendor/laravel/scout/src/EngineManager.php | 128 + .../scout/src/Engines/AlgoliaEngine.php | 244 + vendor/laravel/scout/src/Engines/Engine.php | 100 + .../laravel/scout/src/Engines/NullEngine.php | 102 + .../scout/src/Events/ModelsFlushed.php | 24 + .../scout/src/Events/ModelsImported.php | 24 + .../laravel/scout/src/Jobs/MakeSearchable.php | 44 + vendor/laravel/scout/src/ModelObserver.php | 145 + .../scout/src/ScoutServiceProvider.php | 43 + vendor/laravel/scout/src/Searchable.php | 350 + vendor/laravel/scout/src/SearchableScope.php | 66 + vendor/laravel/tinker/CHANGELOG.md | 62 - vendor/laravel/tinker/README.md | 10 +- vendor/laravel/tinker/composer.json | 18 +- .../tinker/src/ClassAliasAutoloader.php | 4 +- .../tinker/src/Console/TinkerCommand.php | 15 +- vendor/laravel/tinker/src/TinkerCaster.php | 37 +- vendor/league/csv/CHANGELOG.md | 435 +- vendor/league/csv/composer.json | 46 +- vendor/league/csv/src/AbstractCsv.php | 216 +- vendor/league/csv/src/ByteSequence.php | 19 - vendor/league/csv/src/CannotInsertRecord.php | 21 +- vendor/league/csv/src/CharsetConverter.php | 103 +- vendor/league/csv/src/ColumnConsistency.php | 14 +- vendor/league/csv/src/EncloseField.php | 69 +- vendor/league/csv/src/EscapeFormula.php | 58 +- vendor/league/csv/src/Exception.php | 4 +- vendor/league/csv/src/HTMLConverter.php | 64 +- vendor/league/csv/src/Info.php | 99 + vendor/league/csv/src/InvalidArgument.php | 79 + vendor/league/csv/src/MapIterator.php | 19 +- .../csv/src/Polyfill/EmptyEscapeParser.php | 254 - vendor/league/csv/src/RFC4180Field.php | 58 +- vendor/league/csv/src/Reader.php | 222 +- vendor/league/csv/src/ResultSet.php | 228 +- vendor/league/csv/src/Statement.php | 71 +- vendor/league/csv/src/Stream.php | 255 +- vendor/league/csv/src/SyntaxError.php | 39 + vendor/league/csv/src/TabularDataReader.php | 117 + vendor/league/csv/src/UnableToProcessCsv.php | 20 + vendor/league/csv/src/UnavailableFeature.php | 21 + vendor/league/csv/src/UnavailableStream.php | 32 + vendor/league/csv/src/Writer.php | 174 +- vendor/league/csv/src/XMLConverter.php | 112 +- vendor/league/csv/src/functions.php | 152 +- vendor/league/flysystem/CODE_OF_CONDUCT.md | 76 + vendor/league/flysystem/composer.json | 15 +- .../flysystem/src/Adapter/AbstractAdapter.php | 2 +- .../src/Adapter/AbstractFtpAdapter.php | 20 +- vendor/league/flysystem/src/Adapter/Ftp.php | 34 +- vendor/league/flysystem/src/Adapter/Ftpd.php | 7 +- .../flysystem/src/CorruptedPathDetected.php | 17 + vendor/league/flysystem/src/Filesystem.php | 19 +- vendor/league/flysystem/src/MountManager.php | 2 - .../flysystem/src/Plugin/GetWithMetadata.php | 4 +- .../league/flysystem/src/Plugin/ListPaths.php | 2 +- .../league/flysystem/src/Plugin/ListWith.php | 6 +- vendor/league/flysystem/src/Util.php | 19 +- vendor/league/flysystem/src/Util/MimeType.php | 233 +- .../league/mime-type-detection/CHANGELOG.md | 31 + vendor/league/mime-type-detection/LICENSE | 19 + .../league/mime-type-detection/composer.json | 34 + .../src/EmptyExtensionToMimeTypeMap.php | 13 + .../src/ExtensionMimeTypeDetector.php | 42 + .../src/ExtensionToMimeTypeMap.php | 10 + .../src/FinfoMimeTypeDetector.php | 92 + .../src/GeneratedExtensionToMimeTypeMap.php | 1227 ++ .../src/MimeTypeDetector.php | 19 + .../src/OverridingExtensionToMimeTypeMap.php | 30 + .../meilisearch-laravel-scout/.editorconfig | 23 + .../.github/release-draft-template.yml | 27 + .../.github/workflows/release-drafter.yml | 16 + .../.github/workflows/tests.yml | 52 + .../meilisearch-laravel-scout/.gitignore | 6 + .../meilisearch-laravel-scout/.php_cs.dist | 16 + .../meilisearch-laravel-scout/CONTRIBUTING.md | 102 + .../meilisearch-laravel-scout/LICENSE | 21 + .../meilisearch-laravel-scout/README.md | 264 + .../meilisearch-laravel-scout/bors.toml | 9 + .../meilisearch-laravel-scout/composer.json | 56 + .../config/config.php | 38 + .../phpunit.xml.dist | 32 + .../src/Console/IndexMeilisearch.php | 58 + .../src/Engines/MeilisearchEngine.php | 244 + .../src/MeilisearchServiceProvider.php | 49 + .../tests/Feature/FeatureTestCase.php | 42 + .../Feature/MeilisearchConsoleCommandTest.php | 50 + .../tests/Feature/MeilisearchTest.php | 156 + .../tests/Fixtures/SearchableModel.php | 28 + .../tests/TestCase.php | 43 + .../Unit/MeilisearchConsoleCommandTest.php | 92 + .../tests/Unit/MeilisearchEngineTest.php | 350 + .../.code-samples.meilisearch.yaml | 309 + .../meilisearch/meilisearch-php/.editorconfig | 20 + .../.github/release-draft-template.yml | 27 + .../.github/workflows/pre-release-tests.yml | 66 + .../.github/workflows/release-drafter.yml | 16 + .../.github/workflows/tests.yml | 82 + vendor/meilisearch/meilisearch-php/.gitignore | 3 + .../meilisearch/meilisearch-php/.php_cs.dist | 19 + .../meilisearch-php/CONTRIBUTING.md | 111 + vendor/meilisearch/meilisearch-php/LICENSE | 21 + vendor/meilisearch/meilisearch-php/README.md | 232 + vendor/meilisearch/meilisearch-php/bors.toml | 9 + .../meilisearch/meilisearch-php/composer.json | 52 + .../meilisearch/meilisearch-php/phpunit.xml | 14 + .../meilisearch-php/scripts/tests.sh | 7 + .../meilisearch-php/src/Client.php | 66 + .../src/Contracts/Endpoint.php | 23 + .../meilisearch-php/src/Contracts/Http.php | 18 + .../src/Delegates/HandlesIndex.php | 73 + .../src/Delegates/HandlesSystem.php | 52 + .../Endpoints/Delegates/HandlesDocuments.php | 64 + .../src/Endpoints/Delegates/HandlesDumps.php | 23 + .../Endpoints/Delegates/HandlesSettings.php | 132 + .../meilisearch-php/src/Endpoints/Dumps.php | 22 + .../meilisearch-php/src/Endpoints/Health.php | 12 + .../meilisearch-php/src/Endpoints/Indexes.php | 198 + .../meilisearch-php/src/Endpoints/Keys.php | 12 + .../meilisearch-php/src/Endpoints/Stats.php | 12 + .../meilisearch-php/src/Endpoints/Version.php | 12 + .../src/Exceptions/ApiException.php | 88 + .../src/Exceptions/CommunicationException.php | 15 + .../Exceptions/InvalidArgumentException.php | 28 + .../src/Exceptions/TimeOutException.php | 32 + .../meilisearch-php/src/Http/Client.php | 195 + .../meilisearch-php/src/MeiliSearch.php | 10 + .../src/Search/SearchResult.php | 248 + .../tests/Endpoints/ClientTest.php | 310 + .../tests/Endpoints/DocumentsTest.php | 318 + .../tests/Endpoints/DumpTest.php | 32 + .../tests/Endpoints/IndexTest.php | 215 + .../Endpoints/KeysAndPermissionsTest.php | 74 + .../tests/Endpoints/SearchTest.php | 605 + .../tests/Endpoints/UpdatesTest.php | 63 + .../tests/Exceptions/ApiExceptionTest.php | 36 + .../meilisearch-php/tests/Http/ClientTest.php | 20 + .../tests/Search/SearchResultTest.php | 227 + .../Settings/AttributesForFacetingTest.php | 55 + .../Settings/DisplayedAttributesTest.php | 60 + .../tests/Settings/DistinctAttributeTest.php | 48 + .../tests/Settings/RankingRulesTest.php | 67 + .../Settings/SearchableAttributesTest.php | 57 + .../tests/Settings/SettingsTest.php | 140 + .../tests/Settings/StopWordsTest.php | 56 + .../tests/Settings/SynonymsTest.php | 59 + .../meilisearch-php/tests/TestCase.php | 47 + vendor/mockery/mockery/.phpstorm.meta.php | 14 +- vendor/mockery/mockery/CHANGELOG.md | 56 + vendor/mockery/mockery/README.md | 12 +- vendor/mockery/mockery/composer.json | 9 +- .../mockery/docs/mockery/configuration.rst | 17 +- .../docs/mockery/reserved_method_names.rst | 15 +- .../docs/reference/argument_validation.rst | 2 +- .../mockery/docs/reference/expectations.rst | 28 + .../docs/reference/final_methods_classes.rst | 5 +- .../docs/reference/phpunit_integration.rst | 6 - .../mockery/mockery/docs/reference/spies.rst | 2 +- vendor/mockery/mockery/library/Mockery.php | 76 +- .../Phpunit/Legacy/TestListenerForV5.php | 47 - .../Phpunit/Legacy/TestListenerForV6.php | 51 - .../Phpunit/Legacy/TestListenerForV7.php | 55 - .../Phpunit/MockeryPHPUnitIntegration.php | 6 - ...HPUnitIntegrationAssertPostConditions.php} | 2 +- ...onAssertPostConditionsForV7AndPrevious.php | 29 - .../Adapter/Phpunit/MockeryTestCase.php | 23 - ...etUpForV8.php => MockeryTestCaseSetUp.php} | 2 +- .../MockeryTestCaseSetUpForV7AndPrevious.php | 36 - .../Mockery/Adapter/Phpunit/TestListener.php | 31 +- .../{Legacy => }/TestListenerTrait.php | 10 +- .../mockery/library/Mockery/Configuration.php | 97 +- .../mockery/library/Mockery/Container.php | 12 +- .../mockery/library/Mockery/Expectation.php | 40 +- .../library/Mockery/ExpectationDirector.php | 10 +- .../library/Mockery/ExpectationInterface.php | 2 +- .../Mockery/Generator/MockConfiguration.php | 28 - .../Generator/MockConfigurationBuilder.php | 4 +- .../StringManipulation/Pass/ClassPass.php | 5 - .../Pass/MethodDefinitionPass.php | 5 +- .../RemoveBuiltinMethodsThatAreFinalPass.php | 1 + .../library/Mockery/LegacyMockInterface.php | 2 +- .../Mockery/Matcher/PHPUnitConstraint.php | 76 - .../mockery/mockery/library/Mockery/Mock.php | 31 +- .../Mockery/QuickDefinitionsConfiguration.php | 56 + .../mockery/library/Mockery/Reflector.php | 129 +- vendor/monolog/monolog/CHANGELOG.md | 15 + vendor/monolog/monolog/composer.json | 2 +- .../Monolog/Formatter/FlowdockFormatter.php | 1 + .../Formatter/GelfMessageFormatter.php | 45 +- .../Formatter/GoogleCloudLoggingFormatter.php | 3 +- .../src/Monolog/Handler/AmqpHandler.php | 15 +- .../Monolog/Handler/BrowserConsoleHandler.php | 17 +- .../src/Monolog/Handler/FlowdockHandler.php | 1 + .../Handler/WhatFailureGroupHandler.php | 14 + vendor/monolog/monolog/src/Monolog/Logger.php | 68 +- .../Processor/PsrLogMessageProcessor.php | 2 + vendor/nesbot/carbon/.phpstorm.meta.php | 10 + vendor/nesbot/carbon/composer.json | 1 + .../MessageFormatterMapperStrongType.php | 28 + .../MessageFormatterMapperWeakType.php | 36 + vendor/nesbot/carbon/readme.md | 1 + .../carbon/src/Carbon/AbstractTranslator.php | 5 +- vendor/nesbot/carbon/src/Carbon/Carbon.php | 4 +- .../carbon/src/Carbon/CarbonImmutable.php | 958 +- .../carbon/src/Carbon/CarbonInterface.php | 81 +- .../carbon/src/Carbon/CarbonInterval.php | 20 +- .../nesbot/carbon/src/Carbon/CarbonPeriod.php | 226 +- .../src/Carbon/CarbonPeriodImmutable.php | 33 + vendor/nesbot/carbon/src/Carbon/Factory.php | 6 +- .../carbon/src/Carbon/FactoryImmutable.php | 6 +- .../nesbot/carbon/src/Carbon/Lang/ar_AE.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_BH.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_EG.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_IQ.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_JO.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_KW.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_LB.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_OM.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_PS.php | 5 + .../nesbot/carbon/src/Carbon/Lang/ar_QA.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_SA.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_SD.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_SY.php | 2 + .../nesbot/carbon/src/Carbon/Lang/ar_YE.php | 2 + vendor/nesbot/carbon/src/Carbon/Lang/be.php | 7 +- .../carbon/src/Carbon/Lang/ca_ES_Valencia.php | 10 + vendor/nesbot/carbon/src/Carbon/Lang/oc.php | 2 +- vendor/nesbot/carbon/src/Carbon/Lang/pl.php | 2 +- vendor/nesbot/carbon/src/Carbon/Lang/sh.php | 2 +- .../nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php | 22 +- .../carbon/src/Carbon/Lang/sr_Cyrl_BA.php | 10 + .../carbon/src/Carbon/Lang/sr_Cyrl_ME.php | 31 +- .../carbon/src/Carbon/Lang/sr_Cyrl_XK.php | 10 + .../carbon/src/Carbon/Lang/sr_Latn_BA.php | 10 + .../carbon/src/Carbon/Lang/sr_Latn_ME.php | 10 + .../carbon/src/Carbon/Lang/sr_Latn_XK.php | 10 + .../MessageFormatterMapper.php | 42 + .../carbon/src/Carbon/Traits/Comparison.php | 36 +- .../carbon/src/Carbon/Traits/Converter.php | 11 +- .../carbon/src/Carbon/Traits/Creator.php | 27 +- .../carbon/src/Carbon/Traits/Difference.php | 2 +- .../nesbot/carbon/src/Carbon/Traits/Mixin.php | 16 +- .../carbon/src/Carbon/Traits/Modifiers.php | 6 +- .../carbon/src/Carbon/Traits/Options.php | 2 +- .../src/Carbon/Traits/Serialization.php | 22 + .../src/Carbon/Traits/ToStringFormat.php | 8 +- vendor/nikic/php-parser/grammar/php5.y | 12 +- vendor/nikic/php-parser/grammar/php7.y | 19 +- .../lib/PhpParser/Builder/EnumCase.php | 4 +- .../lib/PhpParser/Lexer/Emulative.php | 5 +- .../ReadonlyFunctionTokenEmulator.php | 31 + .../PhpParser/NodeVisitor/NameResolver.php | 2 +- .../php-parser/lib/PhpParser/Parser/Php5.php | 2762 +-- .../php-parser/lib/PhpParser/Parser/Php7.php | 2354 +-- .../october/rain/.github/workflows/tests.yml | 12 +- vendor/october/rain/LICENSE | 1 + vendor/october/rain/build/rain-split-1.0.sh | 10 +- .../october/rain/build/rain-split-stable.sh | 10 +- vendor/october/rain/composer.json | 16 +- .../rain/src/Argon/ArgonServiceProvider.php | 6 +- vendor/october/rain/src/Auth/Manager.php | 4 +- vendor/october/rain/src/Auth/Models/Role.php | 8 +- .../october/rain/src/Auth/Models/Throttle.php | 2 +- vendor/october/rain/src/Auth/Models/User.php | 14 +- .../october/rain/src/Database/Attach/File.php | 11 +- .../rain/src/Database/Behaviors/Sortable.php | 9 +- vendor/october/rain/src/Database/Builder.php | 2 + .../Database/Concerns/GuardsAttributes.php | 9 +- .../Database/Concerns/HasRelationships.php | 39 +- .../Concerns/QueriesRelationships.php | 68 + ...Db_Add_Pivot_Data_To_Deferred_Bindings.php | 22 + .../src/Database/Models/DeferredBinding.php | 12 + .../src/Database/Relations/AttachMany.php | 9 +- .../rain/src/Database/Relations/AttachOne.php | 9 +- .../src/Database/Relations/BelongsToMany.php | 30 +- .../src/Database/Relations/DeferOneOrMany.php | 15 +- .../Database/Relations/DefinedConstraints.php | 1 - .../src/Database/Traits/DeferredBinding.php | 9 +- vendor/october/rain/src/Database/Updater.php | 22 +- .../rain/src/Extension/ExtendableTrait.php | 6 +- .../rain/src/Filesystem/Definitions.php | 5 +- .../rain/src/Foundation/Application.php | 21 +- .../rain/src/Foundation/Exception/Handler.php | 22 +- .../rain/src/Foundation/Http/Kernel.php | 13 +- .../Http/Middleware/CheckForTrustedHost.php | 82 + vendor/october/rain/src/Foundation/Maker.php | 5 +- .../rain/src/Halcyon/MemoryRepository.php | 3 +- vendor/october/rain/src/Halcyon/Model.php | 4 +- .../src/Halcyon/Processors/SectionParser.php | 3 +- .../rain/src/Http/Middleware/TrustHosts.php | 71 + vendor/october/rain/src/Mail/Mailer.php | 4 +- vendor/october/rain/src/Network/Http.php | 2 +- .../rain/src/Parse/Syntax/FieldParser.php | 16 +- .../Console/controller/config_form.stub | 6 +- .../rain/src/Support/Facades/Event.php | 28 + .../october/rain/src/Support/Facades/Mail.php | 51 + .../src/Support/Testing/Fakes/EventFake.php | 13 + .../src/Support/Testing/Fakes/MailFake.php | 92 + vendor/october/rain/src/Support/helpers.php | 8 +- .../Concerns/HasRelationshipsTest.php | 76 + .../tests/Database/EloquentWithCountTest.php | 138 + .../rain/tests/Database/QueryBuilderTest.php | 6 +- .../rain/tests/Database/RelationsTest.php | 200 - .../Middleware/CheckForTrustedHostTest.php | 217 + .../tests/Parse/SyntaxFieldParserTest.php | 17 + .../rain/tests/Support/EventFakeTest.php | 20 + .../rain/tests/Support/HelpersTest.php | 4 + .../rain/tests/Support/MailFakeTest.php | 60 + vendor/october/rain/tests/TestCase.php | 19 + .../tests/fixtures/halcyon/models/Page.php | 4 + .../client-common/.php-cs-fixer.dist.php | 18 + vendor/php-http/client-common/.php_cs.dist | 24 + vendor/php-http/client-common/CHANGELOG.md | 290 + vendor/php-http/client-common/LICENSE | 19 + vendor/php-http/client-common/README.md | 55 + vendor/php-http/client-common/composer.json | 67 + .../client-common/src/BatchClient.php | 42 + .../src/BatchClientInterface.php | 34 + .../client-common/src/BatchResult.php | 157 + .../php-http/client-common/src/Deferred.php | 155 + .../src/EmulatedHttpAsyncClient.php | 25 + .../client-common/src/EmulatedHttpClient.php | 24 + .../src/Exception/BatchException.php | 37 + .../CircularRedirectionException.php | 16 + .../src/Exception/ClientErrorException.php | 16 + .../Exception/HttpClientNoMatchException.php | 33 + .../Exception/HttpClientNotFoundException.php | 16 + .../src/Exception/LoopException.php | 16 + .../MultipleRedirectionException.php | 16 + .../src/Exception/ServerErrorException.php | 16 + .../client-common/src/FlexibleHttpClient.php | 36 + .../src/HttpAsyncClientDecorator.php | 31 + .../src/HttpAsyncClientEmulator.php | 39 + .../client-common/src/HttpClientDecorator.php | 32 + .../client-common/src/HttpClientEmulator.php | 35 + .../client-common/src/HttpClientPool.php | 24 + .../src/HttpClientPool/HttpClientPool.php | 70 + .../src/HttpClientPool/HttpClientPoolItem.php | 181 + .../HttpClientPool/LeastUsedClientPool.php | 45 + .../src/HttpClientPool/RandomClientPool.php | 31 + .../HttpClientPool/RoundRobinClientPool.php | 42 + .../client-common/src/HttpClientRouter.php | 74 + .../src/HttpClientRouterInterface.php | 27 + .../client-common/src/HttpMethodsClient.php | 150 + .../src/HttpMethodsClientInterface.php | 116 + vendor/php-http/client-common/src/Plugin.php | 33 + .../src/Plugin/AddHostPlugin.php | 76 + .../src/Plugin/AddPathPlugin.php | 78 + .../src/Plugin/AuthenticationPlugin.php | 38 + .../src/Plugin/BaseUriPlugin.php | 57 + .../src/Plugin/ContentLengthPlugin.php | 39 + .../src/Plugin/ContentTypePlugin.php | 122 + .../client-common/src/Plugin/CookiePlugin.php | 180 + .../src/Plugin/DecoderPlugin.php | 135 + .../client-common/src/Plugin/ErrorPlugin.php | 92 + .../src/Plugin/HeaderAppendPlugin.php | 48 + .../src/Plugin/HeaderDefaultsPlugin.php | 46 + .../src/Plugin/HeaderRemovePlugin.php | 44 + .../src/Plugin/HeaderSetPlugin.php | 44 + .../src/Plugin/HistoryPlugin.php | 49 + .../client-common/src/Plugin/Journal.php | 33 + .../src/Plugin/QueryDefaultsPlugin.php | 50 + .../src/Plugin/RedirectPlugin.php | 344 + .../src/Plugin/RequestMatcherPlugin.php | 56 + .../src/Plugin/RequestSeekableBodyPlugin.php | 29 + .../src/Plugin/ResponseSeekableBodyPlugin.php | 32 + .../client-common/src/Plugin/RetryPlugin.php | 179 + .../src/Plugin/SeekableBodyPlugin.php | 47 + .../src/Plugin/VersionBridgePlugin.php | 24 + .../client-common/src/PluginChain.php | 63 + .../client-common/src/PluginClient.php | 129 + .../client-common/src/PluginClientBuilder.php | 76 + .../client-common/src/PluginClientFactory.php | 68 + .../client-common/src/VersionBridgeClient.php | 24 + vendor/php-http/discovery/.php-cs-fixer.php | 16 + vendor/php-http/discovery/CHANGELOG.md | 340 + vendor/php-http/discovery/LICENSE | 19 + vendor/php-http/discovery/README.md | 47 + vendor/php-http/discovery/composer.json | 59 + .../php-http/discovery/src/ClassDiscovery.php | 252 + .../discovery/src/Composer/Plugin.php | 370 + vendor/php-http/discovery/src/Exception.php | 12 + .../ClassInstantiationFailedException.php | 14 + .../Exception/DiscoveryFailedException.php | 51 + .../Exception/NoCandidateFoundException.php | 47 + .../src/Exception/NotFoundException.php | 16 + .../Exception/PuliUnavailableException.php | 12 + .../StrategyUnavailableException.php | 15 + .../src/HttpAsyncClientDiscovery.php | 32 + .../discovery/src/HttpClientDiscovery.php | 32 + .../discovery/src/MessageFactoryDiscovery.php | 34 + .../discovery/src/NotFoundException.php | 14 + .../php-http/discovery/src/Psr17Factory.php | 282 + .../discovery/src/Psr17FactoryDiscovery.php | 136 + .../discovery/src/Psr18ClientDiscovery.php | 32 + .../src/Strategy/CommonClassesStrategy.php | 191 + .../Strategy/CommonPsr17ClassesStrategy.php | 107 + .../src/Strategy/DiscoveryStrategy.php | 23 + .../src/Strategy/MockClientStrategy.php | 27 + .../src/Strategy/PuliBetaStrategy.php | 93 + .../discovery/src/StreamFactoryDiscovery.php | 34 + .../discovery/src/UriFactoryDiscovery.php | 34 + vendor/php-http/guzzle7-adapter/CHANGELOG.md | 18 + vendor/php-http/guzzle7-adapter/LICENSE | 19 + vendor/php-http/guzzle7-adapter/README.md | 45 + vendor/php-http/guzzle7-adapter/composer.json | 43 + .../guzzle7-adapter/phpstan.neon.dist | 5 + .../guzzle7-adapter/psalm.baseline.xml | 8 + vendor/php-http/guzzle7-adapter/psalm.xml | 16 + .../php-http/guzzle7-adapter/src/Client.php | 75 + .../Exception/UnexpectedValueException.php | 9 + .../php-http/guzzle7-adapter/src/Promise.php | 132 + .../php-http/httplug/.php-cs-fixer.dist.php | 16 + vendor/php-http/httplug/CHANGELOG.md | 136 + vendor/php-http/httplug/LICENSE | 20 + vendor/php-http/httplug/README.md | 62 + vendor/php-http/httplug/composer.json | 45 + vendor/php-http/httplug/puli.json | 12 + vendor/php-http/httplug/src/Exception.php | 14 + .../httplug/src/Exception/HttpException.php | 65 + .../src/Exception/NetworkException.php | 28 + .../src/Exception/RequestAwareTrait.php | 26 + .../src/Exception/RequestException.php | 29 + .../src/Exception/TransferException.php | 14 + .../php-http/httplug/src/HttpAsyncClient.php | 25 + vendor/php-http/httplug/src/HttpClient.php | 15 + .../src/Promise/HttpFulfilledPromise.php | 54 + .../src/Promise/HttpRejectedPromise.php | 58 + vendor/php-http/message-factory/CHANGELOG.md | 65 + vendor/php-http/message-factory/LICENSE | 19 + vendor/php-http/message-factory/README.md | 36 + vendor/php-http/message-factory/composer.json | 27 + vendor/php-http/message-factory/puli.json | 43 + .../message-factory/src/MessageFactory.php | 12 + .../message-factory/src/RequestFactory.php | 34 + .../message-factory/src/ResponseFactory.php | 35 + .../message-factory/src/StreamFactory.php | 25 + .../message-factory/src/UriFactory.php | 24 + vendor/php-http/message/CHANGELOG.md | 254 + vendor/php-http/message/LICENSE | 19 + vendor/php-http/message/README.md | 51 + vendor/php-http/message/apigen.neon | 6 + vendor/php-http/message/composer.json | 68 + vendor/php-http/message/puli.json | 111 + .../php-http/message/src/Authentication.php | 25 + .../src/Authentication/AutoBasicAuth.php | 48 + .../message/src/Authentication/BasicAuth.php | 44 + .../message/src/Authentication/Bearer.php | 37 + .../message/src/Authentication/Chain.php | 47 + .../message/src/Authentication/Header.php | 36 + .../message/src/Authentication/Matching.php | 69 + .../message/src/Authentication/QueryParam.php | 47 + .../src/Authentication/RequestConditional.php | 43 + .../message/src/Authentication/Wsse.php | 68 + .../message/src/Builder/ResponseBuilder.php | 146 + vendor/php-http/message/src/Cookie.php | 524 + vendor/php-http/message/src/CookieJar.php | 212 + vendor/php-http/message/src/CookieUtil.php | 53 + .../src/Decorator/MessageDecorator.php | 133 + .../src/Decorator/RequestDecorator.php | 86 + .../src/Decorator/ResponseDecorator.php | 55 + .../message/src/Decorator/StreamDecorator.php | 138 + .../message/src/Encoding/ChunkStream.php | 39 + .../message/src/Encoding/CompressStream.php | 45 + .../message/src/Encoding/DechunkStream.php | 29 + .../message/src/Encoding/DecompressStream.php | 45 + .../message/src/Encoding/DeflateStream.php | 41 + .../message/src/Encoding/Filter/Chunk.php | 31 + .../message/src/Encoding/FilteredStream.php | 234 + .../message/src/Encoding/GzipDecodeStream.php | 45 + .../message/src/Encoding/GzipEncodeStream.php | 45 + .../message/src/Encoding/InflateStream.php | 45 + vendor/php-http/message/src/Exception.php | 10 + .../Exception/UnexpectedValueException.php | 9 + vendor/php-http/message/src/Formatter.php | 35 + .../src/Formatter/CurlCommandFormatter.php | 103 + .../Formatter/FullHttpMessageFormatter.php | 116 + .../message/src/Formatter/SimpleFormatter.php | 52 + .../DiactorosMessageFactory.php | 82 + .../MessageFactory/GuzzleMessageFactory.php | 55 + .../src/MessageFactory/SlimMessageFactory.php | 74 + .../php-http/message/src/RequestMatcher.php | 26 + .../RequestMatcher/CallbackRequestMatcher.php | 32 + .../RequestMatcher/RegexRequestMatcher.php | 41 + .../src/RequestMatcher/RequestMatcher.php | 78 + .../message/src/Stream/BufferedStream.php | 273 + .../StreamFactory/DiactorosStreamFactory.php | 48 + .../src/StreamFactory/GuzzleStreamFactory.php | 28 + .../src/StreamFactory/SlimStreamFactory.php | 39 + .../src/UriFactory/DiactorosUriFactory.php | 36 + .../src/UriFactory/GuzzleUriFactory.php | 29 + .../message/src/UriFactory/SlimUriFactory.php | 33 + vendor/php-http/message/src/filters.php | 6 + vendor/php-http/promise/CHANGELOG.md | 48 + vendor/php-http/promise/LICENSE | 19 + vendor/php-http/promise/README.md | 48 + vendor/php-http/promise/composer.json | 38 + .../php-http/promise/src/FulfilledPromise.php | 58 + vendor/php-http/promise/src/Promise.php | 69 + .../php-http/promise/src/RejectedPromise.php | 58 + vendor/phpoption/phpoption/Makefile | 26 - vendor/phpoption/phpoption/composer.json | 15 +- .../phpunit/php-token-stream/.gitattributes | 11 + .../php-token-stream/.github/FUNDING.yml | 1 - vendor/phpunit/php-token-stream/.gitignore | 4 + vendor/phpunit/php-token-stream/.travis.yml | 26 - vendor/phpunit/php-token-stream/ChangeLog.md | 51 +- vendor/phpunit/php-token-stream/LICENSE | 2 +- vendor/phpunit/php-token-stream/README.md | 14 +- vendor/phpunit/php-token-stream/build.xml | 21 - vendor/phpunit/php-token-stream/composer.json | 9 +- vendor/phpunit/php-token-stream/phpunit.xml | 21 - .../phpunit/php-token-stream/src/Abstract.php | 12 + .../php-token-stream/src/Ampersand.php | 12 + .../phpunit/php-token-stream/src/AndEqual.php | 12 + vendor/phpunit/php-token-stream/src/Array.php | 12 + .../php-token-stream/src/ArrayCast.php | 12 + vendor/phpunit/php-token-stream/src/As.php | 12 + vendor/phpunit/php-token-stream/src/At.php | 12 + .../phpunit/php-token-stream/src/Backtick.php | 12 + .../php-token-stream/src/BadCharacter.php | 12 + .../phpunit/php-token-stream/src/BoolCast.php | 12 + .../php-token-stream/src/BooleanAnd.php | 12 + .../php-token-stream/src/BooleanOr.php | 12 + .../src/{Token/Stream => }/CachingFactory.php | 12 +- .../phpunit/php-token-stream/src/Callable.php | 12 + vendor/phpunit/php-token-stream/src/Caret.php | 12 + vendor/phpunit/php-token-stream/src/Case.php | 12 + vendor/phpunit/php-token-stream/src/Catch.php | 12 + .../php-token-stream/src/Character.php | 12 + vendor/phpunit/php-token-stream/src/Class.php | 62 + .../phpunit/php-token-stream/src/ClassC.php | 12 + .../src/ClassNameConstant.php | 12 + vendor/phpunit/php-token-stream/src/Clone.php | 12 + .../php-token-stream/src/CloseBracket.php | 12 + .../php-token-stream/src/CloseCurly.php | 12 + .../php-token-stream/src/CloseSquare.php | 12 + .../phpunit/php-token-stream/src/CloseTag.php | 12 + .../phpunit/php-token-stream/src/Coalesce.php | 12 + .../php-token-stream/src/CoalesceEqual.php | 12 + vendor/phpunit/php-token-stream/src/Colon.php | 12 + vendor/phpunit/php-token-stream/src/Comma.php | 12 + .../phpunit/php-token-stream/src/Comment.php | 12 + .../php-token-stream/src/ConcatEqual.php | 12 + vendor/phpunit/php-token-stream/src/Const.php | 12 + .../src/ConstantEncapsedString.php | 12 + .../phpunit/php-token-stream/src/Continue.php | 12 + .../php-token-stream/src/CurlyOpen.php | 12 + .../phpunit/php-token-stream/src/DNumber.php | 12 + vendor/phpunit/php-token-stream/src/Dec.php | 12 + .../phpunit/php-token-stream/src/Declare.php | 12 + .../phpunit/php-token-stream/src/Default.php | 12 + vendor/phpunit/php-token-stream/src/Dir.php | 12 + vendor/phpunit/php-token-stream/src/Div.php | 12 + .../phpunit/php-token-stream/src/DivEqual.php | 12 + vendor/phpunit/php-token-stream/src/Do.php | 12 + .../php-token-stream/src/DocComment.php | 12 + .../phpunit/php-token-stream/src/Dollar.php | 12 + .../src/DollarOpenCurlyBraces.php | 12 + vendor/phpunit/php-token-stream/src/Dot.php | 12 + .../php-token-stream/src/DoubleArrow.php | 12 + .../php-token-stream/src/DoubleCast.php | 12 + .../php-token-stream/src/DoubleColon.php | 12 + .../php-token-stream/src/DoubleQuotes.php | 12 + vendor/phpunit/php-token-stream/src/Echo.php | 12 + .../phpunit/php-token-stream/src/Ellipsis.php | 12 + vendor/phpunit/php-token-stream/src/Else.php | 12 + .../phpunit/php-token-stream/src/Elseif.php | 12 + vendor/phpunit/php-token-stream/src/Empty.php | 12 + .../src/EncapsedAndWhitespace.php | 12 + .../php-token-stream/src/EndHeredoc.php | 12 + .../php-token-stream/src/Enddeclare.php | 12 + .../phpunit/php-token-stream/src/Endfor.php | 12 + .../php-token-stream/src/Endforeach.php | 12 + vendor/phpunit/php-token-stream/src/Endif.php | 12 + .../php-token-stream/src/Endswitch.php | 12 + .../phpunit/php-token-stream/src/Endwhile.php | 12 + vendor/phpunit/php-token-stream/src/Equal.php | 12 + vendor/phpunit/php-token-stream/src/Eval.php | 12 + .../php-token-stream/src/ExclamationMark.php | 12 + vendor/phpunit/php-token-stream/src/Exit.php | 12 + .../phpunit/php-token-stream/src/Extends.php | 12 + vendor/phpunit/php-token-stream/src/File.php | 12 + vendor/phpunit/php-token-stream/src/Final.php | 12 + .../phpunit/php-token-stream/src/Finally.php | 12 + vendor/phpunit/php-token-stream/src/Fn.php | 12 + vendor/phpunit/php-token-stream/src/For.php | 12 + .../phpunit/php-token-stream/src/Foreach.php | 12 + vendor/phpunit/php-token-stream/src/FuncC.php | 12 + .../phpunit/php-token-stream/src/Function.php | 196 + .../phpunit/php-token-stream/src/Global.php | 12 + vendor/phpunit/php-token-stream/src/Goto.php | 12 + vendor/phpunit/php-token-stream/src/Gt.php | 12 + .../php-token-stream/src/HaltCompiler.php | 12 + vendor/phpunit/php-token-stream/src/If.php | 12 + .../php-token-stream/src/Implements.php | 12 + vendor/phpunit/php-token-stream/src/Inc.php | 12 + .../phpunit/php-token-stream/src/Include.php | 12 + .../php-token-stream/src/IncludeOnce.php | 12 + .../phpunit/php-token-stream/src/Includes.php | 57 + .../php-token-stream/src/InlineHtml.php | 12 + .../php-token-stream/src/Instanceof.php | 12 + .../php-token-stream/src/Insteadof.php | 12 + .../phpunit/php-token-stream/src/IntCast.php | 12 + .../php-token-stream/src/Interface.php | 166 + .../phpunit/php-token-stream/src/IsEqual.php | 12 + .../php-token-stream/src/IsGreaterOrEqual.php | 12 + .../php-token-stream/src/IsIdentical.php | 12 + .../php-token-stream/src/IsNotEqual.php | 12 + .../php-token-stream/src/IsNotIdentical.php | 12 + .../php-token-stream/src/IsSmallerOrEqual.php | 12 + vendor/phpunit/php-token-stream/src/Isset.php | 12 + vendor/phpunit/php-token-stream/src/Line.php | 12 + vendor/phpunit/php-token-stream/src/List.php | 12 + .../phpunit/php-token-stream/src/Lnumber.php | 12 + .../php-token-stream/src/LogicalAnd.php | 12 + .../php-token-stream/src/LogicalOr.php | 12 + .../php-token-stream/src/LogicalXor.php | 12 + vendor/phpunit/php-token-stream/src/Lt.php | 12 + .../phpunit/php-token-stream/src/MethodC.php | 12 + vendor/phpunit/php-token-stream/src/Minus.php | 12 + .../php-token-stream/src/MinusEqual.php | 12 + .../phpunit/php-token-stream/src/ModEqual.php | 12 + .../phpunit/php-token-stream/src/MulEqual.php | 12 + vendor/phpunit/php-token-stream/src/Mult.php | 12 + .../src/NameFullyQualified.php | 12 + .../php-token-stream/src/NameQualified.php | 12 + .../php-token-stream/src/NameRelative.php | 12 + .../php-token-stream/src/Namespace.php | 31 + vendor/phpunit/php-token-stream/src/New.php | 12 + vendor/phpunit/php-token-stream/src/NsC.php | 12 + .../php-token-stream/src/NsSeparator.php | 12 + .../php-token-stream/src/NumString.php | 12 + .../php-token-stream/src/ObjectCast.php | 12 + .../php-token-stream/src/ObjectOperator.php | 12 + .../php-token-stream/src/OpenBracket.php | 12 + .../php-token-stream/src/OpenCurly.php | 12 + .../php-token-stream/src/OpenSquare.php | 12 + .../phpunit/php-token-stream/src/OpenTag.php | 12 + .../php-token-stream/src/OpenTagWithEcho.php | 12 + .../phpunit/php-token-stream/src/OrEqual.php | 12 + .../src/PaamayimNekudotayim.php | 12 + .../phpunit/php-token-stream/src/Percent.php | 12 + vendor/phpunit/php-token-stream/src/Pipe.php | 12 + vendor/phpunit/php-token-stream/src/Plus.php | 12 + .../php-token-stream/src/PlusEqual.php | 12 + vendor/phpunit/php-token-stream/src/Pow.php | 12 + .../phpunit/php-token-stream/src/PowEqual.php | 12 + vendor/phpunit/php-token-stream/src/Print.php | 12 + .../phpunit/php-token-stream/src/Private.php | 12 + .../php-token-stream/src/Protected.php | 12 + .../phpunit/php-token-stream/src/Public.php | 12 + .../php-token-stream/src/QuestionMark.php | 12 + .../phpunit/php-token-stream/src/Require.php | 12 + .../php-token-stream/src/RequireOnce.php | 12 + .../phpunit/php-token-stream/src/Return.php | 12 + .../php-token-stream/src/Semicolon.php | 12 + vendor/phpunit/php-token-stream/src/Sl.php | 12 + .../phpunit/php-token-stream/src/SlEqual.php | 12 + .../php-token-stream/src/Spaceship.php | 12 + vendor/phpunit/php-token-stream/src/Sr.php | 12 + .../phpunit/php-token-stream/src/SrEqual.php | 12 + .../php-token-stream/src/StartHeredoc.php | 12 + .../phpunit/php-token-stream/src/Static.php | 12 + .../src/{Token => }/Stream.php | 575 +- .../phpunit/php-token-stream/src/String.php | 12 + .../php-token-stream/src/StringCast.php | 12 + .../php-token-stream/src/StringVarname.php | 12 + .../phpunit/php-token-stream/src/Switch.php | 12 + vendor/phpunit/php-token-stream/src/Throw.php | 12 + vendor/phpunit/php-token-stream/src/Tilde.php | 12 + vendor/phpunit/php-token-stream/src/Token.php | 1303 +- .../php-token-stream/src/TokenWithScope.php | 107 + .../src/TokenWithScopeAndVisibility.php | 67 + vendor/phpunit/php-token-stream/src/Trait.php | 12 + .../phpunit/php-token-stream/src/TraitC.php | 12 + vendor/phpunit/php-token-stream/src/Try.php | 12 + vendor/phpunit/php-token-stream/src/Unset.php | 12 + .../php-token-stream/src/UnsetCast.php | 12 + vendor/phpunit/php-token-stream/src/Use.php | 12 + .../php-token-stream/src/UseFunction.php | 12 + .../php-token-stream/src/{Token => }/Util.php | 9 +- vendor/phpunit/php-token-stream/src/Var.php | 12 + .../phpunit/php-token-stream/src/Variable.php | 12 + vendor/phpunit/php-token-stream/src/While.php | 12 + .../php-token-stream/src/Whitespace.php | 12 + .../phpunit/php-token-stream/src/XorEqual.php | 12 + vendor/phpunit/php-token-stream/src/Yield.php | 12 + .../php-token-stream/src/YieldFrom.php | 12 + vendor/phpunit/php-token-stream/src/break.php | 12 + .../tests/Token/ClassTest.php | 152 - .../tests/Token/ClosureTest.php | 64 - .../tests/Token/FunctionTest.php | 124 - .../tests/Token/IncludeTest.php | 53 - .../tests/Token/InterfaceTest.php | 169 - .../tests/Token/NamespaceTest.php | 62 - .../_fixture/classExtendsNamespacedClass.php | 10 - .../tests/_fixture/classInNamespace.php | 6 - .../tests/_fixture/classInScopedNamespace.php | 9 - .../_fixture/classUsesNamespacedFunction.php | 8 - .../class_with_method_named_empty.php | 7 - ...h_method_that_declares_anonymous_class.php | 15 - ..._method_that_declares_anonymous_class2.php | 16 - ...ltiple_anonymous_classes_and_functions.php | 26 - .../tests/_fixture/closure.php | 7 - .../tests/_fixture/issue19.php | 3 - .../tests/_fixture/issue30.php | 8 - ...tipleNamespacesWithOneClassUsingBraces.php | 12 - ...espacesWithOneClassUsingNonBraceSyntax.php | 14 - .../_fixture/php-code-coverage-issue-424.php | 13 - .../tests/_fixture/source.php | 42 - .../tests/_fixture/source2.php | 6 - .../tests/_fixture/source3.php | 14 - .../tests/_fixture/source4.php | 30 - .../tests/_fixture/source5.php | 5 - .../php-token-stream/tests/bootstrap.php | 15 - vendor/phpunit/phpunit/ChangeLog-8.5.md | 7 + vendor/phpunit/phpunit/LICENSE | 2 +- vendor/phpunit/phpunit/README.md | 10 +- .../phpunit/phpunit/src/Framework/Assert.php | 2 +- .../Constraint/ClassHasAttribute.php | 2 +- .../Constraint/ClassHasStaticAttribute.php | 2 +- .../src/Framework/MockObject/Generator.php | 40 +- .../src/Framework/MockObject/MockBuilder.php | 4 +- .../phpunit/src/Framework/TestCase.php | 6 +- .../phpunit/src/Framework/TestResult.php | 4 +- .../phpunit/src/Framework/TestSuite.php | 16 +- .../src/Framework/TestSuiteIterator.php | 2 + .../src/Runner/StandardTestSuiteLoader.php | 8 +- vendor/phpunit/phpunit/src/Runner/Version.php | 2 +- vendor/phpunit/phpunit/src/TextUI/Command.php | 6 +- vendor/phpunit/phpunit/src/TextUI/Help.php | 18 +- .../phpunit/phpunit/src/TextUI/TestRunner.php | 6 +- .../phpunit/src/Util/Annotation/DocBlock.php | 2 +- .../phpunit/src/Util/Annotation/Registry.php | 4 +- vendor/phpunit/phpunit/src/Util/Blacklist.php | 56 +- .../phpunit/src/Util/Configuration.php | 2 +- vendor/phpunit/phpunit/src/Util/Log/JUnit.php | 4 +- .../phpunit/phpunit/src/Util/Log/TeamCity.php | 2 +- vendor/phpunit/phpunit/src/Util/Test.php | 12 +- .../src/Util/TestDox/CliTestDoxPrinter.php | 14 +- .../src/Util/TestDox/NamePrettifier.php | 4 +- .../src/Util/TestDox/XmlResultPrinter.php | 2 +- vendor/phpunit/phpunit/src/Util/Xml.php | 2 +- vendor/psr/container/composer.json | 2 +- .../src/ContainerExceptionInterface.php | 4 +- vendor/psr/http-client/CHANGELOG.md | 23 + vendor/psr/http-client/LICENSE | 19 + vendor/psr/http-client/README.md | 12 + vendor/psr/http-client/composer.json | 27 + .../src/ClientExceptionInterface.php | 10 + .../psr/http-client/src/ClientInterface.php | 20 + .../src/NetworkExceptionInterface.php | 24 + .../src/RequestExceptionInterface.php | 24 + vendor/psr/http-factory/.gitignore | 2 + vendor/psr/http-factory/.pullapprove.yml | 7 + vendor/psr/http-factory/LICENSE | 21 + vendor/psr/http-factory/README.md | 10 + vendor/psr/http-factory/composer.json | 35 + .../src/RequestFactoryInterface.php | 18 + .../src/ResponseFactoryInterface.php | 18 + .../src/ServerRequestFactoryInterface.php | 24 + .../src/StreamFactoryInterface.php | 45 + .../src/UploadedFileFactoryInterface.php | 34 + .../http-factory/src/UriFactoryInterface.php | 17 + vendor/psr/http-message/CHANGELOG.md | 36 + vendor/psr/http-message/LICENSE | 19 + vendor/psr/http-message/README.md | 13 + vendor/psr/http-message/composer.json | 26 + .../psr/http-message/src/MessageInterface.php | 187 + .../psr/http-message/src/RequestInterface.php | 129 + .../http-message/src/ResponseInterface.php | 68 + .../src/ServerRequestInterface.php | 261 + .../psr/http-message/src/StreamInterface.php | 158 + .../src/UploadedFileInterface.php | 123 + vendor/psr/http-message/src/UriInterface.php | 323 + vendor/psy/psysh/LICENSE | 2 +- vendor/psy/psysh/README.md | 3 +- vendor/psy/psysh/bin/psysh | 2 +- vendor/psy/psysh/composer.json | 22 +- vendor/psy/psysh/src/CodeCleaner.php | 43 +- .../src/CodeCleaner/AbstractClassPass.php | 6 +- .../CodeCleaner/AssignThisVariablePass.php | 4 +- .../CallTimePassByReferencePass.php | 9 +- .../psysh/src/CodeCleaner/CalledClassPass.php | 15 +- .../psysh/src/CodeCleaner/CodeCleanerPass.php | 2 +- .../CodeCleaner/EmptyArrayDimFetchPass.php | 7 +- vendor/psy/psysh/src/CodeCleaner/ExitPass.php | 4 +- .../psysh/src/CodeCleaner/FinalClassPass.php | 10 +- .../src/CodeCleaner/FunctionContextPass.php | 9 +- .../FunctionReturnInWriteContextPass.php | 11 +- .../src/CodeCleaner/ImplicitReturnPass.php | 10 +- .../psysh/src/CodeCleaner/InstanceOfPass.php | 4 +- .../psy/psysh/src/CodeCleaner/IssetPass.php | 4 +- .../src/CodeCleaner/LabelContextPass.php | 12 +- .../src/CodeCleaner/LeavePsyshAlonePass.php | 4 +- vendor/psy/psysh/src/CodeCleaner/ListPass.php | 8 +- .../psysh/src/CodeCleaner/LoopContextPass.php | 8 +- .../src/CodeCleaner/MagicConstantsPass.php | 2 +- .../src/CodeCleaner/NamespaceAwarePass.php | 10 +- .../psysh/src/CodeCleaner/NamespacePass.php | 5 +- .../psysh/src/CodeCleaner/NoReturnValue.php | 6 +- .../CodeCleaner/PassableByReferencePass.php | 6 +- .../psy/psysh/src/CodeCleaner/RequirePass.php | 10 +- .../psysh/src/CodeCleaner/ReturnTypePass.php | 15 +- .../psysh/src/CodeCleaner/StrictTypesPass.php | 15 +- .../src/CodeCleaner/UseStatementPass.php | 8 +- .../src/CodeCleaner/ValidClassNamePass.php | 117 +- .../src/CodeCleaner/ValidConstantPass.php | 90 - .../src/CodeCleaner/ValidConstructorPass.php | 7 +- .../src/CodeCleaner/ValidFunctionNamePass.php | 28 +- .../psy/psysh/src/Command/BufferCommand.php | 16 +- vendor/psy/psysh/src/Command/ClearCommand.php | 4 +- vendor/psy/psysh/src/Command/Command.php | 44 +- vendor/psy/psysh/src/Command/DocCommand.php | 16 +- vendor/psy/psysh/src/Command/DumpCommand.php | 6 +- vendor/psy/psysh/src/Command/EditCommand.php | 14 +- vendor/psy/psysh/src/Command/ExitCommand.php | 4 +- vendor/psy/psysh/src/Command/HelpCommand.php | 6 +- .../psy/psysh/src/Command/HistoryCommand.php | 18 +- vendor/psy/psysh/src/Command/ListCommand.php | 8 +- .../ListCommand/ClassConstantEnumerator.php | 16 +- .../Command/ListCommand/ClassEnumerator.php | 8 +- .../ListCommand/ConstantEnumerator.php | 10 +- .../src/Command/ListCommand/Enumerator.php | 6 +- .../ListCommand/FunctionEnumerator.php | 12 +- .../ListCommand/GlobalVariableEnumerator.php | 8 +- .../Command/ListCommand/MethodEnumerator.php | 22 +- .../ListCommand/PropertyEnumerator.php | 32 +- .../ListCommand/VariableEnumerator.php | 8 +- vendor/psy/psysh/src/Command/ParseCommand.php | 32 +- .../psysh/src/Command/PsyVersionCommand.php | 2 +- .../psysh/src/Command/ReflectingCommand.php | 26 +- vendor/psy/psysh/src/Command/ShowCommand.php | 16 +- vendor/psy/psysh/src/Command/SudoCommand.php | 6 +- .../psy/psysh/src/Command/ThrowUpCommand.php | 11 +- .../psy/psysh/src/Command/TimeitCommand.php | 10 +- .../Command/TimeitCommand/TimeitVisitor.php | 18 +- vendor/psy/psysh/src/Command/TraceCommand.php | 10 +- .../psy/psysh/src/Command/WhereamiCommand.php | 14 +- vendor/psy/psysh/src/Command/WtfCommand.php | 4 +- vendor/psy/psysh/src/ConfigPaths.php | 80 +- vendor/psy/psysh/src/Configuration.php | 343 +- vendor/psy/psysh/src/ConsoleColorFactory.php | 39 - vendor/psy/psysh/src/Context.php | 36 +- vendor/psy/psysh/src/ContextAware.php | 2 +- vendor/psy/psysh/src/EnvInterface.php | 4 +- .../psysh/src/Exception/BreakException.php | 8 +- .../src/Exception/DeprecatedException.php | 2 +- .../psysh/src/Exception/ErrorException.php | 28 +- vendor/psy/psysh/src/Exception/Exception.php | 2 +- .../src/Exception/FatalErrorException.php | 10 +- .../src/Exception/ParseErrorException.php | 8 +- .../psysh/src/Exception/RuntimeException.php | 10 +- .../psysh/src/Exception/ThrowUpException.php | 18 +- .../src/Exception/TypeErrorException.php | 25 +- .../Exception/UnexpectedTargetException.php | 6 +- vendor/psy/psysh/src/ExecutionClosure.php | 9 +- .../src/ExecutionLoop/AbstractListener.php | 6 +- .../psy/psysh/src/ExecutionLoop/Listener.php | 10 +- .../psysh/src/ExecutionLoop/ProcessForker.php | 29 +- .../src/ExecutionLoop/RunkitReloader.php | 14 +- vendor/psy/psysh/src/ExecutionLoopClosure.php | 17 +- .../psy/psysh/src/Formatter/CodeFormatter.php | 26 +- .../psysh/src/Formatter/DocblockFormatter.php | 22 +- vendor/psy/psysh/src/Formatter/Formatter.php | 2 +- .../src/Formatter/ReflectorFormatter.php | 6 +- .../src/Formatter/SignatureFormatter.php | 46 +- .../psysh/src/Formatter/TraceFormatter.php | 12 +- vendor/psy/psysh/src/Input/CodeArgument.php | 4 +- vendor/psy/psysh/src/Input/FilterOptions.php | 18 +- vendor/psy/psysh/src/Input/ShellInput.php | 25 +- vendor/psy/psysh/src/Input/SilentInput.php | 8 +- vendor/psy/psysh/src/Output/OutputPager.php | 2 +- vendor/psy/psysh/src/Output/PassthruPager.php | 2 +- .../psy/psysh/src/Output/ProcOutputPager.php | 7 +- vendor/psy/psysh/src/Output/ShellOutput.php | 68 +- vendor/psy/psysh/src/Output/Theme.php | 285 + vendor/psy/psysh/src/ParserFactory.php | 47 +- vendor/psy/psysh/src/Readline/GNUReadline.php | 44 +- .../psysh/src/Readline/Hoa/Autocompleter.php | 57 + .../Readline/Hoa/AutocompleterAggregate.php | 118 + .../src/Readline/Hoa/AutocompleterPath.php | 194 + .../src/Readline/Hoa/AutocompleterWord.php | 119 + vendor/psy/psysh/src/Readline/Hoa/Console.php | 347 + .../psysh/src/Readline/Hoa/ConsoleCursor.php | 695 + .../src/Readline/Hoa/ConsoleException.php | 46 + .../psysh/src/Readline/Hoa/ConsoleInput.php | 168 + .../psysh/src/Readline/Hoa/ConsoleOutput.php | 208 + .../src/Readline/Hoa/ConsoleProcessus.php | 892 + .../psysh/src/Readline/Hoa/ConsoleTput.php | 841 + .../psysh/src/Readline/Hoa/ConsoleWindow.php | 529 + vendor/psy/psysh/src/Readline/Hoa/Event.php | 193 + .../psysh/src/Readline/Hoa/EventBucket.php | 109 + .../psysh/src/Readline/Hoa/EventException.php | 44 + .../src/Readline/Hoa/EventListenable.php | 48 + .../psysh/src/Readline/Hoa/EventListener.php | 137 + .../psysh/src/Readline/Hoa/EventListens.php | 83 + .../psysh/src/Readline/Hoa/EventSource.php | 44 + .../psy/psysh/src/Readline/Hoa/Exception.php | 79 + .../psysh/src/Readline/Hoa/ExceptionIdle.php | 267 + vendor/psy/psysh/src/Readline/Hoa/File.php | 278 + .../psysh/src/Readline/Hoa/FileDirectory.php | 221 + .../Hoa/FileDoesNotExistException.php | 48 + .../psysh/src/Readline/Hoa/FileException.php | 48 + .../psy/psysh/src/Readline/Hoa/FileFinder.php | 658 + .../psysh/src/Readline/Hoa/FileGeneric.php | 487 + .../psy/psysh/src/Readline/Hoa/FileLink.php | 149 + .../psysh/src/Readline/Hoa/FileLinkRead.php | 231 + .../src/Readline/Hoa/FileLinkReadWrite.php | 279 + .../psy/psysh/src/Readline/Hoa/FileRead.php | 177 + .../psysh/src/Readline/Hoa/FileReadWrite.php | 279 + vendor/psy/psysh/src/Readline/Hoa/IStream.php | 50 + .../src/Readline/Hoa/IteratorFileSystem.php | 86 + .../Hoa/IteratorRecursiveDirectory.php | 126 + .../src/Readline/Hoa/IteratorSplFileInfo.php | 122 + .../psy/psysh/src/Readline/Hoa/Protocol.php | 223 + .../src/Readline/Hoa/ProtocolException.php | 44 + .../psysh/src/Readline/Hoa/ProtocolNode.php | 323 + .../src/Readline/Hoa/ProtocolNodeLibrary.php | 90 + .../src/Readline/Hoa/ProtocolWrapper.php | 473 + .../psy/psysh/src/Readline/Hoa/Readline.php | 1032 ++ vendor/psy/psysh/src/Readline/Hoa/Stream.php | 571 + .../src/Readline/Hoa/StreamBufferable.php | 73 + .../psysh/src/Readline/Hoa/StreamContext.php | 141 + .../src/Readline/Hoa/StreamException.php | 46 + .../psy/psysh/src/Readline/Hoa/StreamIn.php | 102 + .../psysh/src/Readline/Hoa/StreamLockable.php | 85 + .../psy/psysh/src/Readline/Hoa/StreamOut.php | 95 + .../psysh/src/Readline/Hoa/StreamPathable.php | 55 + .../src/Readline/Hoa/StreamPointable.php | 75 + .../psysh/src/Readline/Hoa/StreamStatable.php | 115 + .../src/Readline/Hoa/StreamTouchable.php | 110 + .../src/Readline/Hoa/Terminfo/77/windows-ansi | Bin 0 -> 1481 bytes .../psysh/src/Readline/Hoa/Terminfo/78/xterm | Bin 0 -> 3258 bytes .../Readline/Hoa/Terminfo/78/xterm-256color | Bin 0 -> 3322 bytes vendor/psy/psysh/src/Readline/Hoa/Ustring.php | 143 + .../psy/psysh/src/Readline/Hoa/Xcallable.php | 256 + vendor/psy/psysh/src/Readline/HoaConsole.php | 108 +- vendor/psy/psysh/src/Readline/Libedit.php | 20 +- vendor/psy/psysh/src/Readline/Readline.php | 34 +- vendor/psy/psysh/src/Readline/Transient.php | 26 +- vendor/psy/psysh/src/Readline/Userland.php | 165 + .../Reflection/ReflectionClassConstant.php | 32 +- .../src/Reflection/ReflectionConstant.php | 2 +- .../src/Reflection/ReflectionConstant_.php | 24 +- .../ReflectionLanguageConstruct.php | 27 +- .../ReflectionLanguageConstructParameter.php | 20 +- .../src/Reflection/ReflectionNamespace.php | 8 +- vendor/psy/psysh/src/Shell.php | 302 +- vendor/psy/psysh/src/Sudo.php | 52 +- vendor/psy/psysh/src/Sudo/SudoVisitor.php | 15 +- vendor/psy/psysh/src/SuperglobalsEnv.php | 4 +- .../psysh/src/TabCompletion/AutoCompleter.php | 8 +- .../Matcher/AbstractContextAwareMatcher.php | 6 +- .../AbstractDefaultParametersMatcher.php | 10 +- .../TabCompletion/Matcher/AbstractMatcher.php | 38 +- .../Matcher/ClassAttributesMatcher.php | 6 +- .../ClassMethodDefaultParametersMatcher.php | 6 +- .../Matcher/ClassMethodsMatcher.php | 6 +- .../Matcher/ClassNamesMatcher.php | 14 +- .../TabCompletion/Matcher/CommandsMatcher.php | 14 +- .../Matcher/ConstantsMatcher.php | 6 +- .../FunctionDefaultParametersMatcher.php | 6 +- .../Matcher/FunctionsMatcher.php | 6 +- .../TabCompletion/Matcher/KeywordsMatcher.php | 14 +- .../Matcher/MongoClientMatcher.php | 6 +- .../Matcher/MongoDatabaseMatcher.php | 6 +- .../Matcher/ObjectAttributesMatcher.php | 6 +- .../ObjectMethodDefaultParametersMatcher.php | 6 +- .../Matcher/ObjectMethodsMatcher.php | 6 +- .../Matcher/VariablesMatcher.php | 6 +- vendor/psy/psysh/src/Util/Docblock.php | 29 +- vendor/psy/psysh/src/Util/Json.php | 6 +- vendor/psy/psysh/src/Util/Mirror.php | 8 +- vendor/psy/psysh/src/Util/Str.php | 12 +- vendor/psy/psysh/src/VarDumper/Cloner.php | 7 +- vendor/psy/psysh/src/VarDumper/Dumper.php | 4 +- vendor/psy/psysh/src/VarDumper/Presenter.php | 12 +- .../psysh/src/VarDumper/PresenterAware.php | 2 +- .../psy/psysh/src/VersionUpdater/Checker.php | 12 +- .../psysh/src/VersionUpdater/Downloader.php | 43 + .../Downloader/CurlDownloader.php | 84 + .../src/VersionUpdater/Downloader/Factory.php | 31 + .../Downloader/FileDownloader.php | 56 + .../src/VersionUpdater/GitHubChecker.php | 16 +- .../psysh/src/VersionUpdater/Installer.php | 143 + .../src/VersionUpdater/IntervalChecker.php | 9 +- .../psysh/src/VersionUpdater/NoopChecker.php | 14 +- .../psysh/src/VersionUpdater/SelfUpdate.php | 186 + vendor/psy/psysh/src/functions.php | 59 +- vendor/ralouphie/getallheaders/LICENSE | 21 + vendor/ralouphie/getallheaders/README.md | 27 + vendor/ralouphie/getallheaders/composer.json | 26 + .../getallheaders/src/getallheaders.php | 46 + vendor/ramsey/uuid/README.md | 2 +- vendor/ramsey/uuid/composer.json | 11 +- vendor/ramsey/uuid/src/Uuid.php | 1 + .../css-selector/CssSelectorConverter.php | 14 +- .../Exception/SyntaxErrorException.php | 13 +- vendor/symfony/css-selector/LICENSE | 2 +- .../css-selector/Parser/TokenStream.php | 8 +- .../Parser/Tokenizer/TokenizerPatterns.php | 8 +- .../symfony/css-selector/XPath/Translator.php | 2 +- .../symfony/css-selector/XPath/XPathExpr.php | 9 + vendor/symfony/css-selector/composer.json | 2 +- .../symfony/deprecation-contracts/.gitignore | 3 + .../deprecation-contracts/CHANGELOG.md | 5 + vendor/symfony/deprecation-contracts/LICENSE | 19 + .../symfony/deprecation-contracts/README.md | 26 + .../deprecation-contracts/composer.json | 35 + .../deprecation-contracts/function.php | 27 + .../http-client-contracts/CHANGELOG.md | 5 + .../http-client-contracts/ChunkInterface.php | 2 - .../Exception/ClientExceptionInterface.php | 2 - .../Exception/DecodingExceptionInterface.php | 2 - .../Exception/ExceptionInterface.php | 2 - .../Exception/HttpExceptionInterface.php | 2 - .../RedirectionExceptionInterface.php | 2 - .../Exception/ServerExceptionInterface.php | 2 - .../Exception/TimeoutExceptionInterface.php | 21 + .../Exception/TransportExceptionInterface.php | 2 - .../HttpClientInterface.php | 8 +- .../ResponseInterface.php | 2 - .../ResponseStreamInterface.php | 2 +- .../Test/HttpClientTestCase.php | 47 +- .../Test/TestHttpServer.php | 3 - .../http-client-contracts/composer.json | 4 +- .../symfony/http-kernel/HttpCache/Store.php | 20 +- vendor/symfony/http-kernel/Kernel.php | 6 +- vendor/symfony/mime/Address.php | 22 +- vendor/symfony/mime/CHANGELOG.md | 6 + vendor/symfony/mime/CharacterStream.php | 5 +- vendor/symfony/mime/Crypto/DkimOptions.php | 97 + vendor/symfony/mime/Crypto/DkimSigner.php | 220 + vendor/symfony/mime/Crypto/SMime.php | 2 +- .../AddMimeTypeGuesserPass.php | 4 + vendor/symfony/mime/Email.php | 33 +- .../mime/Encoder/Base64ContentEncoder.php | 5 +- .../mime/Encoder/IdnAddressEncoder.php | 12 +- .../symfony/mime/Encoder/QpContentEncoder.php | 4 - vendor/symfony/mime/Header/Headers.php | 65 +- vendor/symfony/mime/LICENSE | 2 +- vendor/symfony/mime/Message.php | 4 +- vendor/symfony/mime/MessageConverter.php | 12 +- .../symfony/mime/MimeTypeGuesserInterface.php | 2 - vendor/symfony/mime/MimeTypes.php | 591 +- vendor/symfony/mime/MimeTypesInterface.php | 8 +- vendor/symfony/mime/Part/MessagePart.php | 13 + .../mime/Part/Multipart/FormDataPart.php | 13 +- vendor/symfony/mime/Part/SMimePart.php | 2 +- vendor/symfony/mime/Part/TextPart.php | 20 +- .../mime/Resources/bin/update_mime_types.php | 83 +- vendor/symfony/mime/composer.json | 16 +- vendor/symfony/options-resolver/CHANGELOG.md | 81 + .../Debug/OptionsResolverIntrospector.php | 120 + .../Exception/AccessException.php | 22 + .../Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 21 + .../Exception/InvalidOptionsException.php | 23 + .../Exception/MissingOptionsException.php | 23 + .../Exception/NoConfigurationException.php | 26 + .../Exception/NoSuchOptionException.php | 26 + .../Exception/OptionDefinitionException.php | 21 + .../Exception/UndefinedOptionsException.php | 24 + vendor/symfony/options-resolver/LICENSE | 19 + .../options-resolver/OptionConfigurator.php | 139 + vendor/symfony/options-resolver/Options.php | 22 + .../options-resolver/OptionsResolver.php | 1347 ++ vendor/symfony/options-resolver/README.md | 15 + vendor/symfony/options-resolver/composer.json | 31 + .../service-contracts/Attribute/Required.php | 25 + .../Attribute/SubscribedService.php | 33 + vendor/symfony/service-contracts/CHANGELOG.md | 5 + .../service-contracts/ServiceLocatorTrait.php | 4 +- .../ServiceSubscriberTrait.php | 69 +- .../symfony/service-contracts/composer.json | 10 +- .../translation-contracts/CHANGELOG.md | 5 + .../LocaleAwareInterface.php | 4 +- .../Test/TranslatorTest.php | 18 +- .../TranslatableInterface.php | 20 + .../TranslatorInterface.php | 6 +- .../translation-contracts/TranslatorTrait.php | 12 +- .../translation-contracts/composer.json | 4 +- .../src/CssToInlineStyles.php | 2 +- vendor/twig/twig/.github/dependabot.yml | 6 + vendor/twig/twig/.github/workflows/ci.yml | 8 +- .../twig/.github/workflows/documentation.yml | 10 +- vendor/twig/twig/CHANGELOG | 6 + vendor/twig/twig/src/Environment.php | 6 +- .../twig/twig/src/Extension/CoreExtension.php | 4 + .../src/Node/Expression/CallExpression.php | 4 +- vendor/twig/twig/src/Node/IfNode.php | 5 +- .../less.php/.github/workflows/php.yml | 33 - vendor/wikimedia/less.php/API.md | 197 + vendor/wikimedia/less.php/CHANGES.md | 126 +- vendor/wikimedia/less.php/CODE_OF_CONDUCT.md | 1 + vendor/wikimedia/less.php/LICENSE | 324 +- vendor/wikimedia/less.php/NOTICE.txt | 18 + vendor/wikimedia/less.php/README.md | 338 +- vendor/wikimedia/less.php/SECURITY.md | 5 + vendor/wikimedia/less.php/bin/lessc | 2 +- vendor/wikimedia/less.php/composer.json | 38 - vendor/wikimedia/less.php/lessc.inc.php | 58 +- .../less.php/lib/Less/Autoloader.php | 56 +- vendor/wikimedia/less.php/lib/Less/Cache.php | 249 +- vendor/wikimedia/less.php/lib/Less/Colors.php | 320 +- .../less.php/lib/Less/Configurable.php | 29 +- .../less.php/lib/Less/Environment.php | 117 +- .../less.php/lib/Less/Exception/Chunk.php | 148 +- .../less.php/lib/Less/Exception/Compiler.php | 7 +- .../less.php/lib/Less/Exception/Parser.php | 96 +- .../wikimedia/less.php/lib/Less/Functions.php | 1112 +- .../less.php/lib/Less/Less.php.combine | 0 vendor/wikimedia/less.php/lib/Less/Mime.php | 47 +- vendor/wikimedia/less.php/lib/Less/Output.php | 29 +- .../less.php/lib/Less/Output/Mapped.php | 75 +- vendor/wikimedia/less.php/lib/Less/Parser.php | 2257 ++- .../less.php/lib/Less/SourceMap/Base64VLQ.php | 84 +- .../less.php/lib/Less/SourceMap/Generator.php | 207 +- vendor/wikimedia/less.php/lib/Less/Tree.php | 77 +- .../less.php/lib/Less/Tree/Alpha.php | 41 +- .../less.php/lib/Less/Tree/Anonymous.php | 34 +- .../less.php/lib/Less/Tree/Assignment.php | 26 +- .../less.php/lib/Less/Tree/Attribute.php | 39 +- .../wikimedia/less.php/lib/Less/Tree/Call.php | 133 +- .../less.php/lib/Less/Tree/Color.php | 180 +- .../less.php/lib/Less/Tree/Comment.php | 38 +- .../less.php/lib/Less/Tree/Condition.php | 54 +- .../less.php/lib/Less/Tree/DefaultFunc.php | 26 +- .../lib/Less/Tree/DetachedRuleset.php | 29 +- .../less.php/lib/Less/Tree/Dimension.php | 179 +- .../less.php/lib/Less/Tree/Directive.php | 72 +- .../less.php/lib/Less/Tree/Element.php | 74 +- .../less.php/lib/Less/Tree/Expression.php | 75 +- .../less.php/lib/Less/Tree/Extend.php | 53 +- .../less.php/lib/Less/Tree/Import.php | 242 +- .../less.php/lib/Less/Tree/Javascript.php | 18 +- .../less.php/lib/Less/Tree/Keyword.php | 31 +- .../less.php/lib/Less/Tree/Media.php | 156 +- .../less.php/lib/Less/Tree/Mixin/Call.php | 141 +- .../lib/Less/Tree/Mixin/Definition.php | 189 +- .../less.php/lib/Less/Tree/NameValue.php | 32 +- .../less.php/lib/Less/Tree/Negative.php | 32 +- .../less.php/lib/Less/Tree/Operation.php | 50 +- .../less.php/lib/Less/Tree/Paren.php | 30 +- .../less.php/lib/Less/Tree/Quoted.php | 78 +- .../wikimedia/less.php/lib/Less/Tree/Rule.php | 82 +- .../less.php/lib/Less/Tree/Ruleset.php | 667 +- .../less.php/lib/Less/Tree/RulesetCall.php | 26 +- .../less.php/lib/Less/Tree/Selector.php | 125 +- .../lib/Less/Tree/UnicodeDescriptor.php | 23 +- .../wikimedia/less.php/lib/Less/Tree/Unit.php | 113 +- .../lib/Less/Tree/UnitConversions.php | 46 +- .../wikimedia/less.php/lib/Less/Tree/Url.php | 63 +- .../less.php/lib/Less/Tree/Value.php | 44 +- .../less.php/lib/Less/Tree/Variable.php | 54 +- .../wikimedia/less.php/lib/Less/Version.php | 11 +- .../wikimedia/less.php/lib/Less/Visitor.php | 45 +- .../lib/Less/Visitor/extendFinder.php | 81 +- .../less.php/lib/Less/Visitor/import.php | 2 - .../lib/Less/Visitor/joinSelector.php | 63 +- .../lib/Less/Visitor/processExtends.php | 292 +- .../less.php/lib/Less/Visitor/toCSS.php | 219 +- .../less.php/lib/Less/VisitorReplacing.php | 63 +- 1451 files changed, 92489 insertions(+), 23258 deletions(-) create mode 100644 config/meilisearch.php create mode 100644 config/scout.php create mode 100644 plugins/rainlab/blog/components/Meilisearch.php create mode 100644 plugins/rainlab/blog/components/meilisearch/default.htm create mode 100644 plugins/rainlab/blog/routes.php create mode 100644 themes/modern2/pages/new/demosearch.htm create mode 100644 vendor/clue/stream-filter/.github/FUNDING.yml create mode 100644 vendor/clue/stream-filter/CHANGELOG.md create mode 100644 vendor/clue/stream-filter/LICENSE create mode 100644 vendor/clue/stream-filter/README.md create mode 100644 vendor/clue/stream-filter/composer.json create mode 100644 vendor/clue/stream-filter/src/CallbackFilter.php create mode 100644 vendor/clue/stream-filter/src/functions.php create mode 100644 vendor/clue/stream-filter/src/functions_include.php create mode 100644 vendor/composer/InstalledVersions.php create mode 100644 vendor/composer/installed.php create mode 100644 vendor/guzzlehttp/guzzle/CHANGELOG.md create mode 100644 vendor/guzzlehttp/guzzle/LICENSE create mode 100644 vendor/guzzlehttp/guzzle/README.md create mode 100644 vendor/guzzlehttp/guzzle/UPGRADING.md create mode 100644 vendor/guzzlehttp/guzzle/composer.json create mode 100644 vendor/guzzlehttp/guzzle/src/BodySummarizer.php create mode 100644 vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Client.php create mode 100644 vendor/guzzlehttp/guzzle/src/ClientInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/ClientTrait.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ClientException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/RequestException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ServerException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/TransferException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/Proxy.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/HandlerStack.php create mode 100644 vendor/guzzlehttp/guzzle/src/MessageFormatter.php create mode 100644 vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Middleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/Pool.php create mode 100644 vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RequestOptions.php create mode 100644 vendor/guzzlehttp/guzzle/src/RetryMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/TransferStats.php create mode 100644 vendor/guzzlehttp/guzzle/src/Utils.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions_include.php create mode 100644 vendor/guzzlehttp/promises/CHANGELOG.md create mode 100644 vendor/guzzlehttp/promises/LICENSE create mode 100644 vendor/guzzlehttp/promises/README.md create mode 100644 vendor/guzzlehttp/promises/composer.json create mode 100644 vendor/guzzlehttp/promises/src/AggregateException.php create mode 100644 vendor/guzzlehttp/promises/src/CancellationException.php create mode 100644 vendor/guzzlehttp/promises/src/Coroutine.php create mode 100644 vendor/guzzlehttp/promises/src/Create.php create mode 100644 vendor/guzzlehttp/promises/src/Each.php create mode 100644 vendor/guzzlehttp/promises/src/EachPromise.php create mode 100644 vendor/guzzlehttp/promises/src/FulfilledPromise.php create mode 100644 vendor/guzzlehttp/promises/src/Is.php create mode 100644 vendor/guzzlehttp/promises/src/Promise.php create mode 100644 vendor/guzzlehttp/promises/src/PromiseInterface.php create mode 100644 vendor/guzzlehttp/promises/src/PromisorInterface.php create mode 100644 vendor/guzzlehttp/promises/src/RejectedPromise.php create mode 100644 vendor/guzzlehttp/promises/src/RejectionException.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueue.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueueInterface.php create mode 100644 vendor/guzzlehttp/promises/src/Utils.php create mode 100644 vendor/guzzlehttp/promises/src/functions.php create mode 100644 vendor/guzzlehttp/promises/src/functions_include.php create mode 100644 vendor/guzzlehttp/psr7/CHANGELOG.md create mode 100644 vendor/guzzlehttp/psr7/LICENSE create mode 100644 vendor/guzzlehttp/psr7/README.md create mode 100644 vendor/guzzlehttp/psr7/composer.json create mode 100644 vendor/guzzlehttp/psr7/src/AppendStream.php create mode 100644 vendor/guzzlehttp/psr7/src/BufferStream.php create mode 100644 vendor/guzzlehttp/psr7/src/CachingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/DroppingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php create mode 100644 vendor/guzzlehttp/psr7/src/FnStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Header.php create mode 100644 vendor/guzzlehttp/psr7/src/HttpFactory.php create mode 100644 vendor/guzzlehttp/psr7/src/InflateStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LazyOpenStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LimitStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Message.php create mode 100644 vendor/guzzlehttp/psr7/src/MessageTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/MimeType.php create mode 100644 vendor/guzzlehttp/psr7/src/MultipartStream.php create mode 100644 vendor/guzzlehttp/psr7/src/NoSeekStream.php create mode 100644 vendor/guzzlehttp/psr7/src/PumpStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Query.php create mode 100644 vendor/guzzlehttp/psr7/src/Request.php create mode 100644 vendor/guzzlehttp/psr7/src/Response.php create mode 100644 vendor/guzzlehttp/psr7/src/Rfc7230.php create mode 100644 vendor/guzzlehttp/psr7/src/ServerRequest.php create mode 100644 vendor/guzzlehttp/psr7/src/Stream.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamWrapper.php create mode 100644 vendor/guzzlehttp/psr7/src/UploadedFile.php create mode 100644 vendor/guzzlehttp/psr7/src/Uri.php create mode 100644 vendor/guzzlehttp/psr7/src/UriComparator.php create mode 100644 vendor/guzzlehttp/psr7/src/UriNormalizer.php create mode 100644 vendor/guzzlehttp/psr7/src/UriResolver.php create mode 100644 vendor/guzzlehttp/psr7/src/Utils.php create mode 100644 vendor/http-interop/http-factory-guzzle/.github/workflows/ci.yaml create mode 100644 vendor/http-interop/http-factory-guzzle/LICENSE create mode 100644 vendor/http-interop/http-factory-guzzle/README.md create mode 100644 vendor/http-interop/http-factory-guzzle/composer.json create mode 100644 vendor/http-interop/http-factory-guzzle/src/RequestFactory.php create mode 100644 vendor/http-interop/http-factory-guzzle/src/ResponseFactory.php create mode 100644 vendor/http-interop/http-factory-guzzle/src/ServerRequestFactory.php create mode 100644 vendor/http-interop/http-factory-guzzle/src/StreamFactory.php create mode 100644 vendor/http-interop/http-factory-guzzle/src/UploadedFileFactory.php create mode 100644 vendor/http-interop/http-factory-guzzle/src/UriFactory.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/ViewException.php create mode 100644 vendor/laravel/scout/LICENSE.md create mode 100644 vendor/laravel/scout/README.md create mode 100644 vendor/laravel/scout/UPGRADE.md create mode 100644 vendor/laravel/scout/composer.json create mode 100644 vendor/laravel/scout/config/scout.php create mode 100644 vendor/laravel/scout/src/Builder.php create mode 100644 vendor/laravel/scout/src/Console/FlushCommand.php create mode 100644 vendor/laravel/scout/src/Console/ImportCommand.php create mode 100644 vendor/laravel/scout/src/EngineManager.php create mode 100644 vendor/laravel/scout/src/Engines/AlgoliaEngine.php create mode 100644 vendor/laravel/scout/src/Engines/Engine.php create mode 100644 vendor/laravel/scout/src/Engines/NullEngine.php create mode 100644 vendor/laravel/scout/src/Events/ModelsFlushed.php create mode 100644 vendor/laravel/scout/src/Events/ModelsImported.php create mode 100644 vendor/laravel/scout/src/Jobs/MakeSearchable.php create mode 100644 vendor/laravel/scout/src/ModelObserver.php create mode 100644 vendor/laravel/scout/src/ScoutServiceProvider.php create mode 100644 vendor/laravel/scout/src/Searchable.php create mode 100644 vendor/laravel/scout/src/SearchableScope.php delete mode 100644 vendor/laravel/tinker/CHANGELOG.md create mode 100644 vendor/league/csv/src/Info.php delete mode 100644 vendor/league/csv/src/Polyfill/EmptyEscapeParser.php create mode 100644 vendor/league/csv/src/TabularDataReader.php create mode 100644 vendor/league/csv/src/UnableToProcessCsv.php create mode 100644 vendor/league/csv/src/UnavailableStream.php create mode 100644 vendor/league/flysystem/CODE_OF_CONDUCT.md create mode 100644 vendor/league/flysystem/src/CorruptedPathDetected.php create mode 100644 vendor/league/mime-type-detection/CHANGELOG.md create mode 100644 vendor/league/mime-type-detection/LICENSE create mode 100644 vendor/league/mime-type-detection/composer.json create mode 100644 vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php create mode 100644 vendor/league/mime-type-detection/src/ExtensionMimeTypeDetector.php create mode 100644 vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php create mode 100644 vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php create mode 100644 vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php create mode 100644 vendor/league/mime-type-detection/src/MimeTypeDetector.php create mode 100644 vendor/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.editorconfig create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.github/release-draft-template.yml create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/release-drafter.yml create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/tests.yml create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.gitignore create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/.php_cs.dist create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/CONTRIBUTING.md create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/LICENSE create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/README.md create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/bors.toml create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/composer.json create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/config/config.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/phpunit.xml.dist create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/src/Console/IndexMeilisearch.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/src/Engines/MeilisearchEngine.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/src/MeilisearchServiceProvider.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/FeatureTestCase.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchConsoleCommandTest.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchTest.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Fixtures/SearchableModel.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/TestCase.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchConsoleCommandTest.php create mode 100644 vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchEngineTest.php create mode 100644 vendor/meilisearch/meilisearch-php/.code-samples.meilisearch.yaml create mode 100644 vendor/meilisearch/meilisearch-php/.editorconfig create mode 100644 vendor/meilisearch/meilisearch-php/.github/release-draft-template.yml create mode 100644 vendor/meilisearch/meilisearch-php/.github/workflows/pre-release-tests.yml create mode 100644 vendor/meilisearch/meilisearch-php/.github/workflows/release-drafter.yml create mode 100644 vendor/meilisearch/meilisearch-php/.github/workflows/tests.yml create mode 100644 vendor/meilisearch/meilisearch-php/.gitignore create mode 100644 vendor/meilisearch/meilisearch-php/.php_cs.dist create mode 100644 vendor/meilisearch/meilisearch-php/CONTRIBUTING.md create mode 100644 vendor/meilisearch/meilisearch-php/LICENSE create mode 100644 vendor/meilisearch/meilisearch-php/README.md create mode 100644 vendor/meilisearch/meilisearch-php/bors.toml create mode 100644 vendor/meilisearch/meilisearch-php/composer.json create mode 100644 vendor/meilisearch/meilisearch-php/phpunit.xml create mode 100644 vendor/meilisearch/meilisearch-php/scripts/tests.sh create mode 100644 vendor/meilisearch/meilisearch-php/src/Client.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Contracts/Endpoint.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Contracts/Http.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Delegates/HandlesIndex.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Delegates/HandlesSystem.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDocuments.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDumps.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesSettings.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Dumps.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Health.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Indexes.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Keys.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Stats.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Endpoints/Version.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Exceptions/ApiException.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Exceptions/CommunicationException.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Exceptions/InvalidArgumentException.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Exceptions/TimeOutException.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Http/Client.php create mode 100644 vendor/meilisearch/meilisearch-php/src/MeiliSearch.php create mode 100644 vendor/meilisearch/meilisearch-php/src/Search/SearchResult.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/ClientTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/DocumentsTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/DumpTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/IndexTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/KeysAndPermissionsTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/SearchTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Endpoints/UpdatesTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Exceptions/ApiExceptionTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Http/ClientTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Search/SearchResultTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/AttributesForFacetingTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/DisplayedAttributesTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/DistinctAttributeTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/RankingRulesTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/SearchableAttributesTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/SettingsTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/StopWordsTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/Settings/SynonymsTest.php create mode 100644 vendor/meilisearch/meilisearch-php/tests/TestCase.php delete mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV5.php delete mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php delete mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php rename vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/{MockeryPHPUnitIntegrationAssertPostConditionsForV8.php => MockeryPHPUnitIntegrationAssertPostConditions.php} (93%) delete mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV7AndPrevious.php rename vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/{MockeryTestCaseSetUpForV8.php => MockeryTestCaseSetUp.php} (96%) delete mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV7AndPrevious.php rename vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/{Legacy => }/TestListenerTrait.php (84%) delete mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php create mode 100644 vendor/mockery/mockery/library/Mockery/QuickDefinitionsConfiguration.php create mode 100644 vendor/nesbot/carbon/.phpstorm.meta.php create mode 100644 vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php create mode 100644 vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php create mode 100644 vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php create mode 100644 vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php create mode 100644 vendor/october/rain/LICENSE create mode 100644 vendor/october/rain/src/Database/Concerns/QueriesRelationships.php create mode 100644 vendor/october/rain/src/Database/Migrations/2021_01_19_000001_Db_Add_Pivot_Data_To_Deferred_Bindings.php create mode 100644 vendor/october/rain/src/Foundation/Http/Middleware/CheckForTrustedHost.php create mode 100644 vendor/october/rain/src/Http/Middleware/TrustHosts.php create mode 100755 vendor/october/rain/src/Support/Facades/Event.php create mode 100755 vendor/october/rain/src/Support/Facades/Mail.php create mode 100644 vendor/october/rain/src/Support/Testing/Fakes/EventFake.php create mode 100644 vendor/october/rain/src/Support/Testing/Fakes/MailFake.php create mode 100644 vendor/october/rain/tests/Database/Concerns/HasRelationshipsTest.php create mode 100644 vendor/october/rain/tests/Database/EloquentWithCountTest.php delete mode 100644 vendor/october/rain/tests/Database/RelationsTest.php create mode 100644 vendor/october/rain/tests/Foundation/Http/Middleware/CheckForTrustedHostTest.php create mode 100644 vendor/october/rain/tests/Support/EventFakeTest.php create mode 100644 vendor/october/rain/tests/Support/MailFakeTest.php create mode 100644 vendor/php-http/client-common/.php-cs-fixer.dist.php create mode 100644 vendor/php-http/client-common/.php_cs.dist create mode 100644 vendor/php-http/client-common/CHANGELOG.md create mode 100644 vendor/php-http/client-common/LICENSE create mode 100644 vendor/php-http/client-common/README.md create mode 100644 vendor/php-http/client-common/composer.json create mode 100644 vendor/php-http/client-common/src/BatchClient.php create mode 100644 vendor/php-http/client-common/src/BatchClientInterface.php create mode 100644 vendor/php-http/client-common/src/BatchResult.php create mode 100644 vendor/php-http/client-common/src/Deferred.php create mode 100644 vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php create mode 100644 vendor/php-http/client-common/src/EmulatedHttpClient.php create mode 100644 vendor/php-http/client-common/src/Exception/BatchException.php create mode 100644 vendor/php-http/client-common/src/Exception/CircularRedirectionException.php create mode 100644 vendor/php-http/client-common/src/Exception/ClientErrorException.php create mode 100644 vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php create mode 100644 vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php create mode 100644 vendor/php-http/client-common/src/Exception/LoopException.php create mode 100644 vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php create mode 100644 vendor/php-http/client-common/src/Exception/ServerErrorException.php create mode 100644 vendor/php-http/client-common/src/FlexibleHttpClient.php create mode 100644 vendor/php-http/client-common/src/HttpAsyncClientDecorator.php create mode 100644 vendor/php-http/client-common/src/HttpAsyncClientEmulator.php create mode 100644 vendor/php-http/client-common/src/HttpClientDecorator.php create mode 100644 vendor/php-http/client-common/src/HttpClientEmulator.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php create mode 100644 vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php create mode 100644 vendor/php-http/client-common/src/HttpClientRouter.php create mode 100644 vendor/php-http/client-common/src/HttpClientRouterInterface.php create mode 100644 vendor/php-http/client-common/src/HttpMethodsClient.php create mode 100644 vendor/php-http/client-common/src/HttpMethodsClientInterface.php create mode 100644 vendor/php-http/client-common/src/Plugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/AddHostPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/AddPathPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/CookiePlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/DecoderPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/ErrorPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/HistoryPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/Journal.php create mode 100644 vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/RedirectPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/RetryPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php create mode 100644 vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php create mode 100644 vendor/php-http/client-common/src/PluginChain.php create mode 100644 vendor/php-http/client-common/src/PluginClient.php create mode 100644 vendor/php-http/client-common/src/PluginClientBuilder.php create mode 100644 vendor/php-http/client-common/src/PluginClientFactory.php create mode 100644 vendor/php-http/client-common/src/VersionBridgeClient.php create mode 100644 vendor/php-http/discovery/.php-cs-fixer.php create mode 100644 vendor/php-http/discovery/CHANGELOG.md create mode 100644 vendor/php-http/discovery/LICENSE create mode 100644 vendor/php-http/discovery/README.md create mode 100644 vendor/php-http/discovery/composer.json create mode 100644 vendor/php-http/discovery/src/ClassDiscovery.php create mode 100644 vendor/php-http/discovery/src/Composer/Plugin.php create mode 100644 vendor/php-http/discovery/src/Exception.php create mode 100644 vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php create mode 100644 vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php create mode 100644 vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php create mode 100644 vendor/php-http/discovery/src/Exception/NotFoundException.php create mode 100644 vendor/php-http/discovery/src/Exception/PuliUnavailableException.php create mode 100644 vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php create mode 100644 vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php create mode 100644 vendor/php-http/discovery/src/HttpClientDiscovery.php create mode 100644 vendor/php-http/discovery/src/MessageFactoryDiscovery.php create mode 100644 vendor/php-http/discovery/src/NotFoundException.php create mode 100644 vendor/php-http/discovery/src/Psr17Factory.php create mode 100644 vendor/php-http/discovery/src/Psr17FactoryDiscovery.php create mode 100644 vendor/php-http/discovery/src/Psr18ClientDiscovery.php create mode 100644 vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php create mode 100644 vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php create mode 100644 vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php create mode 100644 vendor/php-http/discovery/src/Strategy/MockClientStrategy.php create mode 100644 vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php create mode 100644 vendor/php-http/discovery/src/StreamFactoryDiscovery.php create mode 100644 vendor/php-http/discovery/src/UriFactoryDiscovery.php create mode 100644 vendor/php-http/guzzle7-adapter/CHANGELOG.md create mode 100644 vendor/php-http/guzzle7-adapter/LICENSE create mode 100644 vendor/php-http/guzzle7-adapter/README.md create mode 100644 vendor/php-http/guzzle7-adapter/composer.json create mode 100644 vendor/php-http/guzzle7-adapter/phpstan.neon.dist create mode 100644 vendor/php-http/guzzle7-adapter/psalm.baseline.xml create mode 100644 vendor/php-http/guzzle7-adapter/psalm.xml create mode 100644 vendor/php-http/guzzle7-adapter/src/Client.php create mode 100644 vendor/php-http/guzzle7-adapter/src/Exception/UnexpectedValueException.php create mode 100644 vendor/php-http/guzzle7-adapter/src/Promise.php create mode 100644 vendor/php-http/httplug/.php-cs-fixer.dist.php create mode 100644 vendor/php-http/httplug/CHANGELOG.md create mode 100644 vendor/php-http/httplug/LICENSE create mode 100644 vendor/php-http/httplug/README.md create mode 100644 vendor/php-http/httplug/composer.json create mode 100644 vendor/php-http/httplug/puli.json create mode 100644 vendor/php-http/httplug/src/Exception.php create mode 100644 vendor/php-http/httplug/src/Exception/HttpException.php create mode 100644 vendor/php-http/httplug/src/Exception/NetworkException.php create mode 100644 vendor/php-http/httplug/src/Exception/RequestAwareTrait.php create mode 100644 vendor/php-http/httplug/src/Exception/RequestException.php create mode 100644 vendor/php-http/httplug/src/Exception/TransferException.php create mode 100644 vendor/php-http/httplug/src/HttpAsyncClient.php create mode 100644 vendor/php-http/httplug/src/HttpClient.php create mode 100644 vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php create mode 100644 vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php create mode 100644 vendor/php-http/message-factory/CHANGELOG.md create mode 100644 vendor/php-http/message-factory/LICENSE create mode 100644 vendor/php-http/message-factory/README.md create mode 100644 vendor/php-http/message-factory/composer.json create mode 100644 vendor/php-http/message-factory/puli.json create mode 100644 vendor/php-http/message-factory/src/MessageFactory.php create mode 100644 vendor/php-http/message-factory/src/RequestFactory.php create mode 100644 vendor/php-http/message-factory/src/ResponseFactory.php create mode 100644 vendor/php-http/message-factory/src/StreamFactory.php create mode 100644 vendor/php-http/message-factory/src/UriFactory.php create mode 100644 vendor/php-http/message/CHANGELOG.md create mode 100644 vendor/php-http/message/LICENSE create mode 100644 vendor/php-http/message/README.md create mode 100644 vendor/php-http/message/apigen.neon create mode 100644 vendor/php-http/message/composer.json create mode 100644 vendor/php-http/message/puli.json create mode 100644 vendor/php-http/message/src/Authentication.php create mode 100644 vendor/php-http/message/src/Authentication/AutoBasicAuth.php create mode 100644 vendor/php-http/message/src/Authentication/BasicAuth.php create mode 100644 vendor/php-http/message/src/Authentication/Bearer.php create mode 100644 vendor/php-http/message/src/Authentication/Chain.php create mode 100644 vendor/php-http/message/src/Authentication/Header.php create mode 100644 vendor/php-http/message/src/Authentication/Matching.php create mode 100644 vendor/php-http/message/src/Authentication/QueryParam.php create mode 100644 vendor/php-http/message/src/Authentication/RequestConditional.php create mode 100644 vendor/php-http/message/src/Authentication/Wsse.php create mode 100644 vendor/php-http/message/src/Builder/ResponseBuilder.php create mode 100644 vendor/php-http/message/src/Cookie.php create mode 100644 vendor/php-http/message/src/CookieJar.php create mode 100644 vendor/php-http/message/src/CookieUtil.php create mode 100644 vendor/php-http/message/src/Decorator/MessageDecorator.php create mode 100644 vendor/php-http/message/src/Decorator/RequestDecorator.php create mode 100644 vendor/php-http/message/src/Decorator/ResponseDecorator.php create mode 100644 vendor/php-http/message/src/Decorator/StreamDecorator.php create mode 100644 vendor/php-http/message/src/Encoding/ChunkStream.php create mode 100644 vendor/php-http/message/src/Encoding/CompressStream.php create mode 100644 vendor/php-http/message/src/Encoding/DechunkStream.php create mode 100644 vendor/php-http/message/src/Encoding/DecompressStream.php create mode 100644 vendor/php-http/message/src/Encoding/DeflateStream.php create mode 100644 vendor/php-http/message/src/Encoding/Filter/Chunk.php create mode 100644 vendor/php-http/message/src/Encoding/FilteredStream.php create mode 100644 vendor/php-http/message/src/Encoding/GzipDecodeStream.php create mode 100644 vendor/php-http/message/src/Encoding/GzipEncodeStream.php create mode 100644 vendor/php-http/message/src/Encoding/InflateStream.php create mode 100644 vendor/php-http/message/src/Exception.php create mode 100644 vendor/php-http/message/src/Exception/UnexpectedValueException.php create mode 100644 vendor/php-http/message/src/Formatter.php create mode 100644 vendor/php-http/message/src/Formatter/CurlCommandFormatter.php create mode 100644 vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php create mode 100644 vendor/php-http/message/src/Formatter/SimpleFormatter.php create mode 100644 vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php create mode 100644 vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php create mode 100644 vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php create mode 100644 vendor/php-http/message/src/RequestMatcher.php create mode 100644 vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php create mode 100644 vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php create mode 100644 vendor/php-http/message/src/RequestMatcher/RequestMatcher.php create mode 100644 vendor/php-http/message/src/Stream/BufferedStream.php create mode 100644 vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php create mode 100644 vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php create mode 100644 vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php create mode 100644 vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php create mode 100644 vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php create mode 100644 vendor/php-http/message/src/UriFactory/SlimUriFactory.php create mode 100644 vendor/php-http/message/src/filters.php create mode 100644 vendor/php-http/promise/CHANGELOG.md create mode 100644 vendor/php-http/promise/LICENSE create mode 100644 vendor/php-http/promise/README.md create mode 100644 vendor/php-http/promise/composer.json create mode 100644 vendor/php-http/promise/src/FulfilledPromise.php create mode 100644 vendor/php-http/promise/src/Promise.php create mode 100644 vendor/php-http/promise/src/RejectedPromise.php delete mode 100644 vendor/phpoption/phpoption/Makefile delete mode 100644 vendor/phpunit/php-token-stream/.github/FUNDING.yml delete mode 100644 vendor/phpunit/php-token-stream/.travis.yml delete mode 100644 vendor/phpunit/php-token-stream/build.xml delete mode 100644 vendor/phpunit/php-token-stream/phpunit.xml create mode 100644 vendor/phpunit/php-token-stream/src/Abstract.php create mode 100644 vendor/phpunit/php-token-stream/src/Ampersand.php create mode 100644 vendor/phpunit/php-token-stream/src/AndEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Array.php create mode 100644 vendor/phpunit/php-token-stream/src/ArrayCast.php create mode 100644 vendor/phpunit/php-token-stream/src/As.php create mode 100644 vendor/phpunit/php-token-stream/src/At.php create mode 100644 vendor/phpunit/php-token-stream/src/Backtick.php create mode 100644 vendor/phpunit/php-token-stream/src/BadCharacter.php create mode 100644 vendor/phpunit/php-token-stream/src/BoolCast.php create mode 100644 vendor/phpunit/php-token-stream/src/BooleanAnd.php create mode 100644 vendor/phpunit/php-token-stream/src/BooleanOr.php rename vendor/phpunit/php-token-stream/src/{Token/Stream => }/CachingFactory.php (80%) create mode 100644 vendor/phpunit/php-token-stream/src/Callable.php create mode 100644 vendor/phpunit/php-token-stream/src/Caret.php create mode 100644 vendor/phpunit/php-token-stream/src/Case.php create mode 100644 vendor/phpunit/php-token-stream/src/Catch.php create mode 100644 vendor/phpunit/php-token-stream/src/Character.php create mode 100644 vendor/phpunit/php-token-stream/src/Class.php create mode 100644 vendor/phpunit/php-token-stream/src/ClassC.php create mode 100644 vendor/phpunit/php-token-stream/src/ClassNameConstant.php create mode 100644 vendor/phpunit/php-token-stream/src/Clone.php create mode 100644 vendor/phpunit/php-token-stream/src/CloseBracket.php create mode 100644 vendor/phpunit/php-token-stream/src/CloseCurly.php create mode 100644 vendor/phpunit/php-token-stream/src/CloseSquare.php create mode 100644 vendor/phpunit/php-token-stream/src/CloseTag.php create mode 100644 vendor/phpunit/php-token-stream/src/Coalesce.php create mode 100644 vendor/phpunit/php-token-stream/src/CoalesceEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Colon.php create mode 100644 vendor/phpunit/php-token-stream/src/Comma.php create mode 100644 vendor/phpunit/php-token-stream/src/Comment.php create mode 100644 vendor/phpunit/php-token-stream/src/ConcatEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Const.php create mode 100644 vendor/phpunit/php-token-stream/src/ConstantEncapsedString.php create mode 100644 vendor/phpunit/php-token-stream/src/Continue.php create mode 100644 vendor/phpunit/php-token-stream/src/CurlyOpen.php create mode 100644 vendor/phpunit/php-token-stream/src/DNumber.php create mode 100644 vendor/phpunit/php-token-stream/src/Dec.php create mode 100644 vendor/phpunit/php-token-stream/src/Declare.php create mode 100644 vendor/phpunit/php-token-stream/src/Default.php create mode 100644 vendor/phpunit/php-token-stream/src/Dir.php create mode 100644 vendor/phpunit/php-token-stream/src/Div.php create mode 100644 vendor/phpunit/php-token-stream/src/DivEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Do.php create mode 100644 vendor/phpunit/php-token-stream/src/DocComment.php create mode 100644 vendor/phpunit/php-token-stream/src/Dollar.php create mode 100644 vendor/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php create mode 100644 vendor/phpunit/php-token-stream/src/Dot.php create mode 100644 vendor/phpunit/php-token-stream/src/DoubleArrow.php create mode 100644 vendor/phpunit/php-token-stream/src/DoubleCast.php create mode 100644 vendor/phpunit/php-token-stream/src/DoubleColon.php create mode 100644 vendor/phpunit/php-token-stream/src/DoubleQuotes.php create mode 100644 vendor/phpunit/php-token-stream/src/Echo.php create mode 100644 vendor/phpunit/php-token-stream/src/Ellipsis.php create mode 100644 vendor/phpunit/php-token-stream/src/Else.php create mode 100644 vendor/phpunit/php-token-stream/src/Elseif.php create mode 100644 vendor/phpunit/php-token-stream/src/Empty.php create mode 100644 vendor/phpunit/php-token-stream/src/EncapsedAndWhitespace.php create mode 100644 vendor/phpunit/php-token-stream/src/EndHeredoc.php create mode 100644 vendor/phpunit/php-token-stream/src/Enddeclare.php create mode 100644 vendor/phpunit/php-token-stream/src/Endfor.php create mode 100644 vendor/phpunit/php-token-stream/src/Endforeach.php create mode 100644 vendor/phpunit/php-token-stream/src/Endif.php create mode 100644 vendor/phpunit/php-token-stream/src/Endswitch.php create mode 100644 vendor/phpunit/php-token-stream/src/Endwhile.php create mode 100644 vendor/phpunit/php-token-stream/src/Equal.php create mode 100644 vendor/phpunit/php-token-stream/src/Eval.php create mode 100644 vendor/phpunit/php-token-stream/src/ExclamationMark.php create mode 100644 vendor/phpunit/php-token-stream/src/Exit.php create mode 100644 vendor/phpunit/php-token-stream/src/Extends.php create mode 100644 vendor/phpunit/php-token-stream/src/File.php create mode 100644 vendor/phpunit/php-token-stream/src/Final.php create mode 100644 vendor/phpunit/php-token-stream/src/Finally.php create mode 100644 vendor/phpunit/php-token-stream/src/Fn.php create mode 100644 vendor/phpunit/php-token-stream/src/For.php create mode 100644 vendor/phpunit/php-token-stream/src/Foreach.php create mode 100644 vendor/phpunit/php-token-stream/src/FuncC.php create mode 100644 vendor/phpunit/php-token-stream/src/Function.php create mode 100644 vendor/phpunit/php-token-stream/src/Global.php create mode 100644 vendor/phpunit/php-token-stream/src/Goto.php create mode 100644 vendor/phpunit/php-token-stream/src/Gt.php create mode 100644 vendor/phpunit/php-token-stream/src/HaltCompiler.php create mode 100644 vendor/phpunit/php-token-stream/src/If.php create mode 100644 vendor/phpunit/php-token-stream/src/Implements.php create mode 100644 vendor/phpunit/php-token-stream/src/Inc.php create mode 100644 vendor/phpunit/php-token-stream/src/Include.php create mode 100644 vendor/phpunit/php-token-stream/src/IncludeOnce.php create mode 100644 vendor/phpunit/php-token-stream/src/Includes.php create mode 100644 vendor/phpunit/php-token-stream/src/InlineHtml.php create mode 100644 vendor/phpunit/php-token-stream/src/Instanceof.php create mode 100644 vendor/phpunit/php-token-stream/src/Insteadof.php create mode 100644 vendor/phpunit/php-token-stream/src/IntCast.php create mode 100644 vendor/phpunit/php-token-stream/src/Interface.php create mode 100644 vendor/phpunit/php-token-stream/src/IsEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/IsGreaterOrEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/IsIdentical.php create mode 100644 vendor/phpunit/php-token-stream/src/IsNotEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/IsNotIdentical.php create mode 100644 vendor/phpunit/php-token-stream/src/IsSmallerOrEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Isset.php create mode 100644 vendor/phpunit/php-token-stream/src/Line.php create mode 100644 vendor/phpunit/php-token-stream/src/List.php create mode 100644 vendor/phpunit/php-token-stream/src/Lnumber.php create mode 100644 vendor/phpunit/php-token-stream/src/LogicalAnd.php create mode 100644 vendor/phpunit/php-token-stream/src/LogicalOr.php create mode 100644 vendor/phpunit/php-token-stream/src/LogicalXor.php create mode 100644 vendor/phpunit/php-token-stream/src/Lt.php create mode 100644 vendor/phpunit/php-token-stream/src/MethodC.php create mode 100644 vendor/phpunit/php-token-stream/src/Minus.php create mode 100644 vendor/phpunit/php-token-stream/src/MinusEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/ModEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/MulEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Mult.php create mode 100644 vendor/phpunit/php-token-stream/src/NameFullyQualified.php create mode 100644 vendor/phpunit/php-token-stream/src/NameQualified.php create mode 100644 vendor/phpunit/php-token-stream/src/NameRelative.php create mode 100644 vendor/phpunit/php-token-stream/src/Namespace.php create mode 100644 vendor/phpunit/php-token-stream/src/New.php create mode 100644 vendor/phpunit/php-token-stream/src/NsC.php create mode 100644 vendor/phpunit/php-token-stream/src/NsSeparator.php create mode 100644 vendor/phpunit/php-token-stream/src/NumString.php create mode 100644 vendor/phpunit/php-token-stream/src/ObjectCast.php create mode 100644 vendor/phpunit/php-token-stream/src/ObjectOperator.php create mode 100644 vendor/phpunit/php-token-stream/src/OpenBracket.php create mode 100644 vendor/phpunit/php-token-stream/src/OpenCurly.php create mode 100644 vendor/phpunit/php-token-stream/src/OpenSquare.php create mode 100644 vendor/phpunit/php-token-stream/src/OpenTag.php create mode 100644 vendor/phpunit/php-token-stream/src/OpenTagWithEcho.php create mode 100644 vendor/phpunit/php-token-stream/src/OrEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/PaamayimNekudotayim.php create mode 100644 vendor/phpunit/php-token-stream/src/Percent.php create mode 100644 vendor/phpunit/php-token-stream/src/Pipe.php create mode 100644 vendor/phpunit/php-token-stream/src/Plus.php create mode 100644 vendor/phpunit/php-token-stream/src/PlusEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Pow.php create mode 100644 vendor/phpunit/php-token-stream/src/PowEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Print.php create mode 100644 vendor/phpunit/php-token-stream/src/Private.php create mode 100644 vendor/phpunit/php-token-stream/src/Protected.php create mode 100644 vendor/phpunit/php-token-stream/src/Public.php create mode 100644 vendor/phpunit/php-token-stream/src/QuestionMark.php create mode 100644 vendor/phpunit/php-token-stream/src/Require.php create mode 100644 vendor/phpunit/php-token-stream/src/RequireOnce.php create mode 100644 vendor/phpunit/php-token-stream/src/Return.php create mode 100644 vendor/phpunit/php-token-stream/src/Semicolon.php create mode 100644 vendor/phpunit/php-token-stream/src/Sl.php create mode 100644 vendor/phpunit/php-token-stream/src/SlEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Spaceship.php create mode 100644 vendor/phpunit/php-token-stream/src/Sr.php create mode 100644 vendor/phpunit/php-token-stream/src/SrEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/StartHeredoc.php create mode 100644 vendor/phpunit/php-token-stream/src/Static.php rename vendor/phpunit/php-token-stream/src/{Token => }/Stream.php (54%) create mode 100644 vendor/phpunit/php-token-stream/src/String.php create mode 100644 vendor/phpunit/php-token-stream/src/StringCast.php create mode 100644 vendor/phpunit/php-token-stream/src/StringVarname.php create mode 100644 vendor/phpunit/php-token-stream/src/Switch.php create mode 100644 vendor/phpunit/php-token-stream/src/Throw.php create mode 100644 vendor/phpunit/php-token-stream/src/Tilde.php create mode 100644 vendor/phpunit/php-token-stream/src/TokenWithScope.php create mode 100644 vendor/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php create mode 100644 vendor/phpunit/php-token-stream/src/Trait.php create mode 100644 vendor/phpunit/php-token-stream/src/TraitC.php create mode 100644 vendor/phpunit/php-token-stream/src/Try.php create mode 100644 vendor/phpunit/php-token-stream/src/Unset.php create mode 100644 vendor/phpunit/php-token-stream/src/UnsetCast.php create mode 100644 vendor/phpunit/php-token-stream/src/Use.php create mode 100644 vendor/phpunit/php-token-stream/src/UseFunction.php rename vendor/phpunit/php-token-stream/src/{Token => }/Util.php (69%) create mode 100644 vendor/phpunit/php-token-stream/src/Var.php create mode 100644 vendor/phpunit/php-token-stream/src/Variable.php create mode 100644 vendor/phpunit/php-token-stream/src/While.php create mode 100644 vendor/phpunit/php-token-stream/src/Whitespace.php create mode 100644 vendor/phpunit/php-token-stream/src/XorEqual.php create mode 100644 vendor/phpunit/php-token-stream/src/Yield.php create mode 100644 vendor/phpunit/php-token-stream/src/YieldFrom.php create mode 100644 vendor/phpunit/php-token-stream/src/break.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/ClassTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classInNamespace.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classInScopedNamespace.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classUsesNamespacedFunction.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_named_empty.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/closure.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/issue19.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/issue30.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingBraces.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingNonBraceSyntax.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/php-code-coverage-issue-424.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source2.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source3.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source4.php delete mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source5.php delete mode 100644 vendor/phpunit/php-token-stream/tests/bootstrap.php create mode 100644 vendor/psr/http-client/CHANGELOG.md create mode 100644 vendor/psr/http-client/LICENSE create mode 100644 vendor/psr/http-client/README.md create mode 100644 vendor/psr/http-client/composer.json create mode 100644 vendor/psr/http-client/src/ClientExceptionInterface.php create mode 100644 vendor/psr/http-client/src/ClientInterface.php create mode 100644 vendor/psr/http-client/src/NetworkExceptionInterface.php create mode 100644 vendor/psr/http-client/src/RequestExceptionInterface.php create mode 100644 vendor/psr/http-factory/.gitignore create mode 100644 vendor/psr/http-factory/.pullapprove.yml create mode 100644 vendor/psr/http-factory/LICENSE create mode 100644 vendor/psr/http-factory/README.md create mode 100644 vendor/psr/http-factory/composer.json create mode 100644 vendor/psr/http-factory/src/RequestFactoryInterface.php create mode 100644 vendor/psr/http-factory/src/ResponseFactoryInterface.php create mode 100644 vendor/psr/http-factory/src/ServerRequestFactoryInterface.php create mode 100644 vendor/psr/http-factory/src/StreamFactoryInterface.php create mode 100644 vendor/psr/http-factory/src/UploadedFileFactoryInterface.php create mode 100644 vendor/psr/http-factory/src/UriFactoryInterface.php create mode 100644 vendor/psr/http-message/CHANGELOG.md create mode 100644 vendor/psr/http-message/LICENSE create mode 100644 vendor/psr/http-message/README.md create mode 100644 vendor/psr/http-message/composer.json create mode 100644 vendor/psr/http-message/src/MessageInterface.php create mode 100644 vendor/psr/http-message/src/RequestInterface.php create mode 100644 vendor/psr/http-message/src/ResponseInterface.php create mode 100644 vendor/psr/http-message/src/ServerRequestInterface.php create mode 100644 vendor/psr/http-message/src/StreamInterface.php create mode 100644 vendor/psr/http-message/src/UploadedFileInterface.php create mode 100644 vendor/psr/http-message/src/UriInterface.php delete mode 100644 vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php delete mode 100644 vendor/psy/psysh/src/ConsoleColorFactory.php create mode 100644 vendor/psy/psysh/src/Output/Theme.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Autocompleter.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/AutocompleterAggregate.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/AutocompleterPath.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/AutocompleterWord.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Console.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleCursor.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleInput.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleOutput.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleProcessus.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleTput.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ConsoleWindow.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Event.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventBucket.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventListenable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventListener.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventListens.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/EventSource.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Exception.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ExceptionIdle.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/File.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileDirectory.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileDoesNotExistException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileFinder.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileGeneric.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileLink.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileLinkRead.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileLinkReadWrite.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileRead.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/FileReadWrite.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/IStream.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/IteratorFileSystem.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/IteratorRecursiveDirectory.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/IteratorSplFileInfo.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Protocol.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ProtocolException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ProtocolNode.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/ProtocolWrapper.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Readline.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Stream.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamBufferable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamContext.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamException.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamIn.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamLockable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamOut.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamPathable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamPointable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamStatable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/StreamTouchable.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Terminfo/77/windows-ansi create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm-256color create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Ustring.php create mode 100644 vendor/psy/psysh/src/Readline/Hoa/Xcallable.php create mode 100644 vendor/psy/psysh/src/Readline/Userland.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/Downloader.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/Downloader/CurlDownloader.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/Downloader/Factory.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/Downloader/FileDownloader.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/Installer.php create mode 100644 vendor/psy/psysh/src/VersionUpdater/SelfUpdate.php create mode 100644 vendor/ralouphie/getallheaders/LICENSE create mode 100644 vendor/ralouphie/getallheaders/README.md create mode 100644 vendor/ralouphie/getallheaders/composer.json create mode 100644 vendor/ralouphie/getallheaders/src/getallheaders.php create mode 100644 vendor/symfony/deprecation-contracts/.gitignore create mode 100644 vendor/symfony/deprecation-contracts/CHANGELOG.md create mode 100644 vendor/symfony/deprecation-contracts/LICENSE create mode 100644 vendor/symfony/deprecation-contracts/README.md create mode 100644 vendor/symfony/deprecation-contracts/composer.json create mode 100644 vendor/symfony/deprecation-contracts/function.php create mode 100644 vendor/symfony/http-client-contracts/CHANGELOG.md create mode 100644 vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php create mode 100644 vendor/symfony/mime/Crypto/DkimOptions.php create mode 100644 vendor/symfony/mime/Crypto/DkimSigner.php create mode 100644 vendor/symfony/options-resolver/CHANGELOG.md create mode 100644 vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php create mode 100644 vendor/symfony/options-resolver/Exception/AccessException.php create mode 100644 vendor/symfony/options-resolver/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/options-resolver/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/options-resolver/Exception/InvalidOptionsException.php create mode 100644 vendor/symfony/options-resolver/Exception/MissingOptionsException.php create mode 100644 vendor/symfony/options-resolver/Exception/NoConfigurationException.php create mode 100644 vendor/symfony/options-resolver/Exception/NoSuchOptionException.php create mode 100644 vendor/symfony/options-resolver/Exception/OptionDefinitionException.php create mode 100644 vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php create mode 100644 vendor/symfony/options-resolver/LICENSE create mode 100644 vendor/symfony/options-resolver/OptionConfigurator.php create mode 100644 vendor/symfony/options-resolver/Options.php create mode 100644 vendor/symfony/options-resolver/OptionsResolver.php create mode 100644 vendor/symfony/options-resolver/README.md create mode 100644 vendor/symfony/options-resolver/composer.json create mode 100644 vendor/symfony/service-contracts/Attribute/Required.php create mode 100644 vendor/symfony/service-contracts/Attribute/SubscribedService.php create mode 100644 vendor/symfony/service-contracts/CHANGELOG.md create mode 100644 vendor/symfony/translation-contracts/CHANGELOG.md create mode 100644 vendor/symfony/translation-contracts/TranslatableInterface.php create mode 100644 vendor/twig/twig/.github/dependabot.yml delete mode 100644 vendor/wikimedia/less.php/.github/workflows/php.yml create mode 100644 vendor/wikimedia/less.php/API.md create mode 100644 vendor/wikimedia/less.php/CODE_OF_CONDUCT.md create mode 100644 vendor/wikimedia/less.php/NOTICE.txt create mode 100644 vendor/wikimedia/less.php/SECURITY.md delete mode 100644 vendor/wikimedia/less.php/composer.json mode change 100755 => 100644 vendor/wikimedia/less.php/lib/Less/Less.php.combine diff --git a/composer.json b/composer.json index 1ed70d1ad..6e2baa76a 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,11 @@ "october/backend": "1.1.*", "october/cms": "1.1.*", "laravel/framework": "~6.0", - "wikimedia/composer-merge-plugin": "dev-feature/composer-v2 as 1.5.0" + "wikimedia/composer-merge-plugin": "dev-feature/composer-v2 as 1.5.0", + "laravel/scout": "^8.6", + "meilisearch/meilisearch-laravel-scout": "^0.12.5", + "guzzlehttp/guzzle": "^7.5", + "php-http/guzzle7-adapter": "^1.0" }, "require-dev": { "phpunit/phpunit": "^8.4|^9.3.3", @@ -82,10 +86,7 @@ ] }, "config": { - "preferred-install": "dist", - "platform": { - "php": "7.2" - } + "preferred-install": "dist" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/config/app.php b/config/app.php index d53b83111..91278ccf5 100644 --- a/config/app.php +++ b/config/app.php @@ -125,7 +125,8 @@ return [ 'providers' => array_merge(include(base_path('modules/system/providers.php')), [ // 'Illuminate\Html\HtmlServiceProvider', // Example - + 'Laravel\Scout\ScoutServiceProvider', + 'Meilisearch\Scout\MeilisearchServiceProvider', 'System\ServiceProvider', ]), diff --git a/config/meilisearch.php b/config/meilisearch.php new file mode 100644 index 000000000..4f4bbab4a --- /dev/null +++ b/config/meilisearch.php @@ -0,0 +1,38 @@ + env('MEILISEARCH_HOST', 'http://localhost:7700'), + + /* + |-------------------------------------------------------------------------- + | MeiliSearch Master Key + |-------------------------------------------------------------------------- + | + | This value is used to authenticate with your MeiliSearch instance. During + | development this is not required, but it MUST be set during a production + | environment. + | + | For more information on the master key, check out the MeiliSearch + | documentation here: + | https://docs.meilisearch.com/guides/advanced_guides/configuration.html + | + */ + + 'key' => env('MEILISEARCH_KEY', null), + +]; diff --git a/config/scout.php b/config/scout.php new file mode 100644 index 000000000..e425bb0e8 --- /dev/null +++ b/config/scout.php @@ -0,0 +1,119 @@ + env('SCOUT_DRIVER', 'algolia'), + + /* + |-------------------------------------------------------------------------- + | Index Prefix + |-------------------------------------------------------------------------- + | + | Here you may specify a prefix that will be applied to all search index + | names used by Scout. This prefix may be useful if you have multiple + | "tenants" or applications sharing the same search infrastructure. + | + */ + + 'prefix' => env('SCOUT_PREFIX', ''), + + /* + |-------------------------------------------------------------------------- + | Queue Data Syncing + |-------------------------------------------------------------------------- + | + | This option allows you to control if the operations that sync your data + | with your search engines are queued. When this is set to "true" then + | all automatic data syncing will get queued for better performance. + | + */ + + 'queue' => env('SCOUT_QUEUE', false), + + /* + |-------------------------------------------------------------------------- + | Database Transactions + |-------------------------------------------------------------------------- + | + | This configuration option determines if your data will only be synced + | with your search indexes after every open database transaction has + | been committed, thus preventing any discarded data from syncing. + | + */ + + 'after_commit' => false, + + /* + |-------------------------------------------------------------------------- + | Chunk Sizes + |-------------------------------------------------------------------------- + | + | These options allow you to control the maximum chunk size when you are + | mass importing data into the search engine. This allows you to fine + | tune each of these chunk sizes based on the power of the servers. + | + */ + + 'chunk' => [ + 'searchable' => 500, + 'unsearchable' => 500, + ], + + /* + |-------------------------------------------------------------------------- + | Soft Deletes + |-------------------------------------------------------------------------- + | + | This option allows to control whether to keep soft deleted records in + | the search indexes. Maintaining soft deleted records can be useful + | if your application still needs to search for the records later. + | + */ + + 'soft_delete' => false, + + /* + |-------------------------------------------------------------------------- + | Identify User + |-------------------------------------------------------------------------- + | + | This option allows you to control whether to notify the search engine + | of the user performing the search. This is sometimes useful if the + | engine supports any analytics based on this application's users. + | + | Supported engines: "algolia" + | + */ + + 'identify' => env('SCOUT_IDENTIFY', false), + + /* + |-------------------------------------------------------------------------- + | Algolia Configuration + |-------------------------------------------------------------------------- + | + | Here you may configure your Algolia settings. Algolia is a cloud hosted + | search engine which works great with Scout out of the box. Just plug + | in your application ID and admin API key to get started searching. + | + */ + + 'algolia' => [ + 'id' => env('ALGOLIA_APP_ID', ''), + 'secret' => env('ALGOLIA_SECRET', ''), + ], + +]; diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php index 8098ecbda..9cdcd9589 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php @@ -45,7 +45,7 @@ class postsController extends Controller if($data){ $data->each(function ($item, $key) { - $item->url = $this->pageUrl('post',['id'=>$item->id,'slug'=>$item->slug]); + $item->url = $this->pageUrl('new/newPost',['id'=>$item->id,'slug'=>$item->slug]); }); } diff --git a/plugins/rainlab/blog/Plugin.php b/plugins/rainlab/blog/Plugin.php index b55e80aac..2d2535045 100644 --- a/plugins/rainlab/blog/Plugin.php +++ b/plugins/rainlab/blog/Plugin.php @@ -27,7 +27,8 @@ class Plugin extends PluginBase 'RainLab\Blog\Components\Post' => 'blogPost', 'RainLab\Blog\Components\Posts' => 'blogPosts', 'RainLab\Blog\Components\Categories' => 'blogCategories', - 'RainLab\Blog\Components\RssFeed' => 'blogRssFeed' + 'RainLab\Blog\Components\RssFeed' => 'blogRssFeed', + 'RainLab\Blog\Components\Meilisearch' => 'meilisearch' ]; } diff --git a/plugins/rainlab/blog/components/Meilisearch.php b/plugins/rainlab/blog/components/Meilisearch.php new file mode 100644 index 000000000..bffad1107 --- /dev/null +++ b/plugins/rainlab/blog/components/Meilisearch.php @@ -0,0 +1,87 @@ + 'meilisearch', + 'description' => 'meilisearch' + ]; + } + + + public function onRun() + { + $this->posts = $this->listPosts(); + //$this->page = $this->listPosts(); + } + + protected function listPosts() + { + + $query = get('q'); + $page = get('page'); + //dd($query); + if(is_null($page)) + { + $page = 1; + } + + if(is_null($query)) + { + $query = 'здравоохранения'; + } + + $this->page = $page; + + $this->query = $query; + + + $per_page = 2; + $offset=$per_page * ($page - 1); + + $client = new Client([ + 'headers' => [ 'Content-Type' => 'application/json' ] + ]); + + + $response = $client->post('http://localhost:7700/indexes/posts_index/search', + ['body' => json_encode( + [ + 'q' => $query, + 'limit' => $per_page, + 'offset' => $offset + $per_page, + ] + )] + ); + + + $res = json_decode($response->getBody()->getContents()); + + //$query = post('query'); + //dd($res); + return $res->hits; + } + + + + +} \ No newline at end of file diff --git a/plugins/rainlab/blog/components/meilisearch/default.htm b/plugins/rainlab/blog/components/meilisearch/default.htm new file mode 100644 index 000000000..10edfeeda --- /dev/null +++ b/plugins/rainlab/blog/components/meilisearch/default.htm @@ -0,0 +1,62 @@ +{% set posts = __SELF__.posts %} +{% set page = __SELF__.page %} +{% set query = __SELF__.query %} + + + {% for post in posts %} + +
+ {% if post.featured_image %} + {{post.title}} + {% endif %} +
+
+

+ {{post.title}} +

+
+

{{post.published_at|date('d.m.Y')}}

+ | +

{{post.published_at|date('H:i')}}

+ | + +

{{post.views}}

+
+ +
+
+ {% endfor %} + +
+ + + + + + + +
+ +
+ + + + + + +
diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 2c9cd4a2d..649b6b6cf 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -21,6 +21,7 @@ use Cms\Classes\Controller; use RainLab\Blog\Classes\TagProcessor; use RainLab\Blog\Models\Category; use RainLab\Blog\Models\PostCategoryGroupPivot; +use Laravel\Scout\Searchable; use ValidationException; @@ -30,6 +31,12 @@ use ValidationException; class Post extends Model { use \October\Rain\Database\Traits\Validation; + use Searchable; + + public function searchableAs() + { + return 'posts_index'; + } public $table = 'rainlab_blog_posts'; // public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; diff --git a/plugins/rainlab/blog/routes.php b/plugins/rainlab/blog/routes.php new file mode 100644 index 000000000..1601ae3ac --- /dev/null +++ b/plugins/rainlab/blog/routes.php @@ -0,0 +1,9 @@ +raw(); + return $result; + //dd("meilisearch"); +}); diff --git a/plugins/tps/reklama/controllers/StatisticsController.php b/plugins/tps/reklama/controllers/StatisticsController.php index bb8273969..035ba3c09 100644 --- a/plugins/tps/reklama/controllers/StatisticsController.php +++ b/plugins/tps/reklama/controllers/StatisticsController.php @@ -92,9 +92,6 @@ class StatisticsController extends Controller $this->vars['reklam_stats'] = $stats->get(); - dd($stats->get()); - $this->vars['count_view'] = 30; - return ['#linechart' => $this->makePartial('linechart')]; } diff --git a/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm b/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm index 19c98671f..a8ad08a79 100644 --- a/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm +++ b/plugins/tps/reklama/controllers/statisticscontroller/_linechart.htm @@ -18,7 +18,7 @@ ]); var options = { - title: ' ', + title: '', curveType: 'function', legend: { position: 'bottom' } }; diff --git a/plugins/tps/reklama/models/Statistika.php b/plugins/tps/reklama/models/Statistika.php index f2369e4f5..a63a7c54b 100644 --- a/plugins/tps/reklama/models/Statistika.php +++ b/plugins/tps/reklama/models/Statistika.php @@ -14,7 +14,7 @@ class Statistika extends Model * Remove this line if timestamps are defined in the database table. */ public $timestamps = false; - + protected $fillable = ['item_id','date']; /** * @var string The database table used by the model. diff --git a/themes/modern2/meta/menus/new-top-menui.yaml b/themes/modern2/meta/menus/new-top-menui.yaml index fd86dc3b4..09e1fa709 100644 --- a/themes/modern2/meta/menus/new-top-menui.yaml +++ b/themes/modern2/meta/menus/new-top-menui.yaml @@ -525,20 +525,16 @@ items: isExternal: '0' - title: Кинотеатры - nesting: null type: url url: /ru/new/posts/poster/kinoteatry code: '' - reference: null - cmsPage: null - replace: null viewBag: locale: en: title: Cinemas url: /en/new/posts/poster/cinemas tm: - title: Kinolar + title: Kinoteatrlar url: /tm/new/posts/poster/kinolar isHidden: '0' cssClass: '' @@ -605,20 +601,16 @@ items: isExternal: '0' - title: Объявления - nesting: null type: url url: /ru/new/posts/poster/obyavleniya code: '' - reference: null - cmsPage: null - replace: null viewBag: locale: en: title: Аds url: /en/new/posts/poster/ads tm: - title: Мahabat + title: Bildirişler url: /tm/new/posts/poster/mahabat isHidden: '0' cssClass: '' diff --git a/themes/modern2/meta/menus/top-menu.yaml b/themes/modern2/meta/menus/top-menu.yaml index a3c5f921d..2e6e7f5a7 100644 --- a/themes/modern2/meta/menus/top-menu.yaml +++ b/themes/modern2/meta/menus/top-menu.yaml @@ -1,8 +1,13 @@ items: - title: Разделы + nesting: null type: header + url: null code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -239,7 +244,6 @@ items: title: Объявления nesting: 0 type: blog-category - url: null code: '' reference: '796' cmsPage: category diff --git a/themes/modern2/pages/404.htm b/themes/modern2/pages/404.htm index 3f4e4df2a..340a8e11e 100644 --- a/themes/modern2/pages/404.htm +++ b/themes/modern2/pages/404.htm @@ -1,13 +1,13 @@ title = "Page not found (404)" url = "/404" -layout = "cms" +layout = "new/master-inside" is_hidden = 0 robot_index = "index" robot_follow = "follow" == -
-
-

{{'Page not found'|_}}

-

{{'We are sorry, but the page you requested cannot be found.'|_}}

+
+
+

{{'Page not found'|_}}

+

{{'We are sorry, but the page you requested cannot be found.'|_}}

\ No newline at end of file diff --git a/themes/modern2/pages/new/demosearch.htm b/themes/modern2/pages/new/demosearch.htm new file mode 100644 index 000000000..cc5fca7b9 --- /dev/null +++ b/themes/modern2/pages/new/demosearch.htm @@ -0,0 +1,25 @@ +title = "demosearch" +url = "new/demosearch" +layout = "new/master-inside" +is_hidden = 0 +robot_index = "noindex" +robot_follow = "follow" + +[meilisearch] +== + +
+
+
+ + + + {% component 'meilisearch' %} + + +
+
+
\ No newline at end of file diff --git a/themes/modern2/pages/new/home.htm b/themes/modern2/pages/new/home.htm index 1081a070d..c7c1abd0d 100644 --- a/themes/modern2/pages/new/home.htm +++ b/themes/modern2/pages/new/home.htm @@ -10,7 +10,7 @@ robot_follow = "follow" [viewBag] localeTitle[en] = "Home" -localeUrl[en] = "/home" +localeTitle[tm] = "Baş Sahypa" [adverts adverts5] code = 5 diff --git a/themes/modern2/partials/new/footer.htm b/themes/modern2/partials/new/footer.htm index dabba181c..936e36b91 100644 --- a/themes/modern2/partials/new/footer.htm +++ b/themes/modern2/partials/new/footer.htm @@ -5,7 +5,7 @@
diff --git a/vendor/clue/stream-filter/.github/FUNDING.yml b/vendor/clue/stream-filter/.github/FUNDING.yml new file mode 100644 index 000000000..9c09fb878 --- /dev/null +++ b/vendor/clue/stream-filter/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: clue +custom: https://clue.engineering/support diff --git a/vendor/clue/stream-filter/CHANGELOG.md b/vendor/clue/stream-filter/CHANGELOG.md new file mode 100644 index 000000000..e6ae94b58 --- /dev/null +++ b/vendor/clue/stream-filter/CHANGELOG.md @@ -0,0 +1,86 @@ +# Changelog + +## 1.6.0 (2022-02-21) + +* Feature: Support PHP 8.1 release. + (#45 by @clue) + +* Improve documentation to use fully-qualified function names. + (#43 by @SimonFrings and #42 by @PaulRotmann) + +* Improve test suite and use GitHub actions for continuous integration (CI). + (#39 and #40 by @SimonFrings) + +## 1.5.0 (2020-10-02) + +* Feature: Improve performance by using global imports. + (#38 by @clue) + +* Improve API documentation and add support / sponsorship info. + (#30 by @clue and #35 by @SimonFrings) + +* Improve test suite and add `.gitattributes` to exclude dev files from exports. + Prepare PHP 8 support, update to PHPUnit 9 and simplify test matrix. + (#32 and #37 by @clue and #34 and #36 by @SimonFrings) + +## 1.4.1 (2019-04-09) + +* Fix: Check if the function is declared before declaring it. + (#23 by @Niko9911) + +* Improve test suite to also test against PHP 7.2 and + add test for base64 encoding and decoding filters. + (#22 by @arubacao and #25 by @Nyholm and @clue) + +## 1.4.0 (2017-08-18) + +* Feature / Fix: The `fun()` function does not pass filter parameter `null` + to underlying `stream_filter_append()` by default + (#15 by @Nyholm) + + Certain filters (such as `convert.quoted-printable-encode`) do not accept + a filter parameter at all. If no explicit filter parameter is given, we no + longer pass a default `null` value. + + ```php + $encode = Filter\fun('convert.quoted-printable-encode'); + assert('t=C3=A4st' === $encode('täst')); + ``` + +* Add examples and improve documentation + (#13 and #20 by @clue and #18 by @Nyholm) + +* Improve test suite by adding PHPUnit to require-dev, + fix HHVM build for now again and ignore future HHVM build errors, + lock Travis distro so new future defaults will not break the build + and test on PHP 7.1 + (#12, #14 and #19 by @clue and #16 by @Nyholm) + +## 1.3.0 (2015-11-08) + +* Feature: Support accessing built-in filters as callbacks + (#5 by @clue) + + ```php + $fun = Filter\fun('zlib.deflate'); + + $ret = $fun('hello') . $fun('world') . $fun(); + assert('helloworld' === gzinflate($ret)); + ``` + +## 1.2.0 (2015-10-23) + +* Feature: Invoke close event when closing filter (flush buffer) + (#9 by @clue) + +## 1.1.0 (2015-10-22) + +* Feature: Abort filter operation when catching an Exception + (#10 by @clue) + +* Feature: Additional safeguards to prevent filter state corruption + (#7 by @clue) + +## 1.0.0 (2015-10-18) + +* First tagged release diff --git a/vendor/clue/stream-filter/LICENSE b/vendor/clue/stream-filter/LICENSE new file mode 100644 index 000000000..dc09d1e6c --- /dev/null +++ b/vendor/clue/stream-filter/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Christian Lück + +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/vendor/clue/stream-filter/README.md b/vendor/clue/stream-filter/README.md new file mode 100644 index 000000000..4196c2cc9 --- /dev/null +++ b/vendor/clue/stream-filter/README.md @@ -0,0 +1,326 @@ +# clue/stream-filter + +[![CI status](https://github.com/clue/stream-filter/workflows/CI/badge.svg)](https://github.com/clue/stream-filter/actions) +[![installs on Packagist](https://img.shields.io/packagist/dt/clue/stream-filter?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/stream-filter) + +A simple and modern approach to stream filtering in PHP + +**Table of contents** + +* [Why?](#why) +* [Support us](#support-us) +* [Usage](#usage) + * [append()](#append) + * [prepend()](#prepend) + * [fun()](#fun) + * [remove()](#remove) +* [Install](#install) +* [Tests](#tests) +* [License](#license) + +## Why? + +PHP's stream filtering system is great! + +It offers very powerful stream filtering options and comes with a useful set of built-in filters. +These filters can be used to easily and efficiently perform various transformations on-the-fly, such as: + +* read from a gzip'ed input file, +* transcode from ISO-8859-1 (Latin1) to UTF-8, +* write to a bzip output file +* and much more. + +But let's face it: +Its API is [*difficult to work with*](https://www.php.net/manual/en/php-user-filter.filter.php) +and its documentation is [*subpar*](https://stackoverflow.com/questions/27103269/what-is-a-bucket-brigade). +This combined means its powerful features are often neglected. + +This project aims to make these features more accessible to a broader audience. +* **Lightweight, SOLID design** - + Provides a thin abstraction that is [*just good enough*](https://en.wikipedia.org/wiki/Principle_of_good_enough) + and does not get in your way. + Custom filters require trivial effort. +* **Good test coverage** - + Comes with an automated tests suite and is regularly tested in the *real world* + +## Support us + +We invest a lot of time developing, maintaining and updating our awesome +open-source projects. You can help us sustain this high-quality of our work by +[becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get +numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue) +for details. + +Let's take these projects to the next level together! 🚀 + +## Usage + +This lightweight library consists only of a few simple functions. +All functions reside under the `Clue\StreamFilter` namespace. + +The below examples refer to all functions with their fully-qualified names like this: + +```php +Clue\StreamFilter\append(…); +``` + +As of PHP 5.6+ you can also import each required function into your code like this: + +```php +use function Clue\StreamFilter\append; + +append(…); +``` + +Alternatively, you can also use an import statement similar to this: + +```php +use Clue\StreamFilter as Filter; + +Filter\append(…); +``` + +### append() + +The `append(resource $stream, callable $callback, int $read_write = STREAM_FILTER_ALL): resource` function can be used to +append a filter callback to the given stream. + +Each stream can have a list of filters attached. +This function appends a filter to the end of this list. + +If the given filter can not be added, it throws an `Exception`. + +The `$stream` can be any valid stream resource, such as: + +```php +$stream = fopen('demo.txt', 'w+'); +``` + +The `$callback` should be a valid callable function which accepts +an individual chunk of data and should return the updated chunk: + +```php +$filter = Clue\StreamFilter\append($stream, function ($chunk) { + // will be called each time you read or write a $chunk to/from the stream + return $chunk; +}); +``` + +As such, you can also use native PHP functions or any other `callable`: + +```php +Clue\StreamFilter\append($stream, 'strtoupper'); + +// will write "HELLO" to the underlying stream +fwrite($stream, 'hello'); +``` + +If the `$callback` accepts invocation without parameters, +then this signature will be invoked once ending (flushing) the filter: + +```php +Clue\StreamFilter\append($stream, function ($chunk = null) { + if ($chunk === null) { + // will be called once ending the filter + return 'end'; + } + // will be called each time you read or write a $chunk to/from the stream + return $chunk; +}); + +fclose($stream); +``` + +> Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data +from the end signal handler if the stream is being closed. + +If your callback throws an `Exception`, then the filter process will be aborted. +In order to play nice with PHP's stream handling, +the `Exception` will be transformed to a PHP warning instead: + +```php +Clue\StreamFilter\append($stream, function ($chunk) { + throw new \RuntimeException('Unexpected chunk'); +}); + +// raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk" +fwrite($stream, 'hello'); +``` + +The optional `$read_write` parameter can be used to only invoke the `$callback` +when either writing to the stream or only when reading from the stream: + +```php +Clue\StreamFilter\append($stream, function ($chunk) { + // will be called each time you write to the stream + return $chunk; +}, STREAM_FILTER_WRITE); + +Clue\StreamFilter\append($stream, function ($chunk) { + // will be called each time you read from the stream + return $chunk; +}, STREAM_FILTER_READ); +``` + +This function returns a filter resource which can be passed to [`remove()`](#remove). + +> Note that once a filter has been added to stream, the stream can no longer be passed to +> [`stream_select()`](https://www.php.net/manual/en/function.stream-select.php) +> (and family). +> +> > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line} +> +> This is due to limitations of PHP's stream filter support, as it can no longer reliably +> tell when the underlying stream resource is actually ready. +> As an alternative, consider calling `stream_select()` on the unfiltered stream and +> then pass the unfiltered data through the [`fun()`](#fun) function. + +### prepend() + +The `prepend(resource $stream, callable $callback, int $read_write = STREAM_FILTER_ALL): resource` function can be used to +prepend a filter callback to the given stream. + +Each stream can have a list of filters attached. +This function prepends a filter to the start of this list. + +If the given filter can not be added, it throws an `Exception`. + +```php +$filter = Clue\StreamFilter\prepend($stream, function ($chunk) { + // will be called each time you read or write a $chunk to/from the stream + return $chunk; +}); +``` + +This function returns a filter resource which can be passed to [`remove()`](#remove). + +Except for the position in the list of filters, this function behaves exactly +like the [`append()`](#append) function. +For more details about its behavior, see also the [`append()`](#append) function. + +### fun() + +The `fun(string $filter, mixed $parameters = null): callable` function can be used to +create a filter function which uses the given built-in `$filter`. + +PHP comes with a useful set of [built-in filters](https://www.php.net/manual/en/filters.php). +Using `fun()` makes accessing these as easy as passing an input string to filter +and getting the filtered output string. + +```php +$fun = Clue\StreamFilter\fun('string.rot13'); + +assert('grfg' === $fun('test')); +assert('test' === $fun($fun('test')); +``` + +Please note that not all filter functions may be available depending +on installed PHP extensions and the PHP version in use. +In particular, [HHVM](https://hhvm.com/) may not offer the same filter functions +or parameters as Zend PHP. +Accessing an unknown filter function will result in a `RuntimeException`: + +```php +Clue\StreamFilter\fun('unknown'); // throws RuntimeException +``` + +Some filters may accept or require additional filter parameters – most +filters do not require filter parameters. +If given, the optional `$parameters` argument will be passed to the +underlying filter handler as-is. +In particular, note how *not passing* this parameter at all differs from +explicitly passing a `null` value (which many filters do not accept). +Please refer to the individual filter definition for more details. +For example, the `string.strip_tags` filter can be invoked like this: + +```php +$fun = Clue\StreamFilter\fun('string.strip_tags', ''); + +$ret = $fun('h
i
'); +assert('hi' === $ret); +``` + +Under the hood, this function allocates a temporary memory stream, so it's +recommended to clean up the filter function after use. +Also, some filter functions (in particular the +[zlib compression filters](https://www.php.net/manual/en/filters.compression.php)) +may use internal buffers and may emit a final data chunk on close. +The filter function can be closed by invoking without any arguments: + +```php +$fun = Clue\StreamFilter\fun('zlib.deflate'); + +$ret = $fun('hello') . $fun('world') . $fun(); +assert('helloworld' === gzinflate($ret)); +``` + +The filter function must not be used anymore after it has been closed. +Doing so will result in a `RuntimeException`: + +```php +$fun = Clue\StreamFilter\fun('string.rot13'); +$fun(); + +$fun('test'); // throws RuntimeException +``` + +> Note: If you're using the zlib compression filters, then you should be wary +about engine inconsistencies between different PHP versions and HHVM. +These inconsistencies exist in the underlying PHP engines and there's little we +can do about this in this library. +[Our test suite](tests/) contains several test cases that exhibit these issues. +If you feel some test case is missing or outdated, we're happy to accept PRs! :) + +### remove() + +The `remove(resource $filter): bool` function can be used to +remove a filter previously added via [`append()`](#append) or [`prepend()`](#prepend). + +```php +$filter = Clue\StreamFilter\append($stream, function () { + // … +}); +Clue\StreamFilter\remove($filter); +``` + +## Install + +The recommended way to install this library is [through Composer](https://getcomposer.org/). +[New to Composer?](https://getcomposer.org/doc/00-intro.md) + +This project follows [SemVer](https://semver.org/). +This will install the latest supported version: + +```bash +$ composer require clue/stream-filter:^1.6 +``` + +See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. + +This project aims to run on any platform and thus does not require any PHP +extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +HHVM. +It's *highly recommended to use the latest supported PHP version* for this project. +Older PHP versions may suffer from a number of inconsistencies documented above. + +## Tests + +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](https://getcomposer.org/): + +```bash +$ composer install +``` + +To run the test suite, go to the project root and run: + +```bash +$ vendor/bin/phpunit +``` + +## License + +This project is released under the permissive [MIT license](LICENSE). + +> Did you know that I offer custom development services and issuing invoices for + sponsorships of releases and for contributions? Contact me (@clue) for details. diff --git a/vendor/clue/stream-filter/composer.json b/vendor/clue/stream-filter/composer.json new file mode 100644 index 000000000..797fb536b --- /dev/null +++ b/vendor/clue/stream-filter/composer.json @@ -0,0 +1,26 @@ +{ + "name": "clue/stream-filter", + "description": "A simple and modern approach to stream filtering in PHP", + "keywords": ["stream", "callback", "filter", "php_user_filter", "stream_filter_append", "stream_filter_register", "bucket brigade"], + "homepage": "https://github.com/clue/php-stream-filter", + "license": "MIT", + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + }, + "autoload": { + "psr-4": { "Clue\\StreamFilter\\": "src/" }, + "files": [ "src/functions_include.php" ] + }, + "autoload-dev": { + "psr-4": { "Clue\\Tests\\StreamFilter\\": "tests/" } + } +} diff --git a/vendor/clue/stream-filter/src/CallbackFilter.php b/vendor/clue/stream-filter/src/CallbackFilter.php new file mode 100644 index 000000000..a667fe68b --- /dev/null +++ b/vendor/clue/stream-filter/src/CallbackFilter.php @@ -0,0 +1,120 @@ +closed = false; + + if (!\is_callable($this->params)) { + throw new \InvalidArgumentException('No valid callback parameter given to stream_filter_(append|prepend)'); + } + $this->callback = $this->params; + + // callback supports end event if it accepts invocation without arguments + $ref = new \ReflectionFunction($this->callback); + $this->supportsClose = ($ref->getNumberOfRequiredParameters() === 0); + + return true; + } + + /** @return void */ + #[\ReturnTypeWillChange] + public function onClose() + { + $this->closed = true; + + // callback supports closing and is not already closed + if ($this->supportsClose) { + $this->supportsClose = false; + // invoke without argument to signal end and discard resulting buffer + try { + \call_user_func($this->callback); + } catch (\Exception $ignored) { + // this might be called during engine shutdown, so it's not safe + // to raise any errors or exceptions here + // trigger_error('Error closing filter: ' . $ignored->getMessage(), E_USER_WARNING); + } + } + + $this->callback = null; + } + + /** @return int */ + #[\ReturnTypeWillChange] + public function filter($in, $out, &$consumed, $closing) + { + // concatenate whole buffer from input brigade + $data = ''; + while ($bucket = \stream_bucket_make_writeable($in)) { + $consumed += $bucket->datalen; + $data .= $bucket->data; + } + + // skip processing callback that already ended + if ($this->closed) { + return \PSFS_FEED_ME; + } + + // only invoke filter function if buffer is not empty + // this may skip flushing a closing filter + if ($data !== '') { + try { + $data = \call_user_func($this->callback, $data); + } catch (\Exception $e) { + // exception should mark filter as closed + $this->onClose(); + \trigger_error('Error invoking filter: ' . $e->getMessage(), \E_USER_WARNING); + + return \PSFS_ERR_FATAL; + } + } + + // mark filter as closed after processing closing chunk + if ($closing) { + $this->closed = true; + + // callback supports closing and is not already closed + if ($this->supportsClose) { + $this->supportsClose = false; + + // invoke without argument to signal end and append resulting buffer + try { + $data .= \call_user_func($this->callback); + } catch (\Exception $e) { + \trigger_error('Error ending filter: ' . $e->getMessage(), \E_USER_WARNING); + + return \PSFS_ERR_FATAL; + } + } + } + + if ($data !== '') { + // create a new bucket for writing the resulting buffer to the output brigade + // reusing an existing bucket turned out to be bugged in some environments (ancient PHP versions and HHVM) + $bucket = @\stream_bucket_new($this->stream, $data); + + // legacy PHP versions (PHP < 5.4) do not support passing data from the event signal handler + // because closing the stream invalidates the stream and its stream bucket brigade before + // invoking the filter close handler. + if ($bucket !== false) { + \stream_bucket_append($out, $bucket); + } + } + + return \PSFS_PASS_ON; + } +} diff --git a/vendor/clue/stream-filter/src/functions.php b/vendor/clue/stream-filter/src/functions.php new file mode 100644 index 000000000..cad88a29a --- /dev/null +++ b/vendor/clue/stream-filter/src/functions.php @@ -0,0 +1,327 @@ + Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data + * from the end signal handler if the stream is being closed. + * + * If your callback throws an `Exception`, then the filter process will be aborted. + * In order to play nice with PHP's stream handling, + * the `Exception` will be transformed to a PHP warning instead: + * + * ```php + * Clue\StreamFilter\append($stream, function ($chunk) { + * throw new \RuntimeException('Unexpected chunk'); + * }); + * + * // raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk" + * fwrite($stream, 'hello'); + * ``` + * + * The optional `$read_write` parameter can be used to only invoke the `$callback` + * when either writing to the stream or only when reading from the stream: + * + * ```php + * Clue\StreamFilter\append($stream, function ($chunk) { + * // will be called each time you write to the stream + * return $chunk; + * }, STREAM_FILTER_WRITE); + * + * Clue\StreamFilter\append($stream, function ($chunk) { + * // will be called each time you read from the stream + * return $chunk; + * }, STREAM_FILTER_READ); + * ``` + * + * This function returns a filter resource which can be passed to [`remove()`](#remove). + * + * > Note that once a filter has been added to stream, the stream can no longer be passed to + * > [`stream_select()`](https://www.php.net/manual/en/function.stream-select.php) + * > (and family). + * > + * > > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line} + * > + * > This is due to limitations of PHP's stream filter support, as it can no longer reliably + * > tell when the underlying stream resource is actually ready. + * > As an alternative, consider calling `stream_select()` on the unfiltered stream and + * > then pass the unfiltered data through the [`fun()`](#fun) function. + * + * @param resource $stream + * @param callable $callback + * @param int $read_write + * @return resource filter resource which can be used for `remove()` + * @throws \Exception on error + * @uses stream_filter_append() + */ +function append($stream, $callback, $read_write = STREAM_FILTER_ALL) +{ + $ret = @\stream_filter_append($stream, register(), $read_write, $callback); + + // PHP 8 throws above on type errors, older PHP and memory issues can throw here + // @codeCoverageIgnoreStart + if ($ret === false) { + $error = \error_get_last() + array('message' => ''); + throw new \RuntimeException('Unable to append filter: ' . $error['message']); + } + // @codeCoverageIgnoreEnd + + return $ret; +} + +/** + * Prepend a filter callback to the given stream. + * + * Each stream can have a list of filters attached. + * This function prepends a filter to the start of this list. + * + * If the given filter can not be added, it throws an `Exception`. + * + * ```php + * $filter = Clue\StreamFilter\prepend($stream, function ($chunk) { + * // will be called each time you read or write a $chunk to/from the stream + * return $chunk; + * }); + * ``` + * + * This function returns a filter resource which can be passed to [`remove()`](#remove). + * + * Except for the position in the list of filters, this function behaves exactly + * like the [`append()`](#append) function. + * For more details about its behavior, see also the [`append()`](#append) function. + * + * @param resource $stream + * @param callable $callback + * @param int $read_write + * @return resource filter resource which can be used for `remove()` + * @throws \Exception on error + * @uses stream_filter_prepend() + */ +function prepend($stream, $callback, $read_write = STREAM_FILTER_ALL) +{ + $ret = @\stream_filter_prepend($stream, register(), $read_write, $callback); + + // PHP 8 throws above on type errors, older PHP and memory issues can throw here + // @codeCoverageIgnoreStart + if ($ret === false) { + $error = \error_get_last() + array('message' => ''); + throw new \RuntimeException('Unable to prepend filter: ' . $error['message']); + } + // @codeCoverageIgnoreEnd + + return $ret; +} + +/** + * Create a filter function which uses the given built-in `$filter`. + * + * PHP comes with a useful set of [built-in filters](https://www.php.net/manual/en/filters.php). + * Using `fun()` makes accessing these as easy as passing an input string to filter + * and getting the filtered output string. + * + * ```php + * $fun = Clue\StreamFilter\fun('string.rot13'); + * + * assert('grfg' === $fun('test')); + * assert('test' === $fun($fun('test')); + * ``` + * + * Please note that not all filter functions may be available depending + * on installed PHP extensions and the PHP version in use. + * In particular, [HHVM](https://hhvm.com/) may not offer the same filter functions + * or parameters as Zend PHP. + * Accessing an unknown filter function will result in a `RuntimeException`: + * + * ```php + * Clue\StreamFilter\fun('unknown'); // throws RuntimeException + * ``` + * + * Some filters may accept or require additional filter parameters – most + * filters do not require filter parameters. + * If given, the optional `$parameters` argument will be passed to the + * underlying filter handler as-is. + * In particular, note how *not passing* this parameter at all differs from + * explicitly passing a `null` value (which many filters do not accept). + * Please refer to the individual filter definition for more details. + * For example, the `string.strip_tags` filter can be invoked like this: + * + * ```php + * $fun = Clue\StreamFilter\fun('string.strip_tags', '
'); + * + * $ret = $fun('h
i
'); + * assert('hi' === $ret); + * ``` + * + * Under the hood, this function allocates a temporary memory stream, so it's + * recommended to clean up the filter function after use. + * Also, some filter functions (in particular the + * [zlib compression filters](https://www.php.net/manual/en/filters.compression.php)) + * may use internal buffers and may emit a final data chunk on close. + * The filter function can be closed by invoking without any arguments: + * + * ```php + * $fun = Clue\StreamFilter\fun('zlib.deflate'); + * + * $ret = $fun('hello') . $fun('world') . $fun(); + * assert('helloworld' === gzinflate($ret)); + * ``` + * + * The filter function must not be used anymore after it has been closed. + * Doing so will result in a `RuntimeException`: + * + * ```php + * $fun = Clue\StreamFilter\fun('string.rot13'); + * $fun(); + * + * $fun('test'); // throws RuntimeException + * ``` + * + * > Note: If you're using the zlib compression filters, then you should be wary + * about engine inconsistencies between different PHP versions and HHVM. + * These inconsistencies exist in the underlying PHP engines and there's little we + * can do about this in this library. + * [Our test suite](tests/) contains several test cases that exhibit these issues. + * If you feel some test case is missing or outdated, we're happy to accept PRs! :) + * + * @param string $filter built-in filter name. See stream_get_filters() or http://php.net/manual/en/filters.php + * @param mixed $parameters (optional) parameters to pass to the built-in filter as-is + * @return callable a filter callback which can be append()'ed or prepend()'ed + * @throws \RuntimeException on error + * @link http://php.net/manual/en/filters.php + * @see stream_get_filters() + * @see append() + */ +function fun($filter, $parameters = null) +{ + $fp = \fopen('php://memory', 'w'); + if (\func_num_args() === 1) { + $filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE); + } else { + $filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE, $parameters); + } + + if ($filter === false) { + \fclose($fp); + $error = \error_get_last() + array('message' => ''); + throw new \RuntimeException('Unable to access built-in filter: ' . $error['message']); + } + + // append filter function which buffers internally + $buffer = ''; + append($fp, function ($chunk) use (&$buffer) { + $buffer .= $chunk; + + // always return empty string in order to skip actually writing to stream resource + return ''; + }, \STREAM_FILTER_WRITE); + + $closed = false; + + return function ($chunk = null) use ($fp, $filter, &$buffer, &$closed) { + if ($closed) { + throw new \RuntimeException('Unable to perform operation on closed stream'); + } + if ($chunk === null) { + $closed = true; + $buffer = ''; + \fclose($fp); + return $buffer; + } + // initialize buffer and invoke filters by attempting to write to stream + $buffer = ''; + \fwrite($fp, $chunk); + + // buffer now contains everything the filter function returned + return $buffer; + }; +} + +/** + * Remove a filter previously added via `append()` or `prepend()`. + * + * ```php + * $filter = Clue\StreamFilter\append($stream, function () { + * // … + * }); + * Clue\StreamFilter\remove($filter); + * ``` + * + * @param resource $filter + * @return bool true on success or false on error + * @throws \RuntimeException on error + * @uses stream_filter_remove() + */ +function remove($filter) +{ + if (@\stream_filter_remove($filter) === false) { + // PHP 8 throws above on type errors, older PHP and memory issues can throw here + $error = \error_get_last(); + throw new \RuntimeException('Unable to remove filter: ' . $error['message']); + } +} + +/** + * Registers the callback filter and returns the resulting filter name + * + * There should be little reason to call this function manually. + * + * @return string filter name + * @uses CallbackFilter + */ +function register() +{ + static $registered = null; + if ($registered === null) { + $registered = 'stream-callback'; + \stream_filter_register($registered, __NAMESPACE__ . '\CallbackFilter'); + } + return $registered; +} diff --git a/vendor/clue/stream-filter/src/functions_include.php b/vendor/clue/stream-filter/src/functions_include.php new file mode 100644 index 000000000..4b315ae8a --- /dev/null +++ b/vendor/clue/stream-filter/src/functions_include.php @@ -0,0 +1,6 @@ + * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + private $vendorDir; + // PSR-4 private $prefixLengthsPsr4 = array(); private $prefixDirsPsr4 = array(); @@ -57,6 +59,13 @@ class ClassLoader private $missingClasses = array(); private $apcuPrefix; + private static $registeredLoaders = array(); + + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + public function getPrefixes() { if (!empty($this->prefixesPsr0)) { @@ -300,6 +309,17 @@ class ClassLoader public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** @@ -308,6 +328,10 @@ class ClassLoader public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** @@ -367,6 +391,16 @@ class ClassLoader return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + private function findFileWithExtension($class, $ext) { // PSR-4 lookup diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php new file mode 100644 index 000000000..c94b8cead --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,1668 @@ + + array ( + 'pretty_version' => '1.1.x-dev', + 'version' => '1.1.9999999.9999999-dev', + 'aliases' => + array ( + ), + 'reference' => 'c51149dba60398ac92d58c33b81c1cfe57a81513', + 'name' => 'october/october', + ), + 'versions' => + array ( + 'clue/stream-filter' => + array ( + 'pretty_version' => 'v1.6.0', + 'version' => '1.6.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd6169430c7731d8509da7aecd0af756a5747b78e', + ), + 'composer/installers' => + array ( + 'pretty_version' => 'v1.12.0', + 'version' => '1.12.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', + ), + 'cordoval/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'davedevelopment/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'dms/phpunit-arraysubset-asserts' => + array ( + 'pretty_version' => 'v0.1.1', + 'version' => '0.1.1.0', + 'aliases' => + array ( + ), + 'reference' => '1fc5a0f3db1d0c440a7c6b8834917888247f8f42', + ), + 'doctrine/cache' => + array ( + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '1ca8f21980e770095a31456042471a57bc4c68fb', + ), + 'doctrine/dbal' => + array ( + 'pretty_version' => '2.13.9', + 'version' => '2.13.9.0', + 'aliases' => + array ( + ), + 'reference' => 'c480849ca3ad6706a39c970cdfe6888fa8a058b8', + ), + 'doctrine/deprecations' => + array ( + 'pretty_version' => 'v1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de', + ), + 'doctrine/event-manager' => + array ( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '95aa4cb529f1e96576f3fda9f5705ada4056a520', + ), + 'doctrine/inflector' => + array ( + 'pretty_version' => '2.0.6', + 'version' => '2.0.6.0', + 'aliases' => + array ( + ), + 'reference' => 'd9d313a36c872fd6ee06d9a6cbcf713eaa40f024', + ), + 'doctrine/instantiator' => + array ( + 'pretty_version' => '1.5.0', + 'version' => '1.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '0a0fa9780f5d4e507415a065172d26a98d02047b', + ), + 'doctrine/lexer' => + array ( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'aliases' => + array ( + ), + 'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229', + ), + 'dragonmantank/cron-expression' => + array ( + 'pretty_version' => 'v2.3.1', + 'version' => '2.3.1.0', + 'aliases' => + array ( + ), + 'reference' => '65b2d8ee1f10915efb3b55597da3404f096acba2', + ), + 'egulias/email-validator' => + array ( + 'pretty_version' => '2.1.25', + 'version' => '2.1.25.0', + 'aliases' => + array ( + ), + 'reference' => '0dbf5d78455d4d6a41d186da50adc1122ec066f4', + ), + 'erusev/parsedown' => + array ( + 'pretty_version' => '1.7.4', + 'version' => '1.7.4.0', + 'aliases' => + array ( + ), + 'reference' => 'cb17b6477dfff935958ba01325f2e8a2bfa6dab3', + ), + 'erusev/parsedown-extra' => + array ( + 'pretty_version' => '0.8.1', + 'version' => '0.8.1.0', + 'aliases' => + array ( + ), + 'reference' => '91ac3ff98f0cea243bdccc688df43810f044dcef', + ), + 'fzaninotto/faker' => + array ( + 'pretty_version' => 'v1.9.2', + 'version' => '1.9.2.0', + 'aliases' => + array ( + ), + 'reference' => '848d8125239d7dbf8ab25cb7f054f1a630e68c2e', + ), + 'grogy/php-parallel-lint' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'guzzlehttp/guzzle' => + array ( + 'pretty_version' => '7.5.0', + 'version' => '7.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba', + ), + 'guzzlehttp/promises' => + array ( + 'pretty_version' => '1.5.2', + 'version' => '1.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'b94b2807d85443f9719887892882d0329d1e2598', + ), + 'guzzlehttp/psr7' => + array ( + 'pretty_version' => '2.4.3', + 'version' => '2.4.3.0', + 'aliases' => + array ( + ), + 'reference' => '67c26b443f348a51926030c83481b85718457d3d', + ), + 'hamcrest/hamcrest-php' => + array ( + 'pretty_version' => 'v2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '8c3d0a3f6af734494ad8f6fbbee0ba92422859f3', + ), + 'http-interop/http-factory-guzzle' => + array ( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '8f06e92b95405216b237521cc64c804dd44c4a81', + ), + 'illuminate/auth' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/broadcasting' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/bus' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cache' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/config' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/console' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/container' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/contracts' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cookie' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/database' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/encryption' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/events' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/filesystem' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/hashing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/http' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/log' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/mail' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/notifications' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pagination' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pipeline' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/queue' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/redis' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/routing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/session' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/support' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/translation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/validation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/view' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'jakub-onderka/php-parallel-lint' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'kodova/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'laravel/framework' => + array ( + 'pretty_version' => 'v6.20.44', + 'version' => '6.20.44.0', + 'aliases' => + array ( + ), + 'reference' => '505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0', + ), + 'laravel/scout' => + array ( + 'pretty_version' => 'v8.6.1', + 'version' => '8.6.1.0', + 'aliases' => + array ( + ), + 'reference' => '7fb1c860a2fd904f0e084a7cc3641eb1448ba278', + ), + 'laravel/tinker' => + array ( + 'pretty_version' => 'v2.8.0', + 'version' => '2.8.0.0', + 'aliases' => + array ( + ), + 'reference' => '74d0b287cc4ae65d15c368dd697aae71d62a73ad', + ), + 'league/commonmark' => + array ( + 'pretty_version' => '1.6.7', + 'version' => '1.6.7.0', + 'aliases' => + array ( + ), + 'reference' => '2b8185c13bc9578367a5bf901881d1c1b5bbd09b', + ), + 'league/csv' => + array ( + 'pretty_version' => '9.8.0', + 'version' => '9.8.0.0', + 'aliases' => + array ( + ), + 'reference' => '9d2e0265c5d90f5dd601bc65ff717e05cec19b47', + ), + 'league/flysystem' => + array ( + 'pretty_version' => '1.1.10', + 'version' => '1.1.10.0', + 'aliases' => + array ( + ), + 'reference' => '3239285c825c152bcc315fe0e87d6b55f5972ed1', + ), + 'league/mime-type-detection' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ff6248ea87a9f116e78edd6002e39e5128a0d4dd', + ), + 'linkorb/jsmin-php' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'be85d87fc9c27730e7e9ced742b13010dafc1026', + ), + 'meilisearch/meilisearch-laravel-scout' => + array ( + 'pretty_version' => 'v0.12.5', + 'version' => '0.12.5.0', + 'aliases' => + array ( + ), + 'reference' => 'e180d66163c79248f48bb15d0ea3081b073c9593', + ), + 'meilisearch/meilisearch-php' => + array ( + 'pretty_version' => 'v0.17.2', + 'version' => '0.17.2.0', + 'aliases' => + array ( + ), + 'reference' => 'a200a32093ae44c04523f6fd014ec888707ceb9e', + ), + 'meyfa/phpunit-assert-gd' => + array ( + 'pretty_version' => 'v2.1.0', + 'version' => '2.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '9e39d550616d61d522ef935f1db1cd2e368ac0f0', + ), + 'mockery/mockery' => + array ( + 'pretty_version' => '1.5.1', + 'version' => '1.5.1.0', + 'aliases' => + array ( + ), + 'reference' => 'e92dcc83d5a51851baf5f5591d32cb2b16e3684e', + ), + 'monolog/monolog' => + array ( + 'pretty_version' => '2.9.1', + 'version' => '2.9.1.0', + 'aliases' => + array ( + ), + 'reference' => 'f259e2b15fb95494c83f52d3caad003bbf5ffaa1', + ), + 'myclabs/deep-copy' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614', + ), + 'nesbot/carbon' => + array ( + 'pretty_version' => '2.66.0', + 'version' => '2.66.0.0', + 'aliases' => + array ( + ), + 'reference' => '496712849902241f04902033b0441b269effe001', + ), + 'nikic/php-parser' => + array ( + 'pretty_version' => 'v4.15.3', + 'version' => '4.15.3.0', + 'aliases' => + array ( + ), + 'reference' => '570e980a201d8ed0236b0a62ddf2c9cbb2034039', + ), + 'october/backend' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => '6c539bebcd189b5c5f7a919faad9d06985499f3b', + ), + 'october/cms' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => '7ca98fc2205710fe235f588ce094b0b13105636a', + ), + 'october/october' => + array ( + 'pretty_version' => '1.1.x-dev', + 'version' => '1.1.9999999.9999999-dev', + 'aliases' => + array ( + ), + 'reference' => 'c51149dba60398ac92d58c33b81c1cfe57a81513', + ), + 'october/rain' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => 'd8388eadcc6cbbc302468400a58aea71aa92115c', + ), + 'october/system' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => 'cffaaaf12075302089995fd795677a16bef94787', + ), + 'opis/closure' => + array ( + 'pretty_version' => '3.6.3', + 'version' => '3.6.3.0', + 'aliases' => + array ( + ), + 'reference' => '3d81e4309d2a927abbe66df935f4bb60082805ad', + ), + 'paragonie/random_compat' => + array ( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'aliases' => + array ( + ), + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + ), + 'phar-io/manifest' => + array ( + 'pretty_version' => '2.0.3', + 'version' => '2.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', + ), + 'phar-io/version' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + ), + 'php-http/async-client-implementation' => + array ( + 'provided' => + array ( + 0 => '*', + 1 => '1.0', + ), + ), + 'php-http/client-common' => + array ( + 'pretty_version' => '2.6.0', + 'version' => '2.6.0.0', + 'aliases' => + array ( + ), + 'reference' => '45db684cd4e186dcdc2b9c06b22970fe123796c0', + ), + 'php-http/client-implementation' => + array ( + 'provided' => + array ( + 0 => '*', + 1 => '1.0', + ), + ), + 'php-http/discovery' => + array ( + 'pretty_version' => '1.15.2', + 'version' => '1.15.2.0', + 'aliases' => + array ( + ), + 'reference' => '5cc428320191ac1d0b6520034c2dc0698628ced5', + ), + 'php-http/guzzle7-adapter' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fb075a71dbfa4847cf0c2938c4e5a9c478ef8b01', + ), + 'php-http/httplug' => + array ( + 'pretty_version' => '2.3.0', + 'version' => '2.3.0.0', + 'aliases' => + array ( + ), + 'reference' => 'f640739f80dfa1152533976e3c112477f69274eb', + ), + 'php-http/message' => + array ( + 'pretty_version' => '1.13.0', + 'version' => '1.13.0.0', + 'aliases' => + array ( + ), + 'reference' => '7886e647a30a966a1a8d1dad1845b71ca8678361', + ), + 'php-http/message-factory' => + array ( + 'pretty_version' => 'v1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1', + ), + 'php-http/message-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'php-http/promise' => + array ( + 'pretty_version' => '1.1.0', + 'version' => '1.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '4c4c1f9b7289a2ec57cde7f1e9762a5789506f88', + ), + 'php-parallel-lint/php-parallel-lint' => + array ( + 'pretty_version' => 'v1.3.2', + 'version' => '1.3.2.0', + 'aliases' => + array ( + ), + 'reference' => '6483c9832e71973ed29cf71bd6b3f4fde438a9de', + ), + 'phpoption/phpoption' => + array ( + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', + 'aliases' => + array ( + ), + 'reference' => 'dc5ff11e274a90cc1c743f66c9ad700ce50db9ab', + ), + 'phpunit/php-code-coverage' => + array ( + 'pretty_version' => '7.0.15', + 'version' => '7.0.15.0', + 'aliases' => + array ( + ), + 'reference' => '819f92bba8b001d4363065928088de22f25a3a48', + ), + 'phpunit/php-file-iterator' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5', + ), + 'phpunit/php-text-template' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686', + ), + 'phpunit/php-timer' => + array ( + 'pretty_version' => '2.1.3', + 'version' => '2.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '2454ae1765516d20c4ffe103d85a58a9a3bd5662', + ), + 'phpunit/php-token-stream' => + array ( + 'pretty_version' => '4.0.4', + 'version' => '4.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'a853a0e183b9db7eed023d7933a858fa1c8d25a3', + ), + 'phpunit/phpunit' => + array ( + 'pretty_version' => '8.5.32', + 'version' => '8.5.32.0', + 'aliases' => + array ( + ), + 'reference' => '375686930d05c9fd7d20f6e5fc38121e8d7a9d55', + ), + 'psr/container' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea', + ), + 'psr/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-client' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + ), + 'psr/http-client-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '*', + ), + ), + 'psr/http-factory' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + ), + 'psr/http-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '^1.0', + 2 => '*', + ), + ), + 'psr/http-message' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', + ), + 'psr/http-message-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '*', + ), + ), + 'psr/log' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', + ), + 'psr/log-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0.0 || 2.0.0 || 3.0.0', + 1 => '1.0|2.0', + ), + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'psy/psysh' => + array ( + 'pretty_version' => 'v0.11.12', + 'version' => '0.11.12.0', + 'aliases' => + array ( + ), + 'reference' => '52cb7c47d403c31c0adc9bf7710fc355f93c20f7', + ), + 'ralouphie/getallheaders' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + ), + 'ramsey/uuid' => + array ( + 'pretty_version' => '3.9.7', + 'version' => '3.9.7.0', + 'aliases' => + array ( + ), + 'reference' => 'dc75aa439eb4c1b77f5379fd958b3dc0e6014178', + ), + 'rhumsaa/uuid' => + array ( + 'replaced' => + array ( + 0 => '3.9.7', + ), + ), + 'roundcube/plugin-installer' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'scssphp/scssphp' => + array ( + 'pretty_version' => 'v1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '33749d12c2569bb24071f94e9af828662dabb068', + ), + 'sebastian/code-unit-reverse-lookup' => + array ( + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', + ), + 'sebastian/comparator' => + array ( + 'pretty_version' => '3.0.5', + 'version' => '3.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '1dc7ceb4a24aede938c7af2a9ed1de09609ca770', + ), + 'sebastian/diff' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '14f72dd46eaf2f2293cbe79c93cc0bc43161a211', + ), + 'sebastian/environment' => + array ( + 'pretty_version' => '4.2.4', + 'version' => '4.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd47bbbad83711771f167c72d4e3f25f7fcc1f8b0', + ), + 'sebastian/exporter' => + array ( + 'pretty_version' => '3.1.5', + 'version' => '3.1.5.0', + 'aliases' => + array ( + ), + 'reference' => '73a9676f2833b9a7c36968f9d882589cd75511e6', + ), + 'sebastian/global-state' => + array ( + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'de036ec91d55d2a9e0db2ba975b512cdb1c23921', + ), + 'sebastian/object-enumerator' => + array ( + 'pretty_version' => '3.0.4', + 'version' => '3.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2', + ), + 'sebastian/object-reflector' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '9b8772b9cbd456ab45d4a598d2dd1a1bced6363d', + ), + 'sebastian/recursion-context' => + array ( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '367dcba38d6e1977be014dc4b22f47a484dac7fb', + ), + 'sebastian/resource-operations' => + array ( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '31d35ca87926450c44eae7e2611d45a7a65ea8b3', + ), + 'sebastian/type' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0150cfbc4495ed2df3872fb31b26781e4e077eb4', + ), + 'sebastian/version' => + array ( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019', + ), + 'shama/baton' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'squizlabs/php_codesniffer' => + array ( + 'pretty_version' => '3.7.1', + 'version' => '3.7.1.0', + 'aliases' => + array ( + ), + 'reference' => '1359e176e9307e906dc3d890bcc9603ff6d90619', + ), + 'swiftmailer/swiftmailer' => + array ( + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', + ), + 'symfony/console' => + array ( + 'pretty_version' => 'v4.4.49', + 'version' => '4.4.49.0', + 'aliases' => + array ( + ), + 'reference' => '33fa45ffc81fdcc1ca368d4946da859c8cdb58d9', + ), + 'symfony/css-selector' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'f4a7d150f5b9e8f974f6f127d8167e420d11fc62', + ), + 'symfony/debug' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '1a692492190773c5310bc7877cb590c04c2f05be', + ), + 'symfony/deprecation-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66', + ), + 'symfony/error-handler' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => 'be731658121ef2d8be88f3a1ec938148a9237291', + ), + 'symfony/event-dispatcher' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '1e866e9e5c1b22168e0ce5f0b467f19bba61266a', + ), + 'symfony/event-dispatcher-contracts' => + array ( + 'pretty_version' => 'v1.1.13', + 'version' => '1.1.13.0', + 'aliases' => + array ( + ), + 'reference' => '1d5cd762abaa6b2a4169d3e77610193a7157129e', + ), + 'symfony/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.1', + ), + ), + 'symfony/finder' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '66bd787edb5e42ff59d3523f623895af05043e4f', + ), + 'symfony/http-client-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70', + ), + 'symfony/http-foundation' => + array ( + 'pretty_version' => 'v4.4.49', + 'version' => '4.4.49.0', + 'aliases' => + array ( + ), + 'reference' => '191413c7b832c015bb38eae963f2e57498c3c173', + ), + 'symfony/http-kernel' => + array ( + 'pretty_version' => 'v4.4.50', + 'version' => '4.4.50.0', + 'aliases' => + array ( + ), + 'reference' => 'aa6df6c045f034aa13ac752fc234bb300b9488ef', + ), + 'symfony/mime' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'a858429a9c704edc53fe057228cf9ca282ba48eb', + ), + 'symfony/options-resolver' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'b03c99236445492f20c61666e8f7e5d388b078e5', + ), + 'symfony/polyfill-ctype' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a', + ), + 'symfony/polyfill-iconv' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '927013f3aac555983a5059aada98e1907d842695', + ), + 'symfony/polyfill-intl-idn' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '639084e360537a19f9ee352433b84ce831f3d2da', + ), + 'symfony/polyfill-intl-normalizer' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '19bd1e4fcd5b91116f14d8533c57831ed00571b6', + ), + 'symfony/polyfill-mbstring' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534', + ), + 'symfony/polyfill-php72' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '869329b1e9894268a8a61dabb69153029b7a8c97', + ), + 'symfony/polyfill-php73' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9', + ), + 'symfony/polyfill-php80' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', + ), + 'symfony/process' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '5cee9cdc4f7805e2699d9fd66991a0e6df8252a2', + ), + 'symfony/routing' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => 'f7751fd8b60a07f3f349947a309b5bdfce22d6ae', + ), + 'symfony/service-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c', + ), + 'symfony/translation' => + array ( + 'pretty_version' => 'v4.4.47', + 'version' => '4.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '45036b1d53accc48fe9bab71ccd86d57eba0dd94', + ), + 'symfony/translation-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe', + ), + 'symfony/translation-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0|2.0', + ), + ), + 'symfony/var-dumper' => + array ( + 'pretty_version' => 'v4.4.47', + 'version' => '4.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '1069c7a3fca74578022fab6f81643248d02f8e63', + ), + 'symfony/yaml' => + array ( + 'pretty_version' => 'v3.4.47', + 'version' => '3.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '88289caa3c166321883f67fe5130188ebbb47094', + ), + 'theseer/tokenizer' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', + ), + 'tijsverkoyen/css-to-inline-styles' => + array ( + 'pretty_version' => '2.2.6', + 'version' => '2.2.6.0', + 'aliases' => + array ( + ), + 'reference' => 'c42125b83a4fa63b187fdf29f9c93cb7733da30c', + ), + 'twig/twig' => + array ( + 'pretty_version' => 'v2.15.4', + 'version' => '2.15.4.0', + 'aliases' => + array ( + ), + 'reference' => '3e059001d6d597dd50ea7c74dd2464b4adea48d3', + ), + 'vlucas/phpdotenv' => + array ( + 'pretty_version' => 'v3.6.10', + 'version' => '3.6.10.0', + 'aliases' => + array ( + ), + 'reference' => '5b547cdb25825f10251370f57ba5d9d924e6f68e', + ), + 'wikimedia/composer-merge-plugin' => + array ( + 'pretty_version' => 'dev-feature/composer-v2', + 'version' => 'dev-feature/composer-v2', + 'aliases' => + array ( + 0 => '1.5.0', + ), + 'reference' => 'a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6', + ), + 'wikimedia/less.php' => + array ( + 'pretty_version' => 'v3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '0d5b30ba792bdbf8991a646fc9c30561b38a5559', + ), + ), +); +private static $canGetVendors; +private static $installedByVendor = array(); + + + + + + + +public static function getInstalledPackages() +{ +$packages = array(); +foreach (self::getInstalled() as $installed) { +$packages[] = array_keys($installed['versions']); +} + +if (1 === \count($packages)) { +return $packages[0]; +} + +return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); +} + + + + + + + + + +public static function isInstalled($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; +} + + + + + + + + + + + + + + +public static function satisfies(VersionParser $parser, $packageName, $constraint) +{ +$constraint = $parser->parseConstraints($constraint); +$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + +return $provided->matches($constraint); +} + + + + + + + + + + +public static function getVersionRanges($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +$ranges = array(); +if (isset($installed['versions'][$packageName]['pretty_version'])) { +$ranges[] = $installed['versions'][$packageName]['pretty_version']; +} +if (array_key_exists('aliases', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); +} +if (array_key_exists('replaced', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); +} +if (array_key_exists('provided', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); +} + +return implode(' || ', $ranges); +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['version'])) { +return null; +} + +return $installed['versions'][$packageName]['version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getPrettyVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['pretty_version'])) { +return null; +} + +return $installed['versions'][$packageName]['pretty_version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getReference($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['reference'])) { +return null; +} + +return $installed['versions'][$packageName]['reference']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getRootPackage() +{ +$installed = self::getInstalled(); + +return $installed[0]['root']; +} + + + + + + + +public static function getRawData() +{ +return self::$installed; +} + + + + + + + + + + + + + + + + + + + +public static function reload($data) +{ +self::$installed = $data; +self::$installedByVendor = array(); +} + + + + + +private static function getInstalled() +{ +if (null === self::$canGetVendors) { +self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); +} + +$installed = array(); + +if (self::$canGetVendors) { +foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { +if (isset(self::$installedByVendor[$vendorDir])) { +$installed[] = self::$installedByVendor[$vendorDir]; +} elseif (is_file($vendorDir.'/composer/installed.php')) { +$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; +} +} +} + +$installed[] = self::$installed; + +return $installed; +} +} diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index be4d35606..58c342c39 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Hamcrest\\Arrays\\IsArray' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', 'Hamcrest\\Arrays\\IsArrayContaining' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', @@ -333,180 +334,183 @@ return array( 'PHPUnit\\Util\\Xml' => $vendorDir . '/phpunit/phpunit/src/Util/Xml.php', 'PHPUnit\\Util\\XmlTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', 'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COALESCE_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream.php', - 'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', - 'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_USE_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Util' => $vendorDir . '/phpunit/php-token-stream/src/Token/Util.php', - 'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/TokenWithScope.php', + 'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php', + 'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Abstract.php', + 'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Ampersand.php', + 'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/AndEqual.php', + 'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Array.php', + 'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/ArrayCast.php', + 'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/As.php', + 'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/At.php', + 'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Backtick.php', + 'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/BadCharacter.php', + 'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/BooleanAnd.php', + 'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/BooleanOr.php', + 'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/BoolCast.php', + 'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/break.php', + 'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Callable.php', + 'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Caret.php', + 'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Case.php', + 'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Catch.php', + 'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Character.php', + 'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Class.php', + 'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/ClassC.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/ClassNameConstant.php', + 'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Clone.php', + 'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/CloseBracket.php', + 'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/CloseCurly.php', + 'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/CloseSquare.php', + 'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/CloseTag.php', + 'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Coalesce.php', + 'PHP_Token_COALESCE_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/CoalesceEqual.php', + 'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Colon.php', + 'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Comma.php', + 'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Comment.php', + 'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/ConcatEqual.php', + 'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Const.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/ConstantEncapsedString.php', + 'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Continue.php', + 'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/CurlyOpen.php', + 'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Dec.php', + 'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Declare.php', + 'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Default.php', + 'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Dir.php', + 'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Div.php', + 'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/DivEqual.php', + 'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/DNumber.php', + 'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Do.php', + 'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/DocComment.php', + 'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Dollar.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php', + 'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Dot.php', + 'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/DoubleArrow.php', + 'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/DoubleCast.php', + 'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/DoubleColon.php', + 'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/DoubleQuotes.php', + 'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Echo.php', + 'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Ellipsis.php', + 'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Else.php', + 'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Elseif.php', + 'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Empty.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/EncapsedAndWhitespace.php', + 'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Enddeclare.php', + 'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Endfor.php', + 'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Endforeach.php', + 'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Endif.php', + 'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Endswitch.php', + 'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Endwhile.php', + 'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/EndHeredoc.php', + 'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Equal.php', + 'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Eval.php', + 'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/ExclamationMark.php', + 'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Exit.php', + 'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Extends.php', + 'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/File.php', + 'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Final.php', + 'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Finally.php', + 'PHP_Token_FN' => $vendorDir . '/phpunit/php-token-stream/src/Fn.php', + 'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/For.php', + 'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Foreach.php', + 'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Function.php', + 'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/FuncC.php', + 'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Global.php', + 'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Goto.php', + 'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Gt.php', + 'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/HaltCompiler.php', + 'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/If.php', + 'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Implements.php', + 'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Inc.php', + 'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Include.php', + 'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/IncludeOnce.php', + 'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/InlineHtml.php', + 'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Instanceof.php', + 'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Insteadof.php', + 'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Interface.php', + 'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/IntCast.php', + 'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Isset.php', + 'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsEqual.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsGreaterOrEqual.php', + 'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/IsIdentical.php', + 'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsNotEqual.php', + 'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/IsNotIdentical.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/IsSmallerOrEqual.php', + 'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Includes.php', + 'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Line.php', + 'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/List.php', + 'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Lnumber.php', + 'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/LogicalAnd.php', + 'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/LogicalOr.php', + 'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/LogicalXor.php', + 'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Lt.php', + 'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/MethodC.php', + 'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Minus.php', + 'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/MinusEqual.php', + 'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/ModEqual.php', + 'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Mult.php', + 'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/MulEqual.php', + 'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Namespace.php', + 'PHP_Token_NAME_FULLY_QUALIFIED' => $vendorDir . '/phpunit/php-token-stream/src/NameFullyQualified.php', + 'PHP_Token_NAME_QUALIFIED' => $vendorDir . '/phpunit/php-token-stream/src/NameQualified.php', + 'PHP_Token_NAME_RELATIVE' => $vendorDir . '/phpunit/php-token-stream/src/NameRelative.php', + 'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/New.php', + 'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/NsC.php', + 'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/NsSeparator.php', + 'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/NumString.php', + 'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/ObjectCast.php', + 'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/ObjectOperator.php', + 'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/OpenBracket.php', + 'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/OpenCurly.php', + 'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/OpenSquare.php', + 'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/OpenTag.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/OpenTagWithEcho.php', + 'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/OrEqual.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/PaamayimNekudotayim.php', + 'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Percent.php', + 'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Pipe.php', + 'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Plus.php', + 'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/PlusEqual.php', + 'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Pow.php', + 'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/PowEqual.php', + 'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Print.php', + 'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Private.php', + 'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Protected.php', + 'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Public.php', + 'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/QuestionMark.php', + 'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Require.php', + 'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/RequireOnce.php', + 'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Return.php', + 'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Semicolon.php', + 'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Sl.php', + 'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/SlEqual.php', + 'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Spaceship.php', + 'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Sr.php', + 'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/SrEqual.php', + 'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/StartHeredoc.php', + 'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Static.php', + 'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/String.php', + 'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/StringCast.php', + 'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/StringVarname.php', + 'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Switch.php', + 'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Stream.php', + 'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/CachingFactory.php', + 'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Throw.php', + 'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Tilde.php', + 'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Trait.php', + 'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/TraitC.php', + 'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Try.php', + 'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Unset.php', + 'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/UnsetCast.php', + 'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Use.php', + 'PHP_Token_USE_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/UseFunction.php', + 'PHP_Token_Util' => $vendorDir . '/phpunit/php-token-stream/src/Util.php', + 'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Var.php', + 'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Variable.php', + 'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/While.php', + 'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Whitespace.php', + 'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/XorEqual.php', + 'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Yield.php', + 'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/YieldFrom.php', 'PharIo\\Manifest\\Application' => $vendorDir . '/phar-io/manifest/src/values/Application.php', 'PharIo\\Manifest\\ApplicationName' => $vendorDir . '/phar-io/manifest/src/values/ApplicationName.php', 'PharIo\\Manifest\\Author' => $vendorDir . '/phar-io/manifest/src/values/Author.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index f3742a622..755d26e0a 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -9,13 +9,19 @@ return array( 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', + '9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php', + '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php', '538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php', '801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index a119a8207..91b24ba61 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -27,6 +27,7 @@ return array( 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), + 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), 'Symfony\\Component\\Mime\\' => array($vendorDir . '/symfony/mime'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), @@ -41,6 +42,8 @@ return array( 'Psy\\' => array($vendorDir . '/psy/psysh/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), + 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), 'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'), @@ -48,11 +51,25 @@ return array( 'October\\Rain\\' => array($vendorDir . '/october/rain/src'), 'October\\Demo\\' => array($baseDir . '/plugins/october/demo'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), + 'Meilisearch\\Scout\\' => array($vendorDir . '/meilisearch/meilisearch-laravel-scout/src'), + 'MeiliSearch\\' => array($vendorDir . '/meilisearch/meilisearch-php/src'), + 'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'), 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), 'League\\Csv\\' => array($vendorDir . '/league/csv/src'), 'League\\CommonMark\\' => array($vendorDir . '/league/commonmark/src'), 'Laravel\\Tinker\\' => array($vendorDir . '/laravel/tinker/src'), + 'Laravel\\Scout\\' => array($vendorDir . '/laravel/scout/src'), 'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'), + 'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'), + 'Http\\Message\\' => array($vendorDir . '/php-http/message/src', $vendorDir . '/php-http/message-factory/src'), + 'Http\\Factory\\Guzzle\\' => array($vendorDir . '/http-interop/http-factory-guzzle/src'), + 'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'), + 'Http\\Client\\Common\\' => array($vendorDir . '/php-http/client-common/src'), + 'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'), + 'Http\\Adapter\\Guzzle7\\' => array($vendorDir . '/php-http/guzzle7-adapter/src'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), + 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'), 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/src'), 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), @@ -68,6 +85,7 @@ return array( 'Cron\\' => array($vendorDir . '/dragonmantank/cron-expression/src/Cron'), 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'), 'Cms\\' => array($baseDir . '/modules/cms'), + 'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'), 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), 'Backend\\' => array($baseDir . '/modules/backend'), 'AssertGD\\' => array($vendorDir . '/meyfa/phpunit-assert-gd/src'), diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 4220bbbc4..da316fdd2 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -22,13 +22,15 @@ class ComposerAutoloaderInitce290a037d2cbd6fc6b8d537449d0ac2 return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInitce290a037d2cbd6fc6b8d537449d0ac2', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInitce290a037d2cbd6fc6b8d537449d0ac2', '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'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2::getInitializer($loader)); } else { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index eb68967c8..50c2b159b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -10,13 +10,19 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', + '9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php', + '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php', '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php', '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', @@ -59,6 +65,7 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\Routing\\' => 26, 'Symfony\\Component\\Process\\' => 26, + 'Symfony\\Component\\OptionsResolver\\' => 34, 'Symfony\\Component\\Mime\\' => 23, 'Symfony\\Component\\HttpKernel\\' => 29, 'Symfony\\Component\\HttpFoundation\\' => 33, @@ -79,6 +86,8 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'Psy\\' => 4, 'Psr\\SimpleCache\\' => 16, 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Http\\Client\\' => 16, 'Psr\\Container\\' => 14, 'PhpParser\\' => 10, 'PhpOption\\' => 10, @@ -92,18 +101,38 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'M' => array ( 'Monolog\\' => 8, + 'Meilisearch\\Scout\\' => 18, + 'MeiliSearch\\' => 12, ), 'L' => array ( + 'League\\MimeTypeDetection\\' => 25, 'League\\Flysystem\\' => 17, 'League\\Csv\\' => 11, 'League\\CommonMark\\' => 18, 'Laravel\\Tinker\\' => 15, + 'Laravel\\Scout\\' => 14, ), 'I' => array ( 'Illuminate\\' => 11, ), + 'H' => + array ( + 'Http\\Promise\\' => 13, + 'Http\\Message\\' => 13, + 'Http\\Factory\\Guzzle\\' => 20, + 'Http\\Discovery\\' => 15, + 'Http\\Client\\Common\\' => 19, + 'Http\\Client\\' => 12, + 'Http\\Adapter\\Guzzle7\\' => 21, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, + 'GuzzleHttp\\' => 11, + ), 'F' => array ( 'Faker\\' => 6, @@ -130,6 +159,7 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'Cron\\' => 5, 'Composer\\Installers\\' => 20, 'Cms\\' => 4, + 'Clue\\StreamFilter\\' => 18, 'Carbon\\' => 7, ), 'B' => @@ -227,6 +257,10 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 array ( 0 => __DIR__ . '/..' . '/symfony/process', ), + 'Symfony\\Component\\OptionsResolver\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/options-resolver', + ), 'Symfony\\Component\\Mime\\' => array ( 0 => __DIR__ . '/..' . '/symfony/mime', @@ -283,6 +317,15 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-client/src', + ), 'Psr\\Container\\' => array ( 0 => __DIR__ . '/..' . '/psr/container/src', @@ -311,6 +354,18 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 array ( 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', ), + 'Meilisearch\\Scout\\' => + array ( + 0 => __DIR__ . '/..' . '/meilisearch/meilisearch-laravel-scout/src', + ), + 'MeiliSearch\\' => + array ( + 0 => __DIR__ . '/..' . '/meilisearch/meilisearch-php/src', + ), + 'League\\MimeTypeDetection\\' => + array ( + 0 => __DIR__ . '/..' . '/league/mime-type-detection/src', + ), 'League\\Flysystem\\' => array ( 0 => __DIR__ . '/..' . '/league/flysystem/src', @@ -327,10 +382,55 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 array ( 0 => __DIR__ . '/..' . '/laravel/tinker/src', ), + 'Laravel\\Scout\\' => + array ( + 0 => __DIR__ . '/..' . '/laravel/scout/src', + ), 'Illuminate\\' => array ( 0 => __DIR__ . '/..' . '/laravel/framework/src/Illuminate', ), + 'Http\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/promise/src', + ), + 'Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/message/src', + 1 => __DIR__ . '/..' . '/php-http/message-factory/src', + ), + 'Http\\Factory\\Guzzle\\' => + array ( + 0 => __DIR__ . '/..' . '/http-interop/http-factory-guzzle/src', + ), + 'Http\\Discovery\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/discovery/src', + ), + 'Http\\Client\\Common\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/client-common/src', + ), + 'Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/httplug/src', + ), + 'Http\\Adapter\\Guzzle7\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/guzzle7-adapter/src', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', + ), + 'GuzzleHttp\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', + ), 'Faker\\' => array ( 0 => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker', @@ -391,6 +491,10 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 array ( 0 => __DIR__ . '/../..' . '/modules/cms', ), + 'Clue\\StreamFilter\\' => + array ( + 0 => __DIR__ . '/..' . '/clue/stream-filter/src', + ), 'Carbon\\' => array ( 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', @@ -442,6 +546,7 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 public static $classMap = array ( 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Hamcrest\\Arrays\\IsArray' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', 'Hamcrest\\Arrays\\IsArrayContaining' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', @@ -768,180 +873,183 @@ class ComposerStaticInitce290a037d2cbd6fc6b8d537449d0ac2 'PHPUnit\\Util\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml.php', 'PHPUnit\\Util\\XmlTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', 'PHP_Token' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_TokenWithScope' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_TokenWithScopeAndVisibility' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ABSTRACT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AMPERSAND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AND_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ARRAY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ARRAY_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_AT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BACKTICK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BAD_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOLEAN_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOLEAN_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BOOL_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_BREAK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CALLABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CARET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CASE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CATCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLASS_NAME_CONSTANT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLONE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CLOSE_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COALESCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COALESCE_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COMMA' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONCAT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONSTANT_ENCAPSED_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CONTINUE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_CURLY_OPEN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DEC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DEFAULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIV' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DIV_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOC_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOLLAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_DOUBLE_QUOTES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELLIPSIS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELSE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ELSEIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EMPTY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENCAPSED_AND_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDDECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDFOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDFOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDSWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ENDWHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_END_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EVAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXCLAMATION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_EXTENDS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FINAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FINALLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_FUNC_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GLOBAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GOTO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_HALT_COMPILER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IMPLEMENTS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INCLUDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INCLUDE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INLINE_HTML' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INSTANCEOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INSTEADOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INTERFACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_INT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_ISSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_GREATER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_NOT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_NOT_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_IS_SMALLER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Includes' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LINE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LIST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LOGICAL_XOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_METHOD_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MINUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MINUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MOD_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_MUL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NAMESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NEW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NS_SEPARATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_NUM_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OBJECT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OPEN_TAG_WITH_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PERCENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PIPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PLUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PLUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_POW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_POW_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PRINT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PRIVATE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PROTECTED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_PUBLIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_QUESTION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_REQUIRE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_REQUIRE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_RETURN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SEMICOLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SPACESHIP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_START_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STATIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_STRING_VARNAME' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_SWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Stream' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream.php', - 'PHP_Token_Stream_CachingFactory' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', - 'PHP_Token_THROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TILDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRAIT_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_TRY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_UNSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_UNSET_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_USE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_USE_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_Util' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Util.php', - 'PHP_Token_VAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_VARIABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_WHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_XOR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_YIELD' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', - 'PHP_Token_YIELD_FROM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TokenWithScope.php', + 'PHP_TokenWithScopeAndVisibility' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php', + 'PHP_Token_ABSTRACT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Abstract.php', + 'PHP_Token_AMPERSAND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Ampersand.php', + 'PHP_Token_AND_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/AndEqual.php', + 'PHP_Token_ARRAY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Array.php', + 'PHP_Token_ARRAY_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ArrayCast.php', + 'PHP_Token_AS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/As.php', + 'PHP_Token_AT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/At.php', + 'PHP_Token_BACKTICK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Backtick.php', + 'PHP_Token_BAD_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BadCharacter.php', + 'PHP_Token_BOOLEAN_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BooleanAnd.php', + 'PHP_Token_BOOLEAN_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BooleanOr.php', + 'PHP_Token_BOOL_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/BoolCast.php', + 'PHP_Token_BREAK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/break.php', + 'PHP_Token_CALLABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Callable.php', + 'PHP_Token_CARET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Caret.php', + 'PHP_Token_CASE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Case.php', + 'PHP_Token_CATCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Catch.php', + 'PHP_Token_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Character.php', + 'PHP_Token_CLASS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Class.php', + 'PHP_Token_CLASS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ClassC.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ClassNameConstant.php', + 'PHP_Token_CLONE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Clone.php', + 'PHP_Token_CLOSE_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseBracket.php', + 'PHP_Token_CLOSE_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseCurly.php', + 'PHP_Token_CLOSE_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseSquare.php', + 'PHP_Token_CLOSE_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CloseTag.php', + 'PHP_Token_COALESCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Coalesce.php', + 'PHP_Token_COALESCE_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CoalesceEqual.php', + 'PHP_Token_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Colon.php', + 'PHP_Token_COMMA' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Comma.php', + 'PHP_Token_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Comment.php', + 'PHP_Token_CONCAT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ConcatEqual.php', + 'PHP_Token_CONST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Const.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ConstantEncapsedString.php', + 'PHP_Token_CONTINUE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Continue.php', + 'PHP_Token_CURLY_OPEN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CurlyOpen.php', + 'PHP_Token_DEC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dec.php', + 'PHP_Token_DECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Declare.php', + 'PHP_Token_DEFAULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Default.php', + 'PHP_Token_DIR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dir.php', + 'PHP_Token_DIV' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Div.php', + 'PHP_Token_DIV_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DivEqual.php', + 'PHP_Token_DNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DNumber.php', + 'PHP_Token_DO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Do.php', + 'PHP_Token_DOC_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DocComment.php', + 'PHP_Token_DOLLAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dollar.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php', + 'PHP_Token_DOT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Dot.php', + 'PHP_Token_DOUBLE_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleArrow.php', + 'PHP_Token_DOUBLE_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleCast.php', + 'PHP_Token_DOUBLE_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleColon.php', + 'PHP_Token_DOUBLE_QUOTES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/DoubleQuotes.php', + 'PHP_Token_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Echo.php', + 'PHP_Token_ELLIPSIS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Ellipsis.php', + 'PHP_Token_ELSE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Else.php', + 'PHP_Token_ELSEIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Elseif.php', + 'PHP_Token_EMPTY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Empty.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/EncapsedAndWhitespace.php', + 'PHP_Token_ENDDECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Enddeclare.php', + 'PHP_Token_ENDFOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endfor.php', + 'PHP_Token_ENDFOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endforeach.php', + 'PHP_Token_ENDIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endif.php', + 'PHP_Token_ENDSWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endswitch.php', + 'PHP_Token_ENDWHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Endwhile.php', + 'PHP_Token_END_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/EndHeredoc.php', + 'PHP_Token_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Equal.php', + 'PHP_Token_EVAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Eval.php', + 'PHP_Token_EXCLAMATION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ExclamationMark.php', + 'PHP_Token_EXIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Exit.php', + 'PHP_Token_EXTENDS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Extends.php', + 'PHP_Token_FILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/File.php', + 'PHP_Token_FINAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Final.php', + 'PHP_Token_FINALLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Finally.php', + 'PHP_Token_FN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Fn.php', + 'PHP_Token_FOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/For.php', + 'PHP_Token_FOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Foreach.php', + 'PHP_Token_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Function.php', + 'PHP_Token_FUNC_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/FuncC.php', + 'PHP_Token_GLOBAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Global.php', + 'PHP_Token_GOTO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Goto.php', + 'PHP_Token_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Gt.php', + 'PHP_Token_HALT_COMPILER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/HaltCompiler.php', + 'PHP_Token_IF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/If.php', + 'PHP_Token_IMPLEMENTS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Implements.php', + 'PHP_Token_INC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Inc.php', + 'PHP_Token_INCLUDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Include.php', + 'PHP_Token_INCLUDE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IncludeOnce.php', + 'PHP_Token_INLINE_HTML' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/InlineHtml.php', + 'PHP_Token_INSTANCEOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Instanceof.php', + 'PHP_Token_INSTEADOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Insteadof.php', + 'PHP_Token_INTERFACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Interface.php', + 'PHP_Token_INT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IntCast.php', + 'PHP_Token_ISSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Isset.php', + 'PHP_Token_IS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsEqual.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsGreaterOrEqual.php', + 'PHP_Token_IS_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsIdentical.php', + 'PHP_Token_IS_NOT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsNotEqual.php', + 'PHP_Token_IS_NOT_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsNotIdentical.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/IsSmallerOrEqual.php', + 'PHP_Token_Includes' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Includes.php', + 'PHP_Token_LINE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Line.php', + 'PHP_Token_LIST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/List.php', + 'PHP_Token_LNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Lnumber.php', + 'PHP_Token_LOGICAL_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalAnd.php', + 'PHP_Token_LOGICAL_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalOr.php', + 'PHP_Token_LOGICAL_XOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/LogicalXor.php', + 'PHP_Token_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Lt.php', + 'PHP_Token_METHOD_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MethodC.php', + 'PHP_Token_MINUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Minus.php', + 'PHP_Token_MINUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MinusEqual.php', + 'PHP_Token_MOD_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ModEqual.php', + 'PHP_Token_MULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Mult.php', + 'PHP_Token_MUL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/MulEqual.php', + 'PHP_Token_NAMESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Namespace.php', + 'PHP_Token_NAME_FULLY_QUALIFIED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameFullyQualified.php', + 'PHP_Token_NAME_QUALIFIED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameQualified.php', + 'PHP_Token_NAME_RELATIVE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NameRelative.php', + 'PHP_Token_NEW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/New.php', + 'PHP_Token_NS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NsC.php', + 'PHP_Token_NS_SEPARATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NsSeparator.php', + 'PHP_Token_NUM_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/NumString.php', + 'PHP_Token_OBJECT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ObjectCast.php', + 'PHP_Token_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/ObjectOperator.php', + 'PHP_Token_OPEN_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenBracket.php', + 'PHP_Token_OPEN_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenCurly.php', + 'PHP_Token_OPEN_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenSquare.php', + 'PHP_Token_OPEN_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenTag.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OpenTagWithEcho.php', + 'PHP_Token_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/OrEqual.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PaamayimNekudotayim.php', + 'PHP_Token_PERCENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Percent.php', + 'PHP_Token_PIPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Pipe.php', + 'PHP_Token_PLUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Plus.php', + 'PHP_Token_PLUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PlusEqual.php', + 'PHP_Token_POW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Pow.php', + 'PHP_Token_POW_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/PowEqual.php', + 'PHP_Token_PRINT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Print.php', + 'PHP_Token_PRIVATE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Private.php', + 'PHP_Token_PROTECTED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Protected.php', + 'PHP_Token_PUBLIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Public.php', + 'PHP_Token_QUESTION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/QuestionMark.php', + 'PHP_Token_REQUIRE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Require.php', + 'PHP_Token_REQUIRE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/RequireOnce.php', + 'PHP_Token_RETURN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Return.php', + 'PHP_Token_SEMICOLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Semicolon.php', + 'PHP_Token_SL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Sl.php', + 'PHP_Token_SL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/SlEqual.php', + 'PHP_Token_SPACESHIP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Spaceship.php', + 'PHP_Token_SR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Sr.php', + 'PHP_Token_SR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/SrEqual.php', + 'PHP_Token_START_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StartHeredoc.php', + 'PHP_Token_STATIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Static.php', + 'PHP_Token_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/String.php', + 'PHP_Token_STRING_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StringCast.php', + 'PHP_Token_STRING_VARNAME' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/StringVarname.php', + 'PHP_Token_SWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Switch.php', + 'PHP_Token_Stream' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Stream.php', + 'PHP_Token_Stream_CachingFactory' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/CachingFactory.php', + 'PHP_Token_THROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Throw.php', + 'PHP_Token_TILDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Tilde.php', + 'PHP_Token_TRAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Trait.php', + 'PHP_Token_TRAIT_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/TraitC.php', + 'PHP_Token_TRY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Try.php', + 'PHP_Token_UNSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Unset.php', + 'PHP_Token_UNSET_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/UnsetCast.php', + 'PHP_Token_USE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Use.php', + 'PHP_Token_USE_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/UseFunction.php', + 'PHP_Token_Util' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Util.php', + 'PHP_Token_VAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Var.php', + 'PHP_Token_VARIABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Variable.php', + 'PHP_Token_WHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/While.php', + 'PHP_Token_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Whitespace.php', + 'PHP_Token_XOR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/XorEqual.php', + 'PHP_Token_YIELD' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Yield.php', + 'PHP_Token_YIELD_FROM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/YieldFrom.php', 'PharIo\\Manifest\\Application' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Application.php', 'PharIo\\Manifest\\ApplicationName' => __DIR__ . '/..' . '/phar-io/manifest/src/values/ApplicationName.php', 'PharIo\\Manifest\\Author' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Author.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 73298f774..4b68f497a 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,6669 +1,8495 @@ -[ - { - "name": "composer/installers", - "version": "v1.12.0", - "version_normalized": "1.12.0.0", - "source": { - "type": "git", - "url": "https://github.com/composer/installers.git", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0" - }, - "replace": { - "roundcube/plugin-installer": "*", - "shama/baton": "*" - }, - "require-dev": { - "composer/composer": "1.6.* || ^2.0", - "composer/semver": "^1 || ^3", - "phpstan/phpstan": "^0.12.55", - "phpstan/phpstan-phpunit": "^0.12.16", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.3" - }, - "time": "2021-09-13T08:19:44+00:00", - "type": "composer-plugin", - "extra": { - "class": "Composer\\Installers\\Plugin", - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Composer\\Installers\\": "src/Composer/Installers" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kyle Robinson Young", - "email": "kyle@dontkry.com", - "homepage": "https://github.com/shama" - } - ], - "description": "A multi-framework Composer library installer", - "homepage": "https://composer.github.io/installers/", - "keywords": [ - "Craft", - "Dolibarr", - "Eliasis", - "Hurad", - "ImageCMS", - "Kanboard", - "Lan Management System", - "MODX Evo", - "MantisBT", - "Mautic", - "Maya", - "OXID", - "Plentymarkets", - "Porto", - "RadPHP", - "SMF", - "Starbug", - "Thelia", - "Whmcs", - "WolfCMS", - "agl", - "aimeos", - "annotatecms", - "attogram", - "bitrix", - "cakephp", - "chef", - "cockpit", - "codeigniter", - "concrete5", - "croogo", - "dokuwiki", - "drupal", - "eZ Platform", - "elgg", - "expressionengine", - "fuelphp", - "grav", - "installer", - "itop", - "joomla", - "known", - "kohana", - "laravel", - "lavalite", - "lithium", - "magento", - "majima", - "mako", - "mediawiki", - "miaoxing", - "modulework", - "modx", - "moodle", - "osclass", - "pantheon", - "phpbb", - "piwik", - "ppi", - "processwire", - "puppet", - "pxcms", - "reindex", - "roundcube", - "shopware", - "silverstripe", - "sydes", - "sylius", - "symfony", - "tastyigniter", - "typo3", - "wordpress", - "yawik", - "zend", - "zikula" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" +{ + "packages": [ + { + "name": "clue/stream-filter", + "version": "v1.6.0", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/clue/stream-filter.git", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e" }, - { - "url": "https://github.com/composer", - "type": "github" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e", + "shasum": "" }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ] - }, - { - "name": "dms/phpunit-arraysubset-asserts", - "version": "v0.1.1", - "version_normalized": "0.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", - "reference": "1fc5a0f3db1d0c440a7c6b8834917888247f8f42" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/1fc5a0f3db1d0c440a7c6b8834917888247f8f42", - "reference": "1fc5a0f3db1d0c440a7c6b8834917888247f8f42", - "shasum": "" - }, - "require": { - "php": "^7.2", - "phpunit/phpunit": "^8.4" - }, - "require-dev": { - "dms/coding-standard": "^1.0", - "squizlabs/php_codesniffer": "^3.4" - }, - "time": "2020-02-18T21:20:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "DMS\\PHPUnitExtensions\\ArraySubset\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Rafael Dohms", - "email": "rdohms@gmail.com" - } - ], - "description": "This package provides Array Subset and related asserts once depracated in PHPunit 8" - }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "version_normalized": "2.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "time": "2022-05-20T20:07:39+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" + "require": { + "php": ">=5.3" }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" + "time": "2022-02-21T13:15:14+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ] - }, - { - "name": "doctrine/dbal", - "version": "2.13.9", - "version_normalized": "2.13.9.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c480849ca3ad6706a39c970cdfe6888fa8a058b8", - "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8", - "shasum": "" - }, - "require": { - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.1 || ^8" - }, - "require-dev": { - "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.4.6", - "phpunit/phpunit": "^7.5.20|^8.5|9.5.16", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.2", - "symfony/cache": "^4.4", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "4.22.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "time": "2022-05-02T20:28:55+00:00", - "bin": [ - "bin/doctrine-dbal" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", - "homepage": "https://www.doctrine-project.org/projects/dbal.html", - "keywords": [ - "abstraction", - "database", - "db2", - "dbal", - "mariadb", - "mssql", - "mysql", - "oci8", - "oracle", - "pdo", - "pgsql", - "postgresql", - "queryobject", - "sasql", - "sql", - "sqlanywhere", - "sqlite", - "sqlserver", - "sqlsrv" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", - "type": "tidelift" - } - ] - }, - { - "name": "doctrine/deprecations", - "version": "v1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "time": "2022-05-02T15:47:09+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/" - }, - { - "name": "doctrine/event-manager", - "version": "1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": "<2.9" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" - }, - "time": "2022-10-12T20:51:15+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "keywords": [ - "event", - "event dispatcher", - "event manager", - "event system", - "events" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", - "type": "tidelift" - } - ] - }, - { - "name": "doctrine/inflector", - "version": "2.0.6", - "version_normalized": "2.0.6.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.3", - "phpunit/phpunit": "^8.5 || ^9.5", - "vimeo/psalm": "^4.25" - }, - "time": "2022-10-20T09:10:12+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", - "homepage": "https://www.doctrine-project.org/projects/inflector.html", - "keywords": [ - "inflection", - "inflector", - "lowercase", - "manipulation", - "php", - "plural", - "singular", - "strings", - "uppercase", - "words" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", - "type": "tidelift" - } - ] - }, - { - "name": "doctrine/instantiator", - "version": "1.4.1", - "version_normalized": "1.4.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" - }, - "time": "2022-03-03T08:28:38+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ] - }, - { - "name": "doctrine/lexer", - "version": "1.2.3", - "version_normalized": "1.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9.0", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.11" - }, - "time": "2022-02-28T11:07:21+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" - } - ] - }, - { - "name": "dragonmantank/cron-expression", - "version": "v2.3.1", - "version_normalized": "2.3.1.0", - "source": { - "type": "git", - "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", - "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", - "shasum": "" - }, - "require": { - "php": "^7.0|^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" - }, - "time": "2020-10-13T00:52:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Cron\\": "src/Cron/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Chris Tankersley", - "email": "chris@ctankersley.com", - "homepage": "https://github.com/dragonmantank" - } - ], - "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", - "keywords": [ - "cron", - "schedule" - ], - "funding": [ - { - "url": "https://github.com/dragonmantank", - "type": "github" - } - ] - }, - { - "name": "egulias/email-validator", - "version": "2.1.25", - "version_normalized": "2.1.25.0", - "source": { - "type": "git", - "url": "https://github.com/egulias/EmailValidator.git", - "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", - "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^1.0.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.10" - }, - "require-dev": { - "dominicsayers/isemail": "^3.0.7", - "phpunit/phpunit": "^4.8.36|^7.5.15", - "satooshi/php-coveralls": "^1.0.1" - }, - "suggest": { - "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" - }, - "time": "2020-12-29T14:50:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Egulias\\EmailValidator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eduardo Gulias Davis" - } - ], - "description": "A library for validating emails against several RFCs", - "homepage": "https://github.com/egulias/EmailValidator", - "keywords": [ - "email", - "emailvalidation", - "emailvalidator", - "validation", - "validator" - ], - "funding": [ - { - "url": "https://github.com/egulias", - "type": "github" - } - ] - }, - { - "name": "erusev/parsedown", - "version": "1.7.4", - "version_normalized": "1.7.4.0", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", - "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "time": "2019-12-30T22:54:17+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ] - }, - { - "name": "erusev/parsedown-extra", - "version": "0.8.1", - "version_normalized": "0.8.1.0", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown-extra.git", - "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef", - "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef", - "shasum": "" - }, - "require": { - "erusev/parsedown": "^1.7.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "time": "2019-12-30T23:20:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "ParsedownExtra": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "An extension of Parsedown that adds support for Markdown Extra.", - "homepage": "https://github.com/erusev/parsedown-extra", - "keywords": [ - "markdown", - "markdown extra", - "parsedown", - "parser" - ] - }, - { - "name": "fzaninotto/faker", - "version": "v1.9.2", - "version_normalized": "1.9.2.0", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7", - "squizlabs/php_codesniffer": "^2.9.2" - }, - "time": "2020-12-11T09:56:16+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "abandoned": true - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "version_normalized": "2.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "shasum": "" - }, - "require": { - "php": "^5.3|^7.0|^8.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" - }, - "time": "2020-07-09T08:09:16+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "hamcrest" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ] - }, - { - "name": "laravel/framework", - "version": "v6.18.43", - "version_normalized": "6.18.43.0", - "source": { - "type": "git", - "url": "https://github.com/laravel/framework.git", - "reference": "7a6043b9049a93a6388d6ab6ac50dad28600d227" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/7a6043b9049a93a6388d6ab6ac50dad28600d227", - "reference": "7a6043b9049a93a6388d6ab6ac50dad28600d227", - "shasum": "" - }, - "require": { - "doctrine/inflector": "^1.4|^2.0", - "dragonmantank/cron-expression": "^2.0", - "egulias/email-validator": "^2.1.10", - "ext-json": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "league/commonmark": "^1.3", - "league/flysystem": "^1.0.34", - "monolog/monolog": "^1.12|^2.0", - "nesbot/carbon": "^2.0", - "opis/closure": "^3.1", - "php": "^7.2", - "psr/container": "^1.0", - "psr/simple-cache": "^1.0", - "ramsey/uuid": "^3.7", - "swiftmailer/swiftmailer": "^6.0", - "symfony/console": "^4.3.4", - "symfony/debug": "^4.3.4", - "symfony/finder": "^4.3.4", - "symfony/http-foundation": "^4.3.4", - "symfony/http-kernel": "^4.3.4", - "symfony/polyfill-php73": "^1.17", - "symfony/process": "^4.3.4", - "symfony/routing": "^4.3.4", - "symfony/var-dumper": "^4.3.4", - "tijsverkoyen/css-to-inline-styles": "^2.2.1", - "vlucas/phpdotenv": "^3.3" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "replace": { - "illuminate/auth": "self.version", - "illuminate/broadcasting": "self.version", - "illuminate/bus": "self.version", - "illuminate/cache": "self.version", - "illuminate/config": "self.version", - "illuminate/console": "self.version", - "illuminate/container": "self.version", - "illuminate/contracts": "self.version", - "illuminate/cookie": "self.version", - "illuminate/database": "self.version", - "illuminate/encryption": "self.version", - "illuminate/events": "self.version", - "illuminate/filesystem": "self.version", - "illuminate/hashing": "self.version", - "illuminate/http": "self.version", - "illuminate/log": "self.version", - "illuminate/mail": "self.version", - "illuminate/notifications": "self.version", - "illuminate/pagination": "self.version", - "illuminate/pipeline": "self.version", - "illuminate/queue": "self.version", - "illuminate/redis": "self.version", - "illuminate/routing": "self.version", - "illuminate/session": "self.version", - "illuminate/support": "self.version", - "illuminate/translation": "self.version", - "illuminate/validation": "self.version", - "illuminate/view": "self.version" - }, - "require-dev": { - "aws/aws-sdk-php": "^3.0", - "doctrine/dbal": "^2.6", - "filp/whoops": "^2.4", - "guzzlehttp/guzzle": "^6.3|^7.0", - "league/flysystem-cached-adapter": "^1.0", - "mockery/mockery": "^1.3.1", - "moontoast/math": "^1.1", - "orchestra/testbench-core": "^4.0", - "pda/pheanstalk": "^4.0", - "phpunit/phpunit": "^7.5.15|^8.4|^9.0", - "predis/predis": "^1.1.1", - "symfony/cache": "^4.3.4" - }, - "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", - "ext-ftp": "Required to use the Flysystem FTP driver.", - "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", - "ext-memcached": "Required to use the memcache cache driver.", - "ext-pcntl": "Required to use all features of the queue worker.", - "ext-posix": "Required to use all features of the queue worker.", - "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", - "filp/whoops": "Required for friendly error pages in development (^2.4).", - "fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).", - "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0|^7.0).", - "laravel/tinker": "Required to use the tinker console command (^2.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", - "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", - "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", - "moontoast/math": "Required to use ordered UUIDs (^1.1).", - "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "predis/predis": "Required to use the predis connector (^1.1.2).", - "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", - "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." - }, - "time": "2020-10-13T14:20:24+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/Illuminate/Foundation/helpers.php", - "src/Illuminate/Support/helpers.php" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "psr-4": { - "Illuminate\\": "src/Illuminate/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Laravel Framework.", - "homepage": "https://laravel.com", - "keywords": [ - "framework", - "laravel" - ] - }, - { - "name": "laravel/tinker", - "version": "v2.4.2", - "version_normalized": "2.4.2.0", - "source": { - "type": "git", - "url": "https://github.com/laravel/tinker.git", - "reference": "58424c24e8aec31c3a3ac54eb3adb15e8a0a067b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/58424c24e8aec31c3a3ac54eb3adb15e8a0a067b", - "reference": "58424c24e8aec31c3a3ac54eb3adb15e8a0a067b", - "shasum": "" - }, - "require": { - "illuminate/console": "^6.0|^7.0|^8.0", - "illuminate/contracts": "^6.0|^7.0|^8.0", - "illuminate/support": "^6.0|^7.0|^8.0", - "php": "^7.2", - "psy/psysh": "^0.10.3", - "symfony/var-dumper": "^4.3|^5.0" - }, - "require-dev": { - "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^8.4|^9.0" - }, - "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0)." - }, - "time": "2020-08-11T19:28:08+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, - "laravel": { - "providers": [ - "Laravel\\Tinker\\TinkerServiceProvider" - ] - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Laravel\\Tinker\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "Powerful REPL for the Laravel framework.", - "keywords": [ - "REPL", - "Tinker", - "laravel", - "psysh" - ] - }, - { - "name": "league/commonmark", - "version": "1.6.7", - "version_normalized": "1.6.7.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/commonmark.git", - "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b", - "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "scrutinizer/ocular": "1.7.*" - }, - "require-dev": { - "cebe/markdown": "~1.0", - "commonmark/commonmark.js": "0.29.2", - "erusev/parsedown": "~1.0", - "ext-json": "*", - "github/gfm": "0.29.0", - "michelf/php-markdown": "~1.4", - "mikehaertl/php-shellcommand": "^1.4", - "phpstan/phpstan": "^0.12.90", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", - "scrutinizer/ocular": "^1.5", - "symfony/finder": "^4.2" - }, - "time": "2022-01-13T17:18:13+00:00", - "bin": [ - "bin/commonmark" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\CommonMark\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "https://www.colinodell.com", - "role": "Lead Developer" - } - ], - "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", - "homepage": "https://commonmark.thephpleague.com", - "keywords": [ - "commonmark", - "flavored", - "gfm", - "github", - "github-flavored", - "markdown", - "md", - "parser" - ], - "funding": [ - { - "url": "https://www.colinodell.com/sponsor", - "type": "custom" - }, - { - "url": "https://www.paypal.me/colinpodell/10.00", - "type": "custom" - }, - { - "url": "https://github.com/colinodell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/league/commonmark", - "type": "tidelift" - } - ] - }, - { - "name": "league/csv", - "version": "9.5.0", - "version_normalized": "9.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/csv.git", - "reference": "b348d09d0d258a4f068efb50a2510dc63101c213" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/b348d09d0d258a4f068efb50a2510dc63101c213", - "reference": "b348d09d0d258a4f068efb50a2510dc63101c213", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=7.0.10" - }, - "require-dev": { - "ext-curl": "*", - "friendsofphp/php-cs-fixer": "^2.12", - "phpstan/phpstan": "^0.9.2", - "phpstan/phpstan-phpunit": "^0.9.4", - "phpstan/phpstan-strict-rules": "^0.9.0", - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" - }, - "time": "2019-12-15T19:51:41+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions_include.php" + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } ], - "psr-4": { - "League\\Csv\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ignace Nyamagana Butera", - "email": "nyamsprod@gmail.com", - "homepage": "https://github.com/nyamsprod/", - "role": "Developer" - } - ], - "description": "Csv data manipulation made easy in PHP", - "homepage": "http://csv.thephpleague.com", - "keywords": [ - "csv", - "export", - "filter", - "import", - "read", - "write" - ] - }, - { - "name": "league/flysystem", - "version": "1.0.70", - "version_normalized": "1.0.70.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/585824702f534f8d3cf7fab7225e8466cc4b7493", - "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/phpspec": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "phpunit/phpunit": "^5.7.26" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "time": "2020-07-26T07:20:36+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "funding": [ - { - "url": "https://offset.earth/frankdejonge", - "type": "other" - } - ] - }, - { - "name": "linkorb/jsmin-php", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/linkorb/jsmin-php.git", - "reference": "be85d87fc9c27730e7e9ced742b13010dafc1026" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/linkorb/jsmin-php/zipball/be85d87fc9c27730e7e9ced742b13010dafc1026", - "reference": "be85d87fc9c27730e7e9ced742b13010dafc1026", - "shasum": "" - }, - "require": { - "php": ">=5.0.0" - }, - "time": "2013-03-15T13:16:35+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Joost Faassen", - "email": "j.faassen@linkorb.com", - "role": "Packaging for Composer" - }, - { - "name": "Ryan Grove", - "email": "ryan@wonko.com", - "role": "PHP port" - }, - { - "name": "Adam Gofort", - "email": "aag@adamgoforth.com", - "role": "Updates to the PHP port" - }, - { - "name": "Douglas Crockford", - "email": "douglas@crockford.com" - } - ], - "description": "Unofficial package of jsmin-php", - "homepage": "http://www.github.com/linkorb/jsmin-php", - "keywords": [ - "javascript", - "jsmin", - "minify" - ] - }, - { - "name": "meyfa/phpunit-assert-gd", - "version": "v2.1.0", - "version_normalized": "2.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/meyfa/phpunit-assert-gd.git", - "reference": "9e39d550616d61d522ef935f1db1cd2e368ac0f0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/meyfa/phpunit-assert-gd/zipball/9e39d550616d61d522ef935f1db1cd2e368ac0f0", - "reference": "9e39d550616d61d522ef935f1db1cd2e368ac0f0", - "shasum": "" - }, - "require": { - "ext-gd": "*", - "php": ">=7.2", - "phpunit/phpunit": "^8.0" - }, - "require-dev": { - "phpmd/phpmd": "@stable" - }, - "time": "2021-01-16T20:29:06+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "AssertGD\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabian Meyer", - "homepage": "http://meyfa.net" - } - ], - "description": "PHPUnit matcher/assertions for GD image resources", - "homepage": "https://github.com/meyfa/phpunit-assert-gd", - "keywords": [ - "assert", - "gd", - "image", - "matcher", - "phpunit", - "resource" - ] - }, - { - "name": "mockery/mockery", - "version": "1.3.6", - "version_normalized": "1.3.6.0", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/dc206df4fa314a50bbb81cf72239a305c5bbd5c0", - "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" - }, - "time": "2022-09-07T15:05:49+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ] - }, - { - "name": "monolog/monolog", - "version": "2.8.0", - "version_normalized": "2.8.0.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "720488632c590286b88b80e62aa3d3d551ad4a50" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50", - "reference": "720488632c590286b88b80e62aa3d3d551ad4a50", - "shasum": "" - }, - "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" - }, - "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7 || ^8", - "ext-json": "*", - "graylog2/gelf-php": "^1.4.2", - "guzzlehttp/guzzle": "^7.4", - "guzzlehttp/psr7": "^2.2", - "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", - "symfony/mailer": "^5.4 || ^6", - "symfony/mime": "^5.4 || ^6" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", - "ext-mbstring": "Allow to work properly with unicode symbols", - "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", - "ext-openssl": "Required to send log messages using SSL", - "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" - }, - "time": "2022-07-24T11:55:47+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "https://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" - } - ] - }, - { - "name": "myclabs/deep-copy", - "version": "1.11.0", - "version_normalized": "1.11.0.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "time": "2022-03-03T13:19:32+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" + "description": "A simple and modern approach to stream filtering in PHP", + "homepage": "https://github.com/clue/php-stream-filter", + "keywords": [ + "bucket brigade", + "callback", + "filter", + "php_user_filter", + "stream", + "stream_filter_append", + "stream_filter_register" ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ] - }, - { - "name": "nesbot/carbon", - "version": "2.64.0", - "version_normalized": "2.64.0.0", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "889546413c97de2d05063b8cb7b193c2531ea211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/889546413c97de2d05063b8cb7b193c2531ea211", - "reference": "889546413c97de2d05063b8cb7b193c2531ea211", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^7.1.8 || ^8.0", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" - }, - "require-dev": { - "doctrine/dbal": "^2.0 || ^3.1.4", - "doctrine/orm": "^2.7", - "friendsofphp/php-cs-fixer": "^3.0", - "kylekatarnls/multi-tester": "^2.0", - "ondrejmirtes/better-reflection": "*", - "phpmd/phpmd": "^2.9", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.99 || ^1.7.14", - "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", - "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", - "squizlabs/php_codesniffer": "^3.4" - }, - "time": "2022-11-26T17:36:00+00:00", - "bin": [ - "bin/carbon" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" + "support": { + "issues": "https://github.com/clue/stream-filter/issues", + "source": "https://github.com/clue/stream-filter/tree/v1.6.0" }, - "laravel": { - "providers": [ - "Carbon\\Laravel\\ServiceProvider" + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "install-path": "../clue/stream-filter" + }, + { + "name": "composer/installers", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.6.* || ^2.0", + "composer/semver": "^1 || ^3", + "phpstan/phpstan": "^0.12.55", + "phpstan/phpstan-phpunit": "^0.12.16", + "symfony/phpunit-bridge": "^4.2 || ^5", + "symfony/process": "^2.3" + }, + "time": "2021-09-13T08:19:44+00:00", + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "https://composer.github.io/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Eliasis", + "Hurad", + "ImageCMS", + "Kanboard", + "Lan Management System", + "MODX Evo", + "MantisBT", + "Mautic", + "Maya", + "OXID", + "Plentymarkets", + "Porto", + "RadPHP", + "SMF", + "Starbug", + "Thelia", + "Whmcs", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "attogram", + "bitrix", + "cakephp", + "chef", + "cockpit", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "eZ Platform", + "elgg", + "expressionengine", + "fuelphp", + "grav", + "installer", + "itop", + "joomla", + "known", + "kohana", + "laravel", + "lavalite", + "lithium", + "magento", + "majima", + "mako", + "mediawiki", + "miaoxing", + "modulework", + "modx", + "moodle", + "osclass", + "pantheon", + "phpbb", + "piwik", + "ppi", + "processwire", + "puppet", + "pxcms", + "reindex", + "roundcube", + "shopware", + "silverstripe", + "sydes", + "sylius", + "symfony", + "tastyigniter", + "typo3", + "wordpress", + "yawik", + "zend", + "zikula" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "install-path": "./installers" + }, + { + "name": "dms/phpunit-arraysubset-asserts", + "version": "v0.1.1", + "version_normalized": "0.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", + "reference": "1fc5a0f3db1d0c440a7c6b8834917888247f8f42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/1fc5a0f3db1d0c440a7c6b8834917888247f8f42", + "reference": "1fc5a0f3db1d0c440a7c6b8834917888247f8f42", + "shasum": "" + }, + "require": { + "php": "^7.2", + "phpunit/phpunit": "^8.4" + }, + "require-dev": { + "dms/coding-standard": "^1.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2020-02-18T21:20:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DMS\\PHPUnitExtensions\\ArraySubset\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rafael Dohms", + "email": "rdohms@gmail.com" + } + ], + "description": "This package provides Array Subset and related asserts once depracated in PHPunit 8", + "install-path": "../dms/phpunit-arraysubset-asserts" + }, + { + "name": "doctrine/cache", + "version": "2.2.0", + "version_normalized": "2.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "time": "2022-05-20T20:07:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "install-path": "../doctrine/cache" + }, + { + "name": "doctrine/dbal", + "version": "2.13.9", + "version_normalized": "2.13.9.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c480849ca3ad6706a39c970cdfe6888fa8a058b8", + "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.0|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1.0", + "ext-pdo": "*", + "php": "^7.1 || ^8" + }, + "require-dev": { + "doctrine/coding-standard": "9.0.0", + "jetbrains/phpstorm-stubs": "2021.1", + "phpstan/phpstan": "1.4.6", + "phpunit/phpunit": "^7.5.20|^8.5|9.5.16", + "psalm/plugin-phpunit": "0.16.1", + "squizlabs/php_codesniffer": "3.6.2", + "symfony/cache": "^4.4", + "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", + "vimeo/psalm": "4.22.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "time": "2022-05-02T20:28:55+00:00", + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlanywhere", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "install-path": "../doctrine/dbal" + }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "time": "2022-05-02T15:47:09+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "install-path": "../doctrine/deprecations" + }, + { + "name": "doctrine/event-manager", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^0.5.3 || ^1", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.8", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.24" + }, + "time": "2022-10-12T20:51:15+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "install-path": "../doctrine/event-manager" + }, + { + "name": "doctrine/inflector", + "version": "2.0.6", + "version_normalized": "2.0.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", + "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25" + }, + "time": "2022-10-20T09:10:12+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "install-path": "../doctrine/inflector" + }, + { + "name": "doctrine/instantiator", + "version": "1.5.0", + "version_normalized": "1.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "time": "2022-12-30T00:15:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "install-path": "../doctrine/instantiator" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "version_normalized": "1.2.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "time": "2022-02-28T11:07:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "install-path": "../doctrine/lexer" + }, + { + "name": "dragonmantank/cron-expression", + "version": "v2.3.1", + "version_normalized": "2.3.1.0", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" + }, + "time": "2020-10-13T00:52:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "install-path": "../dragonmantank/cron-expression" + }, + { + "name": "egulias/email-validator", + "version": "2.1.25", + "version_normalized": "2.1.25.0", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "time": "2020-12-29T14:50:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "install-path": "../egulias/email-validator" + }, + { + "name": "erusev/parsedown", + "version": "1.7.4", + "version_normalized": "1.7.4.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "time": "2019-12-30T22:54:17+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "install-path": "../erusev/parsedown" + }, + { + "name": "erusev/parsedown-extra", + "version": "0.8.1", + "version_normalized": "0.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown-extra.git", + "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef", + "reference": "91ac3ff98f0cea243bdccc688df43810f044dcef", + "shasum": "" + }, + "require": { + "erusev/parsedown": "^1.7.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "time": "2019-12-30T23:20:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "ParsedownExtra": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "An extension of Parsedown that adds support for Markdown Extra.", + "homepage": "https://github.com/erusev/parsedown-extra", + "keywords": [ + "markdown", + "markdown extra", + "parsedown", + "parser" + ], + "install-path": "../erusev/parsedown-extra" + }, + { + "name": "fzaninotto/faker", + "version": "v1.9.2", + "version_normalized": "1.9.2.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" + }, + "time": "2020-12-11T09:56:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "abandoned": true, + "install-path": "../fzaninotto/faker" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.5.0", + "version_normalized": "7.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.9 || ^2.4", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "time": "2022-08-28T15:39:27+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.5.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/guzzle" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.2", + "version_normalized": "1.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "b94b2807d85443f9719887892882d0329d1e2598" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "time": "2022-08-28T14:55:35+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/promises" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.4.3", + "version_normalized": "2.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "67c26b443f348a51926030c83481b85718457d3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", + "reference": "67c26b443f348a51926030c83481b85718457d3d", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2022-10-26T14:07:24+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.4.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/psr7" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, + "time": "2020-07-09T08:09:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "hamcrest" ] }, - "phpstan": { - "includes": [ - "extension.neon" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "install-path": "../hamcrest/hamcrest-php" + }, + { + "name": "http-interop/http-factory-guzzle", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/http-factory-guzzle.git", + "reference": "8f06e92b95405216b237521cc64c804dd44c4a81" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/http-factory-guzzle/zipball/8f06e92b95405216b237521cc64c804dd44c4a81", + "reference": "8f06e92b95405216b237521cc64c804dd44c4a81", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7||^2.0", + "php": ">=7.3", + "psr/http-factory": "^1.0" + }, + "provide": { + "psr/http-factory-implementation": "^1.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "guzzlehttp/psr7": "Includes an HTTP factory starting in version 2.0" + }, + "time": "2021-07-21T13:50:14+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Factory\\Guzzle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "An HTTP Factory using Guzzle PSR7", + "keywords": [ + "factory", + "http", + "psr-17", + "psr-7" + ], + "support": { + "issues": "https://github.com/http-interop/http-factory-guzzle/issues", + "source": "https://github.com/http-interop/http-factory-guzzle/tree/1.2.0" + }, + "install-path": "../http-interop/http-factory-guzzle" + }, + { + "name": "laravel/framework", + "version": "v6.20.44", + "version_normalized": "6.20.44.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "reference": "505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.4|^2.0", + "dragonmantank/cron-expression": "^2.3.1", + "egulias/email-validator": "^2.1.10", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "league/commonmark": "^1.3", + "league/flysystem": "^1.1", + "monolog/monolog": "^1.12|^2.0", + "nesbot/carbon": "^2.31", + "opis/closure": "^3.6", + "php": "^7.2.5|^8.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.3.4", + "symfony/debug": "^4.3.4", + "symfony/finder": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/polyfill-php73": "^1.17", + "symfony/process": "^4.3.4", + "symfony/routing": "^4.3.4", + "symfony/var-dumper": "^4.3.4", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^3.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.155", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.8", + "guzzlehttp/guzzle": "^6.3.1|^7.0.1", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "~1.3.3|^1.4.2", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "^4.8", + "pda/pheanstalk": "^4.0", + "phpunit/phpunit": "^7.5.15|^8.4|^9.3.3", + "predis/predis": "^1.1.1", + "symfony/cache": "^4.3.4" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "filp/whoops": "Required for friendly error pages in development (^2.8).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0.1).", + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", + "predis/predis": "Required to use the predis connector (^1.1.2).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", + "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." + }, + "time": "2022-01-12T16:12:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "install-path": "../laravel/framework" + }, + { + "name": "laravel/scout", + "version": "v8.6.1", + "version_normalized": "8.6.1.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/scout.git", + "reference": "7fb1c860a2fd904f0e084a7cc3641eb1448ba278" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/scout/zipball/7fb1c860a2fd904f0e084a7cc3641eb1448ba278", + "reference": "7fb1c860a2fd904f0e084a7cc3641eb1448ba278", + "shasum": "" + }, + "require": { + "illuminate/bus": "^6.0|^7.0|^8.0", + "illuminate/contracts": "^6.0|^7.0|^8.0", + "illuminate/database": "^6.0|^7.0|^8.0", + "illuminate/http": "^6.0|^7.0|^8.0", + "illuminate/pagination": "^6.0|^7.0|^8.0", + "illuminate/queue": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "php": "^7.2|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^8.0|^9.3" + }, + "suggest": { + "algolia/algoliasearch-client-php": "Required to use the Algolia engine (^2.2)." + }, + "time": "2021-04-06T14:35:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Scout\\ScoutServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laravel\\Scout\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Laravel Scout provides a driver based solution to searching your Eloquent models.", + "keywords": [ + "algolia", + "laravel", + "search" + ], + "support": { + "issues": "https://github.com/laravel/scout/issues", + "source": "https://github.com/laravel/scout" + }, + "install-path": "../laravel/scout" + }, + { + "name": "laravel/tinker", + "version": "v2.8.0", + "version_normalized": "2.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/tinker.git", + "reference": "74d0b287cc4ae65d15c368dd697aae71d62a73ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/tinker/zipball/74d0b287cc4ae65d15c368dd697aae71d62a73ad", + "reference": "74d0b287cc4ae65d15c368dd697aae71d62a73ad", + "shasum": "" + }, + "require": { + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "php": "^7.2.5|^8.0", + "psy/psysh": "^0.10.4|^0.11.1", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0" + }, + "require-dev": { + "mockery/mockery": "~1.3.3|^1.4.2", + "phpunit/phpunit": "^8.5.8|^9.3.3" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." + }, + "time": "2023-01-10T18:03:30+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Tinker\\TinkerServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "support": { + "issues": "https://github.com/laravel/tinker/issues", + "source": "https://github.com/laravel/tinker/tree/v2.8.0" + }, + "install-path": "../laravel/tinker" + }, + { + "name": "league/commonmark", + "version": "1.6.7", + "version_normalized": "1.6.7.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "reference": "2b8185c13bc9578367a5bf901881d1c1b5bbd09b", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "scrutinizer/ocular": "1.7.*" + }, + "require-dev": { + "cebe/markdown": "~1.0", + "commonmark/commonmark.js": "0.29.2", + "erusev/parsedown": "~1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "~1.4", + "mikehaertl/php-shellcommand": "^1.4", + "phpstan/phpstan": "^0.12.90", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", + "scrutinizer/ocular": "^1.5", + "symfony/finder": "^4.2" + }, + "time": "2022-01-13T17:18:13+00:00", + "bin": [ + "bin/commonmark" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "install-path": "../league/commonmark" + }, + { + "name": "league/csv", + "version": "9.8.0", + "version_normalized": "9.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/csv.git", + "reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/9d2e0265c5d90f5dd601bc65ff717e05cec19b47", + "reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "ext-curl": "*", + "ext-dom": "*", + "friendsofphp/php-cs-fixer": "^v3.4.0", + "phpstan/phpstan": "^1.3.0", + "phpstan/phpstan-phpunit": "^1.0.0", + "phpstan/phpstan-strict-rules": "^1.1.0", + "phpunit/phpunit": "^9.5.11" + }, + "suggest": { + "ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes", + "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" + }, + "time": "2022-01-04T00:13:07+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "League\\Csv\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://github.com/nyamsprod/", + "role": "Developer" + } + ], + "description": "CSV data manipulation made easy in PHP", + "homepage": "https://csv.thephpleague.com", + "keywords": [ + "convert", + "csv", + "export", + "filter", + "import", + "read", + "transform", + "write" + ], + "support": { + "docs": "https://csv.thephpleague.com", + "issues": "https://github.com/thephpleague/csv/issues", + "rss": "https://github.com/thephpleague/csv/releases.atom", + "source": "https://github.com/thephpleague/csv" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "install-path": "../league/csv" + }, + { + "name": "league/flysystem", + "version": "1.1.10", + "version_normalized": "1.1.10.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/mime-type-detection": "^1.3", + "php": "^7.2.5 || ^8.0" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" + }, + "suggest": { + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "time": "2022-10-04T09:16:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.1.10" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "install-path": "../league/flysystem" + }, + { + "name": "league/mime-type-detection", + "version": "1.11.0", + "version_normalized": "1.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd", + "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3" + }, + "time": "2022-04-17T13:12:02+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "install-path": "../league/mime-type-detection" + }, + { + "name": "linkorb/jsmin-php", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/linkorb/jsmin-php.git", + "reference": "be85d87fc9c27730e7e9ced742b13010dafc1026" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/linkorb/jsmin-php/zipball/be85d87fc9c27730e7e9ced742b13010dafc1026", + "reference": "be85d87fc9c27730e7e9ced742b13010dafc1026", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "time": "2013-03-15T13:16:35+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" ] - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Carbon\\": "src/Carbon/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "https://markido.com" }, - { - "name": "kylekatarnls", - "homepage": "https://github.com/kylekatarnls" - } - ], - "description": "An API extension for DateTime that supports 281 different languages.", - "homepage": "https://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ], - "funding": [ - { - "url": "https://github.com/sponsors/kylekatarnls", - "type": "github" - }, - { - "url": "https://opencollective.com/Carbon#sponsor", - "type": "opencollective" - }, - { - "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", - "type": "tidelift" - } - ] - }, - { - "name": "nikic/php-parser", - "version": "v4.15.2", - "version_normalized": "4.15.2.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "time": "2022-11-12T15:38:23+00:00", - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ] - }, - { - "name": "october/backend", - "version": "v1.1.12", - "version_normalized": "1.1.12.0", - "source": { - "type": "git", - "url": "https://github.com/octoberrain/backend.git", - "reference": "6c539bebcd189b5c5f7a919faad9d06985499f3b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/octoberrain/backend/zipball/6c539bebcd189b5c5f7a919faad9d06985499f3b", - "reference": "6c539bebcd189b5c5f7a919faad9d06985499f3b", - "shasum": "" - }, - "require": { - "composer/installers": "~1.0", - "php": ">=7.2" - }, - "time": "2021-11-14T22:44:06+00:00", - "type": "october-module", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Backend\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexey Bobkov", - "email": "aleksey.bobkov@gmail.com", - "role": "Co-founder" - }, - { - "name": "Samuel Georges", - "email": "daftspunky@gmail.com", - "role": "Co-founder" - } - ], - "description": "Backend module for October CMS", - "homepage": "https://octobercms.com", - "keywords": [ - "backend", - "october", - "october cms" - ] - }, - { - "name": "october/cms", - "version": "v1.1.12", - "version_normalized": "1.1.12.0", - "source": { - "type": "git", - "url": "https://github.com/octoberrain/cms.git", - "reference": "7ca98fc2205710fe235f588ce094b0b13105636a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/octoberrain/cms/zipball/7ca98fc2205710fe235f588ce094b0b13105636a", - "reference": "7ca98fc2205710fe235f588ce094b0b13105636a", - "shasum": "" - }, - "require": { - "composer/installers": "~1.0", - "php": ">=7.2" - }, - "time": "2021-07-22T05:55:39+00:00", - "type": "october-module", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Cms\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexey Bobkov", - "email": "aleksey.bobkov@gmail.com", - "role": "Co-founder" - }, - { - "name": "Samuel Georges", - "email": "daftspunky@gmail.com", - "role": "Co-founder" - } - ], - "description": "CMS module for October CMS", - "homepage": "https://octobercms.com", - "keywords": [ - "cms", - "october", - "october cms" - ] - }, - { - "name": "october/rain", - "version": "v1.1.1", - "version_normalized": "1.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/octobercms/library.git", - "reference": "717b39b3daee566e1253bdde30754625b63946fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/octobercms/library/zipball/717b39b3daee566e1253bdde30754625b63946fe", - "reference": "717b39b3daee566e1253bdde30754625b63946fe", - "shasum": "" - }, - "require": { - "doctrine/dbal": "^2.6", - "erusev/parsedown-extra": "~0.7", - "ext-ctype": "*", - "ext-curl": "*", - "ext-dom": "*", - "ext-fileinfo": "*", - "ext-gd": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "ext-pdo": "*", - "ext-zip": "*", - "laravel/framework": "~6.0", - "laravel/tinker": "~2.0", - "league/csv": "~9.1", - "linkorb/jsmin-php": "~1.0", - "nesbot/carbon": "^2.0", - "php": ">=7.2", - "scssphp/scssphp": "~1.0", - "symfony/yaml": "^3.4", - "twig/twig": "~2.0", - "wikimedia/less.php": "~2.0" - }, - "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.1.0", - "illuminate/cache": "^6.0", - "illuminate/database": "^6.0", - "illuminate/encryption": "^6.0", - "illuminate/events": "^6.0", - "illuminate/filesystem": "^6.0", - "illuminate/log": "^6.0", - "illuminate/mail": "^6.0", - "illuminate/pagination": "^6.0", - "illuminate/queue": "^6.0", - "illuminate/redis": "^6.0", - "illuminate/routing": "^6.0", - "illuminate/support": "^6.0", - "illuminate/validation": "^6.0", - "illuminate/view": "^6.0", - "meyfa/phpunit-assert-gd": "^2.0.0", - "mockery/mockery": "~1.3.3|^1.4.2", - "php-parallel-lint/php-parallel-lint": "^1.0", - "phpunit/phpunit": "^8.4|^9.3.3", - "squizlabs/php_codesniffer": "3.*" - }, - "suggest": { - "ext-PDO_ODBC": "Required to use databases accessed through ODBC drivers", - "ext-pdo_dblib": "Required to use MS SQL Server databases", - "ext-pdo_mysql": "Required to use MySQL databases", - "ext-pdo_pgsql": "Required to use PostgreSQL databases", - "ext-pdo_sqlite": "Required to use SQLite databases" - }, - "time": "2020-11-22T10:24:39+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/Support/helpers.php", - "src/Router/helpers.php", - "src/Html/helpers.php" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "psr-4": { - "October\\Rain\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexey Bobkov", - "email": "aleksey.bobkov@gmail.com", - "role": "Co-founder" - }, - { - "name": "Samuel Georges", - "email": "daftspunky@gmail.com", - "role": "Co-founder" - }, - { - "name": "Luke Towers", - "email": "octobercms@luketowers.ca", - "homepage": "https://luketowers.ca", - "role": "Maintainer" - } - ], - "description": "October Rain Library", - "homepage": "http://octobercms.com", - "keywords": [ - "cms", - "october", - "rain" - ] - }, - { - "name": "october/system", - "version": "v1.1.12", - "version_normalized": "1.1.12.0", - "source": { - "type": "git", - "url": "https://github.com/octoberrain/system.git", - "reference": "cffaaaf12075302089995fd795677a16bef94787" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/octoberrain/system/zipball/cffaaaf12075302089995fd795677a16bef94787", - "reference": "cffaaaf12075302089995fd795677a16bef94787", - "shasum": "" - }, - "require": { - "composer/installers": "~1.0", - "php": ">=7.2" - }, - "time": "2022-02-20T01:54:45+00:00", - "type": "october-module", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "System\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexey Bobkov", - "email": "aleksey.bobkov@gmail.com", - "role": "Co-founder" - }, - { - "name": "Samuel Georges", - "email": "daftspunky@gmail.com", - "role": "Co-founder" - } - ], - "description": "System module for October CMS", - "homepage": "https://octobercms.com", - "keywords": [ - "october", - "october cms", - "system" - ] - }, - { - "name": "opis/closure", - "version": "3.6.3", - "version_normalized": "3.6.3.0", - "source": { - "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", - "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0 || ^8.0" - }, - "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" - }, - "time": "2022-01-27T09:35:39+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.6.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "functions.php" + "authors": [ + { + "name": "Joost Faassen", + "email": "j.faassen@linkorb.com", + "role": "Packaging for Composer" + }, + { + "name": "Ryan Grove", + "email": "ryan@wonko.com", + "role": "PHP port" + }, + { + "name": "Adam Gofort", + "email": "aag@adamgoforth.com", + "role": "Updates to the PHP port" + }, + { + "name": "Douglas Crockford", + "email": "douglas@crockford.com" + } ], - "psr-4": { - "Opis\\Closure\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" - } - ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", - "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" - ] - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "version_normalized": "9.99.100.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "time": "2020-10-15T08:29:30+00:00", - "type": "library", - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ] - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "time": "2021-07-20T11:28:43+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "version_normalized": "3.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "time": "2022-02-21T01:04:05+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints" - }, - { - "name": "php-parallel-lint/php-parallel-lint", - "version": "v1.3.2", - "version_normalized": "1.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", - "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6483c9832e71973ed29cf71bd6b3f4fde438a9de", - "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.3.0" - }, - "replace": { - "grogy/php-parallel-lint": "*", - "jakub-onderka/php-parallel-lint": "*" - }, - "require-dev": { - "nette/tester": "^1.3 || ^2.0", - "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", - "squizlabs/php_codesniffer": "^3.6" - }, - "suggest": { - "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" - }, - "time": "2022-02-21T12:50:22+00:00", - "bin": [ - "parallel-lint" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "./src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "ahoj@jakubonderka.cz" - } - ], - "description": "This tool check syntax of PHP files about 20x faster than serial check.", - "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint" - }, - { - "name": "phpoption/phpoption", - "version": "1.8.1", - "version_normalized": "1.8.1.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" - }, - "time": "2021-12-04T23:24:31+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ] - }, - { - "name": "phpunit/php-code-coverage", - "version": "7.0.15", - "version_normalized": "7.0.15.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "819f92bba8b001d4363065928088de22f25a3a48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", - "reference": "819f92bba8b001d4363065928088de22f25a3a48", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": ">=7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.3 || ^4.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" - }, - "require-dev": { - "phpunit/phpunit": "^8.2.2" - }, - "suggest": { - "ext-xdebug": "^2.7.2" - }, - "time": "2021-07-26T12:20:09+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.5", - "version_normalized": "2.0.5.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "time": "2021-12-02T12:42:26+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "version_normalized": "1.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "time": "2015-06-21T13:50:34+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ] - }, - { - "name": "phpunit/php-timer", - "version": "2.1.3", - "version_normalized": "2.1.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "time": "2020-11-30T08:20:02+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.3", - "version_normalized": "3.1.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "time": "2021-07-26T12:15:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "abandoned": true - }, - { - "name": "phpunit/phpunit", - "version": "8.5.31", - "version_normalized": "8.5.31.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33c126b09a42de5c99e5e8032b54e8221264a74e", - "reference": "33c126b09a42de5c99e5e8032b54e8221264a74e", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.2", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.5", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.5", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" - }, - "time": "2022-10-28T05:57:37+00:00", - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.5-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ] - }, - { - "name": "psr/container", - "version": "1.1.1", - "version_normalized": "1.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "time": "2021-03-05T17:36:06+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ] - }, - { - "name": "psr/log", - "version": "1.1.4", - "version_normalized": "1.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2021-05-03T11:20:27+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-10-23T01:57:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ] - }, - { - "name": "psy/psysh", - "version": "v0.10.12", - "version_normalized": "0.10.12.0", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "a0d9981aa07ecfcbea28e4bfa868031cca121e7d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/a0d9981aa07ecfcbea28e4bfa868031cca121e7d", - "reference": "a0d9981aa07ecfcbea28e4bfa868031cca121e7d", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-tokenizer": "*", - "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3", - "php": "^8.0 || ^7.0 || ^5.5.9", - "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", - "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "3.17.*" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "time": "2021-11-30T14:05:36+00:00", - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "0.10.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions.php" + "description": "Unofficial package of jsmin-php", + "homepage": "http://www.github.com/linkorb/jsmin-php", + "keywords": [ + "javascript", + "jsmin", + "minify" ], - "psr-4": { - "Psy\\": "src/" - } + "install-path": "../linkorb/jsmin-php" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ] - }, - { - "name": "ramsey/uuid", - "version": "3.9.6", - "version_normalized": "3.9.6.0", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/ffa80ab953edd85d5b6c004f96181a538aad35a3", - "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3", - "shasum": "" - }, - "require": { - "ext-json": "*", - "paragonie/random_compat": "^1 | ^2 | ^9.99.99", - "php": "^5.4 | ^7.0 | ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "codeception/aspect-mock": "^1 | ^2", - "doctrine/annotations": "^1.2", - "goaop/framework": "1.0.0-alpha.2 | ^1 | >=2.1.0 <=2.3.2", - "mockery/mockery": "^0.9.11 | ^1", - "moontoast/math": "^1.1", - "nikic/php-parser": "<=4.5.0", - "paragonie/random-lib": "^2", - "php-mock/php-mock-phpunit": "^0.3 | ^1.1 | ^2.6", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpunit/phpunit": ">=4.8.36 <9.0.0 | >=9.3.0", - "squizlabs/php_codesniffer": "^3.5", - "yoast/phpunit-polyfills": "^1.0" - }, - "suggest": { - "ext-ctype": "Provides support for PHP Ctype functions", - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "time": "2021-09-25T23:07:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions.php" + { + "name": "meilisearch/meilisearch-laravel-scout", + "version": "v0.12.5", + "version_normalized": "0.12.5.0", + "source": { + "type": "git", + "url": "https://github.com/meilisearch/meilisearch-laravel-scout.git", + "reference": "e180d66163c79248f48bb15d0ea3081b073c9593" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/meilisearch/meilisearch-laravel-scout/zipball/e180d66163c79248f48bb15d0ea3081b073c9593", + "reference": "e180d66163c79248f48bb15d0ea3081b073c9593", + "shasum": "" + }, + "require": { + "http-interop/http-factory-guzzle": "^1.0", + "laravel/scout": "^8.0", + "meilisearch/meilisearch-php": "^0.17", + "php": "^7.2|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "guzzlehttp/guzzle": "^7.2", + "mockery/mockery": "^1.3", + "orchestra/testbench": "^5.0|^6.0", + "phpunit/phpunit": "^8.5|^9.5" + }, + "time": "2021-03-10T19:45:29+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Meilisearch\\Scout\\MeilisearchServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Meilisearch\\Scout\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "psr-4": { - "Ramsey\\Uuid\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - }, - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", - "homepage": "https://github.com/ramsey/uuid", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", - "type": "tidelift" - } - ] - }, - { - "name": "scssphp/scssphp", - "version": "v1.11.0", - "version_normalized": "1.11.0.0", - "source": { - "type": "git", - "url": "https://github.com/scssphp/scssphp.git", - "reference": "33749d12c2569bb24071f94e9af828662dabb068" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/scssphp/scssphp/zipball/33749d12c2569bb24071f94e9af828662dabb068", - "reference": "33749d12c2569bb24071f94e9af828662dabb068", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-json": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4", - "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4", - "sass/sass-spec": "*", - "squizlabs/php_codesniffer": "~3.5", - "symfony/phpunit-bridge": "^5.1", - "thoughtbot/bourbon": "^7.0", - "twbs/bootstrap": "~5.0", - "twbs/bootstrap4": "4.6.1", - "zurb/foundation": "~6.5" - }, - "suggest": { - "ext-iconv": "Can be used as fallback when ext-mbstring is not available", - "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv" - }, - "time": "2022-09-02T21:24:55+00:00", - "bin": [ - "bin/pscss" - ], - "type": "library", - "extra": { - "bamarni-bin": { - "forward-command": false, - "bin-links": false - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "ScssPhp\\ScssPhp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthon Pang", - "email": "apang@softwaredevelopment.ca", - "homepage": "https://github.com/robocoder" - }, - { - "name": "Cédric Morin", - "email": "cedric@yterium.com", - "homepage": "https://github.com/Cerdic" - } - ], - "description": "scssphp is a compiler for SCSS written in PHP.", - "homepage": "http://scssphp.github.io/scssphp/", - "keywords": [ - "css", - "less", - "sass", - "scss", - "stylesheet" - ] - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "time": "2020-11-30T08:15:22+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/comparator", - "version": "3.0.5", - "version_normalized": "3.0.5.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", - "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "time": "2022-09-14T12:31:48+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/diff", - "version": "3.0.3", - "version_normalized": "3.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "time": "2020-11-30T07:59:04+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/environment", - "version": "4.2.4", - "version_normalized": "4.2.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "time": "2020-11-30T07:53:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/exporter", - "version": "3.1.5", - "version_normalized": "3.1.5.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", - "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" - }, - "time": "2022-09-14T06:00:17+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/global-state", - "version": "3.0.2", - "version_normalized": "3.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", - "shasum": "" - }, - "require": { - "php": ">=7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "time": "2022-02-10T06:55:38+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.4", - "version_normalized": "3.0.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "time": "2020-11-30T07:40:27+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "version_normalized": "1.1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "time": "2020-11-30T07:37:18+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.1", - "version_normalized": "3.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "time": "2020-11-30T07:34:24+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "time": "2020-11-30T07:30:19+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/type", - "version": "1.1.4", - "version_normalized": "1.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.2" - }, - "time": "2020-11-30T07:25:11+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ] - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "version_normalized": "2.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "time": "2016-10-03T07:35:21+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.7.1", - "version_normalized": "3.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "time": "2022-06-18T07:21:10+00:00", - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ] - }, - { - "name": "swiftmailer/swiftmailer", - "version": "v6.3.0", - "version_normalized": "6.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", - "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", - "shasum": "" - }, - "require": { - "egulias/email-validator": "^2.0|^3.1", - "php": ">=7.0.0", - "symfony/polyfill-iconv": "^1.0", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.4" - }, - "suggest": { - "ext-intl": "Needed to support internationalized email addresses" - }, - "time": "2021-10-18T15:26:12+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "lib/swift_required.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "https://swiftmailer.symfony.com", - "keywords": [ - "email", - "mail", - "mailer" - ], - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", - "type": "tidelift" - } - ], - "abandoned": "symfony/mailer" - }, - { - "name": "symfony/console", - "version": "v4.4.49", - "version_normalized": "4.4.49.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "time": "2022-11-05T17:10:16+00:00", - "type": "library", - "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": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/css-selector", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "bd0a6737e48de45b4b0b7b6fc98c78404ddceaed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/bd0a6737e48de45b4b0b7b6fc98c78404ddceaed", - "reference": "bd0a6737e48de45b4b0b7b6fc98c78404ddceaed", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "time": "2022-06-27T13:16:42+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Converts CSS selectors to XPath expressions", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/debug", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "time": "2022-07-28T16:29:46+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "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": "Provides tools to ease debugging PHP code", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "abandoned": "symfony/error-handler" - }, - { - "name": "symfony/error-handler", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/error-handler.git", - "reference": "be731658121ef2d8be88f3a1ec938148a9237291" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/be731658121ef2d8be88f3a1ec938148a9237291", - "reference": "be731658121ef2d8be88f3a1ec938148a9237291", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3", - "symfony/debug": "^4.4.5", - "symfony/var-dumper": "^4.4|^5.0" - }, - "require-dev": { - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" - }, - "time": "2022-07-28T16:29:46+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\ErrorHandler\\": "" - }, - "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": "Provides tools to manage errors and ease debugging PHP code", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1e866e9e5c1b22168e0ce5f0b467f19bba61266a", - "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "time": "2022-07-20T09:59:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.13", - "version_normalized": "1.1.13.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" - }, - "time": "2022-01-02T09:41:36+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "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 dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/finder", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/66bd787edb5e42ff59d3523f623895af05043e4f", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "time": "2022-07-29T07:35:46+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "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": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/http-client-contracts", - "version": "v1.1.13", - "version_normalized": "1.1.13.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "59f37624a82635962f04c98f31aed122e539a89e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/59f37624a82635962f04c98f31aed122e539a89e", - "reference": "59f37624a82635962f04c98f31aed122e539a89e", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "time": "2022-04-11T14:52:04+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "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 HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/http-foundation", - "version": "v4.4.49", - "version_normalized": "4.4.49.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "191413c7b832c015bb38eae963f2e57498c3c173" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/191413c7b832c015bb38eae963f2e57498c3c173", - "reference": "191413c7b832c015bb38eae963f2e57498c3c173", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/expression-language": "^3.4|^4.0|^5.0" - }, - "time": "2022-11-04T16:17:57+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "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": "Defines an object-oriented layer for the HTTP specification", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/http-kernel", - "version": "v4.4.49", - "version_normalized": "4.4.49.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "4e36db8103062c62b3882b1bd297b02de6b021c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/4e36db8103062c62b3882b1bd297b02de6b021c4", - "reference": "4e36db8103062c62b3882b1bd297b02de6b021c4", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2", - "symfony/error-handler": "^4.4", - "symfony/event-dispatcher": "^4.4", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^4.4.30|^5.3.7", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/browser-kit": "<4.3", - "symfony/config": "<3.4", - "symfony/console": ">=5", - "symfony/dependency-injection": "<4.3", - "symfony/translation": "<4.2", - "twig/twig": "<1.43|<2.13,>=2" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.3|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/dom-crawler": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, - "time": "2022-11-28T17:58:43+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a structured process for converting a Request into a Response", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/mime", - "version": "v4.4.47", - "version_normalized": "4.4.47.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/mime.git", - "reference": "0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d", - "reference": "0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "egulias/email-validator": "~3.0.0", - "symfony/mailer": "<4.4" - }, - "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", - "symfony/dependency-injection": "^3.4|^4.1|^5.0" - }, - "time": "2022-10-03T15:15:11+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Mime\\": "" - }, - "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": "Allows manipulating MIME messages", - "homepage": "https://symfony.com", - "keywords": [ - "mime", - "mime-type" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "authors": [ + { + "name": "Jordan Massart", + "email": "hello@jordan-massart.be" + } ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-iconv", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "927013f3aac555983a5059aada98e1907d842695" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/927013f3aac555983a5059aada98e1907d842695", - "reference": "927013f3aac555983a5059aada98e1907d842695", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-iconv": "*" - }, - "suggest": { - "ext-iconv": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "description": "Laravel Scout custom engine for MeiliSearch", + "keywords": [ + "laravel", + "meilisearch", + "scout", + "search" ], - "psr-4": { - "Symfony\\Polyfill\\Iconv\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "support": { + "issues": "https://github.com/meilisearch/meilisearch-laravel-scout/issues", + "source": "https://github.com/meilisearch/meilisearch-laravel-scout/tree/v0.12.5" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Iconv extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "iconv", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" + "abandoned": true, + "install-path": "../meilisearch/meilisearch-laravel-scout" + }, + { + "name": "meilisearch/meilisearch-php", + "version": "v0.17.2", + "version_normalized": "0.17.2.0", + "source": { + "type": "git", + "url": "https://github.com/meilisearch/meilisearch-php.git", + "reference": "a200a32093ae44c04523f6fd014ec888707ceb9e" }, - { - "url": "https://github.com/fabpot", - "type": "github" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/meilisearch/meilisearch-php/zipball/a200a32093ae44c04523f6fd014ec888707ceb9e", + "reference": "a200a32093ae44c04523f6fd014ec888707ceb9e", + "shasum": "" }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-intl-idn", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" + "require": { + "ext-json": "*", + "php": ">=7.2", + "php-http/client-common": "^2.0", + "php-http/discovery": "^1.7", + "php-http/httplug": "^2.1" }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "guzzlehttp/guzzle": "^7.1", + "http-interop/http-factory-guzzle": "^1.0", + "phpunit/phpunit": "^8.5 || ^9.0" + }, + "suggest": { + "guzzlehttp/guzzle": "Use Guzzle ^7 as HTTP client", + "http-interop/http-factory-guzzle": "Factory for guzzlehttp/guzzle" + }, + "time": "2021-04-26T18:31:30+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "MeiliSearch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "authors": [ + { + "name": "Clementine Urquizar", + "email": "clementine@meilisearch.com" + } ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "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 for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "description": "PHP wrapper for the MeiliSearch API", + "keywords": [ + "api", + "client", + "instant", + "meilisearch", + "php", + "search" ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "support": { + "issues": "https://github.com/meilisearch/meilisearch-php/issues", + "source": "https://github.com/meilisearch/meilisearch-php/tree/v0.17.2" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" + "install-path": "../meilisearch/meilisearch-php" + }, + { + "name": "meyfa/phpunit-assert-gd", + "version": "v2.1.0", + "version_normalized": "2.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/meyfa/phpunit-assert-gd.git", + "reference": "9e39d550616d61d522ef935f1db1cd2e368ac0f0" }, - { - "url": "https://github.com/fabpot", - "type": "github" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/meyfa/phpunit-assert-gd/zipball/9e39d550616d61d522ef935f1db1cd2e368ac0f0", + "reference": "9e39d550616d61d522ef935f1db1cd2e368ac0f0", + "shasum": "" }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" + "require": { + "ext-gd": "*", + "php": ">=7.2", + "phpunit/phpunit": "^8.0" }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "require-dev": { + "phpmd/phpmd": "@stable" + }, + "time": "2021-01-16T20:29:06+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "AssertGD\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "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.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "authors": [ + { + "name": "Fabian Meyer", + "homepage": "http://meyfa.net" + } ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "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" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" + "description": "PHPUnit matcher/assertions for GD image resources", + "homepage": "https://github.com/meyfa/phpunit-assert-gd", + "keywords": [ + "assert", + "gd", + "image", + "matcher", + "phpunit", + "resource" ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" + "install-path": "../meyfa/phpunit-assert-gd" + }, + { + "name": "mockery/mockery", + "version": "1.5.1", + "version_normalized": "1.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "shasum": "" }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": "^7.3 || ^8.0" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" + "conflict": { + "phpunit/phpunit": "<8.0" }, - { - "url": "https://github.com/fabpot", - "type": "github" + "require-dev": { + "phpunit/phpunit": "^8.5 || ^9.3" }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/process", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "time": "2022-06-27T13:16:42+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" + "time": "2022-09-07T15:32:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "installation-source": "dist", + "autoload": { + "psr-0": { + "Mockery": "library/" + } }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/routing", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/f7751fd8b60a07f3f349947a309b5bdfce22d6ae", - "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "psr/log": "^1|^2|^3", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, - "time": "2022-07-20T09:59:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - }, - "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": "Maps an HTTP request to a set of configuration variables", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/service-contracts", - "version": "v1.1.13", - "version_normalized": "1.1.13.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "afa00c500c2d6aea6e3b2f4862355f507bc5ebb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/afa00c500c2d6aea6e3b2f4862355f507bc5ebb4", - "reference": "afa00c500c2d6aea6e3b2f4862355f507bc5ebb4", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "time": "2022-05-27T14:01:05+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "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" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/translation", - "version": "v4.4.47", - "version_normalized": "4.4.47.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/45036b1d53accc48fe9bab71ccd86d57eba0dd94", - "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^1.1.6|^2" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "symfony/translation-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "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/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "time": "2022-10-03T15:15:11+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "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": "Provides tools to internationalize your application", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/translation-contracts", - "version": "v1.1.13", - "version_normalized": "1.1.13.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation-contracts.git", - "reference": "7462e5c4cb8b9cd152f992e8f10963b5641921f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/7462e5c4cb8b9cd152f992e8f10963b5641921f6", - "reference": "7462e5c4cb8b9cd152f992e8f10963b5641921f6", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "suggest": { - "symfony/translation-implementation": "" - }, - "time": "2022-06-27T13:16:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Translation\\": "" - } - }, - "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 translation", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/var-dumper", - "version": "v4.4.47", - "version_normalized": "4.4.47.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "1069c7a3fca74578022fab6f81643248d02f8e63" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63", - "reference": "1069c7a3fca74578022fab6f81643248d02f8e63", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "time": "2022-10-03T15:15:11+00:00", - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "Resources/functions/dump.php" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.5.1" }, - "exclude-from-classmap": [ - "/Tests/" - ] + "install-path": "../mockery/mockery" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + { + "name": "monolog/monolog", + "version": "2.9.1", + "version_normalized": "2.9.1.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "shasum": "" }, - { - "url": "https://github.com/fabpot", - "type": "github" + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ] - }, - { - "name": "symfony/yaml", - "version": "v3.4.47", - "version_normalized": "3.4.47.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "time": "2020-10-24T10:57:07+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5.14", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "version_normalized": "1.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "time": "2021-07-28T10:34:58+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ] - }, - { - "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.5", - "version_normalized": "2.2.5.0", - "source": { - "type": "git", - "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/4348a3a06651827a27d989ad1d13efec6bb49b19", - "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" - }, - "time": "2022-09-12T13:28:28+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "TijsVerkoyen\\CssToInlineStyles\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Tijs Verkoyen", - "email": "css_to_inline_styles@verkoyen.eu", - "role": "Developer" - } - ], - "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", - "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles" - }, - { - "name": "twig/twig", - "version": "v2.15.3", - "version_normalized": "2.15.3.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ab402673db8746cb3a4c46f3869d6253699f614a", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.8" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" - }, - "time": "2022-09-28T08:40:08+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.15-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "time": "2023-02-06T13:44:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } }, - { - "name": "Twig Team", - "role": "Contributors" + "installation-source": "dist", + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "https://twig.symfony.com", - "keywords": [ - "templating" - ], - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.9.1" }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ] - }, - { - "name": "vlucas/phpdotenv", - "version": "v3.6.10", - "version_normalized": "3.6.10.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "install-path": "../monolog/monolog" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", - "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.5.2", - "symfony/polyfill-ctype": "^1.17" - }, - "require-dev": { - "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." - }, - "time": "2021-12-12T23:02:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "version_normalized": "1.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ] - }, - { - "name": "wikimedia/composer-merge-plugin", - "version": "dev-feature/composer-v2", - "version_normalized": "dev-feature/composer-v2", - "source": { - "type": "git", - "url": "https://github.com/daftspunk/composer-merge-plugin.git", - "reference": "a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/daftspunk/composer-merge-plugin/zipball/a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6", - "reference": "a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1||^2.0", - "php": ">=7.2.0" - }, - "require-dev": { - "composer/composer": "^1.1", - "php-parallel-lint/php-parallel-lint": "~1.1.0", - "phpunit/phpunit": "^8.5||^9.0", - "squizlabs/php_codesniffer": "~3.5.4" - }, - "time": "2020-11-20T15:38:00+00:00", - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-master": "1.5.x-dev" + "require": { + "php": "^7.1 || ^8.0" }, - "class": "Wikimedia\\Composer\\MergePlugin" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "time": "2022-03-03T13:19:32+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "install-path": "../myclabs/deep-copy" }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Wikimedia\\Composer\\": "src/" - } + { + "name": "nesbot/carbon", + "version": "2.66.0", + "version_normalized": "2.66.0.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "496712849902241f04902033b0441b269effe001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001", + "reference": "496712849902241f04902033b0441b269effe001", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.1.4", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2023-01-29T18:53:47+00:00", + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev", + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", + "type": "tidelift" + } + ], + "install-path": "../nesbot/carbon" }, - "scripts": { - "test": [ - "composer validate --no-interaction", - "parallel-lint src tests", - "phpunit --log-junit=reports/unitreport.xml --coverage-text --coverage-html=reports/coverage --coverage-clover=reports/coverage.xml", - "phpcs --encoding=utf-8 --standard=PSR2 --report-checkstyle=reports/checkstyle-phpcs.xml --report-full --extensions=php src/* tests/phpunit/*" - ] + { + "name": "nikic/php-parser", + "version": "v4.15.3", + "version_normalized": "4.15.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "time": "2023-01-16T22:05:37+00:00", + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + }, + "install-path": "../nikic/php-parser" }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bryan Davis", - "email": "bd808@wikimedia.org" - } - ], - "description": "Composer plugin to merge multiple composer.json files", - "support": { - "source": "https://github.com/octoberrain/composer-merge-plugin/tree/feature/composer-v2" + { + "name": "october/backend", + "version": "v1.1.12", + "version_normalized": "1.1.12.0", + "source": { + "type": "git", + "url": "https://github.com/octoberrain/backend.git", + "reference": "6c539bebcd189b5c5f7a919faad9d06985499f3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/octoberrain/backend/zipball/6c539bebcd189b5c5f7a919faad9d06985499f3b", + "reference": "6c539bebcd189b5c5f7a919faad9d06985499f3b", + "shasum": "" + }, + "require": { + "composer/installers": "~1.0", + "php": ">=7.2" + }, + "time": "2021-11-14T22:44:06+00:00", + "type": "october-module", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Backend\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexey Bobkov", + "email": "aleksey.bobkov@gmail.com", + "role": "Co-founder" + }, + { + "name": "Samuel Georges", + "email": "daftspunky@gmail.com", + "role": "Co-founder" + } + ], + "description": "Backend module for October CMS", + "homepage": "https://octobercms.com", + "keywords": [ + "backend", + "october", + "october cms" + ], + "install-path": "../../modules/backend" + }, + { + "name": "october/cms", + "version": "v1.1.12", + "version_normalized": "1.1.12.0", + "source": { + "type": "git", + "url": "https://github.com/octoberrain/cms.git", + "reference": "7ca98fc2205710fe235f588ce094b0b13105636a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/octoberrain/cms/zipball/7ca98fc2205710fe235f588ce094b0b13105636a", + "reference": "7ca98fc2205710fe235f588ce094b0b13105636a", + "shasum": "" + }, + "require": { + "composer/installers": "~1.0", + "php": ">=7.2" + }, + "time": "2021-07-22T05:55:39+00:00", + "type": "october-module", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Cms\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexey Bobkov", + "email": "aleksey.bobkov@gmail.com", + "role": "Co-founder" + }, + { + "name": "Samuel Georges", + "email": "daftspunky@gmail.com", + "role": "Co-founder" + } + ], + "description": "CMS module for October CMS", + "homepage": "https://octobercms.com", + "keywords": [ + "cms", + "october", + "october cms" + ], + "install-path": "../../modules/cms" + }, + { + "name": "october/rain", + "version": "v1.1.12", + "version_normalized": "1.1.12.0", + "source": { + "type": "git", + "url": "https://github.com/octobercms/library.git", + "reference": "d8388eadcc6cbbc302468400a58aea71aa92115c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/octobercms/library/zipball/d8388eadcc6cbbc302468400a58aea71aa92115c", + "reference": "d8388eadcc6cbbc302468400a58aea71aa92115c", + "shasum": "" + }, + "require": { + "doctrine/dbal": "^2.6", + "erusev/parsedown-extra": "~0.7", + "ext-ctype": "*", + "ext-curl": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-pdo": "*", + "ext-zip": "*", + "laravel/framework": "~6.0", + "laravel/tinker": "~2.0", + "league/csv": "~9.1", + "linkorb/jsmin-php": "~1.0", + "nesbot/carbon": "^2.0", + "php": ">=7.2.9", + "scssphp/scssphp": "~1.0", + "symfony/yaml": "^3.4", + "twig/twig": "~2.0", + "wikimedia/less.php": "~3.0" + }, + "require-dev": { + "dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1", + "illuminate/cache": "^6.0", + "illuminate/database": "^6.0", + "illuminate/encryption": "^6.0", + "illuminate/events": "^6.0", + "illuminate/filesystem": "^6.0", + "illuminate/log": "^6.0", + "illuminate/mail": "^6.0", + "illuminate/pagination": "^6.0", + "illuminate/queue": "^6.0", + "illuminate/redis": "^6.0", + "illuminate/routing": "^6.0", + "illuminate/support": "^6.0", + "illuminate/validation": "^6.0", + "illuminate/view": "^6.0", + "meyfa/phpunit-assert-gd": "^2.0.0|^3.0.0", + "mockery/mockery": "~1.3.3|^1.4.2", + "php-parallel-lint/php-parallel-lint": "^1.0", + "phpunit/phpunit": "^8.5.12|^9.3.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "ext-PDO_ODBC": "Required to use databases accessed through ODBC drivers", + "ext-pdo_dblib": "Required to use MS SQL Server databases", + "ext-pdo_mysql": "Required to use MySQL databases", + "ext-pdo_pgsql": "Required to use PostgreSQL databases", + "ext-pdo_sqlite": "Required to use SQLite databases" + }, + "time": "2022-03-30T22:57:03+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Support/helpers.php", + "src/Router/helpers.php", + "src/Html/helpers.php" + ], + "psr-4": { + "October\\Rain\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexey Bobkov", + "email": "aleksey.bobkov@gmail.com", + "role": "Co-founder" + }, + { + "name": "Samuel Georges", + "email": "daftspunky@gmail.com", + "role": "Co-founder" + } + ], + "description": "October Rain Library", + "homepage": "http://octobercms.com", + "keywords": [ + "cms", + "october", + "rain" + ], + "support": { + "source": "https://github.com/octobercms/library/tree/v1.1.12" + }, + "install-path": "../october/rain" + }, + { + "name": "october/system", + "version": "v1.1.12", + "version_normalized": "1.1.12.0", + "source": { + "type": "git", + "url": "https://github.com/octoberrain/system.git", + "reference": "cffaaaf12075302089995fd795677a16bef94787" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/octoberrain/system/zipball/cffaaaf12075302089995fd795677a16bef94787", + "reference": "cffaaaf12075302089995fd795677a16bef94787", + "shasum": "" + }, + "require": { + "composer/installers": "~1.0", + "php": ">=7.2" + }, + "time": "2022-02-20T01:54:45+00:00", + "type": "october-module", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "System\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexey Bobkov", + "email": "aleksey.bobkov@gmail.com", + "role": "Co-founder" + }, + { + "name": "Samuel Georges", + "email": "daftspunky@gmail.com", + "role": "Co-founder" + } + ], + "description": "System module for October CMS", + "homepage": "https://octobercms.com", + "keywords": [ + "october", + "october cms", + "system" + ], + "install-path": "../../modules/system" + }, + { + "name": "opis/closure", + "version": "3.6.3", + "version_normalized": "3.6.3.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "time": "2022-01-27T09:35:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Opis\\Closure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "install-path": "../opis/closure" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "version_normalized": "9.99.100.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2020-10-15T08:29:30+00:00", + "type": "library", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "install-path": "../paragonie/random_compat" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "version_normalized": "2.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "time": "2021-07-20T11:28:43+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "install-path": "../phar-io/manifest" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2022-02-21T01:04:05+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "install-path": "../phar-io/version" + }, + { + "name": "php-http/client-common", + "version": "2.6.0", + "version_normalized": "2.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/client-common.git", + "reference": "45db684cd4e186dcdc2b9c06b22970fe123796c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/client-common/zipball/45db684cd4e186dcdc2b9c06b22970fe123796c0", + "reference": "45db684cd4e186dcdc2b9c06b22970fe123796c0", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/httplug": "^2.0", + "php-http/message": "^1.6", + "php-http/message-factory": "^1.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "doctrine/instantiator": "^1.1", + "guzzlehttp/psr7": "^1.4", + "nyholm/psr7": "^1.2", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "phpspec/prophecy": "^1.10.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" + }, + "suggest": { + "ext-json": "To detect JSON responses with the ContentTypePlugin", + "ext-libxml": "To detect XML responses with the ContentTypePlugin", + "php-http/cache-plugin": "PSR-6 Cache plugin", + "php-http/logger-plugin": "PSR-3 Logger plugin", + "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" + }, + "time": "2022-09-29T09:59:43+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Client\\Common\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Common HTTP Client implementations and tools for HTTPlug", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "common", + "http", + "httplug" + ], + "support": { + "issues": "https://github.com/php-http/client-common/issues", + "source": "https://github.com/php-http/client-common/tree/2.6.0" + }, + "install-path": "../php-http/client-common" + }, + { + "name": "php-http/discovery", + "version": "1.15.2", + "version_normalized": "1.15.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/discovery.git", + "reference": "5cc428320191ac1d0b6520034c2dc0698628ced5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/discovery/zipball/5cc428320191ac1d0b6520034c2dc0698628ced5", + "reference": "5cc428320191ac1d0b6520034c2dc0698628ced5", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "nyholm/psr7": "<1.0" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" + }, + "time": "2023-02-11T08:28:41+00:00", + "type": "composer-plugin", + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "homepage": "http://php-http.org", + "keywords": [ + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr17", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.15.2" + }, + "install-path": "../php-http/discovery" + }, + { + "name": "php-http/guzzle7-adapter", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/guzzle7-adapter.git", + "reference": "fb075a71dbfa4847cf0c2938c4e5a9c478ef8b01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/guzzle7-adapter/zipball/fb075a71dbfa4847cf0c2938c4e5a9c478ef8b01", + "reference": "fb075a71dbfa4847cf0c2938c4e5a9c478ef8b01", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^7.0", + "php": "^7.2 | ^8.0", + "php-http/httplug": "^2.0", + "psr/http-client": "^1.0" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0", + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.0|^9.3" + }, + "time": "2021-03-09T07:35:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + } + ], + "description": "Guzzle 7 HTTP Adapter", + "homepage": "http://httplug.io", + "keywords": [ + "Guzzle", + "http" + ], + "support": { + "issues": "https://github.com/php-http/guzzle7-adapter/issues", + "source": "https://github.com/php-http/guzzle7-adapter/tree/1.0.0" + }, + "install-path": "../php-http/guzzle7-adapter" + }, + { + "name": "php-http/httplug", + "version": "2.3.0", + "version_normalized": "2.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "f640739f80dfa1152533976e3c112477f69274eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", + "reference": "f640739f80dfa1152533976e3c112477f69274eb", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/promise": "^1.1", + "psr/http-client": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage": "^4.1", + "phpspec/phpspec": "^5.1 || ^6.0" + }, + "time": "2022-02-21T09:52:22+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ], + "support": { + "issues": "https://github.com/php-http/httplug/issues", + "source": "https://github.com/php-http/httplug/tree/2.3.0" + }, + "install-path": "../php-http/httplug" + }, + { + "name": "php-http/message", + "version": "1.13.0", + "version_normalized": "1.13.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/message.git", + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361", + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361", + "shasum": "" + }, + "require": { + "clue/stream-filter": "^1.5", + "php": "^7.1 || ^8.0", + "php-http/message-factory": "^1.0.2", + "psr/http-message": "^1.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.6", + "ext-zlib": "*", + "guzzlehttp/psr7": "^1.0", + "laminas/laminas-diactoros": "^2.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "slim/slim": "^3.0" + }, + "suggest": { + "ext-zlib": "Used with compressor/decompressor streams", + "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", + "laminas/laminas-diactoros": "Used with Diactoros Factories", + "slim/slim": "Used with Slim Framework PSR-7 implementation" + }, + "time": "2022-02-11T13:41:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/filters.php" + ], + "psr-4": { + "Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTP Message related tools", + "homepage": "http://php-http.org", + "keywords": [ + "http", + "message", + "psr-7" + ], + "support": { + "issues": "https://github.com/php-http/message/issues", + "source": "https://github.com/php-http/message/tree/1.13.0" + }, + "install-path": "../php-http/message" + }, + { + "name": "php-http/message-factory", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/message-factory.git", + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "psr/http-message": "^1.0" + }, + "time": "2015-12-19T14:08:53+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Factory interfaces for PSR-7 HTTP Message", + "homepage": "http://php-http.org", + "keywords": [ + "factory", + "http", + "message", + "stream", + "uri" + ], + "support": { + "issues": "https://github.com/php-http/message-factory/issues", + "source": "https://github.com/php-http/message-factory/tree/master" + }, + "install-path": "../php-http/message-factory" + }, + { + "name": "php-http/promise", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", + "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage": "^4.3.2", + "phpspec/phpspec": "^5.1.2 || ^6.2" + }, + "time": "2020-07-07T09:29:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/php-http/promise/issues", + "source": "https://github.com/php-http/promise/tree/1.1.0" + }, + "install-path": "../php-http/promise" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.3.2", + "version_normalized": "1.3.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6483c9832e71973ed29cf71bd6b3f4fde438a9de", + "reference": "6483c9832e71973ed29cf71bd6b3f4fde438a9de", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.3.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", + "squizlabs/php_codesniffer": "^3.6" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "time": "2022-02-21T12:50:22+00:00", + "bin": [ + "parallel-lint" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "./src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "install-path": "../php-parallel-lint/php-parallel-lint" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.0", + "version_normalized": "1.9.0.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8", + "phpunit/phpunit": "^8.5.28 || ^9.5.21" + }, + "time": "2022-07-30T15:51:26+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "install-path": "../phpoption/phpoption" + }, + { + "name": "phpunit/php-code-coverage", + "version": "7.0.15", + "version_normalized": "7.0.15.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "819f92bba8b001d4363065928088de22f25a3a48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.2.2" + }, + "suggest": { + "ext-xdebug": "^2.7.2" + }, + "time": "2021-07-26T12:20:09+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-code-coverage" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "version_normalized": "2.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2021-12-02T12:42:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-file-iterator" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2015-06-21T13:50:34+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "install-path": "../phpunit/php-text-template" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "version_normalized": "2.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2020-11-30T08:20:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-timer" + }, + { + "name": "phpunit/php-token-stream", + "version": "4.0.4", + "version_normalized": "4.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "time": "2020-08-04T08:28:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "install-path": "../phpunit/php-token-stream" + }, + { + "name": "phpunit/phpunit", + "version": "8.5.32", + "version_normalized": "8.5.32.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "375686930d05c9fd7d20f6e5fc38121e8d7a9d55" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/375686930d05c9fd7d20f6e5fc38121e8d7a9d55", + "reference": "375686930d05c9fd7d20f6e5fc38121e8d7a9d55", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.5", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.5", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0.0" + }, + "time": "2023-01-26T08:30:25+00:00", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.32" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "install-path": "../phpunit/phpunit" + }, + { + "name": "psr/container", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "time": "2021-11-05T16:50:12+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "install-path": "../psr/container" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "time": "2020-06-29T06:28:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "install-path": "../psr/http-client" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "time": "2019-04-30T12:38:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "install-path": "../psr/http-factory" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T14:39:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "install-path": "../psr/http-message" + }, + { + "name": "psr/log", + "version": "1.1.4", + "version_normalized": "1.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2021-05-03T11:20:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "install-path": "../psr/log" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-10-23T01:57:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "install-path": "../psr/simple-cache" + }, + { + "name": "psy/psysh", + "version": "v0.11.12", + "version_normalized": "0.11.12.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/52cb7c47d403c31c0adc9bf7710fc355f93c20f7", + "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "nikic/php-parser": "^4.0 || ^3.1", + "php": "^8.0 || ^7.0.8", + "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + }, + "conflict": { + "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." + }, + "time": "2023-01-29T21:24:40+00:00", + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.11.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Psy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "support": { + "issues": "https://github.com/bobthecow/psysh/issues", + "source": "https://github.com/bobthecow/psysh/tree/v0.11.12" + }, + "install-path": "../psy/psysh" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "install-path": "../ralouphie/getallheaders" + }, + { + "name": "ramsey/uuid", + "version": "3.9.7", + "version_normalized": "3.9.7.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/dc75aa439eb4c1b77f5379fd958b3dc0e6014178", + "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178", + "shasum": "" + }, + "require": { + "ext-json": "*", + "paragonie/random_compat": "^1 | ^2 | ^9.99.99", + "php": "^5.4 | ^7.0 | ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1 | ^2", + "doctrine/annotations": "^1.2", + "goaop/framework": "1.0.0-alpha.2 | ^1 | >=2.1.0 <=2.3.2", + "mockery/mockery": "^0.9.11 | ^1", + "moontoast/math": "^1.1", + "nikic/php-parser": "<=4.5.0", + "paragonie/random-lib": "^2", + "php-mock/php-mock-phpunit": "^0.3 | ^1.1 | ^2.6", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpunit/phpunit": ">=4.8.36 <9.0.0 | >=9.3.0", + "squizlabs/php_codesniffer": "^3.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "time": "2022-12-19T21:55:10+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + }, + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "rss": "https://github.com/ramsey/uuid/releases.atom", + "source": "https://github.com/ramsey/uuid", + "wiki": "https://github.com/ramsey/uuid/wiki" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" + } + ], + "install-path": "../ramsey/uuid" + }, + { + "name": "scssphp/scssphp", + "version": "v1.11.0", + "version_normalized": "1.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/scssphp/scssphp.git", + "reference": "33749d12c2569bb24071f94e9af828662dabb068" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/scssphp/scssphp/zipball/33749d12c2569bb24071f94e9af828662dabb068", + "reference": "33749d12c2569bb24071f94e9af828662dabb068", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4", + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4", + "sass/sass-spec": "*", + "squizlabs/php_codesniffer": "~3.5", + "symfony/phpunit-bridge": "^5.1", + "thoughtbot/bourbon": "^7.0", + "twbs/bootstrap": "~5.0", + "twbs/bootstrap4": "4.6.1", + "zurb/foundation": "~6.5" + }, + "suggest": { + "ext-iconv": "Can be used as fallback when ext-mbstring is not available", + "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv" + }, + "time": "2022-09-02T21:24:55+00:00", + "bin": [ + "bin/pscss" + ], + "type": "library", + "extra": { + "bamarni-bin": { + "forward-command": false, + "bin-links": false + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ScssPhp\\ScssPhp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "homepage": "https://github.com/robocoder" + }, + { + "name": "Cédric Morin", + "email": "cedric@yterium.com", + "homepage": "https://github.com/Cerdic" + } + ], + "description": "scssphp is a compiler for SCSS written in PHP.", + "homepage": "http://scssphp.github.io/scssphp/", + "keywords": [ + "css", + "less", + "sass", + "scss", + "stylesheet" + ], + "install-path": "../scssphp/scssphp" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2020-11-30T08:15:22+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/code-unit-reverse-lookup" + }, + { + "name": "sebastian/comparator", + "version": "3.0.5", + "version_normalized": "3.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "time": "2022-09-14T12:31:48+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/comparator" + }, + { + "name": "sebastian/diff", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "time": "2020-11-30T07:59:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/diff" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "version_normalized": "4.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "time": "2020-11-30T07:53:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/environment" + }, + { + "name": "sebastian/exporter", + "version": "3.1.5", + "version_normalized": "3.1.5.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "time": "2022-09-14T06:00:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/exporter" + }, + { + "name": "sebastian/global-state", + "version": "3.0.2", + "version_normalized": "3.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "time": "2022-02-10T06:55:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/global-state" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "version_normalized": "3.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:40:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/object-enumerator" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:37:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/object-reflector" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2020-11-30T07:34:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/recursion-context" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2020-11-30T07:30:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/resource-operations" + }, + { + "name": "sebastian/type", + "version": "1.1.4", + "version_normalized": "1.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "time": "2020-11-30T07:25:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/type" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "time": "2016-10-03T07:35:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "install-path": "../sebastian/version" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.1", + "version_normalized": "3.7.1.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "time": "2022-06-18T07:21:10+00:00", + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "install-path": "../squizlabs/php_codesniffer" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.3.0", + "version_normalized": "6.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.0|^3.1", + "php": ">=7.0.0", + "symfony/polyfill-iconv": "^1.0", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "symfony/phpunit-bridge": "^4.4|^5.4" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses" + }, + "time": "2021-10-18T15:26:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/swiftmailer/swiftmailer", + "type": "tidelift" + } + ], + "abandoned": "symfony/mailer", + "install-path": "../swiftmailer/swiftmailer" + }, + { + "name": "symfony/console", + "version": "v4.4.49", + "version_normalized": "4.4.49.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "time": "2022-11-05T17:10:16+00:00", + "type": "library", + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/console" + }, + { + "name": "symfony/css-selector", + "version": "v5.4.19", + "version_normalized": "5.4.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "f4a7d150f5b9e8f974f6f127d8167e420d11fc62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4a7d150f5b9e8f974f6f127d8167e420d11fc62", + "reference": "f4a7d150f5b9e8f974f6f127d8167e420d11fc62", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2023-01-01T08:32:19+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v5.4.19" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/css-selector" + }, + { + "name": "symfony/debug", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "1a692492190773c5310bc7877cb590c04c2f05be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", + "reference": "1a692492190773c5310bc7877cb590c04c2f05be", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "^3.4|^4.0|^5.0" + }, + "time": "2022-07-28T16:29:46+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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": "Provides tools to ease debugging PHP code", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "abandoned": "symfony/error-handler", + "install-path": "../symfony/debug" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.2", + "version_normalized": "2.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/deprecation-contracts" + }, + { + "name": "symfony/error-handler", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "be731658121ef2d8be88f3a1ec938148a9237291" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/be731658121ef2d8be88f3a1ec938148a9237291", + "reference": "be731658121ef2d8be88f3a1ec938148a9237291", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2|^3", + "symfony/debug": "^4.4.5", + "symfony/var-dumper": "^4.4|^5.0" + }, + "require-dev": { + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "time": "2022-07-28T16:29:46+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "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": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/error-handler" + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1e866e9e5c1b22168e0ce5f0b467f19bba61266a", + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/event-dispatcher-contracts": "^1.1", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/error-handler": "~3.4|~4.4", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "time": "2022-07-20T09:59:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/event-dispatcher" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.13", + "version_normalized": "1.1.13.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e", + "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e", + "shasum": "" + }, + "require": { + "php": ">=7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "time": "2022-01-02T09:41:36+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "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 dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/event-dispatcher-contracts" + }, + { + "name": "symfony/finder", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "66bd787edb5e42ff59d3523f623895af05043e4f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/66bd787edb5e42ff59d3523f623895af05043e4f", + "reference": "66bd787edb5e42ff59d3523f623895af05043e4f", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2022-07-29T07:35:46+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/finder" + }, + { + "name": "symfony/http-client-contracts", + "version": "v2.5.2", + "version_normalized": "2.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", + "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "time": "2022-04-12T15:48:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "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 HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/http-client-contracts" + }, + { + "name": "symfony/http-foundation", + "version": "v4.4.49", + "version_normalized": "4.4.49.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "191413c7b832c015bb38eae963f2e57498c3c173" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/191413c7b832c015bb38eae963f2e57498c3c173", + "reference": "191413c7b832c015bb38eae963f2e57498c3c173", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/mime": "^4.3|^5.0", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "^3.4|^4.0|^5.0" + }, + "time": "2022-11-04T16:17:57+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/http-foundation" + }, + { + "name": "symfony/http-kernel", + "version": "v4.4.50", + "version_normalized": "4.4.50.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/aa6df6c045f034aa13ac752fc234bb300b9488ef", + "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "^1|^2", + "symfony/error-handler": "^4.4", + "symfony/event-dispatcher": "^4.4", + "symfony/http-client-contracts": "^1.1|^2", + "symfony/http-foundation": "^4.4.30|^5.3.7", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/browser-kit": "<4.3", + "symfony/config": "<3.4", + "symfony/console": ">=5", + "symfony/dependency-injection": "<4.3", + "symfony/translation": "<4.2", + "twig/twig": "<1.43|<2.13,>=2" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^4.3|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0", + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^4.3|^5.0", + "symfony/dom-crawler": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/stopwatch": "^3.4|^4.0|^5.0", + "symfony/templating": "^3.4|^4.0|^5.0", + "symfony/translation": "^4.2|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^1.43|^2.13|^3.0.4" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "" + }, + "time": "2023-02-01T08:01:31+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v4.4.50" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/http-kernel" + }, + { + "name": "symfony/mime", + "version": "v5.4.19", + "version_normalized": "5.4.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "a858429a9c704edc53fe057228cf9ca282ba48eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/a858429a9c704edc53fe057228cf9ca282ba48eb", + "reference": "a858429a9c704edc53fe057228cf9ca282ba48eb", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4", + "symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1|^4", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.4.14|~6.0.14|^6.1.6" + }, + "time": "2023-01-09T05:43:46+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "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": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.4.19" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/mime" + }, + { + "name": "symfony/options-resolver", + "version": "v5.4.19", + "version_normalized": "5.4.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "b03c99236445492f20c61666e8f7e5d388b078e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b03c99236445492f20c61666e8f7e5d388b078e5", + "reference": "b03c99236445492f20c61666e8f7e5d388b078e5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2023-01-01T08:32:19+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.19" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/options-resolver" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-ctype" + }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "927013f3aac555983a5059aada98e1907d842695" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/927013f3aac555983a5059aada98e1907d842695", + "reference": "927013f3aac555983a5059aada98e1907d842695", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-iconv": "*" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-iconv" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "639084e360537a19f9ee352433b84ce831f3d2da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", + "reference": "639084e360537a19f9ee352433b84ce831f3d2da", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-intl-idn" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-intl-normalizer" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-mbstring" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "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.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php72" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "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" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php73" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php80" + }, + { + "name": "symfony/process", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2022-06-27T13:16:42+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/process" + }, + { + "name": "symfony/routing", + "version": "v4.4.44", + "version_normalized": "4.4.44.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/f7751fd8b60a07f3f349947a309b5bdfce22d6ae", + "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "psr/log": "^1|^2|^3", + "symfony/config": "^4.2|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "time": "2022-07-20T09:59:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "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": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/routing" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.2", + "version_normalized": "2.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "time": "2022-05-30T19:17:29+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/service-contracts" + }, + { + "name": "symfony/translation", + "version": "v4.4.47", + "version_normalized": "4.4.47.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/45036b1d53accc48fe9bab71ccd86d57eba0dd94", + "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1.6|^2" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "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/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "time": "2022-10-03T15:15:11+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "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": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/translation" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.2", + "version_normalized": "2.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "time": "2022-06-27T16:58:25+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "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 translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/translation-contracts" + }, + { + "name": "symfony/var-dumper", + "version": "v4.4.47", + "version_normalized": "4.4.47.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "1069c7a3fca74578022fab6f81643248d02f8e63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63", + "reference": "1069c7a3fca74578022fab6f81643248d02f8e63", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^1.43|^2.13|^3.0.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "time": "2022-10-03T15:15:11+00:00", + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/var-dumper" + }, + { + "name": "symfony/yaml", + "version": "v3.4.47", + "version_normalized": "3.4.47.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "88289caa3c166321883f67fe5130188ebbb47094" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", + "reference": "88289caa3c166321883f67fe5130188ebbb47094", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "time": "2020-10-24T10:57:07+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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 Yaml Component", + "homepage": "https://symfony.com", + "install-path": "../symfony/yaml" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "time": "2021-07-28T10:34:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "install-path": "../theseer/tokenizer" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.6", + "version_normalized": "2.2.6.0", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/c42125b83a4fa63b187fdf29f9c93cb7733da30c", + "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.5 || ^7.0 || ^8.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + }, + "time": "2023-01-03T09:29:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.6" + }, + "install-path": "../tijsverkoyen/css-to-inline-styles" + }, + { + "name": "twig/twig", + "version": "v2.15.4", + "version_normalized": "2.15.4.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "3e059001d6d597dd50ea7c74dd2464b4adea48d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3e059001d6d597dd50ea7c74dd2464b4adea48d3", + "reference": "3e059001d6d597dd50ea7c74dd2464b4adea48d3", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.8" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "time": "2022-12-27T12:26:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.15-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v2.15.4" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "install-path": "../twig/twig" + }, + { + "name": "vlucas/phpdotenv", + "version": "v3.6.10", + "version_normalized": "3.6.10.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5b547cdb25825f10251370f57ba5d9d924e6f68e", + "reference": "5b547cdb25825f10251370f57ba5d9d924e6f68e", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.5.2", + "symfony/polyfill-ctype": "^1.17" + }, + "require-dev": { + "ext-filter": "*", + "ext-pcre": "*", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator.", + "ext-pcre": "Required to use most of the library." + }, + "time": "2021-12-12T23:02:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "install-path": "../vlucas/phpdotenv" + }, + { + "name": "wikimedia/composer-merge-plugin", + "version": "dev-feature/composer-v2", + "version_normalized": "dev-feature/composer-v2", + "source": { + "type": "git", + "url": "https://github.com/daftspunk/composer-merge-plugin.git", + "reference": "a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/daftspunk/composer-merge-plugin/zipball/a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6", + "reference": "a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1||^2.0", + "php": ">=7.2.0" + }, + "require-dev": { + "composer/composer": "^1.1", + "php-parallel-lint/php-parallel-lint": "~1.1.0", + "phpunit/phpunit": "^8.5||^9.0", + "squizlabs/php_codesniffer": "~3.5.4" + }, + "time": "2020-11-20T15:38:00+00:00", + "type": "composer-plugin", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + }, + "class": "Wikimedia\\Composer\\MergePlugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Wikimedia\\Composer\\": "src/" + } + }, + "scripts": { + "test": [ + "composer validate --no-interaction", + "parallel-lint src tests", + "phpunit --log-junit=reports/unitreport.xml --coverage-text --coverage-html=reports/coverage --coverage-clover=reports/coverage.xml", + "phpcs --encoding=utf-8 --standard=PSR2 --report-checkstyle=reports/checkstyle-phpcs.xml --report-full --extensions=php src/* tests/phpunit/*" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bryan Davis", + "email": "bd808@wikimedia.org" + } + ], + "description": "Composer plugin to merge multiple composer.json files", + "support": { + "source": "https://github.com/octoberrain/composer-merge-plugin/tree/feature/composer-v2" + }, + "install-path": "../wikimedia/composer-merge-plugin" + }, + { + "name": "wikimedia/less.php", + "version": "v3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/less.php.git", + "reference": "0d5b30ba792bdbf8991a646fc9c30561b38a5559" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/less.php/zipball/0d5b30ba792bdbf8991a646fc9c30561b38a5559", + "reference": "0d5b30ba792bdbf8991a646fc9c30561b38a5559", + "shasum": "" + }, + "require": { + "php": ">=7.2.9" + }, + "require-dev": { + "mediawiki/mediawiki-codesniffer": "40.0.1", + "mediawiki/mediawiki-phan-config": "0.12.0", + "mediawiki/minus-x": "1.1.1", + "php-parallel-lint/php-console-highlighter": "1.0.0", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpunit/phpunit": "^8.5" + }, + "time": "2023-02-03T06:43:41+00:00", + "bin": [ + "bin/lessc" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Less": "lib/" + }, + "classmap": [ + "lessc.inc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Timo Tijhof", + "homepage": "https://timotijhof.net" + }, + { + "name": "Josh Schmidt", + "homepage": "https://github.com/oyejorge" + }, + { + "name": "Matt Agar", + "homepage": "https://github.com/agar" + }, + { + "name": "Martin Jantošovič", + "homepage": "https://github.com/Mordred" + } + ], + "description": "PHP port of the LESS processor", + "homepage": "https://gerrit.wikimedia.org/g/mediawiki/libs/less.php", + "keywords": [ + "css", + "less", + "less.js", + "lesscss", + "php", + "stylesheet" + ], + "support": { + "issues": "https://github.com/wikimedia/less.php/issues", + "source": "https://github.com/wikimedia/less.php/tree/v3.2.1" + }, + "install-path": "../wikimedia/less.php" } - }, - { - "name": "wikimedia/less.php", - "version": "v2.0.0", - "version_normalized": "2.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/less.php.git", - "reference": "c1affb4d4472c9e100fc80bf456b4334862ace3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/less.php/zipball/c1affb4d4472c9e100fc80bf456b4334862ace3c", - "reference": "c1affb4d4472c9e100fc80bf456b4334862ace3c", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "7.5.14" - }, - "time": "2020-02-04T22:36:29+00:00", - "bin": [ - "bin/lessc" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Less": "lib/" - }, - "classmap": [ - "lessc.inc.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Josh Schmidt", - "homepage": "https://github.com/oyejorge" - }, - { - "name": "Matt Agar", - "homepage": "https://github.com/agar" - }, - { - "name": "Martin Jantošovič", - "homepage": "https://github.com/Mordred" - } - ], - "description": "PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)", - "keywords": [ - "css", - "less", - "less.js", - "lesscss", - "php", - "stylesheet" - ] - } -] + ], + "dev": true, + "dev-package-names": [ + "dms/phpunit-arraysubset-asserts", + "doctrine/instantiator", + "fzaninotto/faker", + "hamcrest/hamcrest-php", + "meyfa/phpunit-assert-gd", + "mockery/mockery", + "myclabs/deep-copy", + "phar-io/manifest", + "phar-io/version", + "php-parallel-lint/php-parallel-lint", + "phpunit/php-code-coverage", + "phpunit/php-file-iterator", + "phpunit/php-text-template", + "phpunit/php-timer", + "phpunit/php-token-stream", + "phpunit/phpunit", + "sebastian/code-unit-reverse-lookup", + "sebastian/comparator", + "sebastian/diff", + "sebastian/environment", + "sebastian/exporter", + "sebastian/global-state", + "sebastian/object-enumerator", + "sebastian/object-reflector", + "sebastian/recursion-context", + "sebastian/resource-operations", + "sebastian/type", + "sebastian/version", + "squizlabs/php_codesniffer", + "theseer/tokenizer" + ] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100644 index 000000000..1c16398cb --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,1407 @@ + + array ( + 'pretty_version' => '1.1.x-dev', + 'version' => '1.1.9999999.9999999-dev', + 'aliases' => + array ( + ), + 'reference' => 'c51149dba60398ac92d58c33b81c1cfe57a81513', + 'name' => 'october/october', + ), + 'versions' => + array ( + 'clue/stream-filter' => + array ( + 'pretty_version' => 'v1.6.0', + 'version' => '1.6.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd6169430c7731d8509da7aecd0af756a5747b78e', + ), + 'composer/installers' => + array ( + 'pretty_version' => 'v1.12.0', + 'version' => '1.12.0.0', + 'aliases' => + array ( + ), + 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', + ), + 'cordoval/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'davedevelopment/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'dms/phpunit-arraysubset-asserts' => + array ( + 'pretty_version' => 'v0.1.1', + 'version' => '0.1.1.0', + 'aliases' => + array ( + ), + 'reference' => '1fc5a0f3db1d0c440a7c6b8834917888247f8f42', + ), + 'doctrine/cache' => + array ( + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '1ca8f21980e770095a31456042471a57bc4c68fb', + ), + 'doctrine/dbal' => + array ( + 'pretty_version' => '2.13.9', + 'version' => '2.13.9.0', + 'aliases' => + array ( + ), + 'reference' => 'c480849ca3ad6706a39c970cdfe6888fa8a058b8', + ), + 'doctrine/deprecations' => + array ( + 'pretty_version' => 'v1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de', + ), + 'doctrine/event-manager' => + array ( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '95aa4cb529f1e96576f3fda9f5705ada4056a520', + ), + 'doctrine/inflector' => + array ( + 'pretty_version' => '2.0.6', + 'version' => '2.0.6.0', + 'aliases' => + array ( + ), + 'reference' => 'd9d313a36c872fd6ee06d9a6cbcf713eaa40f024', + ), + 'doctrine/instantiator' => + array ( + 'pretty_version' => '1.5.0', + 'version' => '1.5.0.0', + 'aliases' => + array ( + ), + 'reference' => '0a0fa9780f5d4e507415a065172d26a98d02047b', + ), + 'doctrine/lexer' => + array ( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'aliases' => + array ( + ), + 'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229', + ), + 'dragonmantank/cron-expression' => + array ( + 'pretty_version' => 'v2.3.1', + 'version' => '2.3.1.0', + 'aliases' => + array ( + ), + 'reference' => '65b2d8ee1f10915efb3b55597da3404f096acba2', + ), + 'egulias/email-validator' => + array ( + 'pretty_version' => '2.1.25', + 'version' => '2.1.25.0', + 'aliases' => + array ( + ), + 'reference' => '0dbf5d78455d4d6a41d186da50adc1122ec066f4', + ), + 'erusev/parsedown' => + array ( + 'pretty_version' => '1.7.4', + 'version' => '1.7.4.0', + 'aliases' => + array ( + ), + 'reference' => 'cb17b6477dfff935958ba01325f2e8a2bfa6dab3', + ), + 'erusev/parsedown-extra' => + array ( + 'pretty_version' => '0.8.1', + 'version' => '0.8.1.0', + 'aliases' => + array ( + ), + 'reference' => '91ac3ff98f0cea243bdccc688df43810f044dcef', + ), + 'fzaninotto/faker' => + array ( + 'pretty_version' => 'v1.9.2', + 'version' => '1.9.2.0', + 'aliases' => + array ( + ), + 'reference' => '848d8125239d7dbf8ab25cb7f054f1a630e68c2e', + ), + 'grogy/php-parallel-lint' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'guzzlehttp/guzzle' => + array ( + 'pretty_version' => '7.5.0', + 'version' => '7.5.0.0', + 'aliases' => + array ( + ), + 'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba', + ), + 'guzzlehttp/promises' => + array ( + 'pretty_version' => '1.5.2', + 'version' => '1.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'b94b2807d85443f9719887892882d0329d1e2598', + ), + 'guzzlehttp/psr7' => + array ( + 'pretty_version' => '2.4.3', + 'version' => '2.4.3.0', + 'aliases' => + array ( + ), + 'reference' => '67c26b443f348a51926030c83481b85718457d3d', + ), + 'hamcrest/hamcrest-php' => + array ( + 'pretty_version' => 'v2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '8c3d0a3f6af734494ad8f6fbbee0ba92422859f3', + ), + 'http-interop/http-factory-guzzle' => + array ( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'aliases' => + array ( + ), + 'reference' => '8f06e92b95405216b237521cc64c804dd44c4a81', + ), + 'illuminate/auth' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/broadcasting' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/bus' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cache' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/config' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/console' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/container' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/contracts' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/cookie' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/database' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/encryption' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/events' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/filesystem' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/hashing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/http' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/log' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/mail' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/notifications' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pagination' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/pipeline' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/queue' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/redis' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/routing' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/session' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/support' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/translation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/validation' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'illuminate/view' => + array ( + 'replaced' => + array ( + 0 => 'v6.20.44', + ), + ), + 'jakub-onderka/php-parallel-lint' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'kodova/hamcrest-php' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'laravel/framework' => + array ( + 'pretty_version' => 'v6.20.44', + 'version' => '6.20.44.0', + 'aliases' => + array ( + ), + 'reference' => '505ebcdeaa9ca56d6d7dbf38ed4f53998c973ed0', + ), + 'laravel/scout' => + array ( + 'pretty_version' => 'v8.6.1', + 'version' => '8.6.1.0', + 'aliases' => + array ( + ), + 'reference' => '7fb1c860a2fd904f0e084a7cc3641eb1448ba278', + ), + 'laravel/tinker' => + array ( + 'pretty_version' => 'v2.8.0', + 'version' => '2.8.0.0', + 'aliases' => + array ( + ), + 'reference' => '74d0b287cc4ae65d15c368dd697aae71d62a73ad', + ), + 'league/commonmark' => + array ( + 'pretty_version' => '1.6.7', + 'version' => '1.6.7.0', + 'aliases' => + array ( + ), + 'reference' => '2b8185c13bc9578367a5bf901881d1c1b5bbd09b', + ), + 'league/csv' => + array ( + 'pretty_version' => '9.8.0', + 'version' => '9.8.0.0', + 'aliases' => + array ( + ), + 'reference' => '9d2e0265c5d90f5dd601bc65ff717e05cec19b47', + ), + 'league/flysystem' => + array ( + 'pretty_version' => '1.1.10', + 'version' => '1.1.10.0', + 'aliases' => + array ( + ), + 'reference' => '3239285c825c152bcc315fe0e87d6b55f5972ed1', + ), + 'league/mime-type-detection' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => 'ff6248ea87a9f116e78edd6002e39e5128a0d4dd', + ), + 'linkorb/jsmin-php' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'be85d87fc9c27730e7e9ced742b13010dafc1026', + ), + 'meilisearch/meilisearch-laravel-scout' => + array ( + 'pretty_version' => 'v0.12.5', + 'version' => '0.12.5.0', + 'aliases' => + array ( + ), + 'reference' => 'e180d66163c79248f48bb15d0ea3081b073c9593', + ), + 'meilisearch/meilisearch-php' => + array ( + 'pretty_version' => 'v0.17.2', + 'version' => '0.17.2.0', + 'aliases' => + array ( + ), + 'reference' => 'a200a32093ae44c04523f6fd014ec888707ceb9e', + ), + 'meyfa/phpunit-assert-gd' => + array ( + 'pretty_version' => 'v2.1.0', + 'version' => '2.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '9e39d550616d61d522ef935f1db1cd2e368ac0f0', + ), + 'mockery/mockery' => + array ( + 'pretty_version' => '1.5.1', + 'version' => '1.5.1.0', + 'aliases' => + array ( + ), + 'reference' => 'e92dcc83d5a51851baf5f5591d32cb2b16e3684e', + ), + 'monolog/monolog' => + array ( + 'pretty_version' => '2.9.1', + 'version' => '2.9.1.0', + 'aliases' => + array ( + ), + 'reference' => 'f259e2b15fb95494c83f52d3caad003bbf5ffaa1', + ), + 'myclabs/deep-copy' => + array ( + 'pretty_version' => '1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614', + ), + 'nesbot/carbon' => + array ( + 'pretty_version' => '2.66.0', + 'version' => '2.66.0.0', + 'aliases' => + array ( + ), + 'reference' => '496712849902241f04902033b0441b269effe001', + ), + 'nikic/php-parser' => + array ( + 'pretty_version' => 'v4.15.3', + 'version' => '4.15.3.0', + 'aliases' => + array ( + ), + 'reference' => '570e980a201d8ed0236b0a62ddf2c9cbb2034039', + ), + 'october/backend' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => '6c539bebcd189b5c5f7a919faad9d06985499f3b', + ), + 'october/cms' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => '7ca98fc2205710fe235f588ce094b0b13105636a', + ), + 'october/october' => + array ( + 'pretty_version' => '1.1.x-dev', + 'version' => '1.1.9999999.9999999-dev', + 'aliases' => + array ( + ), + 'reference' => 'c51149dba60398ac92d58c33b81c1cfe57a81513', + ), + 'october/rain' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => 'd8388eadcc6cbbc302468400a58aea71aa92115c', + ), + 'october/system' => + array ( + 'pretty_version' => 'v1.1.12', + 'version' => '1.1.12.0', + 'aliases' => + array ( + ), + 'reference' => 'cffaaaf12075302089995fd795677a16bef94787', + ), + 'opis/closure' => + array ( + 'pretty_version' => '3.6.3', + 'version' => '3.6.3.0', + 'aliases' => + array ( + ), + 'reference' => '3d81e4309d2a927abbe66df935f4bb60082805ad', + ), + 'paragonie/random_compat' => + array ( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'aliases' => + array ( + ), + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + ), + 'phar-io/manifest' => + array ( + 'pretty_version' => '2.0.3', + 'version' => '2.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '97803eca37d319dfa7826cc2437fc020857acb53', + ), + 'phar-io/version' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + ), + 'php-http/async-client-implementation' => + array ( + 'provided' => + array ( + 0 => '*', + 1 => '1.0', + ), + ), + 'php-http/client-common' => + array ( + 'pretty_version' => '2.6.0', + 'version' => '2.6.0.0', + 'aliases' => + array ( + ), + 'reference' => '45db684cd4e186dcdc2b9c06b22970fe123796c0', + ), + 'php-http/client-implementation' => + array ( + 'provided' => + array ( + 0 => '*', + 1 => '1.0', + ), + ), + 'php-http/discovery' => + array ( + 'pretty_version' => '1.15.2', + 'version' => '1.15.2.0', + 'aliases' => + array ( + ), + 'reference' => '5cc428320191ac1d0b6520034c2dc0698628ced5', + ), + 'php-http/guzzle7-adapter' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fb075a71dbfa4847cf0c2938c4e5a9c478ef8b01', + ), + 'php-http/httplug' => + array ( + 'pretty_version' => '2.3.0', + 'version' => '2.3.0.0', + 'aliases' => + array ( + ), + 'reference' => 'f640739f80dfa1152533976e3c112477f69274eb', + ), + 'php-http/message' => + array ( + 'pretty_version' => '1.13.0', + 'version' => '1.13.0.0', + 'aliases' => + array ( + ), + 'reference' => '7886e647a30a966a1a8d1dad1845b71ca8678361', + ), + 'php-http/message-factory' => + array ( + 'pretty_version' => 'v1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1', + ), + 'php-http/message-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'php-http/promise' => + array ( + 'pretty_version' => '1.1.0', + 'version' => '1.1.0.0', + 'aliases' => + array ( + ), + 'reference' => '4c4c1f9b7289a2ec57cde7f1e9762a5789506f88', + ), + 'php-parallel-lint/php-parallel-lint' => + array ( + 'pretty_version' => 'v1.3.2', + 'version' => '1.3.2.0', + 'aliases' => + array ( + ), + 'reference' => '6483c9832e71973ed29cf71bd6b3f4fde438a9de', + ), + 'phpoption/phpoption' => + array ( + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', + 'aliases' => + array ( + ), + 'reference' => 'dc5ff11e274a90cc1c743f66c9ad700ce50db9ab', + ), + 'phpunit/php-code-coverage' => + array ( + 'pretty_version' => '7.0.15', + 'version' => '7.0.15.0', + 'aliases' => + array ( + ), + 'reference' => '819f92bba8b001d4363065928088de22f25a3a48', + ), + 'phpunit/php-file-iterator' => + array ( + 'pretty_version' => '2.0.5', + 'version' => '2.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5', + ), + 'phpunit/php-text-template' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686', + ), + 'phpunit/php-timer' => + array ( + 'pretty_version' => '2.1.3', + 'version' => '2.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '2454ae1765516d20c4ffe103d85a58a9a3bd5662', + ), + 'phpunit/php-token-stream' => + array ( + 'pretty_version' => '4.0.4', + 'version' => '4.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'a853a0e183b9db7eed023d7933a858fa1c8d25a3', + ), + 'phpunit/phpunit' => + array ( + 'pretty_version' => '8.5.32', + 'version' => '8.5.32.0', + 'aliases' => + array ( + ), + 'reference' => '375686930d05c9fd7d20f6e5fc38121e8d7a9d55', + ), + 'psr/container' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea', + ), + 'psr/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'psr/http-client' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + ), + 'psr/http-client-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '*', + ), + ), + 'psr/http-factory' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + ), + 'psr/http-factory-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '^1.0', + 2 => '*', + ), + ), + 'psr/http-message' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', + ), + 'psr/http-message-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + 1 => '*', + ), + ), + 'psr/log' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', + ), + 'psr/log-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0.0 || 2.0.0 || 3.0.0', + 1 => '1.0|2.0', + ), + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'psy/psysh' => + array ( + 'pretty_version' => 'v0.11.12', + 'version' => '0.11.12.0', + 'aliases' => + array ( + ), + 'reference' => '52cb7c47d403c31c0adc9bf7710fc355f93c20f7', + ), + 'ralouphie/getallheaders' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + ), + 'ramsey/uuid' => + array ( + 'pretty_version' => '3.9.7', + 'version' => '3.9.7.0', + 'aliases' => + array ( + ), + 'reference' => 'dc75aa439eb4c1b77f5379fd958b3dc0e6014178', + ), + 'rhumsaa/uuid' => + array ( + 'replaced' => + array ( + 0 => '3.9.7', + ), + ), + 'roundcube/plugin-installer' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'scssphp/scssphp' => + array ( + 'pretty_version' => 'v1.11.0', + 'version' => '1.11.0.0', + 'aliases' => + array ( + ), + 'reference' => '33749d12c2569bb24071f94e9af828662dabb068', + ), + 'sebastian/code-unit-reverse-lookup' => + array ( + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', + ), + 'sebastian/comparator' => + array ( + 'pretty_version' => '3.0.5', + 'version' => '3.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '1dc7ceb4a24aede938c7af2a9ed1de09609ca770', + ), + 'sebastian/diff' => + array ( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'aliases' => + array ( + ), + 'reference' => '14f72dd46eaf2f2293cbe79c93cc0bc43161a211', + ), + 'sebastian/environment' => + array ( + 'pretty_version' => '4.2.4', + 'version' => '4.2.4.0', + 'aliases' => + array ( + ), + 'reference' => 'd47bbbad83711771f167c72d4e3f25f7fcc1f8b0', + ), + 'sebastian/exporter' => + array ( + 'pretty_version' => '3.1.5', + 'version' => '3.1.5.0', + 'aliases' => + array ( + ), + 'reference' => '73a9676f2833b9a7c36968f9d882589cd75511e6', + ), + 'sebastian/global-state' => + array ( + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'aliases' => + array ( + ), + 'reference' => 'de036ec91d55d2a9e0db2ba975b512cdb1c23921', + ), + 'sebastian/object-enumerator' => + array ( + 'pretty_version' => '3.0.4', + 'version' => '3.0.4.0', + 'aliases' => + array ( + ), + 'reference' => 'e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2', + ), + 'sebastian/object-reflector' => + array ( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'aliases' => + array ( + ), + 'reference' => '9b8772b9cbd456ab45d4a598d2dd1a1bced6363d', + ), + 'sebastian/recursion-context' => + array ( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '367dcba38d6e1977be014dc4b22f47a484dac7fb', + ), + 'sebastian/resource-operations' => + array ( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'aliases' => + array ( + ), + 'reference' => '31d35ca87926450c44eae7e2611d45a7a65ea8b3', + ), + 'sebastian/type' => + array ( + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', + 'aliases' => + array ( + ), + 'reference' => '0150cfbc4495ed2df3872fb31b26781e4e077eb4', + ), + 'sebastian/version' => + array ( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019', + ), + 'shama/baton' => + array ( + 'replaced' => + array ( + 0 => '*', + ), + ), + 'squizlabs/php_codesniffer' => + array ( + 'pretty_version' => '3.7.1', + 'version' => '3.7.1.0', + 'aliases' => + array ( + ), + 'reference' => '1359e176e9307e906dc3d890bcc9603ff6d90619', + ), + 'swiftmailer/swiftmailer' => + array ( + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'aliases' => + array ( + ), + 'reference' => '8a5d5072dca8f48460fce2f4131fcc495eec654c', + ), + 'symfony/console' => + array ( + 'pretty_version' => 'v4.4.49', + 'version' => '4.4.49.0', + 'aliases' => + array ( + ), + 'reference' => '33fa45ffc81fdcc1ca368d4946da859c8cdb58d9', + ), + 'symfony/css-selector' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'f4a7d150f5b9e8f974f6f127d8167e420d11fc62', + ), + 'symfony/debug' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '1a692492190773c5310bc7877cb590c04c2f05be', + ), + 'symfony/deprecation-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66', + ), + 'symfony/error-handler' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => 'be731658121ef2d8be88f3a1ec938148a9237291', + ), + 'symfony/event-dispatcher' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '1e866e9e5c1b22168e0ce5f0b467f19bba61266a', + ), + 'symfony/event-dispatcher-contracts' => + array ( + 'pretty_version' => 'v1.1.13', + 'version' => '1.1.13.0', + 'aliases' => + array ( + ), + 'reference' => '1d5cd762abaa6b2a4169d3e77610193a7157129e', + ), + 'symfony/event-dispatcher-implementation' => + array ( + 'provided' => + array ( + 0 => '1.1', + ), + ), + 'symfony/finder' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '66bd787edb5e42ff59d3523f623895af05043e4f', + ), + 'symfony/http-client-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => 'ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70', + ), + 'symfony/http-foundation' => + array ( + 'pretty_version' => 'v4.4.49', + 'version' => '4.4.49.0', + 'aliases' => + array ( + ), + 'reference' => '191413c7b832c015bb38eae963f2e57498c3c173', + ), + 'symfony/http-kernel' => + array ( + 'pretty_version' => 'v4.4.50', + 'version' => '4.4.50.0', + 'aliases' => + array ( + ), + 'reference' => 'aa6df6c045f034aa13ac752fc234bb300b9488ef', + ), + 'symfony/mime' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'a858429a9c704edc53fe057228cf9ca282ba48eb', + ), + 'symfony/options-resolver' => + array ( + 'pretty_version' => 'v5.4.19', + 'version' => '5.4.19.0', + 'aliases' => + array ( + ), + 'reference' => 'b03c99236445492f20c61666e8f7e5d388b078e5', + ), + 'symfony/polyfill-ctype' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a', + ), + 'symfony/polyfill-iconv' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '927013f3aac555983a5059aada98e1907d842695', + ), + 'symfony/polyfill-intl-idn' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '639084e360537a19f9ee352433b84ce831f3d2da', + ), + 'symfony/polyfill-intl-normalizer' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '19bd1e4fcd5b91116f14d8533c57831ed00571b6', + ), + 'symfony/polyfill-mbstring' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534', + ), + 'symfony/polyfill-php72' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '869329b1e9894268a8a61dabb69153029b7a8c97', + ), + 'symfony/polyfill-php73' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9', + ), + 'symfony/polyfill-php80' => + array ( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'aliases' => + array ( + ), + 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', + ), + 'symfony/process' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => '5cee9cdc4f7805e2699d9fd66991a0e6df8252a2', + ), + 'symfony/routing' => + array ( + 'pretty_version' => 'v4.4.44', + 'version' => '4.4.44.0', + 'aliases' => + array ( + ), + 'reference' => 'f7751fd8b60a07f3f349947a309b5bdfce22d6ae', + ), + 'symfony/service-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c', + ), + 'symfony/translation' => + array ( + 'pretty_version' => 'v4.4.47', + 'version' => '4.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '45036b1d53accc48fe9bab71ccd86d57eba0dd94', + ), + 'symfony/translation-contracts' => + array ( + 'pretty_version' => 'v2.5.2', + 'version' => '2.5.2.0', + 'aliases' => + array ( + ), + 'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe', + ), + 'symfony/translation-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0|2.0', + ), + ), + 'symfony/var-dumper' => + array ( + 'pretty_version' => 'v4.4.47', + 'version' => '4.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '1069c7a3fca74578022fab6f81643248d02f8e63', + ), + 'symfony/yaml' => + array ( + 'pretty_version' => 'v3.4.47', + 'version' => '3.4.47.0', + 'aliases' => + array ( + ), + 'reference' => '88289caa3c166321883f67fe5130188ebbb47094', + ), + 'theseer/tokenizer' => + array ( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e', + ), + 'tijsverkoyen/css-to-inline-styles' => + array ( + 'pretty_version' => '2.2.6', + 'version' => '2.2.6.0', + 'aliases' => + array ( + ), + 'reference' => 'c42125b83a4fa63b187fdf29f9c93cb7733da30c', + ), + 'twig/twig' => + array ( + 'pretty_version' => 'v2.15.4', + 'version' => '2.15.4.0', + 'aliases' => + array ( + ), + 'reference' => '3e059001d6d597dd50ea7c74dd2464b4adea48d3', + ), + 'vlucas/phpdotenv' => + array ( + 'pretty_version' => 'v3.6.10', + 'version' => '3.6.10.0', + 'aliases' => + array ( + ), + 'reference' => '5b547cdb25825f10251370f57ba5d9d924e6f68e', + ), + 'wikimedia/composer-merge-plugin' => + array ( + 'pretty_version' => 'dev-feature/composer-v2', + 'version' => 'dev-feature/composer-v2', + 'aliases' => + array ( + 0 => '1.5.0', + ), + 'reference' => 'a8c5a89c6057c6861c79f232ef0b311dc2ec4aa6', + ), + 'wikimedia/less.php' => + array ( + 'pretty_version' => 'v3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '0d5b30ba792bdbf8991a646fc9c30561b38a5559', + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index a8b98d5ce..580fa9609 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 70205)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70400)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/vendor/doctrine/instantiator/README.md b/vendor/doctrine/instantiator/README.md index 4bc02b655..1fa956796 100644 --- a/vendor/doctrine/instantiator/README.md +++ b/vendor/doctrine/instantiator/README.md @@ -14,7 +14,7 @@ This library provides a way of avoiding usage of constructors when instantiating The suggested installation method is via [composer](https://getcomposer.org/): ```sh -php composer.phar require "doctrine/instantiator:~1.0.3" +composer require doctrine/instantiator ``` ## Usage diff --git a/vendor/doctrine/instantiator/composer.json b/vendor/doctrine/instantiator/composer.json index 4fba95ca6..fab817207 100644 --- a/vendor/doctrine/instantiator/composer.json +++ b/vendor/doctrine/instantiator/composer.json @@ -21,12 +21,12 @@ "require-dev": { "ext-phar": "*", "ext-pdo": "*", - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "autoload": { "psr-4": { diff --git a/vendor/doctrine/instantiator/psalm.xml b/vendor/doctrine/instantiator/psalm.xml index e6270c138..e9b622b3b 100644 --- a/vendor/doctrine/instantiator/psalm.xml +++ b/vendor/doctrine/instantiator/psalm.xml @@ -1,7 +1,7 @@ = 5.5 +* Updated to use PSR-7 + * Requires immutable messages, which basically means an event based system + owned by a request instance is no longer possible. + * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7). + * Removed the dependency on `guzzlehttp/streams`. These stream abstractions + are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7` + namespace. +* Added middleware and handler system + * Replaced the Guzzle event and subscriber system with a middleware system. + * No longer depends on RingPHP, but rather places the HTTP handlers directly + in Guzzle, operating on PSR-7 messages. + * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which + means the `guzzlehttp/retry-subscriber` is now obsolete. + * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`. +* Asynchronous responses + * No longer supports the `future` request option to send an async request. + Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`, + `getAsync`, etc.). + * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid + recursion required by chaining and forwarding react promises. See + https://github.com/guzzle/promises + * Added `requestAsync` and `sendAsync` to send request asynchronously. + * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests + asynchronously. +* Request options + * POST and form updates + * Added the `form_fields` and `form_files` request options. + * Removed the `GuzzleHttp\Post` namespace. + * The `body` request option no longer accepts an array for POST requests. + * The `exceptions` request option has been deprecated in favor of the + `http_errors` request options. + * The `save_to` request option has been deprecated in favor of `sink` request + option. +* Clients no longer accept an array of URI template string and variables for + URI variables. You will need to expand URI templates before passing them + into a client constructor or request method. +* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are + now magic methods that will send synchronous requests. +* Replaced `Utils.php` with plain functions in `functions.php`. +* Removed `GuzzleHttp\Collection`. +* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as + an array. +* Removed `GuzzleHttp\Query`. Query string handling is now handled using an + associative array passed into the `query` request option. The query string + is serialized using PHP's `http_build_query`. If you need more control, you + can pass the query string in as a string. +* `GuzzleHttp\QueryParser` has been replaced with the + `GuzzleHttp\Psr7\parse_query`. + +## 5.2.0 - 2015-01-27 + +* Added `AppliesHeadersInterface` to make applying headers to a request based + on the body more generic and not specific to `PostBodyInterface`. +* Reduced the number of stack frames needed to send requests. +* Nested futures are now resolved in the client rather than the RequestFsm +* Finishing state transitions is now handled in the RequestFsm rather than the + RingBridge. +* Added a guard in the Pool class to not use recursion for request retries. + +## 5.1.0 - 2014-12-19 + +* Pool class no longer uses recursion when a request is intercepted. +* The size of a Pool can now be dynamically adjusted using a callback. + See https://github.com/guzzle/guzzle/pull/943. +* Setting a request option to `null` when creating a request with a client will + ensure that the option is not set. This allows you to overwrite default + request options on a per-request basis. + See https://github.com/guzzle/guzzle/pull/937. +* Added the ability to limit which protocols are allowed for redirects by + specifying a `protocols` array in the `allow_redirects` request option. +* Nested futures due to retries are now resolved when waiting for synchronous + responses. See https://github.com/guzzle/guzzle/pull/947. +* `"0"` is now an allowed URI path. See + https://github.com/guzzle/guzzle/pull/935. +* `Query` no longer typehints on the `$query` argument in the constructor, + allowing for strings and arrays. +* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle + specific exceptions if necessary. + +## 5.0.3 - 2014-11-03 + +This change updates query strings so that they are treated as un-encoded values +by default where the value represents an un-encoded value to send over the +wire. A Query object then encodes the value before sending over the wire. This +means that even value query string values (e.g., ":") are url encoded. This +makes the Query class match PHP's http_build_query function. However, if you +want to send requests over the wire using valid query string characters that do +not need to be encoded, then you can provide a string to Url::setQuery() and +pass true as the second argument to specify that the query string is a raw +string that should not be parsed or encoded (unless a call to getQuery() is +subsequently made, forcing the query-string to be converted into a Query +object). + +## 5.0.2 - 2014-10-30 + +* Added a trailing `\r\n` to multipart/form-data payloads. See + https://github.com/guzzle/guzzle/pull/871 +* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs. +* Status codes are now returned as integers. See + https://github.com/guzzle/guzzle/issues/881 +* No longer overwriting an existing `application/x-www-form-urlencoded` header + when sending POST requests, allowing for customized headers. See + https://github.com/guzzle/guzzle/issues/877 +* Improved path URL serialization. + + * No longer double percent-encoding characters in the path or query string if + they are already encoded. + * Now properly encoding the supplied path to a URL object, instead of only + encoding ' ' and '?'. + * Note: This has been changed in 5.0.3 to now encode query string values by + default unless the `rawString` argument is provided when setting the query + string on a URL: Now allowing many more characters to be present in the + query string without being percent encoded. See https://tools.ietf.org/html/rfc3986#appendix-A + +## 5.0.1 - 2014-10-16 + +Bugfix release. + +* Fixed an issue where connection errors still returned response object in + error and end events event though the response is unusable. This has been + corrected so that a response is not returned in the `getResponse` method of + these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867 +* Fixed an issue where transfer statistics were not being populated in the + RingBridge. https://github.com/guzzle/guzzle/issues/866 + +## 5.0.0 - 2014-10-12 + +Adding support for non-blocking responses and some minor API cleanup. + +### New Features + +* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`. +* Added a public API for creating a default HTTP adapter. +* Updated the redirect plugin to be non-blocking so that redirects are sent + concurrently. Other plugins like this can now be updated to be non-blocking. +* Added a "progress" event so that you can get upload and download progress + events. +* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers + requests concurrently using a capped pool size as efficiently as possible. +* Added `hasListeners()` to EmitterInterface. +* Removed `GuzzleHttp\ClientInterface::sendAll` and marked + `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the + recommended way). + +### Breaking changes + +The breaking changes in this release are relatively minor. The biggest thing to +look out for is that request and response objects no longer implement fluent +interfaces. + +* Removed the fluent interfaces (i.e., `return $this`) from requests, + responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`, + `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and + `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of + why I did this: https://ocramius.github.io/blog/fluent-interfaces-are-evil/. + This also makes the Guzzle message interfaces compatible with the current + PSR-7 message proposal. +* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except + for the HTTP request functions from function.php, these functions are now + implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode` + moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to + `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to + `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be + `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php + caused problems for many users: they aren't PSR-4 compliant, require an + explicit include, and needed an if-guard to ensure that the functions are not + declared multiple times. +* Rewrote adapter layer. + * Removing all classes from `GuzzleHttp\Adapter`, these are now + implemented as callables that are stored in `GuzzleHttp\Ring\Client`. + * Removed the concept of "parallel adapters". Sending requests serially or + concurrently is now handled using a single adapter. + * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The + Transaction object now exposes the request, response, and client as public + properties. The getters and setters have been removed. +* Removed the "headers" event. This event was only useful for changing the + body a response once the headers of the response were known. You can implement + a similar behavior in a number of ways. One example might be to use a + FnStream that has access to the transaction being sent. For example, when the + first byte is written, you could check if the response headers match your + expectations, and if so, change the actual stream body that is being + written to. +* Removed the `asArray` parameter from + `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header + value as an array, then use the newly added `getHeaderAsArray()` method of + `MessageInterface`. This change makes the Guzzle interfaces compatible with + the PSR-7 interfaces. +* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add + custom request options using double-dispatch (this was an implementation + detail). Instead, you should now provide an associative array to the + constructor which is a mapping of the request option name mapping to a + function that applies the option value to a request. +* Removed the concept of "throwImmediately" from exceptions and error events. + This control mechanism was used to stop a transfer of concurrent requests + from completing. This can now be handled by throwing the exception or by + cancelling a pool of requests or each outstanding future request individually. +* Updated to "GuzzleHttp\Streams" 3.0. + * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a + `maxLen` parameter. This update makes the Guzzle streams project + compatible with the current PSR-7 proposal. + * `GuzzleHttp\Stream\Stream::__construct`, + `GuzzleHttp\Stream\Stream::factory`, and + `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second + argument. They now accept an associative array of options, including the + "size" key and "metadata" key which can be used to provide custom metadata. + +## 4.2.2 - 2014-09-08 + +* Fixed a memory leak in the CurlAdapter when reusing cURL handles. +* No longer using `request_fulluri` in stream adapter proxies. +* Relative redirects are now based on the last response, not the first response. + +## 4.2.1 - 2014-08-19 + +* Ensuring that the StreamAdapter does not always add a Content-Type header +* Adding automated github releases with a phar and zip + +## 4.2.0 - 2014-08-17 + +* Now merging in default options using a case-insensitive comparison. + Closes https://github.com/guzzle/guzzle/issues/767 +* Added the ability to automatically decode `Content-Encoding` response bodies + using the `decode_content` request option. This is set to `true` by default + to decode the response body if it comes over the wire with a + `Content-Encoding`. Set this value to `false` to disable decoding the + response content, and pass a string to provide a request `Accept-Encoding` + header and turn on automatic response decoding. This feature now allows you + to pass an `Accept-Encoding` header in the headers of a request but still + disable automatic response decoding. + Closes https://github.com/guzzle/guzzle/issues/764 +* Added the ability to throw an exception immediately when transferring + requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760 +* Updating guzzlehttp/streams dependency to ~2.1 +* No longer utilizing the now deprecated namespaced methods from the stream + package. + +## 4.1.8 - 2014-08-14 + +* Fixed an issue in the CurlFactory that caused setting the `stream=false` + request option to throw an exception. + See: https://github.com/guzzle/guzzle/issues/769 +* TransactionIterator now calls rewind on the inner iterator. + See: https://github.com/guzzle/guzzle/pull/765 +* You can now set the `Content-Type` header to `multipart/form-data` + when creating POST requests to force multipart bodies. + See https://github.com/guzzle/guzzle/issues/768 + +## 4.1.7 - 2014-08-07 + +* Fixed an error in the HistoryPlugin that caused the same request and response + to be logged multiple times when an HTTP protocol error occurs. +* Ensuring that cURL does not add a default Content-Type when no Content-Type + has been supplied by the user. This prevents the adapter layer from modifying + the request that is sent over the wire after any listeners may have already + put the request in a desired state (e.g., signed the request). +* Throwing an exception when you attempt to send requests that have the + "stream" set to true in parallel using the MultiAdapter. +* Only calling curl_multi_select when there are active cURL handles. This was + previously changed and caused performance problems on some systems due to PHP + always selecting until the maximum select timeout. +* Fixed a bug where multipart/form-data POST fields were not correctly + aggregated (e.g., values with "&"). + +## 4.1.6 - 2014-08-03 + +* Added helper methods to make it easier to represent messages as strings, + including getting the start line and getting headers as a string. + +## 4.1.5 - 2014-08-02 + +* Automatically retrying cURL "Connection died, retrying a fresh connect" + errors when possible. +* cURL implementation cleanup +* Allowing multiple event subscriber listeners to be registered per event by + passing an array of arrays of listener configuration. + +## 4.1.4 - 2014-07-22 + +* Fixed a bug that caused multi-part POST requests with more than one field to + serialize incorrectly. +* Paths can now be set to "0" +* `ResponseInterface::xml` now accepts a `libxml_options` option and added a + missing default argument that was required when parsing XML response bodies. +* A `save_to` stream is now created lazily, which means that files are not + created on disk unless a request succeeds. + +## 4.1.3 - 2014-07-15 + +* Various fixes to multipart/form-data POST uploads +* Wrapping function.php in an if-statement to ensure Guzzle can be used + globally and in a Composer install +* Fixed an issue with generating and merging in events to an event array +* POST headers are only applied before sending a request to allow you to change + the query aggregator used before uploading +* Added much more robust query string parsing +* Fixed various parsing and normalization issues with URLs +* Fixing an issue where multi-valued headers were not being utilized correctly + in the StreamAdapter + +## 4.1.2 - 2014-06-18 + +* Added support for sending payloads with GET requests + +## 4.1.1 - 2014-06-08 + +* Fixed an issue related to using custom message factory options in subclasses +* Fixed an issue with nested form fields in a multi-part POST +* Fixed an issue with using the `json` request option for POST requests +* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar` + +## 4.1.0 - 2014-05-27 + +* Added a `json` request option to easily serialize JSON payloads. +* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON. +* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`. +* Added the ability to provide an emitter to a client in the client constructor. +* Added the ability to persist a cookie session using $_SESSION. +* Added a trait that can be used to add event listeners to an iterator. +* Removed request method constants from RequestInterface. +* Fixed warning when invalid request start-lines are received. +* Updated MessageFactory to work with custom request option methods. +* Updated cacert bundle to latest build. + +4.0.2 (2014-04-16) +------------------ + +* Proxy requests using the StreamAdapter now properly use request_fulluri (#632) +* Added the ability to set scalars as POST fields (#628) + +## 4.0.1 - 2014-04-04 + +* The HTTP status code of a response is now set as the exception code of + RequestException objects. +* 303 redirects will now correctly switch from POST to GET requests. +* The default parallel adapter of a client now correctly uses the MultiAdapter. +* HasDataTrait now initializes the internal data array as an empty array so + that the toArray() method always returns an array. + +## 4.0.0 - 2014-03-29 + +* For information on changes and upgrading, see: + https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 +* Added `GuzzleHttp\batch()` as a convenience function for sending requests in + parallel without needing to write asynchronous code. +* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`. + You can now pass a callable or an array of associative arrays where each + associative array contains the "fn", "priority", and "once" keys. + +## 4.0.0.rc-2 - 2014-03-25 + +* Removed `getConfig()` and `setConfig()` from clients to avoid confusion + around whether things like base_url, message_factory, etc. should be able to + be retrieved or modified. +* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface +* functions.php functions were renamed using snake_case to match PHP idioms +* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and + `GUZZLE_CURL_SELECT_TIMEOUT` environment variables +* Added the ability to specify custom `sendAll()` event priorities +* Added the ability to specify custom stream context options to the stream + adapter. +* Added a functions.php function for `get_path()` and `set_path()` +* CurlAdapter and MultiAdapter now use a callable to generate curl resources +* MockAdapter now properly reads a body and emits a `headers` event +* Updated Url class to check if a scheme and host are set before adding ":" + and "//". This allows empty Url (e.g., "") to be serialized as "". +* Parsing invalid XML no longer emits warnings +* Curl classes now properly throw AdapterExceptions +* Various performance optimizations +* Streams are created with the faster `Stream\create()` function +* Marked deprecation_proxy() as internal +* Test server is now a collection of static methods on a class + +## 4.0.0-rc.1 - 2014-03-15 + +* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 + +## 3.8.1 - 2014-01-28 + +* Bug: Always using GET requests when redirecting from a 303 response +* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in + `Guzzle\Http\ClientInterface::setSslVerification()` +* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL +* Bug: The body of a request can now be set to `"0"` +* Sending PHP stream requests no longer forces `HTTP/1.0` +* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of + each sub-exception +* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than + clobbering everything). +* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators) +* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`. + For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`. +* Now properly escaping the regular expression delimiter when matching Cookie domains. +* Network access is now disabled when loading XML documents + +## 3.8.0 - 2013-12-05 + +* Added the ability to define a POST name for a file +* JSON response parsing now properly walks additionalProperties +* cURL error code 18 is now retried automatically in the BackoffPlugin +* Fixed a cURL error when URLs contain fragments +* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were + CurlExceptions +* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e) +* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS` +* Fixed a bug that was encountered when parsing empty header parameters +* UriTemplate now has a `setRegex()` method to match the docs +* The `debug` request parameter now checks if it is truthy rather than if it exists +* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin +* Added the ability to combine URLs using strict RFC 3986 compliance +* Command objects can now return the validation errors encountered by the command +* Various fixes to cache revalidation (#437 and 29797e5) +* Various fixes to the AsyncPlugin +* Cleaned up build scripts + +## 3.7.4 - 2013-10-02 + +* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430) +* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp + (see https://github.com/aws/aws-sdk-php/issues/147) +* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots +* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420) +* Updated the bundled cacert.pem (#419) +* OauthPlugin now supports adding authentication to headers or query string (#425) + +## 3.7.3 - 2013-09-08 + +* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and + `CommandTransferException`. +* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description +* Schemas are only injected into response models when explicitly configured. +* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of + an EntityBody. +* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator. +* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`. +* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody() +* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin +* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests +* Bug fix: Properly parsing headers that contain commas contained in quotes +* Bug fix: mimetype guessing based on a filename is now case-insensitive + +## 3.7.2 - 2013-08-02 + +* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander + See https://github.com/guzzle/guzzle/issues/371 +* Bug fix: Cookie domains are now matched correctly according to RFC 6265 + See https://github.com/guzzle/guzzle/issues/377 +* Bug fix: GET parameters are now used when calculating an OAuth signature +* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted +* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched +* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input. + See https://github.com/guzzle/guzzle/issues/379 +* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See + https://github.com/guzzle/guzzle/pull/380 +* cURL multi cleanup and optimizations + +## 3.7.1 - 2013-07-05 + +* Bug fix: Setting default options on a client now works +* Bug fix: Setting options on HEAD requests now works. See #352 +* Bug fix: Moving stream factory before send event to before building the stream. See #353 +* Bug fix: Cookies no longer match on IP addresses per RFC 6265 +* Bug fix: Correctly parsing header parameters that are in `<>` and quotes +* Added `cert` and `ssl_key` as request options +* `Host` header can now diverge from the host part of a URL if the header is set manually +* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter +* OAuth parameters are only added via the plugin if they aren't already set +* Exceptions are now thrown when a URL cannot be parsed +* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails +* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin + +## 3.7.0 - 2013-06-10 + +* See UPGRADING.md for more information on how to upgrade. +* Requests now support the ability to specify an array of $options when creating a request to more easily modify a + request. You can pass a 'request.options' configuration setting to a client to apply default request options to + every request created by a client (e.g. default query string variables, headers, curl options, etc.). +* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. + See `Guzzle\Http\StaticClient::mount`. +* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests + created by a command (e.g. custom headers, query string variables, timeout settings, etc.). +* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the + headers of a response +* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key + (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`) +* ServiceBuilders now support storing and retrieving arbitrary data +* CachePlugin can now purge all resources for a given URI +* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource +* CachePlugin now uses the Vary header to determine if a resource is a cache hit +* `Guzzle\Http\Message\Response` now implements `\Serializable` +* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters +* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable +* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()` +* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size +* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message +* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older + Symfony users can still use the old version of Monolog. +* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`. + Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`. +* Several performance improvements to `Guzzle\Common\Collection` +* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +* Added `Guzzle\Stream\StreamInterface::isRepeatable` +* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`. +* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`. +* Removed `Guzzle\Http\ClientInterface::expandTemplate()` +* Removed `Guzzle\Http\ClientInterface::setRequestFactory()` +* Removed `Guzzle\Http\ClientInterface::getCurlMulti()` +* Removed `Guzzle\Http\Message\RequestInterface::canCache` +* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect` +* Removed `Guzzle\Http\Message\RequestInterface::isRedirect` +* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. +* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting + `Guzzle\Common\Version::$emitWarnings` to true. +* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use + `$request->getResponseBody()->isRepeatable()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. + These will work through Guzzle 4.0 +* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params]. +* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`. +* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. +* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +* Marked `Guzzle\Common\Collection::inject()` as deprecated. +* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');` +* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +* Always setting X-cache headers on cached responses +* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +* Added `CacheStorageInterface::purge($url)` +* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +## 3.6.0 - 2013-05-29 + +* ServiceDescription now implements ToArrayInterface +* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters +* Guzzle can now correctly parse incomplete URLs +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess +* Added the ability to cast Model objects to a string to view debug information. + +## 3.5.0 - 2013-05-13 + +* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times +* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove + itself from the EventDispatcher) +* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values +* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too +* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a + non-existent key +* Bug: All __call() method arguments are now required (helps with mocking frameworks) +* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference + to help with refcount based garbage collection of resources created by sending a request +* Deprecating ZF1 cache and log adapters. These will be removed in the next major version. +* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the + HistoryPlugin for a history. +* Added a `responseBody` alias for the `response_body` location +* Refactored internals to no longer rely on Response::getRequest() +* HistoryPlugin can now be cast to a string +* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests + and responses that are sent over the wire +* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects + +## 3.4.3 - 2013-04-30 + +* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response +* Added a check to re-extract the temp cacert bundle from the phar before sending each request + +## 3.4.2 - 2013-04-29 + +* Bug fix: Stream objects now work correctly with "a" and "a+" modes +* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present +* Bug fix: AsyncPlugin no longer forces HEAD requests +* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter +* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails +* Setting a response on a request will write to the custom request body from the response body if one is specified +* LogPlugin now writes to php://output when STDERR is undefined +* Added the ability to set multiple POST files for the same key in a single call +* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default +* Added the ability to queue CurlExceptions to the MockPlugin +* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send) +* Configuration loading now allows remote files + +## 3.4.1 - 2013-04-16 + +* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti + handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost. +* Exceptions are now properly grouped when sending requests in parallel +* Redirects are now properly aggregated when a multi transaction fails +* Redirects now set the response on the original object even in the event of a failure +* Bug fix: Model names are now properly set even when using $refs +* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax +* Added support for oauth_callback in OAuth signatures +* Added support for oauth_verifier in OAuth signatures +* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection + +## 3.4.0 - 2013-04-11 + +* Bug fix: URLs are now resolved correctly based on https://tools.ietf.org/html/rfc3986#section-5.2. #289 +* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 +* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 +* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. +* Bug fix: Added `number` type to service descriptions. +* Bug fix: empty parameters are removed from an OAuth signature +* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header +* Bug fix: Fixed "array to string" error when validating a union of types in a service description +* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream +* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin. +* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs. +* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections. +* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if + the Content-Type can be determined based on the entity body or the path of the request. +* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder. +* Added support for a PSR-3 LogAdapter. +* Added a `command.after_prepare` event +* Added `oauth_callback` parameter to the OauthPlugin +* Added the ability to create a custom stream class when using a stream factory +* Added a CachingEntityBody decorator +* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized. +* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar. +* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies +* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This + means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use + POST fields or files (the latter is only used when emulating a form POST in the browser). +* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest + +## 3.3.1 - 2013-03-10 + +* Added the ability to create PHP streaming responses from HTTP requests +* Bug fix: Running any filters when parsing response headers with service descriptions +* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing +* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across + response location visitors. +* Bug fix: Removed the possibility of creating configuration files with circular dependencies +* RequestFactory::create() now uses the key of a POST file when setting the POST file name +* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set + +## 3.3.0 - 2013-03-03 + +* A large number of performance optimizations have been made +* Bug fix: Added 'wb' as a valid write mode for streams +* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned +* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()` +* BC: Removed `Guzzle\Http\Utils` class +* BC: Setting a service description on a client will no longer modify the client's command factories. +* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using + the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' +* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to + lowercase +* Operation parameter objects are now lazy loaded internally +* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses +* Added support for instantiating responseType=class responseClass classes. Classes must implement + `Guzzle\Service\Command\ResponseClassInterface` +* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These + additional properties also support locations and can be used to parse JSON responses where the outermost part of the + JSON is an array +* Added support for nested renaming of JSON models (rename sentAs to name) +* CachePlugin + * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error + * Debug headers can now added to cached response in the CachePlugin + +## 3.2.0 - 2013-02-14 + +* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients. +* URLs with no path no longer contain a "/" by default +* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url. +* BadResponseException no longer includes the full request and response message +* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface +* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface +* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription +* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list +* xmlEncoding can now be customized for the XML declaration of a XML service description operation +* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value + aggregation and no longer uses callbacks +* The URL encoding implementation of Guzzle\Http\QueryString can now be customized +* Bug fix: Filters were not always invoked for array service description parameters +* Bug fix: Redirects now use a target response body rather than a temporary response body +* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded +* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives + +## 3.1.2 - 2013-01-27 + +* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the + response body. For example, the XmlVisitor now parses the XML response into an array in the before() method. +* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent +* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444) +* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse() +* Setting default headers on a client after setting the user-agent will not erase the user-agent setting + +## 3.1.1 - 2013-01-20 + +* Adding wildcard support to Guzzle\Common\Collection::getPath() +* Adding alias support to ServiceBuilder configs +* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface + +## 3.1.0 - 2013-01-12 + +* BC: CurlException now extends from RequestException rather than BadResponseException +* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse() +* Added getData to ServiceDescriptionInterface +* Added context array to RequestInterface::setState() +* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http +* Bug: Adding required content-type when JSON request visitor adds JSON to a command +* Bug: Fixing the serialization of a service description with custom data +* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing + an array of successful and failed responses +* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection +* Added Guzzle\Http\IoEmittingEntityBody +* Moved command filtration from validators to location visitors +* Added `extends` attributes to service description parameters +* Added getModels to ServiceDescriptionInterface + +## 3.0.7 - 2012-12-19 + +* Fixing phar detection when forcing a cacert to system if null or true +* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()` +* Cleaning up `Guzzle\Common\Collection::inject` method +* Adding a response_body location to service descriptions + +## 3.0.6 - 2012-12-09 + +* CurlMulti performance improvements +* Adding setErrorResponses() to Operation +* composer.json tweaks + +## 3.0.5 - 2012-11-18 + +* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin +* Bug: Response body can now be a string containing "0" +* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert +* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs +* Added support for XML attributes in service description responses +* DefaultRequestSerializer now supports array URI parameter values for URI template expansion +* Added better mimetype guessing to requests and post files + +## 3.0.4 - 2012-11-11 + +* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value +* Bug: Cookies can now be added that have a name, domain, or value set to "0" +* Bug: Using the system cacert bundle when using the Phar +* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures +* Enhanced cookie jar de-duplication +* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added +* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies +* Added the ability to create any sort of hash for a stream rather than just an MD5 hash + +## 3.0.3 - 2012-11-04 + +* Implementing redirects in PHP rather than cURL +* Added PECL URI template extension and using as default parser if available +* Bug: Fixed Content-Length parsing of Response factory +* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams. +* Adding ToArrayInterface throughout library +* Fixing OauthPlugin to create unique nonce values per request + +## 3.0.2 - 2012-10-25 + +* Magic methods are enabled by default on clients +* Magic methods return the result of a command +* Service clients no longer require a base_url option in the factory +* Bug: Fixed an issue with URI templates where null template variables were being expanded + +## 3.0.1 - 2012-10-22 + +* Models can now be used like regular collection objects by calling filter, map, etc. +* Models no longer require a Parameter structure or initial data in the constructor +* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` + +## 3.0.0 - 2012-10-15 + +* Rewrote service description format to be based on Swagger + * Now based on JSON schema + * Added nested input structures and nested response models + * Support for JSON and XML input and output models + * Renamed `commands` to `operations` + * Removed dot class notation + * Removed custom types +* Broke the project into smaller top-level namespaces to be more component friendly +* Removed support for XML configs and descriptions. Use arrays or JSON files. +* Removed the Validation component and Inspector +* Moved all cookie code to Guzzle\Plugin\Cookie +* Magic methods on a Guzzle\Service\Client now return the command un-executed. +* Calling getResult() or getResponse() on a command will lazily execute the command if needed. +* Now shipping with cURL's CA certs and using it by default +* Added previousResponse() method to response objects +* No longer sending Accept and Accept-Encoding headers on every request +* Only sending an Expect header by default when a payload is greater than 1MB +* Added/moved client options: + * curl.blacklist to curl.option.blacklist + * Added ssl.certificate_authority +* Added a Guzzle\Iterator component +* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin +* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin) +* Added a more robust caching plugin +* Added setBody to response objects +* Updating LogPlugin to use a more flexible MessageFormatter +* Added a completely revamped build process +* Cleaning up Collection class and removing default values from the get method +* Fixed ZF2 cache adapters + +## 2.8.8 - 2012-10-15 + +* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did + +## 2.8.7 - 2012-09-30 + +* Bug: Fixed config file aliases for JSON includes +* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests +* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload +* Bug: Hardening request and response parsing to account for missing parts +* Bug: Fixed PEAR packaging +* Bug: Fixed Request::getInfo +* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail +* Adding the ability for the namespace Iterator factory to look in multiple directories +* Added more getters/setters/removers from service descriptions +* Added the ability to remove POST fields from OAuth signatures +* OAuth plugin now supports 2-legged OAuth + +## 2.8.6 - 2012-09-05 + +* Added the ability to modify and build service descriptions +* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command +* Added a `json` parameter location +* Now allowing dot notation for classes in the CacheAdapterFactory +* Using the union of two arrays rather than an array_merge when extending service builder services and service params +* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references + in service builder config files. +* Services defined in two different config files that include one another will by default replace the previously + defined service, but you can now create services that extend themselves and merge their settings over the previous +* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like + '_default' with a default JSON configuration file. + +## 2.8.5 - 2012-08-29 + +* Bug: Suppressed empty arrays from URI templates +* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching +* Added support for HTTP responses that do not contain a reason phrase in the start-line +* AbstractCommand commands are now invokable +* Added a way to get the data used when signing an Oauth request before a request is sent + +## 2.8.4 - 2012-08-15 + +* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin +* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable. +* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream +* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream +* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5()) +* Added additional response status codes +* Removed SSL information from the default User-Agent header +* DELETE requests can now send an entity body +* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries +* Added the ability of the MockPlugin to consume mocked request bodies +* LogPlugin now exposes request and response objects in the extras array + +## 2.8.3 - 2012-07-30 + +* Bug: Fixed a case where empty POST requests were sent as GET requests +* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body +* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new +* Added multiple inheritance to service description commands +* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()` +* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything +* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles + +## 2.8.2 - 2012-07-24 + +* Bug: Query string values set to 0 are no longer dropped from the query string +* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()` +* Bug: `+` is now treated as an encoded space when parsing query strings +* QueryString and Collection performance improvements +* Allowing dot notation for class paths in filters attribute of a service descriptions + +## 2.8.1 - 2012-07-16 + +* Loosening Event Dispatcher dependency +* POST redirects can now be customized using CURLOPT_POSTREDIR + +## 2.8.0 - 2012-07-15 + +* BC: Guzzle\Http\Query + * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl) + * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding() + * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool) + * Changed the aggregation functions of QueryString to be static methods + * Can now use fromString() with querystrings that have a leading ? +* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters +* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body +* Cookies are no longer URL decoded by default +* Bug: URI template variables set to null are no longer expanded + +## 2.7.2 - 2012-07-02 + +* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser. +* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty() +* CachePlugin now allows for a custom request parameter function to check if a request can be cached +* Bug fix: CachePlugin now only caches GET and HEAD requests by default +* Bug fix: Using header glue when transferring headers over the wire +* Allowing deeply nested arrays for composite variables in URI templates +* Batch divisors can now return iterators or arrays + +## 2.7.1 - 2012-06-26 + +* Minor patch to update version number in UA string +* Updating build process + +## 2.7.0 - 2012-06-25 + +* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes. +* BC: Removed magic setX methods from commands +* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method +* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable. +* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity) +* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace +* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin +* Added the ability to set POST fields and files in a service description +* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method +* Adding a command.before_prepare event to clients +* Added BatchClosureTransfer and BatchClosureDivisor +* BatchTransferException now includes references to the batch divisor and transfer strategies +* Fixed some tests so that they pass more reliably +* Added Guzzle\Common\Log\ArrayLogAdapter + +## 2.6.6 - 2012-06-10 + +* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin +* BC: Removing Guzzle\Service\Command\CommandSet +* Adding generic batching system (replaces the batch queue plugin and command set) +* Updating ZF cache and log adapters and now using ZF's composer repository +* Bug: Setting the name of each ApiParam when creating through an ApiCommand +* Adding result_type, result_doc, deprecated, and doc_url to service descriptions +* Bug: Changed the default cookie header casing back to 'Cookie' + +## 2.6.5 - 2012-06-03 + +* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource() +* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from +* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data +* BC: Renaming methods in the CookieJarInterface +* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations +* Making the default glue for HTTP headers ';' instead of ',' +* Adding a removeValue to Guzzle\Http\Message\Header +* Adding getCookies() to request interface. +* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber() + +## 2.6.4 - 2012-05-30 + +* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class. +* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand +* Bug: Fixing magic method command calls on clients +* Bug: Email constraint only validates strings +* Bug: Aggregate POST fields when POST files are present in curl handle +* Bug: Fixing default User-Agent header +* Bug: Only appending or prepending parameters in commands if they are specified +* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes +* Allowing the use of dot notation for class namespaces when using instance_of constraint +* Added any_match validation constraint +* Added an AsyncPlugin +* Passing request object to the calculateWait method of the ExponentialBackoffPlugin +* Allowing the result of a command object to be changed +* Parsing location and type sub values when instantiating a service description rather than over and over at runtime + +## 2.6.3 - 2012-05-23 + +* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options. +* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields. +* You can now use an array of data when creating PUT request bodies in the request factory. +* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable. +* [Http] Adding support for Content-Type in multipart POST uploads per upload +* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1]) +* Adding more POST data operations for easier manipulation of POST data. +* You can now set empty POST fields. +* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files. +* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate. +* CS updates + +## 2.6.2 - 2012-05-19 + +* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method. + +## 2.6.1 - 2012-05-19 + +* [BC] Removing 'path' support in service descriptions. Use 'uri'. +* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache. +* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it. +* [BC] Removing Guzzle\Common\XmlElement. +* All commands, both dynamic and concrete, have ApiCommand objects. +* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits. +* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored. +* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible. + +## 2.6.0 - 2012-05-15 + +* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder +* [BC] Executing a Command returns the result of the command rather than the command +* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed. +* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args. +* [BC] Moving ResourceIterator* to Guzzle\Service\Resource +* [BC] Completely refactored ResourceIterators to iterate over a cloned command object +* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate +* [BC] Guzzle\Guzzle is now deprecated +* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject +* Adding Guzzle\Version class to give version information about Guzzle +* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate() +* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data +* ServiceDescription and ServiceBuilder are now cacheable using similar configs +* Changing the format of XML and JSON service builder configs. Backwards compatible. +* Cleaned up Cookie parsing +* Trimming the default Guzzle User-Agent header +* Adding a setOnComplete() method to Commands that is called when a command completes +* Keeping track of requests that were mocked in the MockPlugin +* Fixed a caching bug in the CacheAdapterFactory +* Inspector objects can be injected into a Command object +* Refactoring a lot of code and tests to be case insensitive when dealing with headers +* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL +* Adding the ability to set global option overrides to service builder configs +* Adding the ability to include other service builder config files from within XML and JSON files +* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method. + +## 2.5.0 - 2012-05-08 + +* Major performance improvements +* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated. +* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component. +* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}" +* Added the ability to passed parameters to all requests created by a client +* Added callback functionality to the ExponentialBackoffPlugin +* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies. +* Rewinding request stream bodies when retrying requests +* Exception is thrown when JSON response body cannot be decoded +* Added configurable magic method calls to clients and commands. This is off by default. +* Fixed a defect that added a hash to every parsed URL part +* Fixed duplicate none generation for OauthPlugin. +* Emitting an event each time a client is generated by a ServiceBuilder +* Using an ApiParams object instead of a Collection for parameters of an ApiCommand +* cache.* request parameters should be renamed to params.cache.* +* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle. +* Added the ability to disable type validation of service descriptions +* ServiceDescriptions and ServiceBuilders are now Serializable diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE new file mode 100644 index 000000000..fd2375d88 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/LICENSE @@ -0,0 +1,27 @@ +The MIT License (MIT) + +Copyright (c) 2011 Michael Dowling +Copyright (c) 2012 Jeremy Lindblom +Copyright (c) 2014 Graham Campbell +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Tobias Schultze +Copyright (c) 2016 Tobias Nyholm +Copyright (c) 2016 George Mponos + +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/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md new file mode 100644 index 000000000..f287fa98d --- /dev/null +++ b/vendor/guzzlehttp/guzzle/README.md @@ -0,0 +1,94 @@ +![Guzzle](.github/logo.png?raw=true) + +# Guzzle, PHP HTTP client + +[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) +[![Build Status](https://img.shields.io/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) +[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) + +Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and +trivial to integrate with web services. + +- Simple interface for building query strings, POST requests, streaming large + uploads, streaming large downloads, using HTTP cookies, uploading JSON data, + etc... +- Can send both synchronous and asynchronous requests using the same interface. +- Uses PSR-7 interfaces for requests, responses, and streams. This allows you + to utilize other PSR-7 compatible libraries with Guzzle. +- Supports PSR-18 allowing interoperability between other PSR-18 HTTP Clients. +- Abstracts away the underlying HTTP transport, allowing you to write + environment and transport agnostic code; i.e., no hard dependency on cURL, + PHP streams, sockets, or non-blocking event loops. +- Middleware system allows you to augment and compose client behavior. + +```php +$client = new \GuzzleHttp\Client(); +$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); + +echo $response->getStatusCode(); // 200 +echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8' +echo $response->getBody(); // '{"id": 1420053, "name": "guzzle", ...}' + +// Send an asynchronous request. +$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); +$promise = $client->sendAsync($request)->then(function ($response) { + echo 'I completed! ' . $response->getBody(); +}); + +$promise->wait(); +``` + +## Help and docs + +We use GitHub issues only to discuss bugs and new features. For support please refer to: + +- [Documentation](https://docs.guzzlephp.org) +- [Stack Overflow](https://stackoverflow.com/questions/tagged/guzzle) +- [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](https://slack.httplug.io/) +- [Gitter](https://gitter.im/guzzle/guzzle) + + +## Installing Guzzle + +The recommended way to install Guzzle is through +[Composer](https://getcomposer.org/). + +```bash +composer require guzzlehttp/guzzle +``` + + +## Version Guidance + +| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version | +|---------|----------------|---------------------|--------------|---------------------|---------------------|-------|--------------| +| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >=5.3.3,<7.0 | +| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >=5.4,<7.0 | +| 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >=5.4,<7.4 | +| 6.x | Security fixes | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >=5.5,<8.0 | +| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >=7.2.5,<8.2 | + +[guzzle-3-repo]: https://github.com/guzzle/guzzle3 +[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x +[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3 +[guzzle-6-repo]: https://github.com/guzzle/guzzle/tree/6.5 +[guzzle-7-repo]: https://github.com/guzzle/guzzle +[guzzle-3-docs]: https://guzzle3.readthedocs.io/ +[guzzle-5-docs]: https://docs.guzzlephp.org/en/5.3/ +[guzzle-6-docs]: https://docs.guzzlephp.org/en/6.5/ +[guzzle-7-docs]: https://docs.guzzlephp.org/en/latest/ + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/guzzle/security/policy) for more information. + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-guzzle?utm_source=packagist-guzzlehttp-guzzle&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/guzzle/UPGRADING.md b/vendor/guzzlehttp/guzzle/UPGRADING.md new file mode 100644 index 000000000..45417a7e1 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/UPGRADING.md @@ -0,0 +1,1253 @@ +Guzzle Upgrade Guide +==================== + +6.0 to 7.0 +---------- + +In order to take advantage of the new features of PHP, Guzzle dropped the support +of PHP 5. The minimum supported PHP version is now PHP 7.2. Type hints and return +types for functions and methods have been added wherever possible. + +Please make sure: +- You are calling a function or a method with the correct type. +- If you extend a class of Guzzle; update all signatures on methods you override. + +#### Other backwards compatibility breaking changes + +- Class `GuzzleHttp\UriTemplate` is removed. +- Class `GuzzleHttp\Exception\SeekException` is removed. +- Classes `GuzzleHttp\Exception\BadResponseException`, `GuzzleHttp\Exception\ClientException`, + `GuzzleHttp\Exception\ServerException` can no longer be initialized with an empty + Response as argument. +- Class `GuzzleHttp\Exception\ConnectException` now extends `GuzzleHttp\Exception\TransferException` + instead of `GuzzleHttp\Exception\RequestException`. +- Function `GuzzleHttp\Exception\ConnectException::getResponse()` is removed. +- Function `GuzzleHttp\Exception\ConnectException::hasResponse()` is removed. +- Constant `GuzzleHttp\ClientInterface::VERSION` is removed. Added `GuzzleHttp\ClientInterface::MAJOR_VERSION` instead. +- Function `GuzzleHttp\Exception\RequestException::getResponseBodySummary` is removed. + Use `\GuzzleHttp\Psr7\get_message_body_summary` as an alternative. +- Function `GuzzleHttp\Cookie\CookieJar::getCookieValue` is removed. +- Request option `exception` is removed. Please use `http_errors`. +- Request option `save_to` is removed. Please use `sink`. +- Pool option `pool_size` is removed. Please use `concurrency`. +- We now look for environment variables in the `$_SERVER` super global, due to thread safety issues with `getenv`. We continue to fallback to `getenv` in CLI environments, for maximum compatibility. +- The `get`, `head`, `put`, `post`, `patch`, `delete`, `getAsync`, `headAsync`, `putAsync`, `postAsync`, `patchAsync`, and `deleteAsync` methods are now implemented as genuine methods on `GuzzleHttp\Client`, with strong typing. The original `__call` implementation remains unchanged for now, for maximum backwards compatibility, but won't be invoked under normal operation. +- The `log` middleware will log the errors with level `error` instead of `notice` +- Support for international domain names (IDN) is now disabled by default, and enabling it requires installing ext-intl, linked against a modern version of the C library (ICU 4.6 or higher). + +#### Native functions calls + +All internal native functions calls of Guzzle are now prefixed with a slash. This +change makes it impossible for method overloading by other libraries or applications. +Example: + +```php +// Before: +curl_version(); + +// After: +\curl_version(); +``` + +For the full diff you can check [here](https://github.com/guzzle/guzzle/compare/6.5.4..master). + +5.0 to 6.0 +---------- + +Guzzle now uses [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP messages. +Due to the fact that these messages are immutable, this prompted a refactoring +of Guzzle to use a middleware based system rather than an event system. Any +HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be +updated to work with the new immutable PSR-7 request and response objects. Any +event listeners or subscribers need to be updated to become middleware +functions that wrap handlers (or are injected into a +`GuzzleHttp\HandlerStack`). + +- Removed `GuzzleHttp\BatchResults` +- Removed `GuzzleHttp\Collection` +- Removed `GuzzleHttp\HasDataTrait` +- Removed `GuzzleHttp\ToArrayInterface` +- The `guzzlehttp/streams` dependency has been removed. Stream functionality + is now present in the `GuzzleHttp\Psr7` namespace provided by the + `guzzlehttp/psr7` package. +- Guzzle no longer uses ReactPHP promises and now uses the + `guzzlehttp/promises` library. We use a custom promise library for three + significant reasons: + 1. React promises (at the time of writing this) are recursive. Promise + chaining and promise resolution will eventually blow the stack. Guzzle + promises are not recursive as they use a sort of trampolining technique. + Note: there has been movement in the React project to modify promises to + no longer utilize recursion. + 2. Guzzle needs to have the ability to synchronously block on a promise to + wait for a result. Guzzle promises allows this functionality (and does + not require the use of recursion). + 3. Because we need to be able to wait on a result, doing so using React + promises requires wrapping react promises with RingPHP futures. This + overhead is no longer needed, reducing stack sizes, reducing complexity, + and improving performance. +- `GuzzleHttp\Mimetypes` has been moved to a function in + `GuzzleHttp\Psr7\mimetype_from_extension` and + `GuzzleHttp\Psr7\mimetype_from_filename`. +- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query + strings must now be passed into request objects as strings, or provided to + the `query` request option when creating requests with clients. The `query` + option uses PHP's `http_build_query` to convert an array to a string. If you + need a different serialization technique, you will need to pass the query + string in as a string. There are a couple helper functions that will make + working with query strings easier: `GuzzleHttp\Psr7\parse_query` and + `GuzzleHttp\Psr7\build_query`. +- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware + system based on PSR-7, using RingPHP and it's middleware system as well adds + more complexity than the benefits it provides. All HTTP handlers that were + present in RingPHP have been modified to work directly with PSR-7 messages + and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces + complexity in Guzzle, removes a dependency, and improves performance. RingPHP + will be maintained for Guzzle 5 support, but will no longer be a part of + Guzzle 6. +- As Guzzle now uses a middleware based systems the event system and RingPHP + integration has been removed. Note: while the event system has been removed, + it is possible to add your own type of event system that is powered by the + middleware system. + - Removed the `Event` namespace. + - Removed the `Subscriber` namespace. + - Removed `Transaction` class + - Removed `RequestFsm` + - Removed `RingBridge` + - `GuzzleHttp\Subscriber\Cookie` is now provided by + `GuzzleHttp\Middleware::cookies` + - `GuzzleHttp\Subscriber\HttpError` is now provided by + `GuzzleHttp\Middleware::httpError` + - `GuzzleHttp\Subscriber\History` is now provided by + `GuzzleHttp\Middleware::history` + - `GuzzleHttp\Subscriber\Mock` is now provided by + `GuzzleHttp\Handler\MockHandler` + - `GuzzleHttp\Subscriber\Prepare` is now provided by + `GuzzleHttp\PrepareBodyMiddleware` + - `GuzzleHttp\Subscriber\Redirect` is now provided by + `GuzzleHttp\RedirectMiddleware` +- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in + `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone. +- Static functions in `GuzzleHttp\Utils` have been moved to namespaced + functions under the `GuzzleHttp` namespace. This requires either a Composer + based autoloader or you to include functions.php. +- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to + `GuzzleHttp\ClientInterface::getConfig`. +- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed. +- The `json` and `xml` methods of response objects has been removed. With the + migration to strictly adhering to PSR-7 as the interface for Guzzle messages, + adding methods to message interfaces would actually require Guzzle messages + to extend from PSR-7 messages rather then work with them directly. + +## Migrating to middleware + +The change to PSR-7 unfortunately required significant refactoring to Guzzle +due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event +system from plugins. The event system relied on mutability of HTTP messages and +side effects in order to work. With immutable messages, you have to change your +workflow to become more about either returning a value (e.g., functional +middlewares) or setting a value on an object. Guzzle v6 has chosen the +functional middleware approach. + +Instead of using the event system to listen for things like the `before` event, +you now create a stack based middleware function that intercepts a request on +the way in and the promise of the response on the way out. This is a much +simpler and more predictable approach than the event system and works nicely +with PSR-7 middleware. Due to the use of promises, the middleware system is +also asynchronous. + +v5: + +```php +use GuzzleHttp\Event\BeforeEvent; +$client = new GuzzleHttp\Client(); +// Get the emitter and listen to the before event. +$client->getEmitter()->on('before', function (BeforeEvent $e) { + // Guzzle v5 events relied on mutation + $e->getRequest()->setHeader('X-Foo', 'Bar'); +}); +``` + +v6: + +In v6, you can modify the request before it is sent using the `mapRequest` +middleware. The idiomatic way in v6 to modify the request/response lifecycle is +to setup a handler middleware stack up front and inject the handler into a +client. + +```php +use GuzzleHttp\Middleware; +// Create a handler stack that has all of the default middlewares attached +$handler = GuzzleHttp\HandlerStack::create(); +// Push the handler onto the handler stack +$handler->push(Middleware::mapRequest(function (RequestInterface $request) { + // Notice that we have to return a request object + return $request->withHeader('X-Foo', 'Bar'); +})); +// Inject the handler into the client +$client = new GuzzleHttp\Client(['handler' => $handler]); +``` + +## POST Requests + +This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params) +and `multipart` request options. `form_params` is an associative array of +strings or array of strings and is used to serialize an +`application/x-www-form-urlencoded` POST request. The +[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart) +option is now used to send a multipart/form-data POST request. + +`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add +POST files to a multipart/form-data request. + +The `body` option no longer accepts an array to send POST requests. Please use +`multipart` or `form_params` instead. + +The `base_url` option has been renamed to `base_uri`. + +4.x to 5.0 +---------- + +## Rewritten Adapter Layer + +Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send +HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor +is still supported, but it has now been renamed to `handler`. Instead of +passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP +`callable` that follows the RingPHP specification. + +## Removed Fluent Interfaces + +[Fluent interfaces were removed](https://ocramius.github.io/blog/fluent-interfaces-are-evil/) +from the following classes: + +- `GuzzleHttp\Collection` +- `GuzzleHttp\Url` +- `GuzzleHttp\Query` +- `GuzzleHttp\Post\PostBody` +- `GuzzleHttp\Cookie\SetCookie` + +## Removed functions.php + +Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following +functions can be used as replacements. + +- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode` +- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath` +- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path` +- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however, + deprecated in favor of using `GuzzleHttp\Pool::batch()`. + +The "procedural" global client has been removed with no replacement (e.g., +`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client` +object as a replacement. + +## `throwImmediately` has been removed + +The concept of "throwImmediately" has been removed from exceptions and error +events. This control mechanism was used to stop a transfer of concurrent +requests from completing. This can now be handled by throwing the exception or +by cancelling a pool of requests or each outstanding future request +individually. + +## headers event has been removed + +Removed the "headers" event. This event was only useful for changing the +body a response once the headers of the response were known. You can implement +a similar behavior in a number of ways. One example might be to use a +FnStream that has access to the transaction being sent. For example, when the +first byte is written, you could check if the response headers match your +expectations, and if so, change the actual stream body that is being +written to. + +## Updates to HTTP Messages + +Removed the `asArray` parameter from +`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header +value as an array, then use the newly added `getHeaderAsArray()` method of +`MessageInterface`. This change makes the Guzzle interfaces compatible with +the PSR-7 interfaces. + +3.x to 4.0 +---------- + +## Overarching changes: + +- Now requires PHP 5.4 or greater. +- No longer requires cURL to send requests. +- Guzzle no longer wraps every exception it throws. Only exceptions that are + recoverable are now wrapped by Guzzle. +- Various namespaces have been removed or renamed. +- No longer requiring the Symfony EventDispatcher. A custom event dispatcher + based on the Symfony EventDispatcher is + now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant + speed and functionality improvements). + +Changes per Guzzle 3.x namespace are described below. + +## Batch + +The `Guzzle\Batch` namespace has been removed. This is best left to +third-parties to implement on top of Guzzle's core HTTP library. + +## Cache + +The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement +has been implemented yet, but hoping to utilize a PSR cache interface). + +## Common + +- Removed all of the wrapped exceptions. It's better to use the standard PHP + library for unrecoverable exceptions. +- `FromConfigInterface` has been removed. +- `Guzzle\Common\Version` has been removed. The VERSION constant can be found + at `GuzzleHttp\ClientInterface::VERSION`. + +### Collection + +- `getAll` has been removed. Use `toArray` to convert a collection to an array. +- `inject` has been removed. +- `keySearch` has been removed. +- `getPath` no longer supports wildcard expressions. Use something better like + JMESPath for this. +- `setPath` now supports appending to an existing array via the `[]` notation. + +### Events + +Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses +`GuzzleHttp\Event\Emitter`. + +- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by + `GuzzleHttp\Event\EmitterInterface`. +- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by + `GuzzleHttp\Event\Emitter`. +- `Symfony\Component\EventDispatcher\Event` is replaced by + `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in + `GuzzleHttp\Event\EventInterface`. +- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and + `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the + event emitter of a request, client, etc. now uses the `getEmitter` method + rather than the `getDispatcher` method. + +#### Emitter + +- Use the `once()` method to add a listener that automatically removes itself + the first time it is invoked. +- Use the `listeners()` method to retrieve a list of event listeners rather than + the `getListeners()` method. +- Use `emit()` instead of `dispatch()` to emit an event from an emitter. +- Use `attach()` instead of `addSubscriber()` and `detach()` instead of + `removeSubscriber()`. + +```php +$mock = new Mock(); +// 3.x +$request->getEventDispatcher()->addSubscriber($mock); +$request->getEventDispatcher()->removeSubscriber($mock); +// 4.x +$request->getEmitter()->attach($mock); +$request->getEmitter()->detach($mock); +``` + +Use the `on()` method to add a listener rather than the `addListener()` method. + +```php +// 3.x +$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } ); +// 4.x +$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } ); +``` + +## Http + +### General changes + +- The cacert.pem certificate has been moved to `src/cacert.pem`. +- Added the concept of adapters that are used to transfer requests over the + wire. +- Simplified the event system. +- Sending requests in parallel is still possible, but batching is no longer a + concept of the HTTP layer. Instead, you must use the `complete` and `error` + events to asynchronously manage parallel request transfers. +- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`. +- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`. +- QueryAggregators have been rewritten so that they are simply callable + functions. +- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in + `functions.php` for an easy to use static client instance. +- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from + `GuzzleHttp\Exception\TransferException`. + +### Client + +Calling methods like `get()`, `post()`, `head()`, etc. no longer create and +return a request, but rather creates a request, sends the request, and returns +the response. + +```php +// 3.0 +$request = $client->get('/'); +$response = $request->send(); + +// 4.0 +$response = $client->get('/'); + +// or, to mirror the previous behavior +$request = $client->createRequest('GET', '/'); +$response = $client->send($request); +``` + +`GuzzleHttp\ClientInterface` has changed. + +- The `send` method no longer accepts more than one request. Use `sendAll` to + send multiple requests in parallel. +- `setUserAgent()` has been removed. Use a default request option instead. You + could, for example, do something like: + `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`. +- `setSslVerification()` has been removed. Use default request options instead, + like `$client->setConfig('defaults/verify', true)`. + +`GuzzleHttp\Client` has changed. + +- The constructor now accepts only an associative array. You can include a + `base_url` string or array to use a URI template as the base URL of a client. + You can also specify a `defaults` key that is an associative array of default + request options. You can pass an `adapter` to use a custom adapter, + `batch_adapter` to use a custom adapter for sending requests in parallel, or + a `message_factory` to change the factory used to create HTTP requests and + responses. +- The client no longer emits a `client.create_request` event. +- Creating requests with a client no longer automatically utilize a URI + template. You must pass an array into a creational method (e.g., + `createRequest`, `get`, `put`, etc.) in order to expand a URI template. + +### Messages + +Messages no longer have references to their counterparts (i.e., a request no +longer has a reference to it's response, and a response no loger has a +reference to its request). This association is now managed through a +`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to +these transaction objects using request events that are emitted over the +lifecycle of a request. + +#### Requests with a body + +- `GuzzleHttp\Message\EntityEnclosingRequest` and + `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The + separation between requests that contain a body and requests that do not + contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface` + handles both use cases. +- Any method that previously accepts a `GuzzleHttp\Response` object now accept a + `GuzzleHttp\Message\ResponseInterface`. +- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to + `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create + both requests and responses and is implemented in + `GuzzleHttp\Message\MessageFactory`. +- POST field and file methods have been removed from the request object. You + must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface` + to control the format of a POST body. Requests that are created using a + standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use + a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if + the method is POST and no body is provided. + +```php +$request = $client->createRequest('POST', '/'); +$request->getBody()->setField('foo', 'bar'); +$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r'))); +``` + +#### Headers + +- `GuzzleHttp\Message\Header` has been removed. Header values are now simply + represented by an array of values or as a string. Header values are returned + as a string by default when retrieving a header value from a message. You can + pass an optional argument of `true` to retrieve a header value as an array + of strings instead of a single concatenated string. +- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to + `GuzzleHttp\Post`. This interface has been simplified and now allows the + addition of arbitrary headers. +- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most + of the custom headers are now handled separately in specific + subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has + been updated to properly handle headers that contain parameters (like the + `Link` header). + +#### Responses + +- `GuzzleHttp\Message\Response::getInfo()` and + `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event + system to retrieve this type of information. +- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed. +- `GuzzleHttp\Message\Response::getMessage()` has been removed. +- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific + methods have moved to the CacheSubscriber. +- Header specific helper functions like `getContentMd5()` have been removed. + Just use `getHeader('Content-MD5')` instead. +- `GuzzleHttp\Message\Response::setRequest()` and + `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event + system to work with request and response objects as a transaction. +- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the + Redirect subscriber instead. +- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have + been removed. Use `getStatusCode()` instead. + +#### Streaming responses + +Streaming requests can now be created by a client directly, returning a +`GuzzleHttp\Message\ResponseInterface` object that contains a body stream +referencing an open PHP HTTP stream. + +```php +// 3.0 +use Guzzle\Stream\PhpStreamRequestFactory; +$request = $client->get('/'); +$factory = new PhpStreamRequestFactory(); +$stream = $factory->fromRequest($request); +$data = $stream->read(1024); + +// 4.0 +$response = $client->get('/', ['stream' => true]); +// Read some data off of the stream in the response body +$data = $response->getBody()->read(1024); +``` + +#### Redirects + +The `configureRedirects()` method has been removed in favor of a +`allow_redirects` request option. + +```php +// Standard redirects with a default of a max of 5 redirects +$request = $client->createRequest('GET', '/', ['allow_redirects' => true]); + +// Strict redirects with a custom number of redirects +$request = $client->createRequest('GET', '/', [ + 'allow_redirects' => ['max' => 5, 'strict' => true] +]); +``` + +#### EntityBody + +EntityBody interfaces and classes have been removed or moved to +`GuzzleHttp\Stream`. All classes and interfaces that once required +`GuzzleHttp\EntityBodyInterface` now require +`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no +longer uses `GuzzleHttp\EntityBody::factory` but now uses +`GuzzleHttp\Stream\Stream::factory` or even better: +`GuzzleHttp\Stream\create()`. + +- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface` +- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream` +- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream` +- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream` +- `Guzzle\Http\IoEmittyinEntityBody` has been removed. + +#### Request lifecycle events + +Requests previously submitted a large number of requests. The number of events +emitted over the lifecycle of a request has been significantly reduced to make +it easier to understand how to extend the behavior of a request. All events +emitted during the lifecycle of a request now emit a custom +`GuzzleHttp\Event\EventInterface` object that contains context providing +methods and a way in which to modify the transaction at that specific point in +time (e.g., intercept the request and set a response on the transaction). + +- `request.before_send` has been renamed to `before` and now emits a + `GuzzleHttp\Event\BeforeEvent` +- `request.complete` has been renamed to `complete` and now emits a + `GuzzleHttp\Event\CompleteEvent`. +- `request.sent` has been removed. Use `complete`. +- `request.success` has been removed. Use `complete`. +- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`. +- `request.exception` has been removed. Use `error`. +- `request.receive.status_line` has been removed. +- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to + maintain a status update. +- `curl.callback.write` has been removed. Use a custom `StreamInterface` to + intercept writes. +- `curl.callback.read` has been removed. Use a custom `StreamInterface` to + intercept reads. + +`headers` is a new event that is emitted after the response headers of a +request have been received before the body of the response is downloaded. This +event emits a `GuzzleHttp\Event\HeadersEvent`. + +You can intercept a request and inject a response using the `intercept()` event +of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and +`GuzzleHttp\Event\ErrorEvent` event. + +See: http://docs.guzzlephp.org/en/latest/events.html + +## Inflection + +The `Guzzle\Inflection` namespace has been removed. This is not a core concern +of Guzzle. + +## Iterator + +The `Guzzle\Iterator` namespace has been removed. + +- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and + `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of + Guzzle itself. +- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent + class is shipped with PHP 5.4. +- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because + it's easier to just wrap an iterator in a generator that maps values. + +For a replacement of these iterators, see https://github.com/nikic/iter + +## Log + +The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The +`Guzzle\Log` namespace has been removed. Guzzle now relies on +`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been +moved to `GuzzleHttp\Subscriber\Log\Formatter`. + +## Parser + +The `Guzzle\Parser` namespace has been removed. This was previously used to +make it possible to plug in custom parsers for cookies, messages, URI +templates, and URLs; however, this level of complexity is not needed in Guzzle +so it has been removed. + +- Cookie: Cookie parsing logic has been moved to + `GuzzleHttp\Cookie\SetCookie::fromString`. +- Message: Message parsing logic for both requests and responses has been moved + to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only + used in debugging or deserializing messages, so it doesn't make sense for + Guzzle as a library to add this level of complexity to parsing messages. +- UriTemplate: URI template parsing has been moved to + `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL + URI template library if it is installed. +- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously + it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary, + then developers are free to subclass `GuzzleHttp\Url`. + +## Plugin + +The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`. +Several plugins are shipping with the core Guzzle library under this namespace. + +- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar + code has moved to `GuzzleHttp\Cookie`. +- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin. +- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is + received. +- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin. +- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before + sending. This subscriber is attached to all requests by default. +- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin. + +The following plugins have been removed (third-parties are free to re-implement +these if needed): + +- `GuzzleHttp\Plugin\Async` has been removed. +- `GuzzleHttp\Plugin\CurlAuth` has been removed. +- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This + functionality should instead be implemented with event listeners that occur + after normal response parsing occurs in the guzzle/command package. + +The following plugins are not part of the core Guzzle package, but are provided +in separate repositories: + +- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler + to build custom retry policies using simple functions rather than various + chained classes. See: https://github.com/guzzle/retry-subscriber +- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to + https://github.com/guzzle/cache-subscriber +- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to + https://github.com/guzzle/log-subscriber +- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to + https://github.com/guzzle/message-integrity-subscriber +- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to + `GuzzleHttp\Subscriber\MockSubscriber`. +- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to + https://github.com/guzzle/oauth-subscriber + +## Service + +The service description layer of Guzzle has moved into two separate packages: + +- http://github.com/guzzle/command Provides a high level abstraction over web + services by representing web service operations using commands. +- http://github.com/guzzle/guzzle-services Provides an implementation of + guzzle/command that provides request serialization and response parsing using + Guzzle service descriptions. + +## Stream + +Stream have moved to a separate package available at +https://github.com/guzzle/streams. + +`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take +on the responsibilities of `Guzzle\Http\EntityBody` and +`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number +of methods implemented by the `StreamInterface` has been drastically reduced to +allow developers to more easily extend and decorate stream behavior. + +## Removed methods from StreamInterface + +- `getStream` and `setStream` have been removed to better encapsulate streams. +- `getMetadata` and `setMetadata` have been removed in favor of + `GuzzleHttp\Stream\MetadataStreamInterface`. +- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been + removed. This data is accessible when + using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`. +- `rewind` has been removed. Use `seek(0)` for a similar behavior. + +## Renamed methods + +- `detachStream` has been renamed to `detach`. +- `feof` has been renamed to `eof`. +- `ftell` has been renamed to `tell`. +- `readLine` has moved from an instance method to a static class method of + `GuzzleHttp\Stream\Stream`. + +## Metadata streams + +`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams +that contain additional metadata accessible via `getMetadata()`. +`GuzzleHttp\Stream\StreamInterface::getMetadata` and +`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. + +## StreamRequestFactory + +The entire concept of the StreamRequestFactory has been removed. The way this +was used in Guzzle 3 broke the actual interface of sending streaming requests +(instead of getting back a Response, you got a StreamInterface). Streaming +PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. + +3.6 to 3.7 +---------- + +### Deprecations + +- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: + +```php +\Guzzle\Common\Version::$emitWarnings = true; +``` + +The following APIs and options have been marked as deprecated: + +- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +- Marked `Guzzle\Common\Collection::inject()` as deprecated. +- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use + `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or + `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` + +3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational +request methods. When paired with a client's configuration settings, these options allow you to specify default settings +for various aspects of a request. Because these options make other previous configuration options redundant, several +configuration options and methods of a client and AbstractCommand have been deprecated. + +- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`. +- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`. +- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')` +- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0 + + $command = $client->getCommand('foo', array( + 'command.headers' => array('Test' => '123'), + 'command.response_body' => '/path/to/file' + )); + + // Should be changed to: + + $command = $client->getCommand('foo', array( + 'command.request_options' => array( + 'headers' => array('Test' => '123'), + 'save_as' => '/path/to/file' + ) + )); + +### Interface changes + +Additions and changes (you will need to update any implementations or subclasses you may have created): + +- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +- Added `Guzzle\Stream\StreamInterface::isRepeatable` +- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. + +The following methods were removed from interfaces. All of these methods are still available in the concrete classes +that implement them, but you should update your code to use alternative methods: + +- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or + `$client->setDefaultOption('headers/{header_name}', 'value')`. or + `$client->setDefaultOption('headers', array('header_name' => 'value'))`. +- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`. +- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail. +- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin. +- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin. +- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin. + +### Cache plugin breaking changes + +- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +- Always setting X-cache headers on cached responses +- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +- Added `CacheStorageInterface::purge($url)` +- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +3.5 to 3.6 +---------- + +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). + For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). + Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request. +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Moved getLinks() from Response to just be used on a Link header object. + +If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the +HeaderInterface (e.g. toArray(), getAll(), etc.). + +### Interface changes + +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() + +### Removed deprecated functions + +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). + +### Deprecations + +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. + +### Other changes + +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess + +3.3 to 3.4 +---------- + +Base URLs of a client now follow the rules of https://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs. + +3.2 to 3.3 +---------- + +### Response::getEtag() quote stripping removed + +`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header + +### Removed `Guzzle\Http\Utils` + +The `Guzzle\Http\Utils` class was removed. This class was only used for testing. + +### Stream wrapper and type + +`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase. + +### curl.emit_io became emit_io + +Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the +'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' + +3.1 to 3.2 +---------- + +### CurlMulti is no longer reused globally + +Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added +to a single client can pollute requests dispatched from other clients. + +If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the +ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is +created. + +```php +$multi = new Guzzle\Http\Curl\CurlMulti(); +$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); +$builder->addListener('service_builder.create_client', function ($event) use ($multi) { + $event['client']->setCurlMulti($multi); +} +}); +``` + +### No default path + +URLs no longer have a default path value of '/' if no path was specified. + +Before: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com/ +``` + +After: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com +``` + +### Less verbose BadResponseException + +The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and +response information. You can, however, get access to the request and response object by calling `getRequest()` or +`getResponse()` on the exception object. + +### Query parameter aggregation + +Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a +setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is +responsible for handling the aggregation of multi-valued query string variables into a flattened hash. + +2.8 to 3.x +---------- + +### Guzzle\Service\Inspector + +Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig` + +**Before** + +```php +use Guzzle\Service\Inspector; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Inspector::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +**After** + +```php +use Guzzle\Common\Collection; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Collection::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +### Convert XML Service Descriptions to JSON + +**Before** + +```xml + + + + + + Get a list of groups + + + Uses a search query to get a list of groups + + + + Create a group + + + + + Delete a group by ID + + + + + + + Update a group + + + + + + +``` + +**After** + +```json +{ + "name": "Zendesk REST API v2", + "apiVersion": "2012-12-31", + "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users", + "operations": { + "list_groups": { + "httpMethod":"GET", + "uri": "groups.json", + "summary": "Get a list of groups" + }, + "search_groups":{ + "httpMethod":"GET", + "uri": "search.json?query=\"{query} type:group\"", + "summary": "Uses a search query to get a list of groups", + "parameters":{ + "query":{ + "location": "uri", + "description":"Zendesk Search Query", + "type": "string", + "required": true + } + } + }, + "create_group": { + "httpMethod":"POST", + "uri": "groups.json", + "summary": "Create a group", + "parameters":{ + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + }, + "delete_group": { + "httpMethod":"DELETE", + "uri": "groups/{id}.json", + "summary": "Delete a group", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to delete by ID", + "type": "integer", + "required": true + } + } + }, + "get_group": { + "httpMethod":"GET", + "uri": "groups/{id}.json", + "summary": "Get a ticket", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to get by ID", + "type": "integer", + "required": true + } + } + }, + "update_group": { + "httpMethod":"PUT", + "uri": "groups/{id}.json", + "summary": "Update a group", + "parameters":{ + "id": { + "location": "uri", + "description":"Group to update by ID", + "type": "integer", + "required": true + }, + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + } +} +``` + +### Guzzle\Service\Description\ServiceDescription + +Commands are now called Operations + +**Before** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getCommands(); // @returns ApiCommandInterface[] +$sd->hasCommand($name); +$sd->getCommand($name); // @returns ApiCommandInterface|null +$sd->addCommand($command); // @param ApiCommandInterface $command +``` + +**After** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getOperations(); // @returns OperationInterface[] +$sd->hasOperation($name); +$sd->getOperation($name); // @returns OperationInterface|null +$sd->addOperation($operation); // @param OperationInterface $operation +``` + +### Guzzle\Common\Inflection\Inflector + +Namespace is now `Guzzle\Inflection\Inflector` + +### Guzzle\Http\Plugin + +Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below. + +### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log + +Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. + +**Before** + +```php +use Guzzle\Common\Log\ClosureLogAdapter; +use Guzzle\Http\Plugin\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $verbosity is an integer indicating desired message verbosity level +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE); +``` + +**After** + +```php +use Guzzle\Log\ClosureLogAdapter; +use Guzzle\Log\MessageFormatter; +use Guzzle\Plugin\Log\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $format is a string indicating desired message format -- @see MessageFormatter +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT); +``` + +### Guzzle\Http\Plugin\CurlAuthPlugin + +Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`. + +### Guzzle\Http\Plugin\ExponentialBackoffPlugin + +Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes. + +**Before** + +```php +use Guzzle\Http\Plugin\ExponentialBackoffPlugin; + +$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge( + ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429) + )); + +$client->addSubscriber($backoffPlugin); +``` + +**After** + +```php +use Guzzle\Plugin\Backoff\BackoffPlugin; +use Guzzle\Plugin\Backoff\HttpBackoffStrategy; + +// Use convenient factory method instead -- see implementation for ideas of what +// you can do with chaining backoff strategies +$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge( + HttpBackoffStrategy::getDefaultFailureCodes(), array(429) + )); +$client->addSubscriber($backoffPlugin); +``` + +### Known Issues + +#### [BUG] Accept-Encoding header behavior changed unintentionally. + +(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e) + +In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to +properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen. +See issue #217 for a workaround, or use a version containing the fix. diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json new file mode 100644 index 000000000..f369ce67e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -0,0 +1,105 @@ +{ + "name": "guzzlehttp/guzzle", + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "framework", + "http", + "rest", + "web service", + "curl", + "client", + "HTTP client", + "PSR-7", + "PSR-18" + ], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.9 || ^2.4", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "bamarni/composer-bin-plugin": "^1.8.1", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "preferred-install": "dist", + "sort-packages": true + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\": "tests/" + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/BodySummarizer.php b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php new file mode 100644 index 000000000..6eca94ef9 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php @@ -0,0 +1,28 @@ +truncateAt = $truncateAt; + } + + /** + * Returns a summarized message body. + */ + public function summarize(MessageInterface $message): ?string + { + return $this->truncateAt === null + ? \GuzzleHttp\Psr7\Message::bodySummary($message) + : \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php b/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php new file mode 100644 index 000000000..3e02e036e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php @@ -0,0 +1,13 @@ + 'http://www.foo.com/1.0/', + * 'timeout' => 0, + * 'allow_redirects' => false, + * 'proxy' => '192.168.16.1:10' + * ]); + * + * Client configuration settings include the following options: + * + * - handler: (callable) Function that transfers HTTP requests over the + * wire. The function is called with a Psr7\Http\Message\RequestInterface + * and array of transfer options, and must return a + * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a + * Psr7\Http\Message\ResponseInterface on success. + * If no handler is provided, a default handler will be created + * that enables all of the request options below by attaching all of the + * default middleware to the handler. + * - base_uri: (string|UriInterface) Base URI of the client that is merged + * into relative URIs. Can be a string or instance of UriInterface. + * - **: any request option + * + * @param array $config Client configuration settings. + * + * @see \GuzzleHttp\RequestOptions for a list of available request options. + */ + public function __construct(array $config = []) + { + if (!isset($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!\is_callable($config['handler'])) { + throw new InvalidArgumentException('handler must be a callable'); + } + + // Convert the base_uri to a UriInterface + if (isset($config['base_uri'])) { + $config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']); + } + + $this->configureDefaults($config); + } + + /** + * @param string $method + * @param array $args + * + * @return PromiseInterface|ResponseInterface + * + * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0. + */ + public function __call($method, $args) + { + if (\count($args) < 1) { + throw new InvalidArgumentException('Magic request methods require a URI and optional options array'); + } + + $uri = $args[0]; + $opts = $args[1] ?? []; + + return \substr($method, -5) === 'Async' + ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts) + : $this->request($method, $uri, $opts); + } + + /** + * Asynchronously send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + */ + public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface + { + // Merge the base URI into the request URI if needed. + $options = $this->prepareDefaults($options); + + return $this->transfer( + $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), + $options + ); + } + + /** + * Send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function send(RequestInterface $request, array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->sendAsync($request, $options)->wait(); + } + + /** + * The HttpClient PSR (PSR-18) specify this method. + * + * @inheritDoc + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + $options[RequestOptions::ALLOW_REDIRECTS] = false; + $options[RequestOptions::HTTP_ERRORS] = false; + + return $this->sendAsync($request, $options)->wait(); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + */ + public function requestAsync(string $method, $uri = '', array $options = []): PromiseInterface + { + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = $options['headers'] ?? []; + $body = $options['body'] ?? null; + $version = $options['version'] ?? '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options); + if (\is_array($body)) { + throw $this->invalidBody(); + } + $request = new Psr7\Request($method, $uri, $headers, $body, $version); + // Remove the option so that they are not doubly-applied. + unset($options['headers'], $options['body'], $options['version']); + + return $this->transfer($request, $options); + } + + /** + * Create and send an HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string $method HTTP method. + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function request(string $method, $uri = '', array $options = []): ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->requestAsync($method, $uri, $options)->wait(); + } + + /** + * Get a client configuration option. + * + * These options include default request options of the client, a "handler" + * (if utilized by the concrete client), and a "base_uri" if utilized by + * the concrete client. + * + * @param string|null $option The config option to retrieve. + * + * @return mixed + * + * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0. + */ + public function getConfig(?string $option = null) + { + return $option === null + ? $this->config + : ($this->config[$option] ?? null); + } + + private function buildUri(UriInterface $uri, array $config): UriInterface + { + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri); + } + + if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) { + $idnOptions = ($config['idn_conversion'] === true) ? \IDNA_DEFAULT : $config['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + + /** + * Configures the default options for a client. + */ + private function configureDefaults(array $config): void + { + $defaults = [ + 'allow_redirects' => RedirectMiddleware::$defaultSettings, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false, + 'idn_conversion' => false, + ]; + + // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. + + // We can only trust the HTTP_PROXY environment variable in a CLI + // process due to the fact that PHP has no reliable mechanism to + // get environment variables that start with "HTTP_". + if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) { + $defaults['proxy']['http'] = $proxy; + } + + if ($proxy = Utils::getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + + if ($noProxy = Utils::getenv('NO_PROXY')) { + $cleanedNoProxy = \str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy); + } + + $this->config = $config + $defaults; + + if (!empty($config['cookies']) && $config['cookies'] === true) { + $this->config['cookies'] = new CookieJar(); + } + + // Add the default user-agent header. + if (!isset($this->config['headers'])) { + $this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()]; + } else { + // Add the User-Agent header if one was not already set. + foreach (\array_keys($this->config['headers']) as $name) { + if (\strtolower($name) === 'user-agent') { + return; + } + } + $this->config['headers']['User-Agent'] = Utils::defaultUserAgent(); + } + } + + /** + * Merges default options into the array. + * + * @param array $options Options to modify by reference + */ + private function prepareDefaults(array $options): array + { + $defaults = $this->config; + + if (!empty($defaults['headers'])) { + // Default headers are only added if they are not present. + $defaults['_conditional'] = $defaults['headers']; + unset($defaults['headers']); + } + + // Special handling for headers is required as they are added as + // conditional headers and as headers passed to a request ctor. + if (\array_key_exists('headers', $options)) { + // Allows default headers to be unset. + if ($options['headers'] === null) { + $defaults['_conditional'] = []; + unset($options['headers']); + } elseif (!\is_array($options['headers'])) { + throw new InvalidArgumentException('headers must be an array'); + } + } + + // Shallow merge defaults underneath options. + $result = $options + $defaults; + + // Remove null values. + foreach ($result as $k => $v) { + if ($v === null) { + unset($result[$k]); + } + } + + return $result; + } + + /** + * Transfers the given request and applies request options. + * + * The URI of the request is not modified and the request options are used + * as-is without merging in default options. + * + * @param array $options See \GuzzleHttp\RequestOptions. + */ + private function transfer(RequestInterface $request, array $options): PromiseInterface + { + $request = $this->applyOptions($request, $options); + /** @var HandlerStack $handler */ + $handler = $options['handler']; + + try { + return P\Create::promiseFor($handler($request, $options)); + } catch (\Exception $e) { + return P\Create::rejectionFor($e); + } + } + + /** + * Applies the array of request options to a request. + */ + private function applyOptions(RequestInterface $request, array &$options): RequestInterface + { + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + if (array_keys($options['headers']) === range(0, count($options['headers']) - 1)) { + throw new InvalidArgumentException('The headers array must have header name as keys.'); + } + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } + + if (isset($options['form_params'])) { + if (isset($options['multipart'])) { + throw new InvalidArgumentException('You cannot use ' + . 'form_params and multipart at the same time. Use the ' + . 'form_params option if you want to send application/' + . 'x-www-form-urlencoded requests, and the multipart ' + . 'option to send multipart/form-data requests.'); + } + $options['body'] = \http_build_query($options['form_params'], '', '&'); + unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + if (isset($options['multipart'])) { + $options['body'] = new Psr7\MultipartStream($options['multipart']); + unset($options['multipart']); + } + + if (isset($options['json'])) { + $options['body'] = Utils::jsonEncode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/json'; + } + + if (!empty($options['decode_content']) + && $options['decode_content'] !== true + ) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + + if (isset($options['body'])) { + if (\is_array($options['body'])) { + throw $this->invalidBody(); + } + $modify['body'] = Psr7\Utils::streamFor($options['body']); + unset($options['body']); + } + + if (!empty($options['auth']) && \is_array($options['auth'])) { + $value = $options['auth']; + $type = isset($value[2]) ? \strtolower($value[2]) : 'basic'; + switch ($type) { + case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' + . \base64_encode("$value[0]:$value[1]"); + break; + case 'digest': + // @todo: Do not rely on curl + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST; + $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + case 'ntlm': + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM; + $options['curl'][\CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + } + } + + if (isset($options['query'])) { + $value = $options['query']; + if (\is_array($value)) { + $value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986); + } + if (!\is_string($value)) { + throw new InvalidArgumentException('query must be a string or array'); + } + $modify['query'] = $value; + unset($options['query']); + } + + // Ensure that sink is not an invalid value. + if (isset($options['sink'])) { + // TODO: Add more sink validation? + if (\is_bool($options['sink'])) { + throw new InvalidArgumentException('sink must not be a boolean'); + } + } + + $request = Psr7\Utils::modifyRequest($request, $modify); + if ($request->getBody() instanceof Psr7\MultipartStream) { + // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' + . $request->getBody()->getBoundary(); + } + + // Merge in conditional headers if they are not present. + if (isset($options['_conditional'])) { + // Build up the changes so it's in a single clone of the message. + $modify = []; + foreach ($options['_conditional'] as $k => $v) { + if (!$request->hasHeader($k)) { + $modify['set_headers'][$k] = $v; + } + } + $request = Psr7\Utils::modifyRequest($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + + return $request; + } + + /** + * Return an InvalidArgumentException with pre-set message. + */ + private function invalidBody(): InvalidArgumentException + { + return new InvalidArgumentException('Passing in the "body" request ' + . 'option as an array to send a request is not supported. ' + . 'Please use the "form_params" request option to send a ' + . 'application/x-www-form-urlencoded request, or the "multipart" ' + . 'request option to send a multipart/form-data request.'); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php new file mode 100644 index 000000000..6aaee61af --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -0,0 +1,84 @@ +request('GET', $uri, $options); + } + + /** + * Create and send an HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function head($uri, array $options = []): ResponseInterface + { + return $this->request('HEAD', $uri, $options); + } + + /** + * Create and send an HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function put($uri, array $options = []): ResponseInterface + { + return $this->request('PUT', $uri, $options); + } + + /** + * Create and send an HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function post($uri, array $options = []): ResponseInterface + { + return $this->request('POST', $uri, $options); + } + + /** + * Create and send an HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function patch($uri, array $options = []): ResponseInterface + { + return $this->request('PATCH', $uri, $options); + } + + /** + * Create and send an HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function delete($uri, array $options = []): ResponseInterface + { + return $this->request('DELETE', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + abstract public function requestAsync(string $method, $uri, array $options = []): PromiseInterface; + + /** + * Create and send an asynchronous HTTP GET request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function getAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('GET', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function headAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('HEAD', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function putAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PUT', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function postAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('POST', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function patchAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('PATCH', $uri, $options); + } + + /** + * Create and send an asynchronous HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function deleteAsync($uri, array $options = []): PromiseInterface + { + return $this->requestAsync('DELETE', $uri, $options); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php new file mode 100644 index 000000000..9985a9814 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -0,0 +1,317 @@ +strictMode = $strictMode; + + foreach ($cookieArray as $cookie) { + if (!($cookie instanceof SetCookie)) { + $cookie = new SetCookie($cookie); + } + $this->setCookie($cookie); + } + } + + /** + * Create a new Cookie jar from an associative array and domain. + * + * @param array $cookies Cookies to create the jar from + * @param string $domain Domain to set the cookies to + */ + public static function fromArray(array $cookies, string $domain): self + { + $cookieJar = new self(); + foreach ($cookies as $name => $value) { + $cookieJar->setCookie(new SetCookie([ + 'Domain' => $domain, + 'Name' => $name, + 'Value' => $value, + 'Discard' => true + ])); + } + + return $cookieJar; + } + + /** + * Evaluate if this cookie should be persisted to storage + * that survives between requests. + * + * @param SetCookie $cookie Being evaluated. + * @param bool $allowSessionCookies If we should persist session cookies + */ + public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = false): bool + { + if ($cookie->getExpires() || $allowSessionCookies) { + if (!$cookie->getDiscard()) { + return true; + } + } + + return false; + } + + /** + * Finds and returns the cookie based on the name + * + * @param string $name cookie name to search for + * + * @return SetCookie|null cookie that was found or null if not found + */ + public function getCookieByName(string $name): ?SetCookie + { + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + + return null; + } + + /** + * @inheritDoc + */ + public function toArray(): array + { + return \array_map(static function (SetCookie $cookie): array { + return $cookie->toArray(); + }, $this->getIterator()->getArrayCopy()); + } + + /** + * @inheritDoc + */ + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void + { + if (!$domain) { + $this->cookies = []; + return; + } elseif (!$path) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($domain): bool { + return !$cookie->matchesDomain($domain); + } + ); + } elseif (!$name) { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain): bool { + return !($cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } else { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie) use ($path, $domain, $name) { + return !($cookie->getName() == $name && + $cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } + } + + /** + * @inheritDoc + */ + public function clearSessionCookies(): void + { + $this->cookies = \array_filter( + $this->cookies, + static function (SetCookie $cookie): bool { + return !$cookie->getDiscard() && $cookie->getExpires(); + } + ); + } + + /** + * @inheritDoc + */ + public function setCookie(SetCookie $cookie): bool + { + // If the name string is empty (but not 0), ignore the set-cookie + // string entirely. + $name = $cookie->getName(); + if (!$name && $name !== '0') { + return false; + } + + // Only allow cookies with set and valid domain, name, value + $result = $cookie->validate(); + if ($result !== true) { + if ($this->strictMode) { + throw new \RuntimeException('Invalid cookie: ' . $result); + } + $this->removeCookieIfEmpty($cookie); + return false; + } + + // Resolve conflicts with previously set cookies + foreach ($this->cookies as $i => $c) { + // Two cookies are identical, when their path, and domain are + // identical. + if ($c->getPath() != $cookie->getPath() || + $c->getDomain() != $cookie->getDomain() || + $c->getName() != $cookie->getName() + ) { + continue; + } + + // The previously set cookie is a discard cookie and this one is + // not so allow the new cookie to be set + if (!$cookie->getDiscard() && $c->getDiscard()) { + unset($this->cookies[$i]); + continue; + } + + // If the new cookie's expiration is further into the future, then + // replace the old cookie + if ($cookie->getExpires() > $c->getExpires()) { + unset($this->cookies[$i]); + continue; + } + + // If the value has changed, we better change it + if ($cookie->getValue() !== $c->getValue()) { + unset($this->cookies[$i]); + continue; + } + + // The cookie exists, so no need to continue + return false; + } + + $this->cookies[] = $cookie; + + return true; + } + + public function count(): int + { + return \count($this->cookies); + } + + /** + * @return \ArrayIterator + */ + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator(\array_values($this->cookies)); + } + + public function extractCookies(RequestInterface $request, ResponseInterface $response): void + { + if ($cookieHeader = $response->getHeader('Set-Cookie')) { + foreach ($cookieHeader as $cookie) { + $sc = SetCookie::fromString($cookie); + if (!$sc->getDomain()) { + $sc->setDomain($request->getUri()->getHost()); + } + if (0 !== \strpos($sc->getPath(), '/')) { + $sc->setPath($this->getCookiePathFromRequest($request)); + } + if (!$sc->matchesDomain($request->getUri()->getHost())) { + continue; + } + // Note: At this point `$sc->getDomain()` being a public suffix should + // be rejected, but we don't want to pull in the full PSL dependency. + $this->setCookie($sc); + } + } + } + + /** + * Computes cookie path following RFC 6265 section 5.1.4 + * + * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 + */ + private function getCookiePathFromRequest(RequestInterface $request): string + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== \strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + $lastSlashPos = \strrpos($uriPath, '/'); + if (0 === $lastSlashPos || false === $lastSlashPos) { + return '/'; + } + + return \substr($uriPath, 0, $lastSlashPos); + } + + public function withCookieHeader(RequestInterface $request): RequestInterface + { + $values = []; + $uri = $request->getUri(); + $scheme = $uri->getScheme(); + $host = $uri->getHost(); + $path = $uri->getPath() ?: '/'; + + foreach ($this->cookies as $cookie) { + if ($cookie->matchesPath($path) && + $cookie->matchesDomain($host) && + !$cookie->isExpired() && + (!$cookie->getSecure() || $scheme === 'https') + ) { + $values[] = $cookie->getName() . '=' + . $cookie->getValue(); + } + } + + return $values + ? $request->withHeader('Cookie', \implode('; ', $values)) + : $request; + } + + /** + * If a cookie already exists and the server asks to set it again with a + * null value, the cookie must be deleted. + */ + private function removeCookieIfEmpty(SetCookie $cookie): void + { + $cookieValue = $cookie->getValue(); + if ($cookieValue === null || $cookieValue === '') { + $this->clear( + $cookie->getDomain(), + $cookie->getPath(), + $cookie->getName() + ); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php new file mode 100644 index 000000000..7df374b5b --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -0,0 +1,79 @@ + + */ +interface CookieJarInterface extends \Countable, \IteratorAggregate +{ + /** + * Create a request with added cookie headers. + * + * If no matching cookies are found in the cookie jar, then no Cookie + * header is added to the request and the same request is returned. + * + * @param RequestInterface $request Request object to modify. + * + * @return RequestInterface returns the modified request. + */ + public function withCookieHeader(RequestInterface $request): RequestInterface; + + /** + * Extract cookies from an HTTP response and store them in the CookieJar. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + */ + public function extractCookies(RequestInterface $request, ResponseInterface $response): void; + + /** + * Sets a cookie in the cookie jar. + * + * @param SetCookie $cookie Cookie to set. + * + * @return bool Returns true on success or false on failure + */ + public function setCookie(SetCookie $cookie): bool; + + /** + * Remove cookies currently held in the cookie jar. + * + * Invoking this method without arguments will empty the whole cookie jar. + * If given a $domain argument only cookies belonging to that domain will + * be removed. If given a $domain and $path argument, cookies belonging to + * the specified path within that domain are removed. If given all three + * arguments, then the cookie with the specified name, path and domain is + * removed. + * + * @param string|null $domain Clears cookies matching a domain + * @param string|null $path Clears cookies matching a domain and path + * @param string|null $name Clears cookies matching a domain, path, and name + */ + public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void; + + /** + * Discard all sessions cookies. + * + * Removes cookies that don't have an expire field or a have a discard + * field set to true. To be called when the user agent shuts down according + * to RFC 2965. + */ + public function clearSessionCookies(): void; + + /** + * Converts the cookie jar to an array. + */ + public function toArray(): array; +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php new file mode 100644 index 000000000..290236d54 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php @@ -0,0 +1,101 @@ +filename = $cookieFile; + $this->storeSessionCookies = $storeSessionCookies; + + if (\file_exists($cookieFile)) { + $this->load($cookieFile); + } + } + + /** + * Saves the file when shutting down + */ + public function __destruct() + { + $this->save($this->filename); + } + + /** + * Saves the cookies to a file. + * + * @param string $filename File to save + * + * @throws \RuntimeException if the file cannot be found or created + */ + public function save(string $filename): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $jsonStr = Utils::jsonEncode($json); + if (false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) { + throw new \RuntimeException("Unable to save file {$filename}"); + } + } + + /** + * Load cookies from a JSON formatted file. + * + * Old cookies are kept unless overwritten by newly loaded ones. + * + * @param string $filename Cookie file to load. + * + * @throws \RuntimeException if the file cannot be loaded. + */ + public function load(string $filename): void + { + $json = \file_get_contents($filename); + if (false === $json) { + throw new \RuntimeException("Unable to load file {$filename}"); + } + if ($json === '') { + return; + } + + $data = Utils::jsonDecode($json, true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\is_scalar($data) && !empty($data)) { + throw new \RuntimeException("Invalid cookie file: {$filename}"); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php new file mode 100644 index 000000000..5d51ca982 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -0,0 +1,77 @@ +sessionKey = $sessionKey; + $this->storeSessionCookies = $storeSessionCookies; + $this->load(); + } + + /** + * Saves cookies to session when shutting down + */ + public function __destruct() + { + $this->save(); + } + + /** + * Save cookies to the client session + */ + public function save(): void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $_SESSION[$this->sessionKey] = \json_encode($json); + } + + /** + * Load the contents of the client session into the data array + */ + protected function load(): void + { + if (!isset($_SESSION[$this->sessionKey])) { + return; + } + $data = \json_decode($_SESSION[$this->sessionKey], true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\strlen($data)) { + throw new \RuntimeException("Invalid cookie data"); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php new file mode 100644 index 000000000..a613c77bf --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -0,0 +1,446 @@ + null, + 'Value' => null, + 'Domain' => null, + 'Path' => '/', + 'Max-Age' => null, + 'Expires' => null, + 'Secure' => false, + 'Discard' => false, + 'HttpOnly' => false + ]; + + /** + * @var array Cookie data + */ + private $data; + + /** + * Create a new SetCookie object from a string. + * + * @param string $cookie Set-Cookie header string + */ + public static function fromString(string $cookie): self + { + // Create the default return array + $data = self::$defaults; + // Explode the cookie string using a series of semicolons + $pieces = \array_filter(\array_map('trim', \explode(';', $cookie))); + // The name of the cookie (first kvp) must exist and include an equal sign. + if (!isset($pieces[0]) || \strpos($pieces[0], '=') === false) { + return new self($data); + } + + // Add the cookie pieces into the parsed data array + foreach ($pieces as $part) { + $cookieParts = \explode('=', $part, 2); + $key = \trim($cookieParts[0]); + $value = isset($cookieParts[1]) + ? \trim($cookieParts[1], " \n\r\t\0\x0B") + : true; + + // Only check for non-cookies when cookies have been found + if (!isset($data['Name'])) { + $data['Name'] = $key; + $data['Value'] = $value; + } else { + foreach (\array_keys(self::$defaults) as $search) { + if (!\strcasecmp($search, $key)) { + $data[$search] = $value; + continue 2; + } + } + $data[$key] = $value; + } + } + + return new self($data); + } + + /** + * @param array $data Array of cookie data provided by a Cookie parser + */ + public function __construct(array $data = []) + { + /** @var array|null $replaced will be null in case of replace error */ + $replaced = \array_replace(self::$defaults, $data); + if ($replaced === null) { + throw new \InvalidArgumentException('Unable to replace the default values for the Cookie.'); + } + + $this->data = $replaced; + // Extract the Expires value and turn it into a UNIX timestamp if needed + if (!$this->getExpires() && $this->getMaxAge()) { + // Calculate the Expires date + $this->setExpires(\time() + $this->getMaxAge()); + } elseif (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) { + $this->setExpires($expires); + } + } + + public function __toString() + { + $str = $this->data['Name'] . '=' . ($this->data['Value'] ?? '') . '; '; + foreach ($this->data as $k => $v) { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { + if ($k === 'Expires') { + $str .= 'Expires=' . \gmdate('D, d M Y H:i:s \G\M\T', $v) . '; '; + } else { + $str .= ($v === true ? $k : "{$k}={$v}") . '; '; + } + } + } + + return \rtrim($str, '; '); + } + + public function toArray(): array + { + return $this->data; + } + + /** + * Get the cookie name. + * + * @return string + */ + public function getName() + { + return $this->data['Name']; + } + + /** + * Set the cookie name. + * + * @param string $name Cookie name + */ + public function setName($name): void + { + if (!is_string($name)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Name'] = (string) $name; + } + + /** + * Get the cookie value. + * + * @return string|null + */ + public function getValue() + { + return $this->data['Value']; + } + + /** + * Set the cookie value. + * + * @param string $value Cookie value + */ + public function setValue($value): void + { + if (!is_string($value)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Value'] = (string) $value; + } + + /** + * Get the domain. + * + * @return string|null + */ + public function getDomain() + { + return $this->data['Domain']; + } + + /** + * Set the domain of the cookie. + * + * @param string|null $domain + */ + public function setDomain($domain): void + { + if (!is_string($domain) && null !== $domain) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Domain'] = null === $domain ? null : (string) $domain; + } + + /** + * Get the path. + * + * @return string + */ + public function getPath() + { + return $this->data['Path']; + } + + /** + * Set the path of the cookie. + * + * @param string $path Path of the cookie + */ + public function setPath($path): void + { + if (!is_string($path)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Path'] = (string) $path; + } + + /** + * Maximum lifetime of the cookie in seconds. + * + * @return int|null + */ + public function getMaxAge() + { + return null === $this->data['Max-Age'] ? null : (int) $this->data['Max-Age']; + } + + /** + * Set the max-age of the cookie. + * + * @param int|null $maxAge Max age of the cookie in seconds + */ + public function setMaxAge($maxAge): void + { + if (!is_int($maxAge) && null !== $maxAge) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Max-Age'] = $maxAge === null ? null : (int) $maxAge; + } + + /** + * The UNIX timestamp when the cookie Expires. + * + * @return string|int|null + */ + public function getExpires() + { + return $this->data['Expires']; + } + + /** + * Set the unix timestamp for which the cookie will expire. + * + * @param int|string|null $timestamp Unix timestamp or any English textual datetime description. + */ + public function setExpires($timestamp): void + { + if (!is_int($timestamp) && !is_string($timestamp) && null !== $timestamp) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int, string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Expires'] = null === $timestamp ? null : (\is_numeric($timestamp) ? (int) $timestamp : \strtotime((string) $timestamp)); + } + + /** + * Get whether or not this is a secure cookie. + * + * @return bool + */ + public function getSecure() + { + return $this->data['Secure']; + } + + /** + * Set whether or not the cookie is secure. + * + * @param bool $secure Set to true or false if secure + */ + public function setSecure($secure): void + { + if (!is_bool($secure)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Secure'] = (bool) $secure; + } + + /** + * Get whether or not this is a session cookie. + * + * @return bool|null + */ + public function getDiscard() + { + return $this->data['Discard']; + } + + /** + * Set whether or not this is a session cookie. + * + * @param bool $discard Set to true or false if this is a session cookie + */ + public function setDiscard($discard): void + { + if (!is_bool($discard)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['Discard'] = (bool) $discard; + } + + /** + * Get whether or not this is an HTTP only cookie. + * + * @return bool + */ + public function getHttpOnly() + { + return $this->data['HttpOnly']; + } + + /** + * Set whether or not this is an HTTP only cookie. + * + * @param bool $httpOnly Set to true or false if this is HTTP only + */ + public function setHttpOnly($httpOnly): void + { + if (!is_bool($httpOnly)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->data['HttpOnly'] = (bool) $httpOnly; + } + + /** + * Check if the cookie matches a path value. + * + * A request-path path-matches a given cookie-path if at least one of + * the following conditions holds: + * + * - The cookie-path and the request-path are identical. + * - The cookie-path is a prefix of the request-path, and the last + * character of the cookie-path is %x2F ("/"). + * - The cookie-path is a prefix of the request-path, and the first + * character of the request-path that is not included in the cookie- + * path is a %x2F ("/") character. + * + * @param string $requestPath Path to check against + */ + public function matchesPath(string $requestPath): bool + { + $cookiePath = $this->getPath(); + + // Match on exact matches or when path is the default empty "/" + if ($cookiePath === '/' || $cookiePath == $requestPath) { + return true; + } + + // Ensure that the cookie-path is a prefix of the request path. + if (0 !== \strpos($requestPath, $cookiePath)) { + return false; + } + + // Match if the last character of the cookie-path is "/" + if (\substr($cookiePath, -1, 1) === '/') { + return true; + } + + // Match if the first character not included in cookie path is "/" + return \substr($requestPath, \strlen($cookiePath), 1) === '/'; + } + + /** + * Check if the cookie matches a domain value. + * + * @param string $domain Domain to check against + */ + public function matchesDomain(string $domain): bool + { + $cookieDomain = $this->getDomain(); + if (null === $cookieDomain) { + return true; + } + + // Remove the leading '.' as per spec in RFC 6265. + // https://tools.ietf.org/html/rfc6265#section-5.2.3 + $cookieDomain = \ltrim(\strtolower($cookieDomain), '.'); + + $domain = \strtolower($domain); + + // Domain not set or exact match. + if ('' === $cookieDomain || $domain === $cookieDomain) { + return true; + } + + // Matching the subdomain according to RFC 6265. + // https://tools.ietf.org/html/rfc6265#section-5.1.3 + if (\filter_var($domain, \FILTER_VALIDATE_IP)) { + return false; + } + + return (bool) \preg_match('/\.' . \preg_quote($cookieDomain, '/') . '$/', $domain); + } + + /** + * Check if the cookie is expired. + */ + public function isExpired(): bool + { + return $this->getExpires() !== null && \time() > $this->getExpires(); + } + + /** + * Check if the cookie is valid according to RFC 6265. + * + * @return bool|string Returns true if valid or an error message if invalid + */ + public function validate() + { + $name = $this->getName(); + if ($name === '') { + return 'The cookie name must not be empty'; + } + + // Check if any of the invalid characters are present in the cookie name + if (\preg_match( + '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', + $name + )) { + return 'Cookie name must not contain invalid characters: ASCII ' + . 'Control characters (0-31;127), space, tab and the ' + . 'following characters: ()<>@,;:\"/?={}'; + } + + // Value must not be null. 0 and empty string are valid. Empty strings + // are technically against RFC 6265, but known to happen in the wild. + $value = $this->getValue(); + if ($value === null) { + return 'The cookie value must not be empty'; + } + + // Domains must not be empty, but can be 0. "0" is not a valid internet + // domain, but may be used as server name in a private network. + $domain = $this->getDomain(); + if ($domain === null || $domain === '') { + return 'The cookie domain must not be empty'; + } + + return true; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php new file mode 100644 index 000000000..a80956c9d --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -0,0 +1,39 @@ +request = $request; + $this->handlerContext = $handlerContext; + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php new file mode 100644 index 000000000..fa3ed6998 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -0,0 +1,9 @@ +getStatusCode() : 0; + parent::__construct($message, $code, $previous); + $this->request = $request; + $this->response = $response; + $this->handlerContext = $handlerContext; + } + + /** + * Wrap non-RequestExceptions with a RequestException + */ + public static function wrapException(RequestInterface $request, \Throwable $e): RequestException + { + return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e); + } + + /** + * Factory method to create a new exception with a normalized error message + * + * @param RequestInterface $request Request sent + * @param ResponseInterface $response Response received + * @param \Throwable|null $previous Previous exception + * @param array $handlerContext Optional handler context + * @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer + */ + public static function create( + RequestInterface $request, + ResponseInterface $response = null, + \Throwable $previous = null, + array $handlerContext = [], + BodySummarizerInterface $bodySummarizer = null + ): self { + if (!$response) { + return new self( + 'Error completing request', + $request, + null, + $previous, + $handlerContext + ); + } + + $level = (int) \floor($response->getStatusCode() / 100); + if ($level === 4) { + $label = 'Client error'; + $className = ClientException::class; + } elseif ($level === 5) { + $label = 'Server error'; + $className = ServerException::class; + } else { + $label = 'Unsuccessful request'; + $className = __CLASS__; + } + + $uri = $request->getUri(); + $uri = static::obfuscateUri($uri); + + // Client Error: `GET /` resulted in a `404 Not Found` response: + // ... (truncated) + $message = \sprintf( + '%s: `%s %s` resulted in a `%s %s` response', + $label, + $request->getMethod(), + $uri->__toString(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + $summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response); + + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + + return new $className($message, $request, $response, $previous, $handlerContext); + } + + /** + * Obfuscates URI if there is a username and a password present + */ + private static function obfuscateUri(UriInterface $uri): UriInterface + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = \strpos($userInfo, ':'))) { + return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + } + + return $uri; + } + + /** + * Get the request that caused the exception + */ + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Get the associated response + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Check if a response was received + */ + public function hasResponse(): bool + { + return $this->response !== null; + } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext(): array + { + return $this->handlerContext; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php new file mode 100644 index 000000000..8055e067c --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -0,0 +1,10 @@ +maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options): EasyHandle + { + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + + $easy = new EasyHandle; + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + unset($conf['_headers']); + + // Add handler options from the request configuration options + if (isset($options['curl'])) { + $conf = \array_replace($conf, $options['curl']); + } + + $conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles ? \array_pop($this->handles) : \curl_init(); + curl_setopt_array($easy->handle, $conf); + + return $easy; + } + + public function release(EasyHandle $easy): void + { + $resource = $easy->handle; + unset($easy->handle); + + if (\count($this->handles) >= $this->maxHandles) { + \curl_close($resource); + } else { + // Remove all callback functions as they can hold onto references + // and are not cleaned up by curl_reset. Using curl_setopt_array + // does not work for some reason, so removing each one + // individually. + \curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null); + \curl_setopt($resource, \CURLOPT_READFUNCTION, null); + \curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null); + \curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null); + \curl_reset($resource); + $this->handles[] = $resource; + } + } + + /** + * Completes a cURL transaction, either returning a response promise or a + * rejected promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + * @param CurlFactoryInterface $factory Dictates how the handle is released + */ + public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + if (isset($easy->options['on_stats'])) { + self::invokeStats($easy); + } + + if (!$easy->response || $easy->errno) { + return self::finishError($handler, $easy, $factory); + } + + // Return the response if it is present and there is no error. + $factory->release($easy); + + // Rewind the body of the response if possible. + $body = $easy->response->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + + return new FulfilledPromise($easy->response); + } + + private static function invokeStats(EasyHandle $easy): void + { + $curlStats = \curl_getinfo($easy->handle); + $curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME); + $stats = new TransferStats( + $easy->request, + $easy->response, + $curlStats['total_time'], + $easy->errno, + $curlStats + ); + ($easy->options['on_stats'])($stats); + } + + /** + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory): PromiseInterface + { + // Get error information and release the handle to the factory. + $ctx = [ + 'errno' => $easy->errno, + 'error' => \curl_error($easy->handle), + 'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME), + ] + \curl_getinfo($easy->handle); + $ctx[self::CURL_VERSION_STR] = \curl_version()['version']; + $factory->release($easy); + + // Retry when nothing is present or when curl failed to rewind. + if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) { + return self::retryFailedRewind($handler, $easy, $ctx); + } + + return self::createRejection($easy, $ctx); + } + + private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface + { + static $connectionErrors = [ + \CURLE_OPERATION_TIMEOUTED => true, + \CURLE_COULDNT_RESOLVE_HOST => true, + \CURLE_COULDNT_CONNECT => true, + \CURLE_SSL_CONNECT_ERROR => true, + \CURLE_GOT_NOTHING => true, + ]; + + if ($easy->createResponseException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered while creating the response', + $easy->request, + $easy->response, + $easy->createResponseException, + $ctx + ) + ); + } + + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return P\Create::rejectionFor( + new RequestException( + 'An error was encountered during the on_headers event', + $easy->request, + $easy->response, + $easy->onHeadersException, + $ctx + ) + ); + } + + $message = \sprintf( + 'cURL error %s: %s (%s)', + $ctx['errno'], + $ctx['error'], + 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' + ); + $uriString = (string) $easy->request->getUri(); + if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) { + $message .= \sprintf(' for %s', $uriString); + } + + // Create a connection exception if it was a specific error code. + $error = isset($connectionErrors[$easy->errno]) + ? new ConnectException($message, $easy->request, null, $ctx) + : new RequestException($message, $easy->request, $easy->response, null, $ctx); + + return P\Create::rejectionFor($error); + } + + /** + * @return array + */ + private function getDefaultConf(EasyHandle $easy): array + { + $conf = [ + '_headers' => $easy->request->getHeaders(), + \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), + \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + \CURLOPT_RETURNTRANSFER => false, + \CURLOPT_HEADER => false, + \CURLOPT_CONNECTTIMEOUT => 150, + ]; + + if (\defined('CURLOPT_PROTOCOLS')) { + $conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS; + } + + $version = $easy->request->getProtocolVersion(); + if ($version == 1.1) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + } elseif ($version == 2.0) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; + } else { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; + } + + return $conf; + } + + private function applyMethod(EasyHandle $easy, array &$conf): void + { + $body = $easy->request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size > 0) { + $this->applyBody($easy->request, $easy->options, $conf); + return; + } + + $method = $easy->request->getMethod(); + if ($method === 'PUT' || $method === 'POST') { + // See https://tools.ietf.org/html/rfc7230#section-3.3.2 + if (!$easy->request->hasHeader('Content-Length')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + } elseif ($method === 'HEAD') { + $conf[\CURLOPT_NOBODY] = true; + unset( + $conf[\CURLOPT_WRITEFUNCTION], + $conf[\CURLOPT_READFUNCTION], + $conf[\CURLOPT_FILE], + $conf[\CURLOPT_INFILE] + ); + } + } + + private function applyBody(RequestInterface $request, array $options, array &$conf): void + { + $size = $request->hasHeader('Content-Length') + ? (int) $request->getHeaderLine('Content-Length') + : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || !empty($options['_body_as_string'])) { + $conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody(); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[\CURLOPT_UPLOAD] = true; + if ($size !== null) { + $conf[\CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) { + return $body->read($length); + }; + } + + // If the Expect header is not present, prevent curl from adding it + if (!$request->hasHeader('Expect')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!$request->hasHeader('Content-Type')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function applyHeaders(EasyHandle $easy, array &$conf): void + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[\CURLOPT_HTTPHEADER][] = "$name;"; + } else { + $conf[\CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + } + + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader(string $name, array &$options): void + { + foreach (\array_keys($options['_headers']) as $key) { + if (!\strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf): void + { + $options = $easy->options; + if (isset($options['verify'])) { + if ($options['verify'] === false) { + unset($conf[\CURLOPT_CAINFO]); + $conf[\CURLOPT_SSL_VERIFYHOST] = 0; + $conf[\CURLOPT_SSL_VERIFYPEER] = false; + } else { + $conf[\CURLOPT_SSL_VERIFYHOST] = 2; + $conf[\CURLOPT_SSL_VERIFYPEER] = true; + if (\is_string($options['verify'])) { + // Throw an error if the file/folder/link path is not valid or doesn't exist. + if (!\file_exists($options['verify'])) { + throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}"); + } + // If it's a directory or a link to a directory use CURLOPT_CAPATH. + // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. + if ( + \is_dir($options['verify']) || + ( + \is_link($options['verify']) === true && + ($verifyLink = \readlink($options['verify'])) !== false && + \is_dir($verifyLink) + ) + ) { + $conf[\CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[\CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!isset($options['curl'][\CURLOPT_ENCODING]) && !empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[\CURLOPT_ENCODING] = $accept; + } else { + // The empty string enables all available decoders and implicitly + // sets a matching 'Accept-Encoding' header. + $conf[\CURLOPT_ENCODING] = ''; + // But as the user did not specify any acceptable encodings we need + // to overwrite this implicit header with an empty one. + $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (!isset($options['sink'])) { + // Use a default temp stream if no sink was set. + $options['sink'] = \GuzzleHttp\Psr7\Utils::tryFopen('php://temp', 'w+'); + } + $sink = $options['sink']; + if (!\is_string($sink)) { + $sink = \GuzzleHttp\Psr7\Utils::streamFor($sink); + } elseif (!\is_dir(\dirname($sink))) { + // Ensure that the directory exists before failing in curl. + throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink)); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use ($sink): int { + return $sink->write($write); + }; + + $timeoutRequiresNoSignal = false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + + // CURL default value is CURL_IPRESOLVE_WHATEVER + if (isset($options['force_ip_resolve'])) { + if ('v4' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; + } elseif ('v6' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6; + } + } + + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + + if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') { + $conf[\CURLOPT_NOSIGNAL] = true; + } + + if (isset($options['proxy'])) { + if (!\is_array($options['proxy'])) { + $conf[\CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (!isset($options['proxy']['no']) || !Utils::isHostInNoProxy($host, $options['proxy']['no'])) { + $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + + if (isset($options['cert'])) { + $cert = $options['cert']; + if (\is_array($cert)) { + $conf[\CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!\file_exists($cert)) { + throw new \InvalidArgumentException("SSL certificate not found: {$cert}"); + } + # OpenSSL (versions 0.9.3 and later) also support "P12" for PKCS#12-encoded files. + # see https://curl.se/libcurl/c/CURLOPT_SSLCERTTYPE.html + $ext = pathinfo($cert, \PATHINFO_EXTENSION); + if (preg_match('#^(der|p12)$#i', $ext)) { + $conf[\CURLOPT_SSLCERTTYPE] = strtoupper($ext); + } + $conf[\CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + if (\is_array($options['ssl_key'])) { + if (\count($options['ssl_key']) === 2) { + [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; + } else { + [$sslKey] = $options['ssl_key']; + } + } + + $sslKey = $sslKey ?? $options['ssl_key']; + + if (!\file_exists($sslKey)) { + throw new \InvalidArgumentException("SSL private key not found: {$sslKey}"); + } + $conf[\CURLOPT_SSLKEY] = $sslKey; + } + + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!\is_callable($progress)) { + throw new \InvalidArgumentException('progress client option must be callable'); + } + $conf[\CURLOPT_NOPROGRESS] = false; + $conf[\CURLOPT_PROGRESSFUNCTION] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use ($progress) { + $progress($downloadSize, $downloaded, $uploadSize, $uploaded); + }; + } + + if (!empty($options['debug'])) { + $conf[\CURLOPT_STDERR] = Utils::debugResource($options['debug']); + $conf[\CURLOPT_VERBOSE] = true; + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx): PromiseInterface + { + try { + // Only rewind if the body has been read from. + $body = $easy->request->getBody(); + if ($body->tell() > 0) { + $body->rewind(); + } + } catch (\RuntimeException $e) { + $ctx['error'] = 'The connection unexpectedly failed without ' + . 'providing an error. The request would have been retried, ' + . 'but attempting to rewind the request body failed. ' + . 'Exception: ' . $e; + return self::createRejection($easy, $ctx); + } + + // Retry no more than 3 times before giving up. + if (!isset($easy->options['_curl_retries'])) { + $easy->options['_curl_retries'] = 1; + } elseif ($easy->options['_curl_retries'] == 2) { + $ctx['error'] = 'The cURL request was retried 3 times ' + . 'and did not succeed. The most likely reason for the failure ' + . 'is that cURL was unable to rewind the body of the request ' + . 'and subsequent retries resulted in the same error. Turn on ' + . 'the debug option to see what went wrong. See ' + . 'https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createRejection($easy, $ctx); + } else { + $easy->options['_curl_retries']++; + } + + return $handler($easy->request, $easy->options); + } + + private function createHeaderFn(EasyHandle $easy): callable + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + + if (!\is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + + return static function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = \trim($h); + if ($value === '') { + $startingResponse = true; + try { + $easy->createResponse(); + } catch (\Exception $e) { + $easy->createResponseException = $e; + return -1; + } + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + // Associate the exception with the handle and trigger + // a curl header write error by returning 0. + $easy->onHeadersException = $e; + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + return \strlen($h); + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php new file mode 100644 index 000000000..fe57ed5d5 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,25 @@ +factory = $options['handle_factory'] + ?? new CurlFactory(3); + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (isset($options['delay'])) { + \usleep($options['delay'] * 1000); + } + + $easy = $this->factory->create($request, $options); + \curl_exec($easy->handle); + $easy->errno = \curl_errno($easy->handle); + + return CurlFactory::finish($this, $easy, $this->factory); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php new file mode 100644 index 000000000..4356d0247 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,262 @@ + An array of delay times, indexed by handle id in `addRequest`. + * + * @see CurlMultiHandler::addRequest + */ + private $delays = []; + + /** + * @var array An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt() + */ + private $options = []; + + /** + * This handler accepts the following options: + * + * - handle_factory: An optional factory used to create curl handles + * - select_timeout: Optional timeout (in seconds) to block before timing + * out while selecting curl handles. Defaults to 1 second. + * - options: An associative array of CURLMOPT_* options and + * corresponding values for curl_multi_setopt() + */ + public function __construct(array $options = []) + { + $this->factory = $options['handle_factory'] ?? new CurlFactory(50); + + if (isset($options['select_timeout'])) { + $this->selectTimeout = $options['select_timeout']; + } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + @trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED); + $this->selectTimeout = (int) $selectTimeout; + } else { + $this->selectTimeout = 1; + } + + $this->options = $options['options'] ?? []; + } + + /** + * @param string $name + * + * @return resource|\CurlMultiHandle + * + * @throws \BadMethodCallException when another field as `_mh` will be gotten + * @throws \RuntimeException when curl can not initialize a multi handle + */ + public function __get($name) + { + if ($name !== '_mh') { + throw new \BadMethodCallException("Can not get other property as '_mh'."); + } + + $multiHandle = \curl_multi_init(); + + if (false === $multiHandle) { + throw new \RuntimeException('Can not initialize curl multi handle.'); + } + + $this->_mh = $multiHandle; + + foreach ($this->options as $option => $value) { + // A warning is raised in case of a wrong option. + curl_multi_setopt($this->_mh, $option, $value); + } + + return $this->_mh; + } + + public function __destruct() + { + if (isset($this->_mh)) { + \curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $easy = $this->factory->create($request, $options); + $id = (int) $easy->handle; + + $promise = new Promise( + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest(['easy' => $easy, 'deferred' => $promise]); + + return $promise; + } + + /** + * Ticks the curl event loop. + */ + public function tick(): void + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = Utils::currentTime(); + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + \curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['easy']->handle + ); + } + } + } + + // Step through the task queue which may add additional requests. + P\Utils::queue()->run(); + + if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + \usleep(250); + } + + while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM); + + $this->processMessages(); + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute(): void + { + $queue = P\Utils::queue(); + + while ($this->handles || !$queue->isEmpty()) { + // If there are no transfers, then sleep for the next delay + if (!$this->active && $this->delays) { + \usleep($this->timeToNext()); + } + $this->tick(); + } + } + + private function addRequest(array $entry): void + { + $easy = $entry['easy']; + $id = (int) $easy->handle; + $this->handles[$id] = $entry; + if (empty($easy->options['delay'])) { + \curl_multi_add_handle($this->_mh, $easy->handle); + } else { + $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id): bool + { + if (!is_int($id)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['easy']->handle; + unset($this->delays[$id], $this->handles[$id]); + \curl_multi_remove_handle($this->_mh, $handle); + \curl_close($handle); + + return true; + } + + private function processMessages(): void + { + while ($done = \curl_multi_info_read($this->_mh)) { + if ($done['msg'] !== \CURLMSG_DONE) { + // if it's not done, then it would be premature to remove the handle. ref https://github.com/guzzle/guzzle/pull/2892#issuecomment-945150216 + continue; + } + $id = (int) $done['handle']; + \curl_multi_remove_handle($this->_mh, $done['handle']); + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + unset($this->handles[$id], $this->delays[$id]); + $entry['easy']->errno = $done['result']; + $entry['deferred']->resolve( + CurlFactory::finish($this, $entry['easy'], $this->factory) + ); + } + } + + private function timeToNext(): int + { + $currentTime = Utils::currentTime(); + $nextTime = \PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + + return ((int) \max(0, $nextTime - $currentTime)) * 1000000; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 000000000..224344d7c --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,112 @@ +headers); + + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + + if (!empty($this->options['decode_content']) && isset($normalizedKeys['content-encoding'])) { + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + + $bodyLength = (int) $this->sink->getSize(); + if ($bodyLength) { + $headers[$normalizedKeys['content-length']] = $bodyLength; + } else { + unset($headers[$normalizedKeys['content-length']]); + } + } + } + + // Attach a response to the easy handle with the parsed headers. + $this->response = new Response( + $status, + $headers, + $this->sink, + $ver, + $reason + ); + } + + /** + * @param string $name + * + * @return void + * + * @throws \BadMethodCallException + */ + public function __get($name) + { + $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $name; + throw new \BadMethodCallException($msg); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php b/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php new file mode 100644 index 000000000..a0988845f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php @@ -0,0 +1,42 @@ +|null $queue The parameters to be passed to the append function, as an indexed array. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. + */ + public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null) + { + $this->onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + + if ($queue) { + // array_values included for BC + $this->append(...array_values($queue)); + } + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + if (isset($options['delay']) && \is_numeric($options['delay'])) { + \usleep((int) $options['delay'] * 1000); + } + + $this->lastRequest = $request; + $this->lastOptions = $options; + $response = \array_shift($this->queue); + + if (isset($options['on_headers'])) { + if (!\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $response = new RequestException($msg, $request, $response, $e); + } + } + + if (\is_callable($response)) { + $response = $response($request, $options); + } + + $response = $response instanceof \Throwable + ? P\Create::rejectionFor($response) + : P\Create::promiseFor($response); + + return $response->then( + function (?ResponseInterface $value) use ($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + ($this->onFulfilled)($value); + } + + if ($value !== null && isset($options['sink'])) { + $contents = (string) $value->getBody(); + $sink = $options['sink']; + + if (\is_resource($sink)) { + \fwrite($sink, $contents); + } elseif (\is_string($sink)) { + \file_put_contents($sink, $contents); + } elseif ($sink instanceof StreamInterface) { + $sink->write($contents); + } + } + + return $value; + }, + function ($reason) use ($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + ($this->onRejected)($reason); + } + return P\Create::rejectionFor($reason); + } + ); + } + + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + * + * @param mixed ...$values + */ + public function append(...$values): void + { + foreach ($values as $value) { + if ($value instanceof ResponseInterface + || $value instanceof \Throwable + || $value instanceof PromiseInterface + || \is_callable($value) + ) { + $this->queue[] = $value; + } else { + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value)); + } + } + } + + /** + * Get the last received request. + */ + public function getLastRequest(): ?RequestInterface + { + return $this->lastRequest; + } + + /** + * Get the last received request options. + */ + public function getLastOptions(): array + { + return $this->lastOptions; + } + + /** + * Returns the number of remaining items in the queue. + */ + public function count(): int + { + return \count($this->queue); + } + + public function reset(): void + { + $this->queue = []; + } + + /** + * @param mixed $reason Promise or reason. + */ + private function invokeStats( + RequestInterface $request, + array $options, + ResponseInterface $response = null, + $reason = null + ): void { + if (isset($options['on_stats'])) { + $transferTime = $options['transfer_time'] ?? 0; + $stats = new TransferStats($request, $response, $transferTime, $reason); + ($options['on_stats'])($stats); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 000000000..f045b526c --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,51 @@ +withoutHeader('Expect'); + + // Append a content-length header if body size is zero to match + // cURL's behavior. + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', '0'); + } + + return $this->createResponse( + $request, + $options, + $this->createStream($request, $options), + $startTime + ); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + // Determine if the error was a networking error. + $message = $e->getMessage(); + // This list can probably get more comprehensive. + if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed + || false !== \strpos($message, 'Connection refused') + || false !== \strpos($message, "couldn't connect to host") // error on HHVM + || false !== \strpos($message, "connection attempt failed") + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } else { + $e = RequestException::wrapException($request, $e); + } + $this->invokeStats($options, $request, $startTime, null, $e); + + return P\Create::rejectionFor($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + ?float $startTime, + ResponseInterface $response = null, + \Throwable $error = null + ): void { + if (isset($options['on_stats'])) { + $stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []); + ($options['on_stats'])($stats); + } + } + + /** + * @param resource $stream + */ + private function createResponse(RequestInterface $request, array $options, $stream, ?float $startTime): PromiseInterface + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + + try { + [$ver, $status, $reason, $headers] = HeaderProcessor::parseHeaders($hdrs); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + [$stream, $headers] = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\Utils::streamFor($stream); + $sink = $stream; + + if (\strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + try { + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered while creating the response', $request, null, $e) + ); + } + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + return P\Create::rejectionFor( + new RequestException('An error was encountered during the on_headers event', $request, $response, $e) + ); + } + } + + // Do not drain when the request is a HEAD request because they have + // no body. + if ($sink !== $stream) { + $this->drain($stream, $sink, $response->getHeaderLine('Content-Length')); + } + + $this->invokeStats($options, $request, $startTime, $response, null); + + return new FulfilledPromise($response); + } + + private function createSink(StreamInterface $stream, array $options): StreamInterface + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = $options['sink'] ?? Psr7\Utils::tryFopen('php://temp', 'r+'); + + return \is_string($sink) ? new Psr7\LazyOpenStream($sink, 'w+') : Psr7\Utils::streamFor($sink); + } + + /** + * @param resource $stream + */ + private function checkDecode(array $options, array $headers, $stream): array + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream(Psr7\Utils::streamFor($stream)); + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + + // Remove content-encoding header + unset($headers[$normalizedKeys['content-encoding']]); + + // Fix content-length header + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + + return [$stream, $headers]; + } + + /** + * Drains the source stream into the "sink" client option. + * + * @param string $contentLength Header specifying the amount of + * data to read. + * + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain(StreamInterface $source, StreamInterface $sink, string $contentLength): StreamInterface + { + // If a content-length header is provided, then stop reading once + // that number of bytes has been read. This can prevent infinitely + // reading from a stream when dealing with servers that do not honor + // Connection: Close headers. + Psr7\Utils::copyToStream( + $source, + $sink, + (\strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 + ); + + $sink->seek(0); + $source->close(); + + return $sink; + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = []; + \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + try { + $resource = $callback(); + } finally { + \restore_error_handler(); + } + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . \PHP_EOL; + } + } + throw new \RuntimeException(\trim($message)); + } + + return $resource; + } + + /** + * @return resource + */ + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = \array_flip(\get_class_methods(__CLASS__)); + } + + if (!\in_array($request->getUri()->getScheme(), ['http', 'https'])) { + throw new RequestException(\sprintf("The scheme '%s' is not supported.", $request->getUri()->getScheme()), $request); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ($request->getProtocolVersion() == '1.1' + && !$request->hasHeader('Connection') + ) { + $request = $request->withHeader('Connection', 'close'); + } + + // Ensure SSL is verified by default + if (!isset($options['verify'])) { + $options['verify'] = true; + } + + $params = []; + $context = $this->getDefaultContext($request); + + if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + + if (isset($options['stream_context'])) { + if (!\is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = \array_replace_recursive($context, $options['stream_context']); + } + + // Microsoft NTLM authentication only supported with curl handler + if (isset($options['auth'][2]) && 'ntlm' === $options['auth'][2]) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $contextResource = $this->createResource( + static function () use ($context, $params) { + return \stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { + $resource = @\fopen((string) $uri, 'r', false, $contextResource); + $this->lastHeaders = $http_response_header ?? []; + + if (false === $resource) { + throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context); + } + + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + \stream_set_timeout($resource, $sec, $usec); + } + + return $resource; + } + ); + } + + private function resolveHost(RequestInterface $request, array $options): UriInterface + { + $uri = $request->getUri(); + + if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) { + if ('v4' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_A); + if (false === $records || !isset($records[0]['ip'])) { + throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost($records[0]['ip']); + } + if ('v6' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_AAAA); + if (false === $records || !isset($records[0]['ipv6'])) { + throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request): array + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request->getMethod(), + 'header' => $headers, + 'protocol_version' => $request->getProtocolVersion(), + 'ignore_errors' => true, + 'follow_location' => 0, + ], + 'ssl' => [ + 'peer_name' => $request->getUri()->getHost(), + ], + ]; + + $body = (string) $request->getBody(); + + if (!empty($body)) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = \rtrim($context['http']['header']); + + return $context; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_proxy(RequestInterface $request, array &$options, $value, array &$params): void + { + $uri = null; + + if (!\is_array($value)) { + $uri = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) { + $uri = $value[$scheme]; + } + } + } + + if (!$uri) { + return; + } + + $parsed = $this->parse_proxy($uri); + $options['http']['proxy'] = $parsed['proxy']; + + if ($parsed['auth']) { + if (!isset($options['http']['header'])) { + $options['http']['header'] = []; + } + $options['http']['header'] .= "\r\nProxy-Authorization: {$parsed['auth']}"; + } + } + + /** + * Parses the given proxy URL to make it compatible with the format PHP's stream context expects. + */ + private function parse_proxy(string $url): array + { + $parsed = \parse_url($url); + + if ($parsed !== false && isset($parsed['scheme']) && $parsed['scheme'] === 'http') { + if (isset($parsed['host']) && isset($parsed['port'])) { + $auth = null; + if (isset($parsed['user']) && isset($parsed['pass'])) { + $auth = \base64_encode("{$parsed['user']}:{$parsed['pass']}"); + } + + return [ + 'proxy' => "tcp://{$parsed['host']}:{$parsed['port']}", + 'auth' => $auth ? "Basic {$auth}" : null, + ]; + } + } + + // Return proxy as-is. + return [ + 'proxy' => $url, + 'auth' => null, + ]; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_timeout(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_verify(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; + + return; + } + + if (\is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!\file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: $value"); + } + } elseif ($value !== true) { + throw new \InvalidArgumentException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_cert(RequestInterface $request, array &$options, $value, array &$params): void + { + if (\is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!\file_exists($value)) { + throw new \RuntimeException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_progress(RequestInterface $request, array &$options, $value, array &$params): void + { + self::addNotification( + $params, + static function ($code, $a, $b, $c, $transferred, $total) use ($value) { + if ($code == \STREAM_NOTIFY_PROGRESS) { + // The upload progress cannot be determined. Use 0 for cURL compatibility: + // https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html + $value($total, $transferred, 0, 0); + } + } + ); + } + + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_debug(RequestInterface $request, array &$options, $value, array &$params): void + { + if ($value === false) { + return; + } + + static $map = [ + \STREAM_NOTIFY_CONNECT => 'CONNECT', + \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + \STREAM_NOTIFY_PROGRESS => 'PROGRESS', + \STREAM_NOTIFY_FAILURE => 'FAILURE', + \STREAM_NOTIFY_COMPLETED => 'COMPLETED', + \STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max']; + + $value = Utils::debugResource($value); + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); + self::addNotification( + $params, + static function (int $code, ...$passed) use ($ident, $value, $map, $args): void { + \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (\array_filter($passed) as $i => $v) { + \fwrite($value, $args[$i] . ': "' . $v . '" '); + } + \fwrite($value, "\n"); + } + ); + } + + private static function addNotification(array &$params, callable $notify): void + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = self::callArray([ + $params['notification'], + $notify + ]); + } + } + + private static function callArray(array $functions): callable + { + return static function (...$args) use ($functions) { + foreach ($functions as $fn) { + $fn(...$args); + } + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 000000000..e0a1d1191 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,275 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + + return $stack; + } + + /** + * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler. + */ + public function __construct(callable $handler = null) + { + $this->handler = $handler; + } + + /** + * Invokes the handler stack as a composed handler + * + * @return ResponseInterface|PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $handler = $this->resolve(); + + return $handler($request, $options); + } + + /** + * Dumps a string representation of the stack. + * + * @return string + */ + public function __toString() + { + $depth = 0; + $stack = []; + + if ($this->handler !== null) { + $stack[] = "0) Handler: " . $this->debugCallable($this->handler); + } + + $result = ''; + foreach (\array_reverse($this->stack) as $tuple) { + $depth++; + $str = "{$depth}) Name: '{$tuple[1]}', "; + $str .= "Function: " . $this->debugCallable($tuple[0]); + $result = "> {$str}\n{$result}"; + $stack[] = $str; + } + + foreach (\array_keys($stack) as $k) { + $result .= "< {$stack[$k]}\n"; + } + + return $result; + } + + /** + * Set the HTTP handler that actually returns a promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler): void + { + $this->handler = $handler; + $this->cached = null; + } + + /** + * Returns true if the builder has a handler. + */ + public function hasHandler(): bool + { + return $this->handler !== null ; + } + + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, ?string $name = null): void + { + \array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + + /** + * Push a middleware to the top of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, string $name = ''): void + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before(string $findName, callable $middleware, string $withName = ''): void + { + $this->splice($findName, $withName, $middleware, true); + } + + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after(string $findName, callable $middleware, string $withName = ''): void + { + $this->splice($findName, $withName, $middleware, false); + } + + /** + * Remove a middleware by instance or name from the stack. + * + * @param callable|string $remove Middleware to remove by instance or name. + */ + public function remove($remove): void + { + if (!is_string($remove) && !is_callable($remove)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + + $this->cached = null; + $idx = \is_callable($remove) ? 0 : 1; + $this->stack = \array_values(\array_filter( + $this->stack, + static function ($tuple) use ($idx, $remove) { + return $tuple[$idx] !== $remove; + } + )); + } + + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable(RequestInterface, array): PromiseInterface + */ + public function resolve(): callable + { + if ($this->cached === null) { + if (($prev = $this->handler) === null) { + throw new \LogicException('No handler has been specified'); + } + + foreach (\array_reverse($this->stack) as $fn) { + /** @var callable(RequestInterface, array): PromiseInterface $prev */ + $prev = $fn[0]($prev); + } + + $this->cached = $prev; + } + + return $this->cached; + } + + private function findByName(string $name): int + { + foreach ($this->stack as $k => $v) { + if ($v[1] === $name) { + return $k; + } + } + + throw new \InvalidArgumentException("Middleware not found: $name"); + } + + /** + * Splices a function into the middleware list at a specific position. + */ + private function splice(string $findName, string $withName, callable $middleware, bool $before): void + { + $this->cached = null; + $idx = $this->findByName($findName); + $tuple = [$middleware, $withName]; + + if ($before) { + if ($idx === 0) { + \array_unshift($this->stack, $tuple); + } else { + $replacement = [$tuple, $this->stack[$idx]]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } elseif ($idx === \count($this->stack) - 1) { + $this->stack[] = $tuple; + } else { + $replacement = [$this->stack[$idx], $tuple]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } + + /** + * Provides a debug string for a given callable. + * + * @param callable|string $fn Function to write as a string. + */ + private function debugCallable($fn): string + { + if (\is_string($fn)) { + return "callable({$fn})"; + } + + if (\is_array($fn)) { + return \is_string($fn[0]) + ? "callable({$fn[0]}::{$fn[1]})" + : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; + } + + /** @var object $fn */ + return 'callable(' . \spl_object_hash($fn) . ')'; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 000000000..da499547f --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,198 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; + + /** + * @var string Template used to format log messages + */ + private $template; + + /** + * @param string $template Log message template + */ + public function __construct(?string $template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface|null $response Response that was received + * @param \Throwable|null $error Exception that was received + */ + public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string + { + $cache = []; + + /** @var string */ + return \preg_replace_callback( + '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', + function (array $matches) use ($request, $response, $error, &$cache) { + if (isset($cache[$matches[1]])) { + return $cache[$matches[1]]; + } + + $result = ''; + switch ($matches[1]) { + case 'request': + $result = Psr7\Message::toString($request); + break; + case 'response': + $result = $response ? Psr7\Message::toString($response) : ''; + break; + case 'req_headers': + $result = \trim($request->getMethod() + . ' ' . $request->getRequestTarget()) + . ' HTTP/' . $request->getProtocolVersion() . "\r\n" + . $this->headers($request); + break; + case 'res_headers': + $result = $response ? + \sprintf( + 'HTTP/%s %d %s', + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + ) . "\r\n" . $this->headers($response) + : 'NULL'; + break; + case 'req_body': + $result = $request->getBody()->__toString(); + break; + case 'res_body': + if (!$response instanceof ResponseInterface) { + $result = 'NULL'; + break; + } + + $body = $response->getBody(); + + if (!$body->isSeekable()) { + $result = 'RESPONSE_NOT_LOGGEABLE'; + break; + } + + $result = $response->getBody()->__toString(); + break; + case 'ts': + case 'date_iso_8601': + $result = \gmdate('c'); + break; + case 'date_common_log': + $result = \date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri()->__toString(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response + ? $response->getProtocolVersion() + : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = \gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (\strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(\substr($matches[1], 11)); + } elseif (\strpos($matches[1], 'res_header_') === 0) { + $result = $response + ? $response->getHeaderLine(\substr($matches[1], 11)) + : 'NULL'; + } + } + + $cache[$matches[1]] = $result; + return $result; + }, + $this->template + ); + } + + /** + * Get headers from message as string + */ + private function headers(MessageInterface $message): string + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; + } + + return \trim($result); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php b/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php new file mode 100644 index 000000000..a39ac248e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php @@ -0,0 +1,18 @@ +withCookieHeader($request); + return $handler($request, $options) + ->then( + static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { + $cookieJar->extractCookies($request, $response); + return $response; + } + ); + }; + }; + } + + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_errors" request option is set to true. + * + * @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages. + * + * @return callable(callable): callable Returns a function that accepts the next handler. + */ + public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable + { + return static function (callable $handler) use ($bodySummarizer): callable { + return static function ($request, array $options) use ($handler, $bodySummarizer) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + return $handler($request, $options)->then( + static function (ResponseInterface $response) use ($request, $bodySummarizer) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response, null, [], $bodySummarizer); + } + ); + }; + }; + } + + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable(callable): callable Returns a function that accepts the next handler. + * + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container): callable + { + if (!\is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + + return static function (callable $handler) use (&$container): callable { + return static function (RequestInterface $request, array $options) use ($handler, &$container) { + return $handler($request, $options)->then( + static function ($value) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => $value, + 'error' => null, + 'options' => $options + ]; + return $value; + }, + static function ($reason) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => null, + 'error' => $reason, + 'options' => $options + ]; + return P\Create::rejectionFor($reason); + } + ); + }; + }; + } + + /** + * Middleware that invokes a callback before and after sending a request. + * + * The provided listener cannot modify or alter the response. It simply + * "taps" into the chain to be notified before returning the promise. The + * before listener accepts a request and options array, and the after + * listener accepts a request, options array, and response promise. + * + * @param callable $before Function to invoke before forwarding the request. + * @param callable $after Function invoked after forwarding. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function tap(callable $before = null, callable $after = null): callable + { + return static function (callable $handler) use ($before, $after): callable { + return static function (RequestInterface $request, array $options) use ($handler, $before, $after) { + if ($before) { + $before($request, $options); + } + $response = $handler($request, $options); + if ($after) { + $after($request, $options, $response); + } + return $response; + }; + }; + } + + /** + * Middleware that handles request redirects. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function redirect(): callable + { + return static function (callable $handler): RedirectMiddleware { + return new RedirectMiddleware($handler); + }; + } + + /** + * Middleware that retries requests based on the boolean result of + * invoking the provided "decider" function. + * + * If no delay function is provided, a simple implementation of exponential + * backoff will be utilized. + * + * @param callable $decider Function that accepts the number of retries, + * a request, [response], and [exception] and + * returns true if the request is to be retried. + * @param callable $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function retry(callable $decider, callable $delay = null): callable + { + return static function (callable $handler) use ($decider, $delay): RetryMiddleware { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. + * @param string $logLevel Level at which to log requests. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable + { + // To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter + if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) { + throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class)); + } + + return static function (callable $handler) use ($logger, $formatter, $logLevel): callable { + return static function (RequestInterface $request, array $options = []) use ($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then( + static function ($response) use ($logger, $request, $formatter, $logLevel): ResponseInterface { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + return $response; + }, + static function ($reason) use ($logger, $request, $formatter): PromiseInterface { + $response = $reason instanceof RequestException ? $reason->getResponse() : null; + $message = $formatter->format($request, $response, P\Create::exceptionFor($reason)); + $logger->error($message); + return P\Create::rejectionFor($reason); + } + ); + }; + }; + } + + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + */ + public static function prepareBody(): callable + { + return static function (callable $handler): PrepareBodyMiddleware { + return new PrepareBodyMiddleware($handler); + }; + } + + /** + * Middleware that applies a map function to the request before passing to + * the next handler. + * + * @param callable $fn Function that accepts a RequestInterface and returns + * a RequestInterface. + */ + public static function mapRequest(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $request, array $options) use ($handler, $fn) { + return $handler($fn($request), $options); + }; + }; + } + + /** + * Middleware that applies a map function to the resolved promise's + * response. + * + * @param callable $fn Function that accepts a ResponseInterface and + * returns a ResponseInterface. + */ + public static function mapResponse(callable $fn): callable + { + return static function (callable $handler) use ($fn): callable { + return static function (RequestInterface $request, array $options) use ($handler, $fn) { + return $handler($request, $options)->then($fn); + }; + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php new file mode 100644 index 000000000..6277c61fb --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Pool.php @@ -0,0 +1,125 @@ + $rfn) { + if ($rfn instanceof RequestInterface) { + yield $key => $client->sendAsync($rfn, $opts); + } elseif (\is_callable($rfn)) { + yield $key => $rfn($opts); + } else { + throw new \InvalidArgumentException('Each value yielded by the iterator must be a Psr7\Http\Message\RequestInterface or a callable that returns a promise that fulfills with a Psr7\Message\Http\ResponseInterface object.'); + } + } + }; + + $this->each = new EachPromise($requests(), $config); + } + + /** + * Get promise + */ + public function promise(): PromiseInterface + { + return $this->each->promise(); + } + + /** + * Sends multiple requests concurrently and returns an array of responses + * and exceptions that uses the same ordering as the provided requests. + * + * IMPORTANT: This method keeps every request and response in memory, and + * as such, is NOT recommended when sending a large number or an + * indeterminate number of requests concurrently. + * + * @param ClientInterface $client Client used to send the requests + * @param array|\Iterator $requests Requests to send concurrently. + * @param array $options Passes through the options available in + * {@see \GuzzleHttp\Pool::__construct} + * + * @return array Returns an array containing the response or an exception + * in the same order that the requests were sent. + * + * @throws \InvalidArgumentException if the event format is incorrect. + */ + public static function batch(ClientInterface $client, $requests, array $options = []): array + { + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + \ksort($res); + + return $res; + } + + /** + * Execute callback(s) + */ + private static function cmpCallback(array &$options, string $name, array &$results): void + { + if (!isset($options[$name])) { + $options[$name] = static function ($v, $k) use (&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = static function ($v, $k) use (&$results, $currentFn) { + $currentFn($v, $k); + $results[$k] = $v; + }; + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php new file mode 100644 index 000000000..7ca628338 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,104 @@ +nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $fn = $this->nextHandler; + + // Don't do anything if the request has no body. + if ($request->getBody()->getSize() === 0) { + return $fn($request, $options); + } + + $modify = []; + + // Add a default content-type if possible. + if (!$request->hasHeader('Content-Type')) { + if ($uri = $request->getBody()->getMetadata('uri')) { + if (is_string($uri) && $type = Psr7\MimeType::fromFilename($uri)) { + $modify['set_headers']['Content-Type'] = $type; + } + } + } + + // Add a default content-length or transfer-encoding header. + if (!$request->hasHeader('Content-Length') + && !$request->hasHeader('Transfer-Encoding') + ) { + $size = $request->getBody()->getSize(); + if ($size !== null) { + $modify['set_headers']['Content-Length'] = $size; + } else { + $modify['set_headers']['Transfer-Encoding'] = 'chunked'; + } + } + + // Add the expect header if needed. + $this->addExpectHeader($request, $options, $modify); + + return $fn(Psr7\Utils::modifyRequest($request, $modify), $options); + } + + /** + * Add expect header + */ + private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void + { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + + $expect = $options['expect'] ?? null; + + // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 + if ($expect === false || $request->getProtocolVersion() < 1.1) { + return; + } + + // The expect header is unconditionally enabled + if ($expect === true) { + $modify['set_headers']['Expect'] = '100-Continue'; + return; + } + + // By default, send the expect header when the payload is > 1mb + if ($expect === null) { + $expect = 1048576; + } + + // Always add if the body cannot be rewound, the size cannot be + // determined, or the size is greater than the cutoff threshold + $body = $request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { + $modify['set_headers']['Expect'] = '100-Continue'; + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php new file mode 100644 index 000000000..f67d448be --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,228 @@ + 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, + 'track_redirects' => false, + ]; + + /** + * @var callable(RequestInterface, array): PromiseInterface + */ + private $nextHandler; + + /** + * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + $fn = $this->nextHandler; + + if (empty($options['allow_redirects'])) { + return $fn($request, $options); + } + + if ($options['allow_redirects'] === true) { + $options['allow_redirects'] = self::$defaultSettings; + } elseif (!\is_array($options['allow_redirects'])) { + throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } else { + // Merge the default settings with the provided settings + $options['allow_redirects'] += self::$defaultSettings; + } + + if (empty($options['allow_redirects']['max'])) { + return $fn($request, $options); + } + + return $fn($request, $options) + ->then(function (ResponseInterface $response) use ($request, $options) { + return $this->checkRedirect($request, $options, $response); + }); + } + + /** + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) + { + if (\strpos((string) $response->getStatusCode(), '3') !== 0 + || !$response->hasHeader('Location') + ) { + return $response; + } + + $this->guardMax($request, $response, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + + // If authorization is handled by curl, unset it if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $nextRequest->getUri()) && defined('\CURLOPT_HTTPAUTH')) { + unset( + $options['curl'][\CURLOPT_HTTPAUTH], + $options['curl'][\CURLOPT_USERPWD] + ); + } + + if (isset($options['allow_redirects']['on_redirect'])) { + ($options['allow_redirects']['on_redirect'])( + $request, + $response, + $nextRequest->getUri() + ); + } + + $promise = $this($nextRequest, $options); + + // Add headers to be able to track history of redirects. + if (!empty($options['allow_redirects']['track_redirects'])) { + return $this->withTracking( + $promise, + (string) $nextRequest->getUri(), + $response->getStatusCode() + ); + } + + return $promise; + } + + /** + * Enable tracking on promise. + */ + private function withTracking(PromiseInterface $promise, string $uri, int $statusCode): PromiseInterface + { + return $promise->then( + static function (ResponseInterface $response) use ($uri, $statusCode) { + // Note that we are pushing to the front of the list as this + // would be an earlier response than what is currently present + // in the history header. + $historyHeader = $response->getHeader(self::HISTORY_HEADER); + $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); + \array_unshift($historyHeader, $uri); + \array_unshift($statusHeader, (string) $statusCode); + + return $response->withHeader(self::HISTORY_HEADER, $historyHeader) + ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + } + ); + } + + /** + * Check for too many redirects. + * + * @throws TooManyRedirectsException Too many redirects. + */ + private function guardMax(RequestInterface $request, ResponseInterface $response, array &$options): void + { + $current = $options['__redirect_count'] + ?? 0; + $options['__redirect_count'] = $current + 1; + $max = $options['allow_redirects']['max']; + + if ($options['__redirect_count'] > $max) { + throw new TooManyRedirectsException("Will not follow more than {$max} redirects", $request, $response); + } + } + + public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response): RequestInterface + { + // Request modifications to apply. + $modify = []; + $protocols = $options['allow_redirects']['protocols']; + + // Use a GET request if this is an entity enclosing request and we are + // not forcing RFC compliance, but rather emulating what all browsers + // would do. + $statusCode = $response->getStatusCode(); + if ($statusCode == 303 || + ($statusCode <= 302 && !$options['allow_redirects']['strict']) + ) { + $safeMethods = ['GET', 'HEAD', 'OPTIONS']; + $requestMethod = $request->getMethod(); + + $modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET'; + $modify['body'] = ''; + } + + $uri = self::redirectUri($request, $response, $protocols); + if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) { + $idnOptions = ($options['idn_conversion'] === true) ? \IDNA_DEFAULT : $options['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + + $modify['uri'] = $uri; + Psr7\Message::rewindBody($request); + + // Add the Referer header if it is told to do so and only + // add the header if we are not redirecting from https to http. + if ($options['allow_redirects']['referer'] + && $modify['uri']->getScheme() === $request->getUri()->getScheme() + ) { + $uri = $request->getUri()->withUserInfo(''); + $modify['set_headers']['Referer'] = (string) $uri; + } else { + $modify['remove_headers'][] = 'Referer'; + } + + // Remove Authorization and Cookie headers if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $modify['uri'])) { + $modify['remove_headers'][] = 'Authorization'; + $modify['remove_headers'][] = 'Cookie'; + } + + return Psr7\Utils::modifyRequest($request, $modify); + } + + /** + * Set the appropriate URL on the request based on the location header. + */ + private static function redirectUri( + RequestInterface $request, + ResponseInterface $response, + array $protocols + ): UriInterface { + $location = Psr7\UriResolver::resolve( + $request->getUri(), + new Psr7\Uri($response->getHeaderLine('Location')) + ); + + // Ensure that the redirect URI is allowed based on the protocols. + if (!\in_array($location->getScheme(), $protocols)) { + throw new BadResponseException(\sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, \implode(', ', $protocols)), $request, $response); + } + + return $location; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php new file mode 100644 index 000000000..20b31bc20 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,264 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + } + + /** + * Default exponential backoff delay function. + * + * @return int milliseconds. + */ + public static function exponentialDelay(int $retries): int + { + return (int) \pow(2, $retries - 1) * 1000; + } + + public function __invoke(RequestInterface $request, array $options): PromiseInterface + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + + $fn = $this->nextHandler; + return $fn($request, $options) + ->then( + $this->onFulfilled($request, $options), + $this->onRejected($request, $options) + ); + } + + /** + * Execute fulfilled closure + */ + private function onFulfilled(RequestInterface $request, array $options): callable + { + return function ($value) use ($request, $options) { + if (!($this->decider)( + $options['retries'], + $request, + $value, + null + )) { + return $value; + } + return $this->doRetry($request, $options, $value); + }; + } + + /** + * Execute rejected closure + */ + private function onRejected(RequestInterface $req, array $options): callable + { + return function ($reason) use ($req, $options) { + if (!($this->decider)( + $options['retries'], + $req, + null, + $reason + )) { + return P\Create::rejectionFor($reason); + } + return $this->doRetry($req, $options); + }; + } + + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface + { + $options['delay'] = ($this->delay)(++$options['retries'], $response, $request); + + return $this($request, $options); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php new file mode 100644 index 000000000..93fa334c8 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,133 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } + + /** + * Returns the response that was received (if any). + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * Returns true if a response was received. + */ + public function hasResponse(): bool + { + return $this->response !== null; + } + + /** + * Gets handler specific error data. + * + * This might be an exception, a integer representing an error code, or + * anything else. Relying on this value assumes that you know what handler + * you are using. + * + * @return mixed + */ + public function getHandlerErrorData() + { + return $this->handlerErrorData; + } + + /** + * Get the effective URI the request was sent to. + */ + public function getEffectiveUri(): UriInterface + { + return $this->request->getUri(); + } + + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float|null Time in seconds. + */ + public function getTransferTime(): ?float + { + return $this->transferTime; + } + + /** + * Gets an array of all of the handler specific transfer data. + */ + public function getHandlerStats(): array + { + return $this->handlerStats; + } + + /** + * Get a specific handler statistic from the handler by name. + * + * @param string $stat Handler specific transfer stat to retrieve. + * + * @return mixed|null + */ + public function getHandlerStat(string $stat) + { + return $this->handlerStats[$stat] ?? null; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Utils.php b/vendor/guzzlehttp/guzzle/src/Utils.php new file mode 100644 index 000000000..e355f3212 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Utils.php @@ -0,0 +1,385 @@ +getHost()) { + $asciiHost = self::idnToAsci($uri->getHost(), $options, $info); + if ($asciiHost === false) { + $errorBitSet = $info['errors'] ?? 0; + + $errorConstants = array_filter(array_keys(get_defined_constants()), static function (string $name): bool { + return substr($name, 0, 11) === 'IDNA_ERROR_'; + }); + + $errors = []; + foreach ($errorConstants as $errorConstant) { + if ($errorBitSet & constant($errorConstant)) { + $errors[] = $errorConstant; + } + } + + $errorMessage = 'IDN conversion failed'; + if ($errors) { + $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; + } + + throw new InvalidArgumentException($errorMessage); + } + if ($uri->getHost() !== $asciiHost) { + // Replace URI only if the ASCII version is different + $uri = $uri->withHost($asciiHost); + } + } + + return $uri; + } + + /** + * @internal + */ + public static function getenv(string $name): ?string + { + if (isset($_SERVER[$name])) { + return (string) $_SERVER[$name]; + } + + if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== false && $value !== null) { + return (string) $value; + } + + return null; + } + + /** + * @return string|false + */ + private static function idnToAsci(string $domain, int $options, ?array &$info = []) + { + if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) { + return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info); + } + + throw new \Error('ext-idn or symfony/polyfill-intl-idn not loaded or too old'); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 000000000..a70d2cbf3 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,167 @@ + +Copyright (c) 2015 Graham Campbell +Copyright (c) 2017 Tobias Schultze +Copyright (c) 2020 Tobias Nyholm + +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/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md new file mode 100644 index 000000000..1ea667ab9 --- /dev/null +++ b/vendor/guzzlehttp/promises/README.md @@ -0,0 +1,546 @@ +# Guzzle Promises + +[Promises/A+](https://promisesaplus.com/) implementation that handles promise +chaining and resolution iteratively, allowing for "infinite" promise chaining +while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) +for a general introduction to promises. + +- [Features](#features) +- [Quick start](#quick-start) +- [Synchronous wait](#synchronous-wait) +- [Cancellation](#cancellation) +- [API](#api) + - [Promise](#promise) + - [FulfilledPromise](#fulfilledpromise) + - [RejectedPromise](#rejectedpromise) +- [Promise interop](#promise-interop) +- [Implementation notes](#implementation-notes) + + +## Features + +- [Promises/A+](https://promisesaplus.com/) implementation. +- Promise resolution and chaining is handled iteratively, allowing for + "infinite" promise chaining. +- Promises have a synchronous `wait` method. +- Promises can be cancelled. +- Works with any object that has a `then` function. +- C# style async/await coroutine promises using + `GuzzleHttp\Promise\Coroutine::of()`. + + +## Quick Start + +A *promise* represents the eventual result of an asynchronous operation. The +primary way of interacting with a promise is through its `then` method, which +registers callbacks to receive either a promise's eventual value or the reason +why the promise cannot be fulfilled. + +### Callbacks + +Callbacks are registered with the `then` method by providing an optional +`$onFulfilled` followed by an optional `$onRejected` function. + + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then( + // $onFulfilled + function ($value) { + echo 'The promise was fulfilled.'; + }, + // $onRejected + function ($reason) { + echo 'The promise was rejected.'; + } +); +``` + +*Resolving* a promise means that you either fulfill a promise with a *value* or +reject a promise with a *reason*. Resolving a promise triggers callbacks +registered with the promise's `then` method. These callbacks are triggered +only once and in the order in which they were added. + +### Resolving a Promise + +Promises are fulfilled using the `resolve($value)` method. Resolving a promise +with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger +all of the onFulfilled callbacks (resolving a promise with a rejected promise +will reject the promise and trigger the `$onRejected` callbacks). + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(function ($value) { + // Return a value and don't break the chain + return "Hello, " . $value; + }) + // This then is executed after the first then and receives the value + // returned from the first then. + ->then(function ($value) { + echo $value; + }); + +// Resolving the promise triggers the $onFulfilled callbacks and outputs +// "Hello, reader." +$promise->resolve('reader.'); +``` + +### Promise Forwarding + +Promises can be chained one after the other. Each then in the chain is a new +promise. The return value of a promise is what's forwarded to the next +promise in the chain. Returning a promise in a `then` callback will cause the +subsequent promises in the chain to only be fulfilled when the returned promise +has been fulfilled. The next promise in the chain will be invoked with the +resolved value of the promise. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$nextPromise = new Promise(); + +$promise + ->then(function ($value) use ($nextPromise) { + echo $value; + return $nextPromise; + }) + ->then(function ($value) { + echo $value; + }); + +// Triggers the first callback and outputs "A" +$promise->resolve('A'); +// Triggers the second callback and outputs "B" +$nextPromise->resolve('B'); +``` + +### Promise Rejection + +When a promise is rejected, the `$onRejected` callbacks are invoked with the +rejection reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + echo $reason; +}); + +$promise->reject('Error!'); +// Outputs "Error!" +``` + +### Rejection Forwarding + +If an exception is thrown in an `$onRejected` callback, subsequent +`$onRejected` callbacks are invoked with the thrown exception as the reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + throw new Exception($reason); +})->then(null, function ($reason) { + assert($reason->getMessage() === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +You can also forward a rejection down the promise chain by returning a +`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or +`$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + return new RejectedPromise($reason); +})->then(null, function ($reason) { + assert($reason === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +If an exception is not thrown in a `$onRejected` callback and the callback +does not return a rejected promise, downstream `$onFulfilled` callbacks are +invoked using the value returned from the `$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(null, function ($reason) { + return "It's ok"; + }) + ->then(function ($value) { + assert($value === "It's ok"); + }); + +$promise->reject('Error!'); +``` + + +## Synchronous Wait + +You can synchronously force promises to complete using a promise's `wait` +method. When creating a promise, you can provide a wait function that is used +to synchronously force a promise to complete. When a wait function is invoked +it is expected to deliver a value to the promise or reject the promise. If the +wait function does not deliver a value, then an exception is thrown. The wait +function provided to a promise constructor is invoked when the `wait` function +of the promise is called. + +```php +$promise = new Promise(function () use (&$promise) { + $promise->resolve('foo'); +}); + +// Calling wait will return the value of the promise. +echo $promise->wait(); // outputs "foo" +``` + +If an exception is encountered while invoking the wait function of a promise, +the promise is rejected with the exception and the exception is thrown. + +```php +$promise = new Promise(function () use (&$promise) { + throw new Exception('foo'); +}); + +$promise->wait(); // throws the exception. +``` + +Calling `wait` on a promise that has been fulfilled will not trigger the wait +function. It will simply return the previously resolved value. + +```php +$promise = new Promise(function () { die('this is not called!'); }); +$promise->resolve('foo'); +echo $promise->wait(); // outputs "foo" +``` + +Calling `wait` on a promise that has been rejected will throw an exception. If +the rejection reason is an instance of `\Exception` the reason is thrown. +Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason +can be obtained by calling the `getReason` method of the exception. + +```php +$promise = new Promise(); +$promise->reject('foo'); +$promise->wait(); +``` + +> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' + +### Unwrapping a Promise + +When synchronously waiting on a promise, you are joining the state of the +promise into the current state of execution (i.e., return the value of the +promise if it was fulfilled or throw an exception if it was rejected). This is +called "unwrapping" the promise. Waiting on a promise will by default unwrap +the promise state. + +You can force a promise to resolve and *not* unwrap the state of the promise +by passing `false` to the first argument of the `wait` function: + +```php +$promise = new Promise(); +$promise->reject('foo'); +// This will not throw an exception. It simply ensures the promise has +// been resolved. +$promise->wait(false); +``` + +When unwrapping a promise, the resolved value of the promise will be waited +upon until the unwrapped value is not a promise. This means that if you resolve +promise A with a promise B and unwrap promise A, the value returned by the +wait function will be the value delivered to promise B. + +**Note**: when you do not unwrap the promise, no value is returned. + + +## Cancellation + +You can cancel a promise that has not yet been fulfilled using the `cancel()` +method of a promise. When creating a promise you can provide an optional +cancel function that when invoked cancels the action of computing a resolution +of the promise. + + +## API + +### Promise + +When creating a promise object, you can provide an optional `$waitFn` and +`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is +expected to resolve the promise. `$cancelFn` is a function with no arguments +that is expected to cancel the computation of a promise. It is invoked when the +`cancel()` method of a promise is called. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise( + function () use (&$promise) { + $promise->resolve('waited'); + }, + function () { + // do something that will cancel the promise computation (e.g., close + // a socket, cancel a database query, etc...) + } +); + +assert('waited' === $promise->wait()); +``` + +A promise has the following methods: + +- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` + + Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. + +- `otherwise(callable $onRejected) : PromiseInterface` + + Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. + +- `wait($unwrap = true) : mixed` + + Synchronously waits on the promise to complete. + + `$unwrap` controls whether or not the value of the promise is returned for a + fulfilled promise or if an exception is thrown if the promise is rejected. + This is set to `true` by default. + +- `cancel()` + + Attempts to cancel the promise if possible. The promise being cancelled and + the parent most ancestor that has not yet been resolved will also be + cancelled. Any promises waiting on the cancelled promise to resolve will also + be cancelled. + +- `getState() : string` + + Returns the state of the promise. One of `pending`, `fulfilled`, or + `rejected`. + +- `resolve($value)` + + Fulfills the promise with the given `$value`. + +- `reject($reason)` + + Rejects the promise with the given `$reason`. + + +### FulfilledPromise + +A fulfilled promise can be created to represent a promise that has been +fulfilled. + +```php +use GuzzleHttp\Promise\FulfilledPromise; + +$promise = new FulfilledPromise('value'); + +// Fulfilled callbacks are immediately invoked. +$promise->then(function ($value) { + echo $value; +}); +``` + + +### RejectedPromise + +A rejected promise can be created to represent a promise that has been +rejected. + +```php +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new RejectedPromise('Error'); + +// Rejected callbacks are immediately invoked. +$promise->then(null, function ($reason) { + echo $reason; +}); +``` + + +## Promise Interoperability + +This library works with foreign promises that have a `then` method. This means +you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) +for example. When a foreign promise is returned inside of a then method +callback, promise resolution will occur recursively. + +```php +// Create a React promise +$deferred = new React\Promise\Deferred(); +$reactPromise = $deferred->promise(); + +// Create a Guzzle promise that is fulfilled with a React promise. +$guzzlePromise = new GuzzleHttp\Promise\Promise(); +$guzzlePromise->then(function ($value) use ($reactPromise) { + // Do something something with the value... + // Return the React promise + return $reactPromise; +}); +``` + +Please note that wait and cancel chaining is no longer possible when forwarding +a foreign promise. You will need to wrap a third-party promise with a Guzzle +promise in order to utilize wait and cancel functions with foreign promises. + + +### Event Loop Integration + +In order to keep the stack size constant, Guzzle promises are resolved +asynchronously using a task queue. When waiting on promises synchronously, the +task queue will be automatically run to ensure that the blocking promise and +any forwarded promises are resolved. When using promises asynchronously in an +event loop, you will need to run the task queue on each tick of the loop. If +you do not run the task queue, then promises will not be resolved. + +You can run the task queue using the `run()` method of the global task queue +instance. + +```php +// Get the global task queue +$queue = GuzzleHttp\Promise\Utils::queue(); +$queue->run(); +``` + +For example, you could use Guzzle promises with React using a periodic timer: + +```php +$loop = React\EventLoop\Factory::create(); +$loop->addPeriodicTimer(0, [$queue, 'run']); +``` + +*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? + + +## Implementation Notes + +### Promise Resolution and Chaining is Handled Iteratively + +By shuffling pending handlers from one owner to another, promises are +resolved iteratively, allowing for "infinite" then chaining. + +```php +then(function ($v) { + // The stack size remains constant (a good thing) + echo xdebug_get_stack_depth() . ', '; + return $v + 1; + }); +} + +$parent->resolve(0); +var_dump($p->wait()); // int(1000) + +``` + +When a promise is fulfilled or rejected with a non-promise value, the promise +then takes ownership of the handlers of each child promise and delivers values +down the chain without using recursion. + +When a promise is resolved with another promise, the original promise transfers +all of its pending handlers to the new promise. When the new promise is +eventually resolved, all of the pending handlers are delivered the forwarded +value. + +### A Promise is the Deferred + +Some promise libraries implement promises using a deferred object to represent +a computation and a promise object to represent the delivery of the result of +the computation. This is a nice separation of computation and delivery because +consumers of the promise cannot modify the value that will be eventually +delivered. + +One side effect of being able to implement promise resolution and chaining +iteratively is that you need to be able for one promise to reach into the state +of another promise to shuffle around ownership of handlers. In order to achieve +this without making the handlers of a promise publicly mutable, a promise is +also the deferred value, allowing promises of the same parent class to reach +into and modify the private properties of promises of the same type. While this +does allow consumers of the value to modify the resolution or rejection of the +deferred, it is a small price to pay for keeping the stack size constant. + +```php +$promise = new Promise(); +$promise->then(function ($value) { echo $value; }); +// The promise is the deferred value, so you can deliver a value to it. +$promise->resolve('foo'); +// prints "foo" +``` + + +## Upgrading from Function API + +A static API was first introduced in 1.4.0, in order to mitigate problems with +functions conflicting between global and local copies of the package. The +function API will be removed in 2.0.0. A migration table has been provided here +for your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `queue` | `Utils::queue` | +| `task` | `Utils::task` | +| `promise_for` | `Create::promiseFor` | +| `rejection_for` | `Create::rejectionFor` | +| `exception_for` | `Create::exceptionFor` | +| `iter_for` | `Create::iterFor` | +| `inspect` | `Utils::inspect` | +| `inspect_all` | `Utils::inspectAll` | +| `unwrap` | `Utils::unwrap` | +| `all` | `Utils::all` | +| `some` | `Utils::some` | +| `any` | `Utils::any` | +| `settle` | `Utils::settle` | +| `each` | `Each::of` | +| `each_limit` | `Each::ofLimit` | +| `each_limit_all` | `Each::ofLimitAll` | +| `!is_fulfilled` | `Is::pending` | +| `is_fulfilled` | `Is::fulfilled` | +| `is_rejected` | `Is::rejected` | +| `is_settled` | `Is::settled` | +| `coroutine` | `Coroutine::of` | + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information. + + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json new file mode 100644 index 000000000..c959fb32b --- /dev/null +++ b/vendor/guzzlehttp/promises/composer.json @@ -0,0 +1,58 @@ +{ + "name": "guzzlehttp/promises", + "description": "Guzzle promises library", + "keywords": ["promise"], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Promise\\Tests\\": "tests/" + } + }, + "scripts": { + "test": "vendor/bin/simple-phpunit", + "test-ci": "vendor/bin/simple-phpunit --coverage-text" + }, + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "config": { + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 000000000..d2b5712b9 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,17 @@ +then(function ($v) { echo $v; }); + * + * @param callable $generatorFn Generator function to wrap into a promise. + * + * @return Promise + * + * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration + */ +final class Coroutine implements PromiseInterface +{ + /** + * @var PromiseInterface|null + */ + private $currentPromise; + + /** + * @var Generator + */ + private $generator; + + /** + * @var Promise + */ + private $result; + + public function __construct(callable $generatorFn) + { + $this->generator = $generatorFn(); + $this->result = new Promise(function () { + while (isset($this->currentPromise)) { + $this->currentPromise->wait(); + } + }); + try { + $this->nextCoroutine($this->generator->current()); + } catch (\Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * Create a new coroutine. + * + * @return self + */ + public static function of(callable $generatorFn) + { + return new self($generatorFn); + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + return $this->result->then($onFulfilled, $onRejected); + } + + public function otherwise(callable $onRejected) + { + return $this->result->otherwise($onRejected); + } + + public function wait($unwrap = true) + { + return $this->result->wait($unwrap); + } + + public function getState() + { + return $this->result->getState(); + } + + public function resolve($value) + { + $this->result->resolve($value); + } + + public function reject($reason) + { + $this->result->reject($reason); + } + + public function cancel() + { + $this->currentPromise->cancel(); + $this->result->cancel(); + } + + private function nextCoroutine($yielded) + { + $this->currentPromise = Create::promiseFor($yielded) + ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); + } + + /** + * @internal + */ + public function _handleSuccess($value) + { + unset($this->currentPromise); + try { + $next = $this->generator->send($value); + if ($this->generator->valid()) { + $this->nextCoroutine($next); + } else { + $this->result->resolve($value); + } + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * @internal + */ + public function _handleFailure($reason) + { + unset($this->currentPromise); + try { + $nextYield = $this->generator->throw(Create::exceptionFor($reason)); + // The throw was caught, so keep iterating on the coroutine + $this->nextCoroutine($nextYield); + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } +} diff --git a/vendor/guzzlehttp/promises/src/Create.php b/vendor/guzzlehttp/promises/src/Create.php new file mode 100644 index 000000000..8d038e9c1 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Create.php @@ -0,0 +1,84 @@ +then([$promise, 'resolve'], [$promise, 'reject']); + return $promise; + } + + return new FulfilledPromise($value); + } + + /** + * Creates a rejected promise for a reason if the reason is not a promise. + * If the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + */ + public static function rejectionFor($reason) + { + if ($reason instanceof PromiseInterface) { + return $reason; + } + + return new RejectedPromise($reason); + } + + /** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + */ + public static function exceptionFor($reason) + { + if ($reason instanceof \Exception || $reason instanceof \Throwable) { + return $reason; + } + + return new RejectionException($reason); + } + + /** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + */ + public static function iterFor($value) + { + if ($value instanceof \Iterator) { + return $value; + } + + if (is_array($value)) { + return new \ArrayIterator($value); + } + + return new \ArrayIterator([$value]); + } +} diff --git a/vendor/guzzlehttp/promises/src/Each.php b/vendor/guzzlehttp/promises/src/Each.php new file mode 100644 index 000000000..1dda35499 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Each.php @@ -0,0 +1,90 @@ + $onFulfilled, + 'rejected' => $onRejected + ]))->promise(); + } + + /** + * Like of, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow + * for dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ + public static function ofLimit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null + ) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency + ]))->promise(); + } + + /** + * Like limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + */ + public static function ofLimitAll( + $iterable, + $concurrency, + callable $onFulfilled = null + ) { + return each_limit( + $iterable, + $concurrency, + $onFulfilled, + function ($reason, $idx, PromiseInterface $aggregate) { + $aggregate->reject($reason); + } + ); + } +} diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 000000000..280d79950 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,247 @@ +iterable = Create::iterFor($iterable); + + if (isset($config['concurrency'])) { + $this->concurrency = $config['concurrency']; + } + + if (isset($config['fulfilled'])) { + $this->onFulfilled = $config['fulfilled']; + } + + if (isset($config['rejected'])) { + $this->onRejected = $config['rejected']; + } + } + + /** @psalm-suppress InvalidNullableReturnType */ + public function promise() + { + if ($this->aggregate) { + return $this->aggregate; + } + + try { + $this->createPromise(); + /** @psalm-assert Promise $this->aggregate */ + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + $this->aggregate->reject($e); + } catch (\Exception $e) { + $this->aggregate->reject($e); + } + + /** + * @psalm-suppress NullableReturnStatement + * @phpstan-ignore-next-line + */ + return $this->aggregate; + } + + private function createPromise() + { + $this->mutex = false; + $this->aggregate = new Promise(function () { + if ($this->checkIfFinished()) { + return; + } + reset($this->pending); + // Consume a potentially fluctuating list of promises while + // ensuring that indexes are maintained (precluding array_shift). + while ($promise = current($this->pending)) { + next($this->pending); + $promise->wait(); + if (Is::settled($this->aggregate)) { + return; + } + } + }); + + // Clear the references when the promise is resolved. + $clearFn = function () { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + $this->nextPendingIndex = 0; + }; + + $this->aggregate->then($clearFn, $clearFn); + } + + private function refillPending() + { + if (!$this->concurrency) { + // Add all pending promises. + while ($this->addPending() && $this->advanceIterator()); + return; + } + + // Add only up to N pending promises. + $concurrency = is_callable($this->concurrency) + ? call_user_func($this->concurrency, count($this->pending)) + : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); + // Concurrency may be set to 0 to disallow new promises. + if (!$concurrency) { + return; + } + // Add the first pending promise. + $this->addPending(); + // Note this is special handling for concurrency=1 so that we do + // not advance the iterator after adding the first promise. This + // helps work around issues with generators that might not have the + // next value to yield until promise callbacks are called. + while (--$concurrency + && $this->advanceIterator() + && $this->addPending()); + } + + private function addPending() + { + if (!$this->iterable || !$this->iterable->valid()) { + return false; + } + + $promise = Create::promiseFor($this->iterable->current()); + $key = $this->iterable->key(); + + // Iterable keys may not be unique, so we use a counter to + // guarantee uniqueness + $idx = $this->nextPendingIndex++; + + $this->pending[$idx] = $promise->then( + function ($value) use ($idx, $key) { + if ($this->onFulfilled) { + call_user_func( + $this->onFulfilled, + $value, + $key, + $this->aggregate + ); + } + $this->step($idx); + }, + function ($reason) use ($idx, $key) { + if ($this->onRejected) { + call_user_func( + $this->onRejected, + $reason, + $key, + $this->aggregate + ); + } + $this->step($idx); + } + ); + + return true; + } + + private function advanceIterator() + { + // Place a lock on the iterator so that we ensure to not recurse, + // preventing fatal generator errors. + if ($this->mutex) { + return false; + } + + $this->mutex = true; + + try { + $this->iterable->next(); + $this->mutex = false; + return true; + } catch (\Throwable $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } catch (\Exception $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } + } + + private function step($idx) + { + // If the promise was already resolved, then ignore this step. + if (Is::settled($this->aggregate)) { + return; + } + + unset($this->pending[$idx]); + + // Only refill pending promises if we are not locked, preventing the + // EachPromise to recursively invoke the provided iterator, which + // cause a fatal error: "Cannot resume an already running generator" + if ($this->advanceIterator() && !$this->checkIfFinished()) { + // Add more pending promises if possible. + $this->refillPending(); + } + } + + private function checkIfFinished() + { + if (!$this->pending && !$this->iterable->valid()) { + // Resolve the promise if there's nothing left to do. + $this->aggregate->resolve(null); + return true; + } + + return false; + } +} diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php new file mode 100644 index 000000000..98f72a62a --- /dev/null +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,84 @@ +value = $value; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + + $queue = Utils::queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use ($p, $value, $onFulfilled) { + if (Is::pending($p)) { + try { + $p->resolve($onFulfilled($value)); + } catch (\Throwable $e) { + $p->reject($e); + } catch (\Exception $e) { + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + return $unwrap ? $this->value : null; + } + + public function getState() + { + return self::FULFILLED; + } + + public function resolve($value) + { + if ($value !== $this->value) { + throw new \LogicException("Cannot resolve a fulfilled promise"); + } + } + + public function reject($reason) + { + throw new \LogicException("Cannot reject a fulfilled promise"); + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/Is.php b/vendor/guzzlehttp/promises/src/Is.php new file mode 100644 index 000000000..c3ed8d014 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Is.php @@ -0,0 +1,46 @@ +getState() === PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + */ + public static function settled(PromiseInterface $promise) + { + return $promise->getState() !== PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled. + * + * @return bool + */ + public static function fulfilled(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::FULFILLED; + } + + /** + * Returns true if a promise is rejected. + * + * @return bool + */ + public static function rejected(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::REJECTED; + } +} diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php new file mode 100644 index 000000000..75939057b --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,278 @@ +waitFn = $waitFn; + $this->cancelFn = $cancelFn; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + if ($this->state === self::PENDING) { + $p = new Promise(null, [$this, 'cancel']); + $this->handlers[] = [$p, $onFulfilled, $onRejected]; + $p->waitList = $this->waitList; + $p->waitList[] = $this; + return $p; + } + + // Return a fulfilled promise and immediately invoke any callbacks. + if ($this->state === self::FULFILLED) { + $promise = Create::promiseFor($this->result); + return $onFulfilled ? $promise->then($onFulfilled) : $promise; + } + + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = Create::rejectionFor($this->result); + return $onRejected ? $rejection->then(null, $onRejected) : $rejection; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true) + { + $this->waitIfPending(); + + if ($this->result instanceof PromiseInterface) { + return $this->result->wait($unwrap); + } + if ($unwrap) { + if ($this->state === self::FULFILLED) { + return $this->result; + } + // It's rejected so "unwrap" and throw an exception. + throw Create::exceptionFor($this->result); + } + } + + public function getState() + { + return $this->state; + } + + public function cancel() + { + if ($this->state !== self::PENDING) { + return; + } + + $this->waitFn = $this->waitList = null; + + if ($this->cancelFn) { + $fn = $this->cancelFn; + $this->cancelFn = null; + try { + $fn(); + } catch (\Throwable $e) { + $this->reject($e); + } catch (\Exception $e) { + $this->reject($e); + } + } + + // Reject the promise only if it wasn't rejected in a then callback. + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject(new CancellationException('Promise has been cancelled')); + } + } + + public function resolve($value) + { + $this->settle(self::FULFILLED, $value); + } + + public function reject($reason) + { + $this->settle(self::REJECTED, $reason); + } + + private function settle($state, $value) + { + if ($this->state !== self::PENDING) { + // Ignore calls with the same resolution. + if ($state === $this->state && $value === $this->result) { + return; + } + throw $this->state === $state + ? new \LogicException("The promise is already {$state}.") + : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + } + + if ($value === $this) { + throw new \LogicException('Cannot fulfill or reject a promise with itself'); + } + + // Clear out the state of the promise but stash the handlers. + $this->state = $state; + $this->result = $value; + $handlers = $this->handlers; + $this->handlers = null; + $this->waitList = $this->waitFn = null; + $this->cancelFn = null; + + if (!$handlers) { + return; + } + + // If the value was not a settled promise or a thenable, then resolve + // it in the task queue using the correct ID. + if (!is_object($value) || !method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + Utils::queue()->add(static function () use ($id, $value, $handlers) { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise && Is::pending($value)) { + // We can just merge our handlers onto the next promise. + $value->handlers = array_merge($value->handlers, $handlers); + } else { + // Resolve the handlers when the forwarded promise is resolved. + $value->then( + static function ($value) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(1, $value, $handler); + } + }, + static function ($reason) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(2, $reason, $handler); + } + } + ); + } + } + + /** + * Call a stack of handlers using a specific callback index and value. + * + * @param int $index 1 (resolve) or 2 (reject). + * @param mixed $value Value to pass to the callback. + * @param array $handler Array of handler data (promise and callbacks). + */ + private static function callHandler($index, $value, array $handler) + { + /** @var PromiseInterface $promise */ + $promise = $handler[0]; + + // The promise may have been cancelled or resolved before placing + // this thunk in the queue. + if (Is::settled($promise)) { + return; + } + + try { + if (isset($handler[$index])) { + /* + * If $f throws an exception, then $handler will be in the exception + * stack trace. Since $handler contains a reference to the callable + * itself we get a circular reference. We clear the $handler + * here to avoid that memory leak. + */ + $f = $handler[$index]; + unset($handler); + $promise->resolve($f($value)); + } elseif ($index === 1) { + // Forward resolution values as-is. + $promise->resolve($value); + } else { + // Forward rejections down the chain. + $promise->reject($value); + } + } catch (\Throwable $reason) { + $promise->reject($reason); + } catch (\Exception $reason) { + $promise->reject($reason); + } + } + + private function waitIfPending() + { + if ($this->state !== self::PENDING) { + return; + } elseif ($this->waitFn) { + $this->invokeWaitFn(); + } elseif ($this->waitList) { + $this->invokeWaitList(); + } else { + // If there's no wait function, then reject the promise. + $this->reject('Cannot wait on a promise that has ' + . 'no internal wait function. You must provide a wait ' + . 'function when constructing the promise to be able to ' + . 'wait on a promise.'); + } + + Utils::queue()->run(); + + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject('Invoking the wait callback did not resolve the promise'); + } + } + + private function invokeWaitFn() + { + try { + $wfn = $this->waitFn; + $this->waitFn = null; + $wfn(true); + } catch (\Exception $reason) { + if ($this->state === self::PENDING) { + // The promise has not been resolved yet, so reject the promise + // with the exception. + $this->reject($reason); + } else { + // The promise was already resolved, so there's a problem in + // the application. + throw $reason; + } + } + } + + private function invokeWaitList() + { + $waitList = $this->waitList; + $this->waitList = null; + + foreach ($waitList as $result) { + do { + $result->waitIfPending(); + $result = $result->result; + } while ($result instanceof Promise); + + if ($result instanceof PromiseInterface) { + $result->wait(false); + } + } + } +} diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 000000000..e59833143 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,97 @@ +reason = $reason; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // If there's no onRejected callback then just return self. + if (!$onRejected) { + return $this; + } + + $queue = Utils::queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use ($p, $reason, $onRejected) { + if (Is::pending($p)) { + try { + // Return a resolved promise if onRejected does not throw. + $p->resolve($onRejected($reason)); + } catch (\Throwable $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } catch (\Exception $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + if ($unwrap) { + throw Create::exceptionFor($this->reason); + } + + return null; + } + + public function getState() + { + return self::REJECTED; + } + + public function resolve($value) + { + throw new \LogicException("Cannot resolve a rejected promise"); + } + + public function reject($reason) + { + if ($reason !== $this->reason) { + throw new \LogicException("Cannot reject a rejected promise"); + } + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php new file mode 100644 index 000000000..e2f137707 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,48 @@ +reason = $reason; + + $message = 'The promise was rejected'; + + if ($description) { + $message .= ' with reason: ' . $description; + } elseif (is_string($reason) + || (is_object($reason) && method_exists($reason, '__toString')) + ) { + $message .= ' with reason: ' . $this->reason; + } elseif ($reason instanceof \JsonSerializable) { + $message .= ' with reason: ' + . json_encode($this->reason, JSON_PRETTY_PRINT); + } + + parent::__construct($message); + } + + /** + * Returns the rejection reason. + * + * @return mixed + */ + public function getReason() + { + return $this->reason; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php new file mode 100644 index 000000000..f0fba2c59 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,67 @@ +run(); + */ +class TaskQueue implements TaskQueueInterface +{ + private $enableShutdown = true; + private $queue = []; + + public function __construct($withShutdown = true) + { + if ($withShutdown) { + register_shutdown_function(function () { + if ($this->enableShutdown) { + // Only run the tasks if an E_ERROR didn't occur. + $err = error_get_last(); + if (!$err || ($err['type'] ^ E_ERROR)) { + $this->run(); + } + } + }); + } + } + + public function isEmpty() + { + return !$this->queue; + } + + public function add(callable $task) + { + $this->queue[] = $task; + } + + public function run() + { + while ($task = array_shift($this->queue)) { + /** @var callable $task */ + $task(); + } + } + + /** + * The task queue will be run and exhausted by default when the process + * exits IFF the exit is not the result of a PHP E_ERROR error. + * + * You can disable running the automatic shutdown of the queue by calling + * this function. If you disable the task queue shutdown process, then you + * MUST either run the task queue (as a result of running your event loop + * or manually using the run() method) or wait on each outstanding promise. + * + * Note: This shutdown will occur before any destructors are triggered. + */ + public function disableShutdown() + { + $this->enableShutdown = false; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php new file mode 100644 index 000000000..723d4d54e --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,24 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\Utils::queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + */ + public static function queue(TaskQueueInterface $assign = null) + { + static $queue; + + if ($assign) { + $queue = $assign; + } elseif (!$queue) { + $queue = new TaskQueue(); + } + + return $queue; + } + + /** + * Adds a function to run in the task queue when it is next `run()` and + * returns a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + */ + public static function task(callable $task) + { + $queue = self::queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use ($task, $promise) { + try { + if (Is::pending($promise)) { + $promise->resolve($task()); + } + } catch (\Throwable $e) { + $promise->reject($e); + } catch (\Exception $e) { + $promise->reject($e); + } + }); + + return $promise; + } + + /** + * Synchronously waits on a promise to resolve and returns an inspection + * state array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the + * array will contain a "value" key mapping to the fulfilled value of the + * promise. If the promise is rejected, the array will contain a "reason" + * key mapping to the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + */ + public static function inspect(PromiseInterface $promise) + { + try { + return [ + 'state' => PromiseInterface::FULFILLED, + 'value' => $promise->wait() + ]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (\Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } catch (\Exception $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } + } + + /** + * Waits on all of the provided promises, but does not unwrap rejected + * promises as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + */ + public static function inspectAll($promises) + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = inspect($promise); + } + + return $results; + } + + /** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same + * order the promises were provided). An exception is thrown if any of the + * promises are rejected. + * + * @param iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + */ + public static function unwrap($promises) + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = $promise->wait(); + } + + return $results; + } + + /** + * Given an array of promises, return a promise that is fulfilled when all + * the items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + */ + public static function all($promises, $recursive = false) + { + $results = []; + $promise = Each::of( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = $value; + }, + function ($reason, $idx, Promise $aggregate) { + $aggregate->reject($reason); + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); + + if (true === $recursive) { + $promise = $promise->then(function ($results) use ($recursive, &$promises) { + foreach ($promises as $promise) { + if (Is::pending($promise)) { + return self::all($promises, $recursive); + } + } + return $results; + }); + } + + return $promise; + } + + /** + * Initiate a competitive race between multiple promises or values (values + * will become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise + * is fulfilled with an array that contains the fulfillment values of the + * winners in order of resolution. + * + * This promise is rejected with a {@see AggregateException} if the number + * of fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function some($count, $promises) + { + $results = []; + $rejections = []; + + return Each::of( + $promises, + function ($value, $idx, PromiseInterface $p) use (&$results, $count) { + if (Is::settled($p)) { + return; + } + $results[$idx] = $value; + if (count($results) >= $count) { + $p->resolve(null); + } + }, + function ($reason) use (&$rejections) { + $rejections[] = $reason; + } + )->then( + function () use (&$results, &$rejections, $count) { + if (count($results) !== $count) { + throw new AggregateException( + 'Not enough promises to fulfill count', + $rejections + ); + } + ksort($results); + return array_values($results); + } + ); + } + + /** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function any($promises) + { + return self::some(1, $promises)->then(function ($values) { + return $values[0]; + }); + } + + /** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function settle($promises) + { + $results = []; + + return Each::of( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; + }, + function ($reason, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); + } +} diff --git a/vendor/guzzlehttp/promises/src/functions.php b/vendor/guzzlehttp/promises/src/functions.php new file mode 100644 index 000000000..c03d39d02 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions.php @@ -0,0 +1,363 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + * + * @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead. + */ +function queue(TaskQueueInterface $assign = null) +{ + return Utils::queue($assign); +} + +/** + * Adds a function to run in the task queue when it is next `run()` and returns + * a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + * + * @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead. + */ +function task(callable $task) +{ + return Utils::task($task); +} + +/** + * Creates a promise for a value if the value is not a promise. + * + * @param mixed $value Promise or value. + * + * @return PromiseInterface + * + * @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead. + */ +function promise_for($value) +{ + return Create::promiseFor($value); +} + +/** + * Creates a rejected promise for a reason if the reason is not a promise. If + * the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + * + * @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead. + */ +function rejection_for($reason) +{ + return Create::rejectionFor($reason); +} + +/** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + * + * @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead. + */ +function exception_for($reason) +{ + return Create::exceptionFor($reason); +} + +/** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + * + * @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead. + */ +function iter_for($value) +{ + return Create::iterFor($value); +} + +/** + * Synchronously waits on a promise to resolve and returns an inspection state + * array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the array + * will contain a "value" key mapping to the fulfilled value of the promise. If + * the promise is rejected, the array will contain a "reason" key mapping to + * the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead. + */ +function inspect(PromiseInterface $promise) +{ + return Utils::inspect($promise); +} + +/** + * Waits on all of the provided promises, but does not unwrap rejected promises + * as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead. + */ +function inspect_all($promises) +{ + return Utils::inspectAll($promises); +} + +/** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same order + * the promises were provided). An exception is thrown if any of the promises + * are rejected. + * + * @param iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + * + * @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead. + */ +function unwrap($promises) +{ + return Utils::unwrap($promises); +} + +/** + * Given an array of promises, return a promise that is fulfilled when all the + * items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + * + * @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead. + */ +function all($promises, $recursive = false) +{ + return Utils::all($promises, $recursive); +} + +/** + * Initiate a competitive race between multiple promises or values (values will + * become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise is + * fulfilled with an array that contains the fulfillment values of the winners + * in order of resolution. + * + * This promise is rejected with a {@see AggregateException} if the number of + * fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead. + */ +function some($count, $promises) +{ + return Utils::some($count, $promises); +} + +/** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead. + */ +function any($promises) +{ + return Utils::any($promises); +} + +/** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead. + */ +function settle($promises) +{ + return Utils::settle($promises); +} + +/** + * Given an iterator that yields promises or values, returns a promise that is + * fulfilled with a null value when the iterator has been consumed or the + * aggregate promise has been fulfilled or rejected. + * + * $onFulfilled is a function that accepts the fulfilled value, iterator index, + * and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate if needed. + * + * $onRejected is a function that accepts the rejection reason, iterator index, + * and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate if needed. + * + * @param mixed $iterable Iterator or array to iterate over. + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + * + * @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead. + */ +function each( + $iterable, + callable $onFulfilled = null, + callable $onRejected = null +) { + return Each::of($iterable, $onFulfilled, $onRejected); +} + +/** + * Like each, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow for + * dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + * + * @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead. + */ +function each_limit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null +) { + return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected); +} + +/** + * Like each_limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + * + * @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead. + */ +function each_limit_all( + $iterable, + $concurrency, + callable $onFulfilled = null +) { + return Each::ofLimitAll($iterable, $concurrency, $onFulfilled); +} + +/** + * Returns true if a promise is fulfilled. + * + * @return bool + * + * @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead. + */ +function is_fulfilled(PromiseInterface $promise) +{ + return Is::fulfilled($promise); +} + +/** + * Returns true if a promise is rejected. + * + * @return bool + * + * @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead. + */ +function is_rejected(PromiseInterface $promise) +{ + return Is::rejected($promise); +} + +/** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + * + * @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead. + */ +function is_settled(PromiseInterface $promise) +{ + return Is::settled($promise); +} + +/** + * Create a new coroutine. + * + * @see Coroutine + * + * @return PromiseInterface + * + * @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead. + */ +function coroutine(callable $generatorFn) +{ + return Coroutine::of($generatorFn); +} diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php new file mode 100644 index 000000000..34cd1710a --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions_include.php @@ -0,0 +1,6 @@ +withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE new file mode 100644 index 000000000..51c7ec81c --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,26 @@ +The MIT License (MIT) + +Copyright (c) 2015 Michael Dowling +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Graham Campbell +Copyright (c) 2016 Tobias Schultze +Copyright (c) 2016 George Mponos +Copyright (c) 2018 Tobias Nyholm + +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/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md new file mode 100644 index 000000000..8b9929a1d --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,872 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](https://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + +![CI](https://github.com/guzzle/psr7/workflows/CI/badge.svg) +![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg) + + +# Stream implementation + +This package comes with a number of stream implementations and stream +decorators. + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\Utils::streamFor('abc, '); +$b = Psr7\Utils::streamFor('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\Utils::streamFor(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\Utils::streamFor('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content. + +This stream decorator converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + call_user_func($this->callback); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\Utils::streamFor('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Static API + +There are various static methods available under the `GuzzleHttp\Psr7` namespace. + + +## `GuzzleHttp\Psr7\Message::toString` + +`public static function toString(MessageInterface $message): string` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\Message::toString($request); +``` + + +## `GuzzleHttp\Psr7\Message::bodySummary` + +`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null` + +Get a short summary of the message body. + +Will return `null` if the response is not printable. + + +## `GuzzleHttp\Psr7\Message::rewindBody` + +`public static function rewindBody(MessageInterface $message): void` + +Attempts to rewind a message body and throws an exception on failure. + +The body of the message will only be rewound if a call to `tell()` +returns a value other than `0`. + + +## `GuzzleHttp\Psr7\Message::parseMessage` + +`public static function parseMessage(string $message): array` + +Parses an HTTP message into an associative array. + +The array contains the "start-line" key containing the start line of +the message, "headers" key containing an associative array of header +array values, and a "body" key containing the body of the message. + + +## `GuzzleHttp\Psr7\Message::parseRequestUri` + +`public static function parseRequestUri(string $path, array $headers): string` + +Constructs a URI for an HTTP request message. + + +## `GuzzleHttp\Psr7\Message::parseRequest` + +`public static function parseRequest(string $message): Request` + +Parses a request message string into a request object. + + +## `GuzzleHttp\Psr7\Message::parseResponse` + +`public static function parseResponse(string $message): Response` + +Parses a response message string into a response object. + + +## `GuzzleHttp\Psr7\Header::parse` + +`public static function parse(string|array $header): array` + +Parse an array of header values containing ";" separated data into an +array of associative arrays representing the header key value pair data +of the header. When a parameter does not contain a value, but just +contains a key, this function will inject a key with a '' string value. + + +## `GuzzleHttp\Psr7\Header::splitList` + +`public static function splitList(string|string[] $header): string[]` + +Splits a HTTP header defined to contain a comma-separated list into +each individual value: + +``` +$knownEtags = Header::splitList($request->getHeader('if-none-match')); +``` + +Example headers include `accept`, `cache-control` and `if-none-match`. + + +## `GuzzleHttp\Psr7\Header::normalize` (deprecated) + +`public static function normalize(string|array $header): array` + +`Header::normalize()` is deprecated in favor of [`Header::splitList()`](README.md#guzzlehttppsr7headersplitlist) +which performs the same operation with a cleaned up API and improved +documentation. + +Converts an array of header values that may contain comma separated +headers into an array of headers with no comma separated values. + + +## `GuzzleHttp\Psr7\Query::parse` + +`public static function parse(string $str, int|bool $urlEncoding = true): array` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key +value pair will become an array. This function does not parse nested +PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` +will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`. + + +## `GuzzleHttp\Psr7\Query::build` + +`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string` + +Build a query string from an array of key value pairs. + +This function can use the return value of `parse()` to build a query +string. This function does not modify the provided keys when an array is +encountered (like `http_build_query()` would). + + +## `GuzzleHttp\Psr7\Utils::caselessRemove` + +`public static function caselessRemove(iterable $keys, $keys, array $data): array` + +Remove the items given by the keys, case insensitively from the data. + + +## `GuzzleHttp\Psr7\Utils::copyToStream` + +`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void` + +Copy the contents of a stream into another stream until the given number +of bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::copyToString` + +`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string` + +Copy the contents of a stream into a string until the given number of +bytes have been read. + + +## `GuzzleHttp\Psr7\Utils::hash` + +`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string` + +Calculate a hash of a stream. + +This method reads the entire stream to calculate a rolling hash, based on +PHP's `hash_init` functions. + + +## `GuzzleHttp\Psr7\Utils::modifyRequest` + +`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface` + +Clone and modify a request with the given changes. + +This method is useful for reducing the number of clones needed to mutate +a message. + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `GuzzleHttp\Psr7\Utils::readLine` + +`public static function readLine(StreamInterface $stream, int $maxLength = null): string` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `GuzzleHttp\Psr7\Utils::streamFor` + +`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +- metadata: Array of custom metadata. +- size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\Utils::streamFor('foo'); +$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100)); +``` + + +## `GuzzleHttp\Psr7\Utils::tryFopen` + +`public static function tryFopen(string $filename, string $mode): resource` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an +error handler that checks for errors and throws an exception instead. + + +## `GuzzleHttp\Psr7\Utils::tryGetContents` + +`public static function tryGetContents(resource $stream): string` + +Safely gets the contents of a given stream. + +When stream_get_contents fails, PHP normally raises a warning. This +function adds an error handler that checks for errors and throws an +exception instead. + + +## `GuzzleHttp\Psr7\Utils::uriFor` + +`public static function uriFor(string|UriInterface $uri): UriInterface` + +Returns a UriInterface for the given value. + +This function accepts a string or UriInterface and returns a +UriInterface for the given value. If the value is already a +UriInterface, it is returned as-is. + + +## `GuzzleHttp\Psr7\MimeType::fromFilename` + +`public static function fromFilename(string $filename): string|null` + +Determines the mimetype of a file by looking at its extension. + + +## `GuzzleHttp\Psr7\MimeType::fromExtension` + +`public static function fromExtension(string $extension): string|null` + +Maps a file extensions to a mimetype. + + +## Upgrading from Function API + +The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0. A migration table has been provided here for your convenience: + +| Original Function | Replacement Method | +|----------------|----------------| +| `str` | `Message::toString` | +| `uri_for` | `Utils::uriFor` | +| `stream_for` | `Utils::streamFor` | +| `parse_header` | `Header::parse` | +| `normalize_header` | `Header::normalize` | +| `modify_request` | `Utils::modifyRequest` | +| `rewind_body` | `Message::rewindBody` | +| `try_fopen` | `Utils::tryFopen` | +| `copy_to_string` | `Utils::copyToString` | +| `copy_to_stream` | `Utils::copyToStream` | +| `hash` | `Utils::hash` | +| `readline` | `Utils::readLine` | +| `parse_request` | `Message::parseRequest` | +| `parse_response` | `Message::parseResponse` | +| `parse_query` | `Query::parse` | +| `build_query` | `Query::build` | +| `mimetype_from_filename` | `MimeType::fromFilename` | +| `mimetype_from_extension` | `MimeType::fromExtension` | +| `_parse_message` | `Message::parseMessage` | +| `_parse_request_uri` | `Message::parseRequestUri` | +| `get_message_body_summary` | `Message::bodySummary` | +| `_caseless_remove` | `Utils::caselessRemove` | + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called +manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](https://www.php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Cross-Origin Detection + +`GuzzleHttp\Psr7\UriComparator` provides methods to determine if a modified URL should be considered cross-origin. + +### `GuzzleHttp\Psr7\UriComparator::isCrossOrigin` + +`public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool` + +Determines if a modified URL should be considered cross-origin with respect to an original URL. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers +do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. + + +## Version Guidance + +| Version | Status | PHP Version | +|---------|----------------|------------------| +| 1.x | Security fixes | >=5.4,<8.1 | +| 2.x | Latest | ^7.2.5 \|\| ^8.0 | + + +## Security + +If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. + + +## License + +Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. + + +## For Enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 000000000..cd91040cf --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,96 @@ +{ + "name": "guzzlehttp/psr7", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "request", + "response", + "message", + "stream", + "http", + "uri", + "url", + "psr-7" + ], + "license": "MIT", + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "preferred-install": "dist", + "sort-packages": true + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 000000000..cbcfaee65 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,248 @@ +addStream($stream); + } + } + + public function __toString(): string + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream): void + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents(): string + { + return Utils::copyToString($this); + } + + /** + * Closes each attached stream. + */ + public function close(): void + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + + return null; + } + + public function tell(): int + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + */ + public function getSize(): ?int + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof(): bool + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind(): void + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + */ + public function seek($offset, $whence = SEEK_SET): void + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + . $i . ' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + */ + public function read($length): string + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + $this->current++; + } + + $result = $this->streams[$this->current]->read($remaining); + + if ($result === '') { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return false; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 000000000..21be8c0a9 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,149 @@ +hwm = $hwm; + } + + public function __toString(): string + { + return $this->getContents(); + } + + public function getContents(): string + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close(): void + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + + return null; + } + + public function getSize(): ?int + { + return strlen($this->buffer); + } + + public function isReadable(): bool + { + return true; + } + + public function isWritable(): bool + { + return true; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof(): bool + { + return strlen($this->buffer) === 0; + } + + public function tell(): int + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length): string + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string): int + { + $this->buffer .= $string; + + if (strlen($this->buffer) >= $this->hwm) { + return 0; + } + + return strlen($string); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if ($key === 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 000000000..f34722cff --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,153 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); + } + + public function getSize(): ?int + { + $remoteSize = $this->remoteStream->getSize(); + + if (null === $remoteSize) { + return null; + } + + return max($this->stream->getSize(), $remoteSize); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + if ($whence === SEEK_SET) { + $byte = $offset; + } elseif ($whence === SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence === SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length): string + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string): int + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof(): bool + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close(): void + { + $this->remoteStream->close(); + $this->stream->close(); + } + + private function cacheEntireStream(): int + { + $target = new FnStream(['write' => 'strlen']); + Utils::copyToStream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 000000000..6e3d209d0 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,49 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string): int + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php b/vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php new file mode 100644 index 000000000..3a084779a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php @@ -0,0 +1,14 @@ + */ + private $methods; + + /** + * @param array $methods Hash of method name to a callable. + */ + public function __construct(array $methods) + { + $this->methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * + * @throws \BadMethodCallException + */ + public function __get(string $name): void + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * + * @throws \LogicException + */ + public function __wakeup(): void + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::SLOTS, array_keys($methods)) as $diff) { + /** @var callable $callable */ + $callable = [$stream, $diff]; + $methods[$diff] = $callable; + } + + return new self($methods); + } + + public function __toString(): string + { + try { + return call_user_func($this->_fn___toString); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function close(): void + { + call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize(): ?int + { + return call_user_func($this->_fn_getSize); + } + + public function tell(): int + { + return call_user_func($this->_fn_tell); + } + + public function eof(): bool + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable(): bool + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind(): void + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET): void + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable(): bool + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string): int + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable(): bool + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length): string + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents(): string + { + return call_user_func($this->_fn_getContents); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/Header.php b/vendor/guzzlehttp/psr7/src/Header.php new file mode 100644 index 000000000..4d7005b22 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Header.php @@ -0,0 +1,134 @@ +]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + } + + return $params; + } + + /** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @deprecated Use self::splitList() instead. + */ + public static function normalize($header): array + { + $result = []; + foreach ((array) $header as $value) { + foreach (self::splitList($value) as $parsed) { + $result[] = $parsed; + } + } + + return $result; + } + + /** + * Splits a HTTP header defined to contain a comma-separated list into + * each individual value. Empty values will be removed. + * + * Example headers include 'accept', 'cache-control' and 'if-none-match'. + * + * This method must not be used to parse headers that are not defined as + * a list, such as 'user-agent' or 'set-cookie'. + * + * @param string|string[] $values Header value as returned by MessageInterface::getHeader() + * + * @return string[] + */ + public static function splitList($values): array + { + if (!\is_array($values)) { + $values = [$values]; + } + + $result = []; + foreach ($values as $value) { + if (!\is_string($value)) { + throw new \TypeError('$header must either be a string or an array containing strings.'); + } + + $v = ''; + $isQuoted = false; + $isEscaped = false; + for ($i = 0, $max = \strlen($value); $i < $max; $i++) { + if ($isEscaped) { + $v .= $value[$i]; + $isEscaped = false; + + continue; + } + + if (!$isQuoted && $value[$i] === ',') { + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + + $v = ''; + continue; + } + + if ($isQuoted && $value[$i] === '\\') { + $isEscaped = true; + $v .= $value[$i]; + + continue; + } + if ($value[$i] === '"') { + $isQuoted = !$isQuoted; + $v .= $value[$i]; + + continue; + } + + $v .= $value[$i]; + } + + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + } + + return $result; + } +} diff --git a/vendor/guzzlehttp/psr7/src/HttpFactory.php b/vendor/guzzlehttp/psr7/src/HttpFactory.php new file mode 100644 index 000000000..30be222fc --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/HttpFactory.php @@ -0,0 +1,100 @@ +getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } + + public function createStream(string $content = ''): StreamInterface + { + return Utils::streamFor($content); + } + + public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface + { + try { + $resource = Utils::tryFopen($file, $mode); + } catch (\RuntimeException $e) { + if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) { + throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e); + } + + throw $e; + } + + return Utils::streamFor($resource); + } + + public function createStreamFromResource($resource): StreamInterface + { + return Utils::streamFor($resource); + } + + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + if (empty($method)) { + if (!empty($serverParams['REQUEST_METHOD'])) { + $method = $serverParams['REQUEST_METHOD']; + } else { + throw new \InvalidArgumentException('Cannot determine HTTP method'); + } + } + + return new ServerRequest($method, $uri, [], null, '1.1', $serverParams); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + return new Response($code, [], null, '1.1', $reasonPhrase); + } + + public function createRequest(string $method, $uri): RequestInterface + { + return new Request($method, $uri); + } + + public function createUri(string $uri = ''): UriInterface + { + return new Uri($uri); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 000000000..8e00f1c32 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,37 @@ + 15 + 32]); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 000000000..5618331f1 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,41 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + */ + protected function createStream(): StreamInterface + { + return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 000000000..fb2232557 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,157 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof(): bool + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit === -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + */ + public function getSize(): ?int + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit === -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + */ + public function seek($offset, $whence = SEEK_SET): void + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset %s with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + */ + public function tell(): int + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset(int $offset): void + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit(int $limit): void + { + $this->limit = $limit; + } + + public function read($length): string + { + if ($this->limit === -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Message.php b/vendor/guzzlehttp/psr7/src/Message.php new file mode 100644 index 000000000..61c1a5dcc --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Message.php @@ -0,0 +1,246 @@ +getMethod() . ' ' + . $message->getRequestTarget()) + . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' + . $message->getStatusCode() . ' ' + . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + if (strtolower($name) === 'set-cookie') { + foreach ($values as $value) { + $msg .= "\r\n{$name}: " . $value; + } + } else { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + } + + return "{$msg}\r\n\r\n" . $message->getBody(); + } + + /** + * Get a short summary of the message body. + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + */ + public static function bodySummary(MessageInterface $message, int $truncateAt = 120): ?string + { + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $body->rewind(); + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary)) { + return null; + } + + return $summary; + } + + /** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` + * returns a value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ + public static function rewindBody(MessageInterface $message): void + { + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } + } + + /** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + */ + public static function parseMessage(string $message): array + { + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + [$rawHeaders, $body] = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + [$startLine, $rawHeaders] = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; + } + + /** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + */ + public static function parseRequestUri(string $path, array $headers): string + { + $hostKey = array_filter(array_keys($headers), function ($k) { + // Numeric array keys are converted to int by PHP. + $k = (string) $k; + + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); + } + + /** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + */ + public static function parseRequest(string $message): RequestInterface + { + $data = self::parseMessage($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? self::parseRequestUri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); + } + + /** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + */ + public static function parseResponse(string $message): ResponseInterface + { + $data = self::parseMessage($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + (int) $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + $parts[2] ?? null + ); + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 000000000..d2dc28b60 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,264 @@ + Map of all registered headers, as original name => array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface|null */ + private $stream; + + public function getProtocolVersion(): string + { + return $this->protocol; + } + + public function withProtocolVersion($version): MessageInterface + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function hasHeader($header): bool + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header): array + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header): string + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value): MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value): MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header): MessageInterface + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody(): StreamInterface + { + if (!$this->stream) { + $this->stream = Utils::streamFor(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body): MessageInterface + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + /** + * @param array $headers + */ + private function setHeaders(array $headers): void + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + // Numeric array keys are converted to int by PHP. + $header = (string) $header; + + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + /** + * @param mixed $value + * + * @return string[] + */ + private function normalizeHeaderValue($value): array + { + if (!is_array($value)) { + return $this->trimAndValidateHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimAndValidateHeaderValues($value); + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param mixed[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimAndValidateHeaderValues(array $values): array + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + $trimmed = trim((string) $value, " \t"); + $this->assertValue($trimmed); + + return $trimmed; + }, array_values($values)); + } + + /** + * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * + * @param mixed $header + */ + private function assertHeader($header): void + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { + throw new \InvalidArgumentException( + sprintf( + '"%s" is not valid header name', + $header + ) + ); + } + } + + /** + * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * VCHAR = %x21-7E + * obs-text = %x80-FF + * obs-fold = CRLF 1*( SP / HTAB ) + */ + private function assertValue(string $value): void + { + // The regular expression intentionally does not support the obs-fold production, because as + // per RFC 7230#3.2.4: + // + // A sender MUST NOT generate a message that includes + // line folding (i.e., that has any field-value that contains a match to + // the obs-fold rule) unless the message is intended for packaging + // within the message/http media type. + // + // Clients must not send a request with line folding and a server sending folded headers is + // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting + // folding is not likely to break any legitimate use case. + if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) { + throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value)); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/MimeType.php b/vendor/guzzlehttp/psr7/src/MimeType.php new file mode 100644 index 000000000..0debbd18c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MimeType.php @@ -0,0 +1,1237 @@ + 'application/vnd.1000minds.decision-model+xml', + '3dml' => 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + '3gpp' => 'video/3gpp', + '3mf' => 'model/3mf', + '7z' => 'application/x-7z-compressed', + '7zip' => 'application/x-7z-compressed', + '123' => 'application/vnd.lotus-1-2-3', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/x-acc', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/vnd.nokia.n-gage.ac+xml', + 'ac3' => 'audio/ac3', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'age' => 'application/vnd.age', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/pdf', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'amr' => 'audio/amr', + 'apk' => 'application/vnd.android.package-archive', + 'apng' => 'image/apng', + 'appcache' => 'text/cache-manifest', + 'application' => 'application/x-ms-application', + 'apr' => 'application/vnd.lotus-approach', + 'arc' => 'application/x-freearc', + 'arj' => 'application/x-arj', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomdeleted' => 'application/atomdeleted+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/x-au', + 'avci' => 'image/avci', + 'avcs' => 'image/avcs', + 'avi' => 'video/x-msvideo', + 'avif' => 'image/avif', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azv' => 'image/vnd.airzip.accelerator.azv', + 'azw' => 'application/vnd.amazon.ebook', + 'b16' => 'image/vnd.pco.b16', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bdoc' => 'application/x-bdoc', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmml' => 'application/vnd.balsamiq.bmml+xml', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btif' => 'image/prs.btif', + 'buffer' => 'application/octet-stream', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cco' => 'application/x-cocoa', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdfx' => 'application/cdfx+xml', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdr' => 'application/cdr', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cjs' => 'application/node', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/octet-stream', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'coffee' => 'text/coffeescript', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpl' => 'application/cpl+xml', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'crx' => 'application/x-chrome-extension', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'csh' => 'application/x-csh', + 'csl' => 'application/vnd.citationstyles.style+xml', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'csr' => 'application/octet-stream', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbf' => 'application/vnd.dbf', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'ddf' => 'application/vnd.syncml.dmddf+xml', + 'dds' => 'image/vnd.ms-dds', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'disposition-notification' => 'message/disposition-notification', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/octet-stream', + 'dmg' => 'application/x-apple-diskimage', + 'dmn' => 'application/octet-stream', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dra' => 'audio/vnd.dra', + 'drle' => 'image/dicom-rle', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwd' => 'application/atsc-dwd+xml', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ear' => 'application/java-archive', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'image/emf', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emotionml' => 'application/emotionml+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es' => 'application/ecmascript', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/octet-stream', + 'exi' => 'application/exi', + 'exp' => 'application/express', + 'exr' => 'image/aces', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/mp4', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fdt' => 'application/fdt+xml', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'fits' => 'image/fits', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'fo' => 'application/vnd.software602.filler.form+xml', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'gdoc' => 'application/vnd.google-apps.document', + 'ged' => 'text/vnd.familysearch.gedcom', + 'geo' => 'application/vnd.dynageo', + 'geojson' => 'application/geo+json', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'glb' => 'model/gltf-binary', + 'gltf' => 'model/gltf+json', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gpg' => 'application/gpg-keys', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gsheet' => 'application/vnd.google-apps.spreadsheet', + 'gslides' => 'application/vnd.google-apps.presentation', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'gz' => 'application/gzip', + 'gzip' => 'application/gzip', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hbs' => 'text/x-handlebars-template', + 'hdd' => 'application/x-virtualbox-hdd', + 'hdf' => 'application/x-hdf', + 'heic' => 'image/heic', + 'heics' => 'image/heic-sequence', + 'heif' => 'image/heif', + 'heifs' => 'image/heif-sequence', + 'hej2' => 'image/hej2k', + 'held' => 'application/atsc-held+xml', + 'hh' => 'text/x-c', + 'hjson' => 'application/hjson', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'hsj2' => 'image/hsj2', + 'htc' => 'text/x-component', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'img' => 'application/octet-stream', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ini' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'its' => 'application/its+xml', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jade' => 'text/jade', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'jardiff' => 'application/x-java-archive-diff', + 'java' => 'text/x-java-source', + 'jhc' => 'image/jphc', + 'jisp' => 'application/vnd.jisp', + 'jls' => 'image/jls', + 'jlt' => 'application/vnd.hp-jlyt', + 'jng' => 'image/x-jng', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jp2' => 'image/jp2', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpf' => 'image/jpx', + 'jpg' => 'image/jpeg', + 'jpg2' => 'image/jp2', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jph' => 'image/jph', + 'jpm' => 'video/jpm', + 'jpx' => 'image/jpx', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'json5' => 'application/json5', + 'jsonld' => 'application/ld+json', + 'jsonml' => 'application/jsonml+json', + 'jsx' => 'text/jsx', + 'jxr' => 'image/jxr', + 'jxra' => 'image/jxra', + 'jxrs' => 'image/jxrs', + 'jxs' => 'image/jxs', + 'jxsc' => 'image/jxsc', + 'jxsi' => 'image/jxsi', + 'jxss' => 'image/jxss', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kdb' => 'application/octet-stream', + 'kdbx' => 'application/x-keepass2', + 'key' => 'application/x-iwork-keynote-sffkey', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktx2' => 'image/ktx2', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'less' => 'text/less', + 'lgr' => 'application/lgr+xml', + 'lha' => 'application/octet-stream', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'litcoffee' => 'text/coffeescript', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lua' => 'text/x-lua', + 'luac' => 'application/x-lua-bytecode', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/octet-stream', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'text/plain', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/x-m4a', + 'm4p' => 'application/mp4', + 'm4s' => 'video/iso.segment', + 'm4u' => 'application/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm21' => 'application/mp21', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'maei' => 'application/mmt-aei+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'manifest' => 'text/cache-manifest', + 'map' => 'application/json', + 'mar' => 'application/octet-stream', + 'markdown' => 'text/markdown', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'md' => 'text/markdown', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'mdx' => 'text/mdx', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mjs' => 'application/javascript', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mkd' => 'text/x-markdown', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mml' => 'text/mathml', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mp21' => 'application/mp21', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpd' => 'application/dash+xml', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpf' => 'application/media-policy-dataset+xml', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msg' => 'application/vnd.ms-outlook', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msl' => 'application/vnd.mobius.msl', + 'msm' => 'application/octet-stream', + 'msp' => 'application/octet-stream', + 'msty' => 'application/vnd.muvee.style', + 'mtl' => 'model/mtl', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musd' => 'application/mmt-usd+xml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mvt' => 'application/vnd.mapbox-vector-tile', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxmf' => 'audio/mobile-xmf', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nq' => 'application/n-quads', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'nt' => 'application/n-triples', + 'ntf' => 'application/vnd.nitf', + 'numbers' => 'application/x-iwork-numbers-sffnumbers', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obgx' => 'application/vnd.openblox.game+xml', + 'obj' => 'model/obj', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogex' => 'model/vnd.opengex', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'opus' => 'audio/ogg', + 'org' => 'text/x-org', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'osm' => 'application/vnd.openstreetmap.data+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'font/otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'ova' => 'application/x-virtualbox-ova', + 'ovf' => 'application/x-virtualbox-ovf', + 'owl' => 'application/rdf+xml', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p7a' => 'application/x-pkcs7-signature', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'pac' => 'application/x-ns-proxy-autoconfig', + 'pages' => 'application/x-iwork-pages-sffpages', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/x-pilot', + 'pde' => 'text/x-processing', + 'pdf' => 'application/pdf', + 'pem' => 'application/x-x509-user-cert', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp', + 'phar' => 'application/octet-stream', + 'php' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'phtml' => 'application/x-httpd-php', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'pkpass' => 'application/vnd.apple.pkpass', + 'pl' => 'application/x-perl', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pm' => 'application/x-perl', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'model/prc', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'provx' => 'application/provenance+xml', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'application/x-photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'pti' => 'image/prs.pti', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'raml' => 'application/raml+yaml', + 'rapd' => 'application/route-apd+xml', + 'rar' => 'application/x-rar', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'relo' => 'application/p2p-overlay+xml', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rng' => 'application/xml', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsa' => 'application/x-pkcs7', + 'rsat' => 'application/atsc-rsat+xml', + 'rsd' => 'application/rsd+xml', + 'rsheet' => 'application/urc-ressheet+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'run' => 'application/x-makeself', + 'rusd' => 'application/route-usd+xml', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sass' => 'text/x-sass', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scss' => 'text/x-scss', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'sea' => 'application/octet-stream', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'senmlx' => 'application/senml+xml', + 'sensmlx' => 'application/sensml+xml', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shex' => 'text/shex', + 'shf' => 'application/shf+xml', + 'shtml' => 'text/html', + 'sid' => 'image/x-mrsid-image', + 'sieve' => 'application/sieve', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'siv' => 'application/sieve', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slim' => 'text/slim', + 'slm' => 'text/slim', + 'sls' => 'application/route-s-tsid+xml', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spdx' => 'text/spdx', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'sst' => 'application/octet-stream', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'model/stl', + 'stpx' => 'model/step+xml', + 'stpxz' => 'model/step-xml+zip', + 'stpz' => 'model/step+zip', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'styl' => 'text/stylus', + 'stylus' => 'text/stylus', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'swidtag' => 'application/swid+xml', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 't38' => 'image/t38', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tap' => 'image/vnd.tencent.tap', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'td' => 'application/urc-targetdesc+xml', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tfx' => 'image/tiff-fx', + 'tga' => 'image/x-tga', + 'tgz' => 'application/x-tar', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tk' => 'application/x-tcl', + 'tmo' => 'application/vnd.tmobile-livetv', + 'toml' => 'application/toml', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trig' => 'application/trig', + 'trm' => 'application/x-msterminal', + 'ts' => 'video/mp2t', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'font/collection', + 'ttf' => 'font/ttf', + 'ttl' => 'text/turtle', + 'ttml' => 'application/ttml+xml', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u3d' => 'model/u3d', + 'u8dsn' => 'message/global-delivery-status', + 'u8hdr' => 'message/global-headers', + 'u8mdn' => 'message/global-disposition-notification', + 'u8msg' => 'message/global', + 'u32' => 'application/x-authorware-bin', + 'ubj' => 'application/ubjson', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'usdz' => 'model/vnd.usdz+zip', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vbox' => 'application/x-virtualbox-vbox', + 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vdi' => 'application/x-virtualbox-vdi', + 'vds' => 'model/vnd.sap.vds', + 'vhd' => 'application/x-virtualbox-vhd', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vlc' => 'application/videolan', + 'vmdk' => 'application/x-virtualbox-vmdk', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtf' => 'image/vnd.valve.source.texture', + 'vtt' => 'text/vtt', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wadl' => 'application/vnd.sun.wadl+xml', + 'war' => 'application/java-archive', + 'wasm' => 'application/wasm', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webapp' => 'application/x-web-app-manifest+json', + 'webm' => 'video/webm', + 'webmanifest' => 'application/manifest+json', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgt' => 'application/widget', + 'wif' => 'application/watcherinfo+xml', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'image/wmf', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + 'word' => 'application/msword', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsc' => 'message/vnd.wfa.wsc', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+fastinfoset', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d-vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'x32' => 'application/x-authorware-bin', + 'x_b' => 'model/vnd.parasolid.transmit.binary', + 'x_t' => 'model/vnd.parasolid.transmit.text', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xav' => 'application/xcap-att+xml', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xca' => 'application/xcap-caps+xml', + 'xcs' => 'application/calendar+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xel' => 'application/xcap-el+xml', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xns' => 'application/xcap-ns+xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsd' => 'application/xml', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yaml' => 'text/yaml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'yml' => 'text/yaml', + 'ymp' => 'text/x-suse-ymp', + 'z' => 'application/x-compress', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'zsh' => 'text/x-scriptzsh', + ]; + + /** + * Determines the mimetype of a file by looking at its extension. + * + * @link https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromFilename(string $filename): ?string + { + return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); + } + + /** + * Maps a file extensions to a mimetype. + * + * @link https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromExtension(string $extension): ?string + { + return self::MIME_TYPES[strtolower($extension)] ?? null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 000000000..3e12b74d1 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,159 @@ +boundary = $boundary ?: bin2hex(random_bytes(20)); + $this->stream = $this->createStream($elements); + } + + public function getBoundary(): string + { + return $this->boundary; + } + + public function isWritable(): bool + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + * + * @param array $headers + */ + private function getHeaders(array $headers): string + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements = []): StreamInterface + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + if (!is_array($element)) { + throw new \UnexpectedValueException("An array is expected"); + } + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element): void + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = Utils::streamFor($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') { + $element['filename'] = $uri; + } + } + + [$body, $headers] = $this->createElement( + $element['name'], + $element['contents'], + $element['filename'] ?? null, + $element['headers'] ?? [] + ); + + $stream->addStream(Utils::streamFor($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(Utils::streamFor("\r\n")); + } + + private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf( + 'form-data; name="%s"; filename="%s"', + $name, + basename($filename) + ) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = MimeType::fromFilename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, string $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 000000000..161a224f0 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,28 @@ +source = $source; + $this->size = $options['size'] ?? null; + $this->metadata = $options['metadata'] ?? []; + $this->buffer = new BufferStream(); + } + + public function __toString(): string + { + try { + return Utils::copyToString($this); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function close(): void + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = 0; + $this->source = null; + + return null; + } + + public function getSize(): ?int + { + return $this->size; + } + + public function tell(): int + { + return $this->tellPos; + } + + public function eof(): bool + { + return $this->source === null; + } + + public function isSeekable(): bool + { + return false; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable(): bool + { + return false; + } + + public function write($string): int + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable(): bool + { + return true; + } + + public function read($length): string + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents(): string + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return $this->metadata[$key] ?? null; + } + + private function pump(int $length): void + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Query.php b/vendor/guzzlehttp/psr7/src/Query.php new file mode 100644 index 000000000..2faab3a88 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Query.php @@ -0,0 +1,113 @@ + '1', 'foo[b]' => '2'])`. + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + */ + public static function parse(string $str, $urlEncoding = true): array + { + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', (string) $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { + return $str; + }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!array_key_exists($key, $result)) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? (int) $v : $v; + if ($v !== null) { + $qs .= '=' . $encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? (int) $vv : $vv; + if ($vv !== null) { + $qs .= '=' . $encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 000000000..b17af66a2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,157 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + */ + public function __construct( + string $method, + $uri, + array $headers = [], + $body = null, + string $version = '1.1' + ) { + $this->assertMethod($method); + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + } + + public function getRequestTarget(): string + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target === '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget): RequestInterface + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + public function getMethod(): string + { + return $this->method; + } + + public function withMethod($method): RequestInterface + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri(): UriInterface + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri(): void + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + /** + * @param mixed $method + */ + private function assertMethod($method): void + { + if (!is_string($method) || $method === '') { + throw new InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php new file mode 100644 index 000000000..4c6ee6f03 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,160 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 308 => 'Permanent Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase; + + /** @var int */ + private $statusCode; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|resource|StreamInterface|null $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + int $status = 200, + array $headers = [], + $body = null, + string $version = '1.1', + string $reason = null + ) { + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::PHRASES[$this->statusCode])) { + $this->reasonPhrase = self::PHRASES[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode(): int + { + return $this->statusCode; + } + + public function getReasonPhrase(): string + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = ''): ResponseInterface + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) { + $reasonPhrase = self::PHRASES[$new->statusCode]; + } + $new->reasonPhrase = (string) $reasonPhrase; + return $new; + } + + /** + * @param mixed $statusCode + */ + private function assertStatusCodeIsInteger($statusCode): void + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange(int $statusCode): void + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 000000000..30224018d --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,23 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 000000000..43cbb502e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,344 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + * @param array $serverParams Typically the $_SERVER superglobal + */ + public function __construct( + string $method, + $uri, + array $headers = [], + $body = null, + string $version = '1.1', + array $serverParams = [] + ) { + $this->serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files An array which respect $_FILES structure + * + * @throws InvalidArgumentException for unrecognized values + */ + public static function normalizeFiles(array $files): array + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * + * @return UploadedFileInterface|UploadedFileInterface[] + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []): array + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key], + 'error' => $files['error'][$key], + 'name' => $files['name'][$key], + 'type' => $files['type'][$key], + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + */ + public static function fromGlobals(): ServerRequestInterface + { + $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority(string $authority): array + { + $uri = 'http://' . $authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = $parts['host'] ?? null; + $port = $parts['port'] ?? null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + */ + public static function getUriFromGlobals(): UriInterface + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + [$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + public function getServerParams(): array + { + return $this->serverParams; + } + + public function getUploadedFiles(): array + { + return $this->uploadedFiles; + } + + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + public function getCookieParams(): array + { + return $this->cookieParams; + } + + public function withCookieParams(array $cookies): ServerRequestInterface + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + public function getQueryParams(): array + { + return $this->queryParams; + } + + public function withQueryParams(array $query): ServerRequestInterface + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + * + * @return array|object|null + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + public function withParsedBody($data): ServerRequestInterface + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + public function withAttribute($attribute, $value): ServerRequestInterface + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + public function withoutAttribute($attribute): ServerRequestInterface + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 000000000..ecd31861e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,282 @@ +size = $options['size']; + } + + $this->customMetadata = $options['metadata'] ?? []; + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function getContents(): string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + + return Utils::tryGetContents($this->stream); + } + + public function close(): void + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize(): ?int + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (is_array($stats) && isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable(): bool + { + return $this->readable; + } + + public function isWritable(): bool + { + return $this->writable; + } + + public function isSeekable(): bool + { + return $this->seekable; + } + + public function eof(): bool + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell(): int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $whence = (int) $whence; + + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + . $offset . ' with whence ' . var_export($whence, true)); + } + } + + public function read($length): string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + try { + $string = fread($this->stream, $length); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to read from stream', 0, $e); + } + + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string): int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return $meta[$key] ?? null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 000000000..56d4104d4 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,155 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @return StreamInterface + */ + public function __get(string $name) + { + if ($name === 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; + } + } + + public function getContents(): string + { + return Utils::copyToString($this); + } + + /** + * Allow decorators to implement custom methods + * + * @return mixed + */ + public function __call(string $method, array $args) + { + /** @var callable $callable */ + $callable = [$this->stream, $method]; + $result = call_user_func_array($callable, $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close(): void + { + $this->stream->close(); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize(): ?int + { + return $this->stream->getSize(); + } + + public function eof(): bool + { + return $this->stream->eof(); + } + + public function tell(): int + { + return $this->stream->tell(); + } + + public function isReadable(): bool + { + return $this->stream->isReadable(); + } + + public function isWritable(): bool + { + return $this->stream->isWritable(); + } + + public function isSeekable(): bool + { + return $this->stream->isSeekable(); + } + + public function rewind(): void + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET): void + { + $this->stream->seek($offset, $whence); + } + + public function read($length): string + { + return $this->stream->read($length); + } + + public function write($string): int + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @throws \BadMethodCallException + */ + protected function createStream(): StreamInterface + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 000000000..2a9346403 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,175 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream] + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register(): void + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read(int $count): string + { + return $this->stream->read($count); + } + + public function stream_write(string $data): int + { + return $this->stream->write($data); + } + + public function stream_tell(): int + { + return $this->stream->tell(); + } + + public function stream_eof(): bool + { + return $this->stream->eof(); + } + + public function stream_seek(int $offset, int $whence): bool + { + $this->stream->seek($offset, $whence); + + return true; + } + + /** + * @return resource|false + */ + public function stream_cast(int $cast_as) + { + $stream = clone($this->stream); + $resource = $stream->detach(); + + return $resource ?? false; + } + + /** + * @return array + */ + public function stream_stat(): array + { + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } + + /** + * @return array + */ + public function url_stat(string $path, int $flags): array + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 000000000..b1521bcf8 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,211 @@ +setError($errorStatus); + $this->size = $size; + $this->clientFilename = $clientFilename; + $this->clientMediaType = $clientMediaType; + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param StreamInterface|string|resource $streamOrFile + * + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile): void + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @throws InvalidArgumentException + */ + private function setError(int $error): void + { + if (false === in_array($error, UploadedFile::ERRORS, true)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + private function isStringNotEmpty($param): bool + { + return is_string($param) && false === empty($param); + } + + /** + * Return true if there is no upload error + */ + private function isOk(): bool + { + return $this->error === UPLOAD_ERR_OK; + } + + public function isMoved(): bool + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive(): void + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + public function getStream(): StreamInterface + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + /** @var string $file */ + $file = $this->file; + + return new LazyOpenStream($file, 'r+'); + } + + public function moveTo($targetPath): void + { + $this->validateActive(); + + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + $this->moved = PHP_SAPI === 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + Utils::copyToStream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + public function getSize(): ?int + { + return $this->size; + } + + public function getError(): int + { + return $this->error; + } + + public function getClientFilename(): ?string + { + return $this->clientFilename; + } + + public function getClientMediaType(): ?string + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 000000000..09e878d3d --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,740 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + /** + * Unreserved characters for use in a regex. + * + * @link https://tools.ietf.org/html/rfc3986#section-2.3 + */ + private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; + + /** + * Sub-delims for use in a regex. + * + * @link https://tools.ietf.org/html/rfc3986#section-2.2 + */ + private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; + private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** @var string|null String representation */ + private $composedComponents; + + public function __construct(string $uri = '') + { + if ($uri !== '') { + $parts = self::parse($uri); + if ($parts === false) { + throw new MalformedUriException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + /** + * UTF-8 aware \parse_url() replacement. + * + * The internal function produces broken output for non ASCII domain names + * (IDN) when used with locales other than "C". + * + * On the other hand, cURL understands IDN correctly only when UTF-8 locale + * is configured ("C.UTF-8", "en_US.UTF-8", etc.). + * + * @see https://bugs.php.net/bug.php?id=52923 + * @see https://www.php.net/manual/en/function.parse-url.php#114817 + * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING + * + * @return array|false + */ + private static function parse(string $url) + { + // If IPv6 + $prefix = ''; + if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { + /** @var array{0:string, 1:string, 2:string} $matches */ + $prefix = $matches[1]; + $url = $matches[2]; + } + + /** @var string */ + $encodedUrl = preg_replace_callback( + '%[^:/@?&=#]+%usD', + static function ($matches) { + return urlencode($matches[0]); + }, + $url + ); + + $result = parse_url($prefix . $encodedUrl); + + if ($result === false) { + return false; + } + + return array_map('urldecode', $result); + } + + public function __toString(): string + { + if ($this->composedComponents === null) { + $this->composedComponents = self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + return $this->composedComponents; + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + + if ($authority != '' || $scheme === 'file') { + $uri .= '//' . $authority; + } + + if ($authority != '' && $path != '' && $path[0] != '/') { + $path = '/' . $path; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?' . $query; + } + + if ($fragment != '') { + $uri .= '#' . $fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + */ + public static function isDefaultPort(UriInterface $uri): bool + { + return $uri->getPort() === null + || (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri): bool + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri): bool + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + */ + public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + */ + public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws MalformedUriException If the components do not form a valid URI. + */ + public static function fromParts(array $parts): UriInterface + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme(): string + { + return $this->scheme; + } + + public function getAuthority(): string + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo(): string + { + return $this->userInfo; + } + + public function getHost(): string + { + return $this->host; + } + + public function getPort(): ?int + { + return $this->port; + } + + public function getPath(): string + { + return $this->path; + } + + public function getQuery(): string + { + return $this->query; + } + + public function getFragment(): string + { + return $this->fragment; + } + + public function withScheme($scheme): UriInterface + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null): UriInterface + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withHost($host): UriInterface + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withPort($port): UriInterface + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path): UriInterface + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->composedComponents = null; + $new->validateState(); + + return $new; + } + + public function withQuery($query): UriInterface + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + $new->composedComponents = null; + + return $new; + } + + public function withFragment($fragment): UriInterface + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + $new->composedComponents = null; + + return $new; + } + + public function jsonSerialize(): string + { + return $this->__toString(); + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts): void + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + } + + $this->removeDefaultPort(); + } + + /** + * @param mixed $scheme + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme): string + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $component + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component): string + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param mixed $host + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host): string + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + + /** + * @param mixed $port + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port): ?int + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (0 > $port || 0xffff < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param string[] $keys + * + * @return string[] + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys): array + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + private static function generateQueryString(string $key, ?string $value): string + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); + } + + return $queryString; + } + + private function removeDefaultPort(): void + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param mixed $path + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path): string + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param mixed $str + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str): string + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match): string + { + return rawurlencode($match[0]); + } + + private function validateState(): void + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriComparator.php b/vendor/guzzlehttp/psr7/src/UriComparator.php new file mode 100644 index 000000000..70c582aa0 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriComparator.php @@ -0,0 +1,52 @@ +getHost(), $modified->getHost()) !== 0) { + return true; + } + + if ($original->getScheme() !== $modified->getScheme()) { + return true; + } + + if (self::computePort($original) !== self::computePort($modified)) { + return true; + } + + return false; + } + + private static function computePort(UriInterface $uri): int + { + $port = $uri->getPort(); + + if (null !== $port) { + return $port; + } + + return 'https' === $uri->getScheme() ? 443 : 80; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 000000000..e12971edd --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,220 @@ +getPath() === '' && + ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri): UriInterface + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match) { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri): UriInterface + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 000000000..426e5c9ad --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,211 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + */ + public static function relativize(UriInterface $base, UriInterface $target): UriInterface + { + if ($target->getScheme() !== '' && + ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + /** @var string $lastSegment */ + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target): string + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/Utils.php b/vendor/guzzlehttp/psr7/src/Utils.php new file mode 100644 index 000000000..3a4cf3946 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Utils.php @@ -0,0 +1,459 @@ + $v) { + if (!is_string($k) || !in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; + } + + /** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void + { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } + } + + /** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToString(StreamInterface $stream, int $maxLen = -1): string + { + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + if ($buf === '') { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === '') { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; + } + + /** + * Calculate a hash of a stream. + * + * This method reads the entire stream to calculate a rolling hash, based + * on PHP's `hash_init` functions. + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @throws \RuntimeException on error. + */ + public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string + { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, $rawOutput); + $stream->seek($pos); + + return $out; + } + + /** + * Clone and modify a request with the given changes. + * + * This method is useful for reducing the number of clones needed to mutate + * a message. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + */ + public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface + { + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':' . $port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = self::caselessRemove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + $new = (new ServerRequest( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), + $changes['version'] ?? $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + + foreach ($request->getAttributes() as $key => $value) { + $new = $new->withAttribute($key, $value); + } + + return $new; + } + + return new Request( + $changes['method'] ?? $request->getMethod(), + $uri, + $headers, + $changes['body'] ?? $request->getBody(), + $changes['version'] ?? $request->getProtocolVersion() + ); + } + + /** + * Read a line from the stream up to the maximum allowed buffer length. + * + * @param StreamInterface $stream Stream to read from + * @param int|null $maxLength Maximum buffer length + */ + public static function readLine(StreamInterface $stream, ?int $maxLength = null): string + { + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + if ('' === ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; + } + + /** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * This method accepts the following `$resource` types: + * - `Psr\Http\Message\StreamInterface`: Returns the value as-is. + * - `string`: Creates a stream object that uses the given string as the contents. + * - `resource`: Creates a stream object that wraps the given PHP stream resource. + * - `Iterator`: If the provided value implements `Iterator`, then a read-only + * stream object will be created that wraps the given iterable. Each time the + * stream is read from, data from the iterator will fill a buffer and will be + * continuously called until the buffer is equal to the requested read size. + * Subsequent read calls will first read from the buffer and then call `next` + * on the underlying iterator until it is exhausted. + * - `object` with `__toString()`: If the object has the `__toString()` method, + * the object will be cast to a string and then a stream will be returned that + * uses the string value. + * - `NULL`: When `null` is passed, an empty stream object is returned. + * - `callable` When a callable is passed, a read-only stream object will be + * created that invokes the given callable. The callable is invoked with the + * number of suggested bytes to read. The callable can return any number of + * bytes, but MUST return `false` when there is no more data to return. The + * stream object that wraps the callable will invoke the callable until the + * number of requested bytes are available. Any additional bytes will be + * buffered and used in subsequent reads. + * + * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data + * @param array{size?: int, metadata?: array} $options Additional options + * + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function streamFor($resource = '', array $options = []): StreamInterface + { + if (is_scalar($resource)) { + $stream = self::tryFopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, (string) $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + /* + * The 'php://input' is a special stream with quirks and inconsistencies. + * We avoid using that stream by reading it into php://temp + */ + + /** @var resource $resource */ + if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') { + $stream = self::tryFopen('php://temp', 'w+'); + stream_copy_to_stream($resource, $stream); + fseek($stream, 0); + $resource = $stream; + } + return new Stream($resource, $options); + case 'object': + /** @var object $resource */ + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return self::streamFor((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(self::tryFopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); + } + + /** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * + * @throws \RuntimeException if the file cannot be opened + */ + public static function tryFopen(string $filename, string $mode) + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $errstr + )); + + return true; + }); + + try { + /** @var resource $handle */ + $handle = fopen($filename, $mode); + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf( + 'Unable to open "%s" using mode "%s": %s', + $filename, + $mode, + $e->getMessage() + ), 0, $e); + } + + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; + } + + /** + * Safely gets the contents of a given stream. + * + * When stream_get_contents fails, PHP normally raises a warning. This + * function adds an error handler that checks for errors and throws an + * exception instead. + * + * @param resource $stream + * + * @throws \RuntimeException if the stream cannot be read + */ + public static function tryGetContents($stream): string + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use (&$ex): bool { + $ex = new \RuntimeException(sprintf( + 'Unable to read stream contents: %s', + $errstr + )); + + return true; + }); + + try { + /** @var string|false $contents */ + $contents = stream_get_contents($stream); + + if ($contents === false) { + $ex = new \RuntimeException('Unable to read stream contents'); + } + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf( + 'Unable to read stream contents: %s', + $e->getMessage() + ), 0, $e); + } + + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $contents; + } + + /** + * Returns a UriInterface for the given value. + * + * This function accepts a string or UriInterface and returns a + * UriInterface for the given value. If the value is already a + * UriInterface, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @throws \InvalidArgumentException + */ + public static function uriFor($uri): UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + + if (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/vendor/http-interop/http-factory-guzzle/.github/workflows/ci.yaml b/vendor/http-interop/http-factory-guzzle/.github/workflows/ci.yaml new file mode 100644 index 000000000..6d076b841 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/.github/workflows/ci.yaml @@ -0,0 +1,60 @@ +name: CI + +on: + pull_request: + push: + branches: [ master ] + +jobs: + run: + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + php: + - '7.3' + - '7.4' + - '8.0' + minimum_versions: [false] + coverage: ['none'] + include: + - description: 'Minimum version' + php: '7.3' + minimum_versions: true + - description: 'Log Code Coverage' + php: '8.0' + coverage: 'xdebug' + + name: PHP ${{ matrix.php }} ${{ matrix.description }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: ${{ matrix.php }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ matrix.coverage }} + + - name: Install dependencies + run: composer install + if: matrix.minimum_versions == false + + - name: Install dependencies (lowest versions) + run: composer update --no-interaction --prefer-lowest + if: matrix.minimum_versions == true + + - name: Run PHPUnit tests + run: vendor/bin/phpunit + + - name: Upload code coverage + uses: codecov/codecov-action@v2 + if: matrix.coverage == 'xdebug' + with: + file: './build/logs/clover.xml' + fail_ci_if_error: true diff --git a/vendor/http-interop/http-factory-guzzle/LICENSE b/vendor/http-interop/http-factory-guzzle/LICENSE new file mode 100644 index 000000000..efb5a1966 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Woody Gilk + +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/vendor/http-interop/http-factory-guzzle/README.md b/vendor/http-interop/http-factory-guzzle/README.md new file mode 100644 index 000000000..3e9197e43 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/README.md @@ -0,0 +1,7 @@ +# HTTP Factory for Guzzle + +HTTP factory implemented for [Guzzle](https://github.com/guzzle/psr7). + +**NOTE:** `guzzlehttp/psr7` includes an HTTP factory implementation starting with +version 2.0. Please use the official factory if your project can use +`"guzzlehttp/psr7": "^2.0"`. diff --git a/vendor/http-interop/http-factory-guzzle/composer.json b/vendor/http-interop/http-factory-guzzle/composer.json new file mode 100644 index 000000000..6956435a9 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/composer.json @@ -0,0 +1,37 @@ +{ + "name": "http-interop/http-factory-guzzle", + "description": "An HTTP Factory using Guzzle PSR7", + "keywords": [ + "psr-7", + "psr-17", + "http", + "factory" + ], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "provide": { + "psr/http-factory-implementation": "^1.0" + }, + "require": { + "php": ">=7.3", + "psr/http-factory": "^1.0", + "guzzlehttp/psr7": "^1.7||^2.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^9.5" + }, + "autoload": { + "psr-4": { + "Http\\Factory\\Guzzle\\": "src/" + } + }, + "suggest": { + "guzzlehttp/psr7": "Includes an HTTP factory starting in version 2.0" + } +} diff --git a/vendor/http-interop/http-factory-guzzle/src/RequestFactory.php b/vendor/http-interop/http-factory-guzzle/src/RequestFactory.php new file mode 100644 index 000000000..1ab71ee7b --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/src/RequestFactory.php @@ -0,0 +1,15 @@ +createStreamFromResource(Utils::tryFopen($file, $mode)); + } + + public function createStreamFromResource($resource): StreamInterface + { + return new Stream($resource); + } +} diff --git a/vendor/http-interop/http-factory-guzzle/src/UploadedFileFactory.php b/vendor/http-interop/http-factory-guzzle/src/UploadedFileFactory.php new file mode 100644 index 000000000..d58375bb4 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/src/UploadedFileFactory.php @@ -0,0 +1,25 @@ +getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } +} diff --git a/vendor/http-interop/http-factory-guzzle/src/UriFactory.php b/vendor/http-interop/http-factory-guzzle/src/UriFactory.php new file mode 100644 index 000000000..3250986c1 --- /dev/null +++ b/vendor/http-interop/http-factory-guzzle/src/UriFactory.php @@ -0,0 +1,15 @@ + $config['region'], - 'version' => 'latest', - 'endpoint' => $config['endpoint'] ?? null, - ]; - - if ($config['key'] && $config['secret']) { - $dynamoConfig['credentials'] = Arr::only( - $config, ['key', 'secret', 'token'] - ); - } + $client = $this->newDynamodbClient($config); return $this->repository( new DynamoDbStore( - new DynamoDbClient($dynamoConfig), + $client, $config['table'], $config['attributes']['key'] ?? 'key', $config['attributes']['value'] ?? 'value', @@ -250,6 +240,28 @@ class CacheManager implements FactoryContract ); } + /** + * Create new DynamoDb Client instance. + * + * @return DynamoDbClient + */ + protected function newDynamodbClient(array $config) + { + $dynamoConfig = [ + 'region' => $config['region'], + 'version' => 'latest', + 'endpoint' => $config['endpoint'] ?? null, + ]; + + if (isset($config['key']) && isset($config['secret'])) { + $dynamoConfig['credentials'] = Arr::only( + $config, ['key', 'secret', 'token'] + ); + } + + return new DynamoDbClient($dynamoConfig); + } + /** * Create a new cache repository with the given implementation. * diff --git a/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php index 4e663db41..aa28a789f 100644 --- a/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php +++ b/vendor/laravel/framework/src/Illuminate/Cache/DynamoDbStore.php @@ -525,4 +525,14 @@ class DynamoDbStore implements LockProvider, Store { $this->prefix = ! empty($prefix) ? $prefix.':' : ''; } + + /** + * Get the DynamoDb Client instance. + * + * @return DynamoDbClient + */ + public function getClient() + { + return $this->dynamo; + } } diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Lock.php b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php index 0200c5a47..e2b8fa4a3 100644 --- a/vendor/laravel/framework/src/Illuminate/Cache/Lock.php +++ b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php @@ -98,7 +98,7 @@ abstract class Lock implements LockContract * * @param int $seconds * @param callable|null $callback - * @return bool + * @return mixed * * @throws \Illuminate\Contracts\Cache\LockTimeoutException */ diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php b/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php index efa83d4fc..388b43023 100644 --- a/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php +++ b/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php @@ -36,6 +36,8 @@ class RateLimiter */ public function tooManyAttempts($key, $maxAttempts) { + $key = $this->cleanRateLimiterKey($key); + if ($this->attempts($key) >= $maxAttempts) { if ($this->cache->has($key.':timer')) { return true; @@ -56,6 +58,8 @@ class RateLimiter */ public function hit($key, $decaySeconds = 60) { + $key = $this->cleanRateLimiterKey($key); + $this->cache->add( $key.':timer', $this->availableAt($decaySeconds), $decaySeconds ); @@ -79,6 +83,8 @@ class RateLimiter */ public function attempts($key) { + $key = $this->cleanRateLimiterKey($key); + return $this->cache->get($key, 0); } @@ -90,6 +96,8 @@ class RateLimiter */ public function resetAttempts($key) { + $key = $this->cleanRateLimiterKey($key); + return $this->cache->forget($key); } @@ -102,6 +110,8 @@ class RateLimiter */ public function retriesLeft($key, $maxAttempts) { + $key = $this->cleanRateLimiterKey($key); + $attempts = $this->attempts($key); return $maxAttempts - $attempts; @@ -115,6 +125,8 @@ class RateLimiter */ public function clear($key) { + $key = $this->cleanRateLimiterKey($key); + $this->resetAttempts($key); $this->cache->forget($key.':timer'); @@ -128,6 +140,19 @@ class RateLimiter */ public function availableIn($key) { + $key = $this->cleanRateLimiterKey($key); + return $this->cache->get($key.':timer') - $this->currentTime(); } + + /** + * Clean the rate limiter key from unicode characters. + * + * @param string $key + * @return string + */ + public function cleanRateLimiterKey($key) + { + return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key)); + } } diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php index 208ae9466..ad50ce9ad 100644 --- a/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php @@ -179,7 +179,7 @@ class RedisTaggedCache extends TaggedCache if (count($values) > 0) { foreach (array_chunk($values, 1000) as $valuesChunk) { - call_user_func_array([$this->store->connection(), 'del'], $valuesChunk); + $this->store->connection()->del(...$valuesChunk); } } } diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Repository.php b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php index 0b3418a90..a242e8afc 100755 --- a/vendor/laravel/framework/src/Illuminate/Cache/Repository.php +++ b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php @@ -550,7 +550,7 @@ class Repository implements ArrayAccess, CacheContract /** * Get the event dispatcher instance. * - * @return \Illuminate\Contracts\Events\Dispatcher + * @return \Illuminate\Contracts\Events\Dispatcher */ public function getEventDispatcher() { diff --git a/vendor/laravel/framework/src/Illuminate/Cache/composer.json b/vendor/laravel/framework/src/Illuminate/Cache/composer.json index e69c40624..01331f1b0 100755 --- a/vendor/laravel/framework/src/Illuminate/Cache/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Cache/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Config/composer.json b/vendor/laravel/framework/src/Illuminate/Config/composer.json index 55e8a4035..3704ba14f 100755 --- a/vendor/laravel/framework/src/Illuminate/Config/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Config/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Console/Application.php b/vendor/laravel/framework/src/Illuminate/Console/Application.php index 7066c8485..ee06175f4 100755 --- a/vendor/laravel/framework/src/Illuminate/Console/Application.php +++ b/vendor/laravel/framework/src/Illuminate/Console/Application.php @@ -116,7 +116,7 @@ class Application extends SymfonyApplication implements ApplicationContract */ public static function artisanBinary() { - return defined('ARTISAN_BINARY') ? ProcessUtils::escapeArgument(ARTISAN_BINARY) : 'artisan'; + return ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php b/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php index 3f6f9c764..e860ec2a2 100644 --- a/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php +++ b/vendor/laravel/framework/src/Illuminate/Console/Concerns/HasParameters.php @@ -21,7 +21,7 @@ trait HasParameters if ($arguments instanceof InputArgument) { $this->getDefinition()->addArgument($arguments); } else { - call_user_func_array([$this, 'addArgument'], $arguments); + $this->addArgument(...array_values($arguments)); } } @@ -29,7 +29,7 @@ trait HasParameters if ($options instanceof InputOption) { $this->getDefinition()->addOption($options); } else { - call_user_func_array([$this, 'addOption'], $options); + $this->addOption(...array_values($options)); } } } diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php index 96b1c1e1b..6af680d99 100644 --- a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php @@ -3,6 +3,7 @@ namespace Illuminate\Console\Scheduling; use Illuminate\Contracts\Container\Container; +use Illuminate\Support\Reflector; use InvalidArgumentException; use LogicException; @@ -35,7 +36,7 @@ class CallbackEvent extends Event */ public function __construct(EventMutex $mutex, $callback, array $parameters = [], $timezone = null) { - if (! is_string($callback) && ! is_callable($callback)) { + if (! is_string($callback) && ! Reflector::isCallable($callback)) { throw new InvalidArgumentException( 'Invalid scheduled callback event. Must be a string or callable.' ); @@ -163,6 +164,6 @@ class CallbackEvent extends Event return $this->description; } - return is_string($this->callback) ? $this->callback : 'Closure'; + return is_string($this->callback) ? $this->callback : 'Callback'; } } diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php index be8b6065c..58bc7e0ab 100644 --- a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php @@ -10,8 +10,8 @@ use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Contracts\Mail\Mailer; use Illuminate\Support\Arr; -use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Date; +use Illuminate\Support\Reflector; use Illuminate\Support\Traits\Macroable; use Psr\Http\Client\ClientExceptionInterface; use Symfony\Component\Process\Process; @@ -319,10 +319,10 @@ class Event */ protected function expressionPasses() { - $date = Carbon::now(); + $date = Date::now(); if ($this->timezone) { - $date->setTimezone($this->timezone); + $date = $date->setTimezone($this->timezone); } return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); @@ -577,7 +577,7 @@ class Event return function (Container $container, HttpClient $http) use ($url) { try { $http->get($url); - } catch (ClientExceptionInterface | TransferException $e) { + } catch (ClientExceptionInterface|TransferException $e) { $container->make(ExceptionHandler::class)->report($e); } }; @@ -672,7 +672,7 @@ class Event */ public function when($callback) { - $this->filters[] = is_callable($callback) ? $callback : function () use ($callback) { + $this->filters[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { return $callback; }; @@ -687,7 +687,7 @@ class Event */ public function skip($callback) { - $this->rejects[] = is_callable($callback) ? $callback : function () use ($callback) { + $this->rejects[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { return $callback; }; diff --git a/vendor/laravel/framework/src/Illuminate/Console/composer.json b/vendor/laravel/framework/src/Illuminate/Console/composer.json index 55f104571..8183ff829 100755 --- a/vendor/laravel/framework/src/Illuminate/Console/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Console/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0", "symfony/console": "^4.3.4", @@ -31,8 +31,8 @@ } }, "suggest": { - "dragonmantank/cron-expression": "Required to use scheduler (^2.0).", - "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.0|^7.0).", + "dragonmantank/cron-expression": "Required to use scheduler (^2.3.1).", + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.3.1|^7.0.1).", "illuminate/bus": "Required to use the scheduled job dispatcher (^6.0)", "illuminate/container": "Required to use the scheduler (^6.0)", "illuminate/filesystem": "Required to use the generator command (^6.0)", diff --git a/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php b/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php index 8b53f71a3..c617bf797 100644 --- a/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php +++ b/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php @@ -3,6 +3,7 @@ namespace Illuminate\Container; use Closure; +use Illuminate\Contracts\Container\BindingResolutionException; use InvalidArgumentException; use ReflectionFunction; use ReflectionMethod; @@ -23,14 +24,16 @@ class BoundMethod */ public static function call($container, $callback, array $parameters = [], $defaultMethod = null) { + if (is_string($callback) && ! $defaultMethod && method_exists($callback, '__invoke')) { + $defaultMethod = '__invoke'; + } + if (static::isCallableWithAtSign($callback) || $defaultMethod) { return static::callClass($container, $callback, $parameters, $defaultMethod); } return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) { - return call_user_func_array( - $callback, static::getMethodDependencies($container, $callback, $parameters) - ); + return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters))); }); } @@ -121,7 +124,7 @@ class BoundMethod static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies); } - return array_merge($dependencies, $parameters); + return array_merge($dependencies, array_values($parameters)); } /** @@ -171,6 +174,10 @@ class BoundMethod } } elseif ($parameter->isDefaultValueAvailable()) { $dependencies[] = $parameter->getDefaultValue(); + } elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) { + $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new BindingResolutionException($message); } } diff --git a/vendor/laravel/framework/src/Illuminate/Container/Container.php b/vendor/laravel/framework/src/Illuminate/Container/Container.php index c0e2082b3..0d31a89a5 100755 --- a/vendor/laravel/framework/src/Illuminate/Container/Container.php +++ b/vendor/laravel/framework/src/Illuminate/Container/Container.php @@ -1073,7 +1073,6 @@ class Container implements ArrayAccess, ContainerContract * @param string $abstract * @param object $object * @param array $callbacksPerType - * * @return array */ protected function getCallbacksForType($abstract, $object, array $callbacksPerType) diff --git a/vendor/laravel/framework/src/Illuminate/Container/composer.json b/vendor/laravel/framework/src/Illuminate/Container/composer.json index 76da21634..bb1a7e397 100755 --- a/vendor/laravel/framework/src/Illuminate/Container/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Container/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "psr/container": "^1.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Lock.php b/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Lock.php index 4f98d68d9..03f633a07 100644 --- a/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Lock.php +++ b/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Lock.php @@ -17,14 +17,14 @@ interface Lock * * @param int $seconds * @param callable|null $callback - * @return bool + * @return mixed */ public function block($seconds, $callback = null); /** * Release the lock. * - * @return void + * @return bool */ public function release(); diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php b/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php index c17adc6ee..2c12e93bc 100644 --- a/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php +++ b/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php @@ -25,7 +25,7 @@ interface Application extends Container /** * Get the path to the bootstrap directory. * - * @param string $path Optionally, a path to append to the bootstrap path + * @param string $path * @return string */ public function bootstrapPath($path = ''); @@ -33,7 +33,7 @@ interface Application extends Container /** * Get the path to the application configuration files. * - * @param string $path Optionally, a path to append to the config path + * @param string $path * @return string */ public function configPath($path = ''); @@ -41,7 +41,7 @@ interface Application extends Container /** * Get the path to the database directory. * - * @param string $path Optionally, a path to append to the database path + * @param string $path * @return string */ public function databasePath($path = ''); diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/composer.json b/vendor/laravel/framework/src/Illuminate/Contracts/composer.json index fee8ed4d0..c62efd954 100644 --- a/vendor/laravel/framework/src/Illuminate/Contracts/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Contracts/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "psr/container": "^1.0", "psr/simple-cache": "^1.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php b/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php index a880e898e..337435a74 100755 --- a/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php +++ b/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php @@ -143,7 +143,7 @@ class CookieJar implements JarContract if (head($parameters) instanceof Cookie) { $cookie = head($parameters); } else { - $cookie = call_user_func_array([$this, 'make'], $parameters); + $cookie = $this->make(...array_values($parameters)); } if (! isset($this->queued[$cookie->getName()])) { diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/composer.json b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json index 1517a2b19..920d7fff1 100755 --- a/vendor/laravel/framework/src/Illuminate/Cookie/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0", "symfony/http-foundation": "^4.3.4", diff --git a/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php index 72132c164..16c868748 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php +++ b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php @@ -40,11 +40,23 @@ trait DetectsLostConnections 'Communication link failure', 'connection is no longer usable', 'Login timeout expired', - 'Connection refused', + 'SQLSTATE[HY000] [2002] 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.', 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', + 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known', 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected', + 'SQLSTATE[HY000] [2002] Connection timed out', + 'SSL: Connection timed out', + 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.', + 'Temporary failure in name resolution', + 'SSL: Broken pipe', + 'SQLSTATE[08S01]: Communication link failure', + 'SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host', + 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: No route to host', + 'The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.', + 'SQLSTATE[08006] [7] could not translate host name', + 'TCP Provider: Error code 0x274C', ]); } } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php index fe603c18f..7ed95b0fc 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php @@ -7,6 +7,7 @@ use Closure; use Exception; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Concerns\BuildsQueries; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Pagination\Paginator; @@ -224,7 +225,7 @@ class Builder /** * Add a basic where clause to the query. * - * @param \Closure|string|array $column + * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column * @param mixed $operator * @param mixed $value * @param string $boolean @@ -246,7 +247,7 @@ class Builder /** * Add a basic where clause to the query, and return the first result. * - * @param \Closure|string|array $column + * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column * @param mixed $operator * @param mixed $value * @param string $boolean @@ -260,7 +261,7 @@ class Builder /** * Add an "or where" clause to the query. * - * @param \Closure|array|string $column + * @param \Closure|array|string|\Illuminate\Database\Query\Expression $column * @param mixed $operator * @param mixed $value * @return \Illuminate\Database\Eloquent\Builder|static @@ -277,7 +278,7 @@ class Builder /** * Add an "order by" clause for a timestamp to the query. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @return $this */ public function latest($column = null) @@ -294,7 +295,7 @@ class Builder /** * Add an "order by" clause for a timestamp to the query. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @return $this */ public function oldest($column = null) @@ -503,13 +504,13 @@ class Builder /** * Get a single column's value from the first result of a query. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @return mixed */ public function value($column) { if ($result = $this->first([$column])) { - return $result->{$column}; + return $result->{Str::afterLast($column, '.')}; } } @@ -686,7 +687,7 @@ class Builder /** * Get an array with the values of a given column. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @param string|null $key * @return \Illuminate\Support\Collection */ @@ -801,7 +802,7 @@ class Builder /** * Increment a column's value by a given amount. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @param float|int $amount * @param array $extra * @return int @@ -816,7 +817,7 @@ class Builder /** * Decrement a column's value by a given amount. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @param float|int $amount * @param array $extra * @return int @@ -919,7 +920,7 @@ class Builder // messed up when adding scopes. Then we'll return back out the builder. $builder = $builder->callScope( [$this->model, 'scope'.ucfirst($scope)], - (array) $parameters + Arr::wrap($parameters) ); } @@ -1143,7 +1144,15 @@ class Builder protected function createSelectWithConstraint($name) { return [explode(':', $name)[0], static function ($query) use ($name) { - $query->select(explode(',', explode(':', $name)[1])); + $query->select(array_map(static function ($column) use ($query) { + if (Str::contains($column, '.')) { + return $column; + } + + return $query instanceof BelongsToMany + ? $query->getRelated()->getTable().'.'.$column + : $column; + }, explode(',', explode(':', $name)[1]))); }]; } @@ -1268,7 +1277,7 @@ class Builder /** * Qualify the given column name by the model's table. * - * @param string $column + * @param string|\Illuminate\Database\Query\Expression $column * @return string */ public function qualifyColumn($column) @@ -1359,14 +1368,16 @@ class Builder } if (static::hasGlobalMacro($method)) { - if (static::$macros[$method] instanceof Closure) { - return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters); + $callable = static::$macros[$method]; + + if ($callable instanceof Closure) { + $callable = $callable->bindTo($this, static::class); } - return call_user_func_array(static::$macros[$method], $parameters); + return $callable(...$parameters); } - if (method_exists($this->model, $scope = 'scope'.ucfirst($method))) { + if ($this->model !== null && method_exists($this->model, $scope = 'scope'.ucfirst($method))) { return $this->callScope([$this->model, $scope], $parameters); } @@ -1404,11 +1415,13 @@ class Builder static::throwBadMethodCallException($method); } - if (static::$macros[$method] instanceof Closure) { - return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters); + $callable = static::$macros[$method]; + + if ($callable instanceof Closure) { + $callable = $callable->bindTo(null, static::class); } - return call_user_func_array(static::$macros[$method], $parameters); + return $callable(...$parameters); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php index 7201603a9..6416714cf 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php @@ -159,7 +159,7 @@ class Collection extends BaseCollection implements QueueableCollection return; } - $models = $models->pluck($name); + $models = $models->pluck($name)->whereNotNull(); if ($models->first() instanceof BaseCollection) { $models = $models->collapse(); @@ -258,6 +258,23 @@ class Collection extends BaseCollection implements QueueableCollection }) ? $result->toBase() : $result; } + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key / value pair. + * + * @param callable $callback + * @return \Illuminate\Support\Collection|static + */ + public function mapWithKeys(callable $callback) + { + $result = parent::mapWithKeys($callback); + + return $result->contains(function ($item) { + return ! $item instanceof Model; + }) ? $result->toBase() : $result; + } + /** * Reload a fresh model instance from the database for all the entities. * @@ -446,12 +463,12 @@ class Collection extends BaseCollection implements QueueableCollection /** * Zip the collection together with one or more arrays. * - * @param mixed ...$items + * @param mixed ...$items * @return \Illuminate\Support\Collection */ public function zip($items) { - return call_user_func_array([$this->toBase(), 'zip'], func_get_args()); + return $this->toBase()->zip(...func_get_args()); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php index 92c3758e1..c48bd22a5 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php @@ -233,7 +233,7 @@ trait HasRelationships // If the type value is null it is probably safe to assume we're eager loading // the relationship. In this case we'll just pass in a dummy query where we // need to remove any eager loads that may already be defined on a model. - return empty($class = $this->{$type}) + return is_null($class = $this->{$type}) || $class === '' ? $this->morphEagerTo($name, $type, $id, $ownerKey) : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php index 28c5fd25f..9f319c514 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -52,7 +52,6 @@ class BelongsTo extends Relation * @param string $foreignKey * @param string $ownerKey * @param string $relationName - * * @return void */ public function __construct(Builder $query, Model $child, $foreignKey, $ownerKey, $relationName) diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php index c40d2db8e..de9f07253 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php @@ -284,6 +284,8 @@ trait AsPivot */ protected function newQueryForCollectionRestoration(array $ids) { + $ids = array_values($ids); + if (! Str::contains($ids[0], ':')) { return parent::newQueryForRestoration($ids); } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index 4894103d2..b0abf2848 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -429,7 +429,7 @@ trait InteractsWithPivotTable return 0; } - $query->whereIn($this->relatedPivotKey, (array) $ids); + $query->whereIn($this->getQualifiedRelatedPivotKeyName(), (array) $ids); } // Once we have all of the conditions set on the statement, we are ready @@ -537,14 +537,14 @@ trait InteractsWithPivotTable $query = $this->newPivotStatement(); foreach ($this->pivotWheres as $arguments) { - call_user_func_array([$query, 'where'], $arguments); + $query->where(...$arguments); } foreach ($this->pivotWhereIns as $arguments) { - call_user_func_array([$query, 'whereIn'], $arguments); + $query->whereIn(...$arguments); } - return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey}); + return $query->where($this->getQualifiedForeignPivotKeyName(), $this->parent->{$this->parentKey}); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php index 0db82ba10..68489265f 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php @@ -139,6 +139,8 @@ class MorphPivot extends Pivot */ protected function newQueryForCollectionRestoration(array $ids) { + $ids = array_values($ids); + if (! Str::contains($ids[0], ':')) { return parent::newQueryForRestoration($ids); } diff --git a/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php index f9bded758..efd5f836c 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php +++ b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php @@ -102,7 +102,7 @@ class MigrationServiceProvider extends ServiceProvider implements DeferrableProv protected function registerCommands(array $commands) { foreach (array_keys($commands) as $command) { - call_user_func_array([$this, "register{$command}Command"], []); + $this->{"register{$command}Command"}(); } $this->commands(array_values($commands)); diff --git a/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php b/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php index 94b5b57d8..532b0f1fa 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php @@ -7,6 +7,7 @@ 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; +use LogicException; class MySqlConnection extends Connection { @@ -61,6 +62,12 @@ class MySqlConnection extends Connection */ protected function getDoctrineDriver() { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + return new DoctrineDriver; } } diff --git a/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php index 5555df1a2..8d207b3ed 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php @@ -7,6 +7,7 @@ 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; +use LogicException; class PostgresConnection extends Connection { @@ -61,6 +62,12 @@ class PostgresConnection extends Connection */ protected function getDoctrineDriver() { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + return new DoctrineDriver; } } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php index 0d4c7c3ae..60c61f441 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php @@ -698,7 +698,7 @@ class Builder ); if (! $value instanceof Expression) { - $this->addBinding($value, 'where'); + $this->addBinding($this->flattenValue($value), 'where'); } return $this; @@ -1043,7 +1043,7 @@ class Builder $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); - $this->addBinding($this->cleanBindings($values), 'where'); + $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where'); return $this; } @@ -1111,6 +1111,8 @@ class Builder $value, $operator, func_num_args() === 2 ); + $value = $this->flattenValue($value); + if ($value instanceof DateTimeInterface) { $value = $value->format('Y-m-d'); } @@ -1150,6 +1152,8 @@ class Builder $value, $operator, func_num_args() === 2 ); + $value = $this->flattenValue($value); + if ($value instanceof DateTimeInterface) { $value = $value->format('H:i:s'); } @@ -1189,6 +1193,8 @@ class Builder $value, $operator, func_num_args() === 2 ); + $value = $this->flattenValue($value); + if ($value instanceof DateTimeInterface) { $value = $value->format('d'); } @@ -1232,6 +1238,8 @@ class Builder $value, $operator, func_num_args() === 2 ); + $value = $this->flattenValue($value); + if ($value instanceof DateTimeInterface) { $value = $value->format('m'); } @@ -1275,6 +1283,8 @@ class Builder $value, $operator, func_num_args() === 2 ); + $value = $this->flattenValue($value); + if ($value instanceof DateTimeInterface) { $value = $value->format('Y'); } @@ -1583,7 +1593,7 @@ class Builder $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); if (! $value instanceof Expression) { - $this->addBinding($value); + $this->addBinding((int) $this->flattenValue($value)); } return $this; @@ -1732,7 +1742,7 @@ class Builder $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); if (! $value instanceof Expression) { - $this->addBinding($value, 'having'); + $this->addBinding($this->flattenValue($value), 'having'); } return $this; @@ -1770,7 +1780,7 @@ class Builder $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not'); - $this->addBinding($this->cleanBindings($values), 'having'); + $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having'); return $this; } @@ -1922,7 +1932,7 @@ class Builder { $property = $this->unions ? 'unionOffset' : 'offset'; - $this->$property = max(0, $value); + $this->$property = max(0, (int) $value); return $this; } @@ -1949,7 +1959,7 @@ class Builder $property = $this->unions ? 'unionLimit' : 'limit'; if ($value >= 0) { - $this->$property = $value; + $this->$property = ! is_null($value) ? (int) $value : null; } return $this; @@ -2948,6 +2958,17 @@ class Builder })); } + /** + * Get a scalar type value from an unknown type of input. + * + * @param mixed $value + * @return mixed + */ + protected function flattenValue($value) + { + return is_array($value) ? head(Arr::flatten($value)) : $value; + } + /** * Get the default key name of the table. * diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php index f0a0bfc51..88a7df3dc 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -60,8 +60,8 @@ class SqlServerGrammar extends Grammar // If there is a limit on the query, but not an offset, we will add the top // clause to the query, which serves as a "limit" type clause within the // SQL Server system similar to the limit keywords available in MySQL. - if ($query->limit > 0 && $query->offset <= 0) { - $select .= 'top '.$query->limit.' '; + if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) { + $select .= 'top '.((int) $query->limit).' '; } return $select.$this->columnize($columns); @@ -221,10 +221,10 @@ class SqlServerGrammar extends Grammar */ protected function compileRowConstraint($query) { - $start = $query->offset + 1; + $start = (int) $query->offset + 1; if ($query->limit > 0) { - $finish = $query->offset + $query->limit; + $finish = (int) $query->offset + (int) $query->limit; return "between {$start} and {$finish}"; } diff --git a/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php index 4990fdd29..a622df325 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php @@ -7,6 +7,7 @@ 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; +use LogicException; class SQLiteConnection extends Connection { @@ -85,6 +86,12 @@ class SQLiteConnection extends Connection */ protected function getDoctrineDriver() { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + return new DoctrineDriver; } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php index 3fe9fd8fb..fd54fb28d 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php @@ -61,9 +61,22 @@ class RenameColumn protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) { $tableDiff->renamedColumns = [ - $command->from => new Column($command->to, $column->getType(), $column->toArray()), + $command->from => new Column($command->to, $column->getType(), self::getWritableColumnOptions($column)), ]; return $tableDiff; } + + /** + * Get the writable column options. + * + * @param \Doctrine\DBAL\Schema\Column $column + * @return array + */ + private static function getWritableColumnOptions(Column $column) + { + return array_filter($column->toArray(), function (string $name) use ($column) { + return method_exists($column, 'set'.$name); + }, ARRAY_FILTER_USE_KEY); + } } diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index c52cd8ff8..374ff9aa8 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -625,6 +625,7 @@ class SQLiteGrammar extends Grammar * Create the column definition for a date-time (with time zone) type. * * Note: "SQLite does not have a storage class set aside for storing dates and/or times." + * * @link https://www.sqlite.org/datatype3.html * * @param \Illuminate\Support\Fluent $column diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index f30be6759..e4e41f911 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -29,13 +29,13 @@ class SqlServerGrammar extends Grammar protected $serials = ['tinyInteger', 'smallInteger', 'mediumInteger', 'integer', 'bigInteger']; /** - * Compile the query to determine if a table exists. + * Compile the query to determine if a table or view exists. * * @return string */ public function compileTableExists() { - return "select * from sysobjects where type = 'U' and name = ?"; + return "select * from sysobjects where type in ('U', 'V') and name = ?"; } /** @@ -48,7 +48,7 @@ class SqlServerGrammar extends Grammar { return "select col.name from sys.columns as col join sys.objects as obj on col.object_id = obj.object_id - where obj.type = 'U' and obj.name = '$table'"; + where obj.type in ('U', 'V') and obj.name = '$table'"; } /** @@ -212,7 +212,7 @@ class SqlServerGrammar extends Grammar $sql = "DECLARE @sql NVARCHAR(MAX) = '';"; $sql .= "SELECT @sql += 'ALTER TABLE [dbo].[{$tableName}] DROP CONSTRAINT ' + OBJECT_NAME([default_object_id]) + ';' "; - $sql .= 'FROM SYS.COLUMNS '; + $sql .= 'FROM sys.columns '; $sql .= "WHERE [object_id] = OBJECT_ID('[dbo].[{$tableName}]') AND [name] in ({$columns}) AND [default_object_id] <> 0;"; $sql .= 'EXEC(@sql)'; diff --git a/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php index 8a6425721..ab523576e 100755 --- a/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php @@ -9,6 +9,7 @@ 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 LogicException; use Throwable; class SqlServerConnection extends Connection @@ -108,6 +109,12 @@ class SqlServerConnection extends Connection */ protected function getDoctrineDriver() { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, in order to use this feature you must require the package "doctrine/dbal:^2.6".' + ); + } + return new DoctrineDriver; } } diff --git a/vendor/laravel/framework/src/Illuminate/Database/composer.json b/vendor/laravel/framework/src/Illuminate/Database/composer.json index f407ca6c2..2d658fb0f 100644 --- a/vendor/laravel/framework/src/Illuminate/Database/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Database/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/container": "^6.0", "illuminate/contracts": "^6.0", @@ -33,7 +33,7 @@ }, "suggest": { "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", - "fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", "illuminate/console": "Required to use the database commands (^6.0).", "illuminate/events": "Required to use the observers with Eloquent (^6.0).", "illuminate/filesystem": "Required to use the migrations (^6.0).", diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/composer.json b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json index 5f535b400..cc0b3e349 100644 --- a/vendor/laravel/framework/src/Illuminate/Encryption/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", diff --git a/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php index 5a88df56f..c7fc821de 100644 --- a/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php +++ b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php @@ -89,17 +89,15 @@ class CallQueuedListener implements ShouldQueue $this->job, $container->make($this->class) ); - call_user_func_array( - [$handler, $this->method], $this->data - ); + $handler->{$this->method}(...array_values($this->data)); } /** * Set the job instance of the given class if necessary. * * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $instance - * @return mixed + * @param object $instance + * @return object */ protected function setJobInstanceIfNecessary(Job $job, $instance) { @@ -124,10 +122,10 @@ class CallQueuedListener implements ShouldQueue $handler = Container::getInstance()->make($this->class); - $parameters = array_merge($this->data, [$e]); + $parameters = array_merge(array_values($this->data), [$e]); if (method_exists($handler, 'failed')) { - call_user_func_array([$handler, 'failed'], $parameters); + $handler->failed(...$parameters); } } diff --git a/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php index 21dc14ab9..eb25f5c6f 100755 --- a/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php +++ b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php @@ -384,9 +384,9 @@ class Dispatcher implements DispatcherContract return call_user_func($this->createClassCallable($listener), $event, $payload); } - return call_user_func_array( - $this->createClassCallable($listener), $payload - ); + $callable = $this->createClassCallable($listener); + + return $callable(...array_values($payload)); }; } @@ -569,7 +569,7 @@ class Dispatcher implements DispatcherContract /** * Get the queue implementation from the resolver. * - * @return \Illuminate\Contracts\Queue\Queue + * @return \Illuminate\Contracts\Queue\Factory */ protected function resolveQueue() { diff --git a/vendor/laravel/framework/src/Illuminate/Events/composer.json b/vendor/laravel/framework/src/Illuminate/Events/composer.json index 639083026..9dd481dc0 100755 --- a/vendor/laravel/framework/src/Illuminate/Events/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Events/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/container": "^6.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php index d3d62194b..e4b917c0d 100644 --- a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -739,6 +739,6 @@ class FilesystemAdapter implements CloudFilesystemContract */ public function __call($method, array $parameters) { - return call_user_func_array([$this->driver, $method], $parameters); + return $this->driver->{$method}(...array_values($parameters)); } } diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json index 010622d88..b9c23cea1 100644 --- a/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0", "symfony/finder": "^4.3.4" @@ -31,7 +31,7 @@ }, "suggest": { "ext-ftp": "Required to use the Flysystem FTP driver.", - "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0.34).", + "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.1).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Application.php b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php index bec8355f1..6b08a8b1d 100755 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Application.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php @@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '6.18.43'; + const VERSION = '6.20.44'; /** * The base path for the Laravel installation. @@ -230,7 +230,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn */ public function afterLoadingEnvironment(Closure $callback) { - return $this->afterBootstrapping( + $this->afterBootstrapping( LoadEnvironmentVariables::class, $callback ); } @@ -333,7 +333,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn /** * Get the base path of the Laravel installation. * - * @param string $path Optionally, a path to append to the base path + * @param string $path * @return string */ public function basePath($path = '') @@ -344,7 +344,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn /** * Get the path to the bootstrap directory. * - * @param string $path Optionally, a path to append to the bootstrap path + * @param string $path * @return string */ public function bootstrapPath($path = '') @@ -355,7 +355,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn /** * Get the path to the application configuration files. * - * @param string $path Optionally, a path to append to the config path + * @param string $path * @return string */ public function configPath($path = '') @@ -366,7 +366,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn /** * Get the path to the database directory. * - * @param string $path Optionally, a path to append to the database path + * @param string $path * @return string */ public function databasePath($path = '') diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedCommand.php index 67749ee93..fb3d027b4 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedCommand.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedCommand.php @@ -37,6 +37,6 @@ class QueuedCommand implements ShouldQueue */ public function handle(KernelContract $kernel) { - call_user_func_array([$kernel, 'call'], $this->data); + $kernel->call(...array_values($this->data)); } } diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php index 11e5c148c..82b461598 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php @@ -31,6 +31,10 @@ class StorageLinkCommand extends Command return $this->error('The "public/storage" directory already exists.'); } + if (is_link(public_path('storage'))) { + $this->laravel->make('files')->delete(public_path('storage')); + } + $this->laravel->make('files')->link( storage_path('app/public'), public_path('storage') ); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub index 712a40789..4d1070c2f 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub @@ -9,7 +9,7 @@ class DummyClass extends Exception /** * Report the exception. * - * @return void + * @return bool|null */ public function report() { diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-report.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-report.stub index 8db5c4f3c..643149863 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-report.stub +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-report.stub @@ -9,7 +9,7 @@ class DummyClass extends Exception /** * Report the exception. * - * @return void + * @return bool|null */ public function report() { diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job.stub index d0255ddb3..8f9db50b4 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job.stub +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job.stub @@ -2,12 +2,11 @@ namespace DummyNamespace; -use Illuminate\Bus\Queueable; use Illuminate\Foundation\Bus\Dispatchable; class DummyClass { - use Dispatchable, Queueable; + use Dispatchable; /** * Create a new job instance. diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php index 1102d7526..1bac2b305 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php @@ -19,6 +19,7 @@ use Illuminate\Session\TokenMismatchException; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\View; +use Illuminate\Support\Reflector; use Illuminate\Support\ViewErrorBag; use Illuminate\Validation\ValidationException; use Psr\Log\LoggerInterface; @@ -103,8 +104,10 @@ class Handler implements ExceptionHandlerContract return; } - if (is_callable($reportCallable = [$e, 'report'])) { - return $this->container->call($reportCallable); + if (Reflector::isCallable($reportCallable = [$e, 'report'])) { + if (($response = $this->container->call($reportCallable)) !== false) { + return $response; + } } try { @@ -321,7 +324,7 @@ class Handler implements ExceptionHandlerContract */ protected function convertExceptionToResponse(Exception $e) { - return SymfonyResponse::create( + return new SymfonyResponse( $this->renderExceptionContent($e), $this->isHttpException($e) ? $e->getStatusCode() : 500, $this->isHttpException($e) ? $e->getHeaders() : [] diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php index 6a1f028f9..59483200e 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php @@ -3,6 +3,7 @@ namespace Illuminate\Foundation\Http\Middleware; use Closure; +use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Support\Responsable; @@ -152,7 +153,11 @@ class VerifyCsrfToken $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); if (! $token && $header = $request->header('X-XSRF-TOKEN')) { - $token = CookieValuePrefix::remove($this->encrypter->decrypt($header, static::serialized())); + try { + $token = CookieValuePrefix::remove($this->encrypter->decrypt($header, static::serialized())); + } catch (DecryptException $e) { + $token = ''; + } } return $token; diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index 66aeb5121..7c33b8d5d 100755 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -168,7 +168,7 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid protected function registerCommands(array $commands) { foreach (array_keys($commands) as $command) { - call_user_func_array([$this, "register{$command}Command"], []); + $this->{"register{$command}Command"}(); } $this->commands(array_values($commands)); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php index bbd1c08c2..aa3181cdf 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php @@ -64,7 +64,8 @@ trait InteractsWithExceptionHandling $this->originalExceptionHandler = app(ExceptionHandler::class); } - $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler { + $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler + { protected $except; protected $originalHandler; diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php index edb679d7c..b124c01aa 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -121,7 +121,8 @@ trait MakesHttpRequests } foreach ((array) $middleware as $abstract) { - $this->app->instance($abstract, new class { + $this->app->instance($abstract, new class + { public function handle($request, $next) { return $next($request); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php index 9d07f4615..c25171423 100644 --- a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/ArraySubset.php @@ -27,8 +27,8 @@ if (class_exists(Version::class) && (int) Version::series()[0] >= 9) { /** * Create a new array subset constraint instance. * - * @param iterable $subset - * @param bool $strict + * @param iterable $subset + * @param bool $strict * @return void */ public function __construct(iterable $subset, bool $strict = false) @@ -91,9 +91,9 @@ if (class_exists(Version::class) && (int) Version::series()[0] >= 9) { /** * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function toString(): string { @@ -162,8 +162,8 @@ if (class_exists(Version::class) && (int) Version::series()[0] >= 9) { /** * Create a new array subset constraint instance. * - * @param iterable $subset - * @param bool $strict + * @param iterable $subset + * @param bool $strict * @return void */ public function __construct(iterable $subset, bool $strict = false) @@ -224,9 +224,9 @@ if (class_exists(Version::class) && (int) Version::series()[0] >= 9) { /** * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * * @return string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ public function toString(): string { diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/composer.json b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json index a728b6f71..80d47dde6 100755 --- a/vendor/laravel/framework/src/Illuminate/Hashing/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php index be760a261..25d6ec1e9 100644 --- a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php @@ -31,7 +31,7 @@ trait InteractsWithContentTypes */ public function isJson() { - return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']); + return Str::contains($this->header('CONTENT_TYPE') ?? '', ['/json', '+json']); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php index 76744b487..0858b40e2 100644 --- a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php +++ b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php @@ -96,7 +96,7 @@ trait ResponseTrait */ public function cookie($cookie) { - return call_user_func_array([$this, 'withCookie'], func_get_args()); + return $this->withCookie(...func_get_args()); } /** @@ -108,7 +108,7 @@ trait ResponseTrait public function withCookie($cookie) { if (is_string($cookie) && function_exists('cookie')) { - $cookie = call_user_func_array('cookie', func_get_args()); + $cookie = cookie(...func_get_args()); } $this->headers->setCookie($cookie); diff --git a/vendor/laravel/framework/src/Illuminate/Http/composer.json b/vendor/laravel/framework/src/Illuminate/Http/composer.json index 5c17211e9..c53a73b94 100755 --- a/vendor/laravel/framework/src/Illuminate/Http/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Http/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/session": "^6.0", "illuminate/support": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/Log/LogManager.php b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php index ab9bf51a1..53bc54ee7 100644 --- a/vendor/laravel/framework/src/Illuminate/Log/LogManager.php +++ b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php @@ -494,7 +494,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function emergency($message, array $context = []) @@ -510,7 +509,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function alert($message, array $context = []) @@ -525,7 +523,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function critical($message, array $context = []) @@ -539,7 +536,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function error($message, array $context = []) @@ -555,7 +551,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function warning($message, array $context = []) @@ -568,7 +563,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function notice($message, array $context = []) @@ -583,7 +577,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function info($message, array $context = []) @@ -596,7 +589,6 @@ class LogManager implements LoggerInterface * * @param string $message * @param array $context - * * @return void */ public function debug($message, array $context = []) @@ -610,7 +602,6 @@ class LogManager implements LoggerInterface * @param mixed $level * @param string $message * @param array $context - * * @return void */ public function log($level, $message, array $context = []) diff --git a/vendor/laravel/framework/src/Illuminate/Log/composer.json b/vendor/laravel/framework/src/Illuminate/Log/composer.json index 5b2d0c329..3bd21d0a9 100755 --- a/vendor/laravel/framework/src/Illuminate/Log/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Log/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0", "monolog/monolog": "^1.12|^2.0" diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php index 10a7ae6b6..7a11e58f6 100755 --- a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php +++ b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php @@ -325,7 +325,7 @@ class Mailer implements MailerContract, MailQueueContract protected function addContent($message, $view, $plain, $raw, $data) { if (isset($view)) { - $message->setBody($this->renderView($view, $data), 'text/html'); + $message->setBody($this->renderView($view, $data) ?: ' ', 'text/html'); } if (isset($plain)) { @@ -371,7 +371,7 @@ class Mailer implements MailerContract, MailQueueContract /** * Queue a new e-mail message for sending. * - * @param \Illuminate\Contracts\Mail\Mailable $view + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view * @param string|null $queue * @return mixed * diff --git a/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php index 0b19fed2a..6124b3a03 100644 --- a/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php +++ b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php @@ -114,7 +114,6 @@ class PendingMail * Send a new mailable message instance. * * @param \Illuminate\Contracts\Mail\Mailable $mailable - * * @return mixed */ public function send(MailableContract $mailable) @@ -127,6 +126,7 @@ class PendingMail * * @param \Illuminate\Contracts\Mail\Mailable $mailable * @return mixed + * * @deprecated Use send() instead. */ public function sendNow(MailableContract $mailable) diff --git a/vendor/laravel/framework/src/Illuminate/Mail/composer.json b/vendor/laravel/framework/src/Illuminate/Mail/composer.json index 3851f3907..dfe6100d2 100755 --- a/vendor/laravel/framework/src/Illuminate/Mail/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Mail/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/container": "^6.0", "illuminate/contracts": "^6.0", @@ -35,8 +35,8 @@ } }, "suggest": { - "aws/aws-sdk-php": "Required to use the SES mail driver (^3.0).", - "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.0|^7.0).", + "aws/aws-sdk-php": "Required to use the SES mail driver (^3.155).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.3.1|^7.0.1).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." }, "config": { diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php index c65940aad..19b9a7de1 100644 --- a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php +++ b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php @@ -171,7 +171,7 @@ class NotificationSender * Queue the given notification instances. * * @param mixed $notifiables - * @param array[\Illuminate\Notifications\Channels\Notification] $notification + * @param \Illuminate\Notifications\Notification $notification * @return void */ protected function queueNotification($notifiables, $notification) diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/composer.json b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json index cbe02a736..8a96b6646 100644 --- a/vendor/laravel/framework/src/Illuminate/Notifications/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/broadcasting": "^6.0", "illuminate/bus": "^6.0", "illuminate/container": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php index e09ec3b2c..5fefab34c 100644 --- a/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php +++ b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php @@ -446,7 +446,7 @@ abstract class AbstractPaginator implements Htmlable public static function resolveCurrentPage($pageName = 'page', $default = 1) { if (isset(static::$currentPageResolver)) { - return call_user_func(static::$currentPageResolver, $pageName); + return (int) call_user_func(static::$currentPageResolver, $pageName); } return $default; diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php index edf0c20ec..1b381d642 100644 --- a/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php +++ b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php @@ -34,7 +34,7 @@ class LengthAwarePaginator extends AbstractPaginator implements Arrayable, Array * @param int $total * @param int $perPage * @param int|null $currentPage - * @param array $options (path, query, fragment, pageName) + * @param array $options (path, query, fragment, pageName) * @return void */ public function __construct($items, $total, $perPage, $currentPage = null, array $options = []) diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php index dfe146465..eb664eef3 100644 --- a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php +++ b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php @@ -26,7 +26,7 @@ class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Cou * @param mixed $items * @param int $perPage * @param int|null $currentPage - * @param array $options (path, query, fragment, pageName) + * @param array $options (path, query, fragment, pageName) * @return void */ public function __construct($items, $perPage, $currentPage = null, array $options = []) diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/composer.json b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json index d54b1d2b9..c8f966516 100755 --- a/vendor/laravel/framework/src/Illuminate/Pagination/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json index 68d30a44d..1d6a6b931 100644 --- a/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0", "symfony/debug": "^4.3.4" diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php index f8a1cf4bc..044c06a2b 100644 --- a/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php @@ -11,7 +11,7 @@ class SerializableClosure extends OpisSerializableClosure /** * Transform the use variables before serialization. * - * @param array $data The Closure's use variables + * @param array $data * @return array */ protected function transformUseVariables($data) @@ -26,7 +26,7 @@ class SerializableClosure extends OpisSerializableClosure /** * Resolve the use variables after unserialization. * - * @param array $data The Closure's transformed use variables + * @param array $data * @return array */ protected function resolveUseVariables($data) diff --git a/vendor/laravel/framework/src/Illuminate/Queue/composer.json b/vendor/laravel/framework/src/Illuminate/Queue/composer.json index a2bc8c461..8e1616012 100644 --- a/vendor/laravel/framework/src/Illuminate/Queue/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Queue/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/console": "^6.0", "illuminate/container": "^6.0", @@ -23,7 +23,7 @@ "illuminate/filesystem": "^6.0", "illuminate/pipeline": "^6.0", "illuminate/support": "^6.0", - "opis/closure": "^3.1", + "opis/closure": "^3.6", "symfony/debug": "^4.3.4", "symfony/process": "^4.3.4" }, @@ -40,7 +40,7 @@ "suggest": { "ext-pcntl": "Required to use all features of the queue worker.", "ext-posix": "Required to use all features of the queue worker.", - "aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.0).", + "aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.155).", "illuminate/redis": "Required to use the Redis queue driver (^6.0).", "pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)." }, diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php index 0950ec97c..072384dcc 100644 --- a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php @@ -197,7 +197,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract */ public function spop($key, $count = 1) { - return $this->command('spop', [$key, $count]); + return $this->command('spop', func_get_args()); } /** @@ -306,8 +306,8 @@ class PhpRedisConnection extends Connection implements ConnectionContract /** * Scans the all keys based on options. * - * @param mixed $cursor - * @param array $options + * @param mixed $cursor + * @param array $options * @return mixed */ public function scan($cursor, $options = []) @@ -323,9 +323,9 @@ class PhpRedisConnection extends Connection implements ConnectionContract /** * Scans the given set for all values based on options. * - * @param string $key - * @param mixed $cursor - * @param array $options + * @param string $key + * @param mixed $cursor + * @param array $options * @return mixed */ public function zscan($key, $cursor, $options = []) @@ -341,9 +341,9 @@ class PhpRedisConnection extends Connection implements ConnectionContract /** * Scans the given set for all values based on options. * - * @param string $key - * @param mixed $cursor - * @param array $options + * @param string $key + * @param mixed $cursor + * @param array $options * @return mixed */ public function hscan($key, $cursor, $options = []) @@ -359,9 +359,9 @@ class PhpRedisConnection extends Connection implements ConnectionContract /** * Scans the given set for all values based on options. * - * @param string $key - * @param mixed $cursor - * @param array $options + * @param string $key + * @param mixed $cursor + * @param array $options * @return mixed */ public function sscan($key, $cursor, $options = []) @@ -484,14 +484,8 @@ class PhpRedisConnection extends Connection implements ConnectionContract return $this->command('flushdb'); } - foreach ($this->client->_masters() as [$host, $port]) { - $redis = tap(new Redis)->connect($host, $port); - - if (isset($this->config['password']) && ! empty($this->config['password'])) { - $redis->auth($this->config['password']); - } - - $redis->flushDb(); + foreach ($this->client->_masters() as $master) { + $this->client->flushDb($master); } } diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisConnection.php index 665f328b0..932982562 100644 --- a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisConnection.php +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisConnection.php @@ -42,7 +42,7 @@ class PredisConnection extends Connection implements ConnectionContract { $loop = $this->pubSubLoop(); - call_user_func_array([$loop, $method], (array) $channels); + $loop->{$method}(...array_values((array) $channels)); foreach ($loop as $message) { if ($message->kind === 'message' || $message->kind === 'pmessage') { diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php index b01f11420..684737b13 100644 --- a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php @@ -128,6 +128,12 @@ class PhpRedisConnector implements Connector $parameters[] = Arr::get($config, 'read_timeout', 0.0); } + if (version_compare(phpversion('redis'), '5.3.0', '>=')) { + if (! is_null($context = Arr::get($config, 'context'))) { + $parameters[] = $context; + } + } + $client->{($persistent ? 'pconnect' : 'connect')}(...$parameters); } @@ -152,6 +158,12 @@ class PhpRedisConnector implements Connector $parameters[] = $options['password'] ?? null; } + if (version_compare(phpversion('redis'), '5.3.2', '>=')) { + if (! is_null($context = Arr::get($options, 'context'))) { + $parameters[] = $context; + } + } + return tap(new RedisCluster(...$parameters), function ($client) use ($options) { if (! empty($options['prefix'])) { $client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']); diff --git a/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php index b5d98203c..8a6c88d1c 100644 --- a/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php +++ b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php @@ -192,7 +192,7 @@ class RedisManager implements Factory } return array_filter($parsed, function ($key) { - return ! in_array($key, ['driver', 'username'], true); + return ! in_array($key, ['driver'], true); }, ARRAY_FILTER_USE_KEY); } diff --git a/vendor/laravel/framework/src/Illuminate/Redis/composer.json b/vendor/laravel/framework/src/Illuminate/Redis/composer.json index 2fdce35b4..efb357a09 100755 --- a/vendor/laravel/framework/src/Illuminate/Redis/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Redis/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "illuminate/contracts": "^6.0", "illuminate/support": "^6.0" }, diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Controller.php b/vendor/laravel/framework/src/Illuminate/Routing/Controller.php index 50de97122..a26a5ee7e 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/Controller.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/Controller.php @@ -51,7 +51,7 @@ abstract class Controller */ public function callAction($method, $parameters) { - return call_user_func_array([$this, $method], $parameters); + return $this->{$method}(...array_values($parameters)); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php index 63d59ad93..3d4a684cf 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php @@ -50,7 +50,7 @@ class Pipeline extends BasePipeline $response = $handler->render($passable, $e); - if (method_exists($response, 'withException')) { + if (is_object($response) && method_exists($response, 'withException')) { $response->withException($e); } diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Route.php b/vendor/laravel/framework/src/Illuminate/Routing/Route.php index 2d854ef95..9b31e619f 100755 --- a/vendor/laravel/framework/src/Illuminate/Routing/Route.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/Route.php @@ -790,9 +790,9 @@ class Route $this->computedMiddleware = []; - return $this->computedMiddleware = array_unique(array_merge( + return $this->computedMiddleware = Router::uniqueMiddleware(array_merge( $this->middleware(), $this->controllerMiddleware() - ), SORT_REGULAR); + )); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php index a1839758c..9d7eb76a8 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php @@ -3,6 +3,7 @@ namespace Illuminate\Routing; use Illuminate\Support\Arr; +use Illuminate\Support\Reflector; use Illuminate\Support\Str; use LogicException; use UnexpectedValueException; @@ -28,7 +29,7 @@ class RouteAction // If the action is already a Closure instance, we will just set that instance // as the "uses" property, because there is nothing else we need to do when // it is available. Otherwise we will need to find it in the action list. - if (is_callable($action, true)) { + if (Reflector::isCallable($action, true)) { return ! is_array($action) ? ['uses' => $action] : [ 'uses' => $action[0].'@'.$action[1], 'controller' => $action[0].'@'.$action[1], @@ -73,7 +74,7 @@ class RouteAction protected static function findCallable(array $action) { return Arr::first($action, function ($value, $key) { - return is_callable($value) && is_numeric($key); + return Reflector::isCallable($value) && is_numeric($key); }); } diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php index 8a804a79e..dc28c9f4d 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php @@ -5,6 +5,7 @@ namespace Illuminate\Routing; use BadMethodCallException; use Closure; use Illuminate\Support\Arr; +use Illuminate\Support\Reflector; use InvalidArgumentException; /** @@ -167,6 +168,15 @@ class RouteRegistrar $action = ['uses' => $action]; } + if (is_array($action) && + ! Arr::isAssoc($action) && + Reflector::isCallable($action)) { + $action = [ + 'uses' => $action[0].'@'.$action[1], + 'controller' => $action[0].'@'.$action[1], + ]; + } + return array_merge($this->attributes, $action); } diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php index 535d5edcb..bd7e932fb 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php @@ -37,7 +37,7 @@ class RouteSignatureParameters { [$class, $method] = Str::parseCallback($uses); - if (! method_exists($class, $method) && is_callable($class, $method)) { + if (! method_exists($class, $method) && Reflector::isCallable($class, $method)) { return []; } diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Router.php b/vendor/laravel/framework/src/Illuminate/Routing/Router.php index e7f0b58a4..8e762351e 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/Router.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/Router.php @@ -1273,6 +1273,29 @@ class Router implements BindingRegistrar, RegistrarContract $this->container->instance('routes', $this->routes); } + /** + * Remove any duplicate middleware from the given array. + * + * @param array $middleware + * @return array + */ + public static function uniqueMiddleware(array $middleware) + { + $seen = []; + $result = []; + + foreach ($middleware as $value) { + $key = \is_object($value) ? \spl_object_id($value) : $value; + + if (! isset($seen[$key])) { + $seen[$key] = true; + $result[] = $value; + } + } + + return $result; + } + /** * Dynamically handle calls into the router instance. * diff --git a/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php index f38460338..57dbb0730 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php @@ -62,7 +62,7 @@ class SortedMiddleware extends Collection } } - return array_values(array_unique($middlewares, SORT_REGULAR)); + return Router::uniqueMiddleware($middlewares); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php index 63e344aca..e1dd34af1 100755 --- a/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php +++ b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php @@ -320,13 +320,9 @@ class UrlGenerator implements UrlGeneratorContract */ public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) { - $parameters = $this->formatParameters($parameters); - - if (array_key_exists('signature', $parameters)) { - throw new InvalidArgumentException( - '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' - ); - } + $this->ensureSignedRouteParametersAreNotReserved( + $parameters = $this->formatParameters($parameters) + ); if ($expiration) { $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; @@ -341,6 +337,27 @@ class UrlGenerator implements UrlGeneratorContract ], $absolute); } + /** + * Ensure the given signed route parameters are not reserved. + * + * @param mixed $parameters + * @return void + */ + protected function ensureSignedRouteParametersAreNotReserved($parameters) + { + if (array_key_exists('signature', $parameters)) { + throw new InvalidArgumentException( + '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + + if (array_key_exists('expires', $parameters)) { + throw new InvalidArgumentException( + '"Expires" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + } + /** * Create a temporary signed route URL for a named route. * diff --git a/vendor/laravel/framework/src/Illuminate/Routing/composer.json b/vendor/laravel/framework/src/Illuminate/Routing/composer.json index 9bc8e5f46..026fc9651 100644 --- a/vendor/laravel/framework/src/Illuminate/Routing/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Routing/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/container": "^6.0", "illuminate/contracts": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/Session/composer.json b/vendor/laravel/framework/src/Illuminate/Session/composer.json index 3c9962cde..5707e4383 100755 --- a/vendor/laravel/framework/src/Illuminate/Session/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Session/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/contracts": "^6.0", "illuminate/filesystem": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/Support/Collection.php b/vendor/laravel/framework/src/Illuminate/Support/Collection.php index 91102f686..87b5058a4 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Collection.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Collection.php @@ -1197,7 +1197,7 @@ class Collection implements ArrayAccess, Enumerable * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); * => [[1, 4], [2, 5], [3, 6]] * - * @param mixed ...$items + * @param mixed ...$items * @return static */ public function zip($items) @@ -1210,7 +1210,7 @@ class Collection implements ArrayAccess, Enumerable return new static(func_get_args()); }, $this->items], $arrayableItems); - return new static(call_user_func_array('array_map', $params)); + return new static(array_map(...$params)); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php index 67e0b4c23..0bc5b3425 100755 --- a/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php @@ -19,6 +19,7 @@ namespace Illuminate\Support\Facades; * @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 mixed make($abstract, array $parameters = []) * @method static void boot() * @method static void booting(callable $callback) * @method static void booted(callable $callback) diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/DB.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/DB.php index a249b4a09..bcbe62ced 100755 --- a/vendor/laravel/framework/src/Illuminate/Support/Facades/DB.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/DB.php @@ -24,6 +24,11 @@ namespace Illuminate\Support\Facades; * @method static int transactionLevel() * @method static array pretend(\Closure $callback) * @method static void listen(\Closure $callback) + * @method static void enableQueryLog() + * @method static void disableQueryLog() + * @method static bool logging() + * @method static array getQueryLog() + * @method static void flushQueryLog() * * @see \Illuminate\Database\DatabaseManager * @see \Illuminate\Database\Connection diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Request.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Request.php index c181f7c83..81d0b4be0 100755 --- a/vendor/laravel/framework/src/Illuminate/Support/Facades/Request.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Request.php @@ -83,6 +83,9 @@ namespace Illuminate\Support\Facades; * @method static mixed offsetGet(string $offset) * @method static void offsetSet(string $offset, mixed $value) * @method static void offsetUnset(string $offset) + * @method static array validate(array $rules, ...$params) + * @method static array validateWithBag(string $errorBag, array $rules, ...$params) + * @method static bool hasValidSignature(bool $absolute = true) * * @see \Illuminate\Http\Request */ diff --git a/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php b/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php index 5956ba784..b025a282b 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php +++ b/vendor/laravel/framework/src/Illuminate/Support/LazyCollection.php @@ -1140,7 +1140,7 @@ class LazyCollection implements Enumerable * e.g. new LazyCollection([1, 2, 3])->zip([4, 5, 6]); * => [[1, 4], [2, 5], [3, 6]] * - * @param mixed ...$items + * @param mixed ...$items * @return static */ public function zip($items) diff --git a/vendor/laravel/framework/src/Illuminate/Support/Reflector.php b/vendor/laravel/framework/src/Illuminate/Support/Reflector.php index fb597f514..66392ca2f 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Reflector.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Reflector.php @@ -3,10 +3,58 @@ namespace Illuminate\Support; use ReflectionClass; +use ReflectionMethod; use ReflectionNamedType; class Reflector { + /** + * This is a PHP 7.4 compatible implementation of is_callable. + * + * @param mixed $var + * @param bool $syntaxOnly + * @return bool + */ + public static function isCallable($var, $syntaxOnly = false) + { + if (! is_array($var)) { + return is_callable($var, $syntaxOnly); + } + + if ((! isset($var[0]) || ! isset($var[1])) || + ! is_string($var[1] ?? null)) { + return false; + } + + if ($syntaxOnly && + (is_string($var[0]) || is_object($var[0])) && + is_string($var[1])) { + return true; + } + + $class = is_object($var[0]) ? get_class($var[0]) : $var[0]; + + $method = $var[1]; + + if (! class_exists($class)) { + return false; + } + + if (method_exists($class, $method)) { + return (new ReflectionMethod($class, $method))->isPublic(); + } + + if (is_object($var[0]) && method_exists($class, '__call')) { + return (new ReflectionMethod($class, '__call'))->isPublic(); + } + + if (! is_object($var[0]) && method_exists($class, '__callStatic')) { + return (new ReflectionMethod($class, '__callStatic'))->isPublic(); + } + + return false; + } + /** * Get the class name of the given parameter's type, if possible. * diff --git a/vendor/laravel/framework/src/Illuminate/Support/Str.php b/vendor/laravel/framework/src/Illuminate/Support/Str.php index 8ff6d4cac..3497e851c 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Str.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Str.php @@ -455,6 +455,10 @@ class Str */ public static function replaceLast($search, $replace, $subject) { + if ($search === '') { + return $subject; + } + $position = strrpos($subject, $search); if ($position !== false) { diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php index 172e020ff..48fa7b955 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php @@ -306,7 +306,7 @@ class MailFake implements Mailer, MailQueue /** * Queue a new e-mail message for sending. * - * @param string|array $view + * @param \Illuminate\Contracts\Mail\Mailable|string|array $view * @param string|null $queue * @return mixed */ diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php index af33d0292..223dd4433 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php @@ -21,7 +21,7 @@ class PendingMailFake extends PendingMail /** * Send a new mailable message instance. * - * @param \Illuminate\Contracts\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\Contracts\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\Contracts\Mail\Mailable $mailable; + * @param \Illuminate\Contracts\Mail\Mailable $mailable * @return mixed */ public function queue(Mailable $mailable) diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php index a32b51803..f7e9bfc60 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php @@ -143,7 +143,7 @@ trait EnumeratesValues */ public function dd(...$args) { - call_user_func_array([$this, 'dump'], $args); + $this->dump(...$args); exit(1); } diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php index bf9a2fc04..8b7add869 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php @@ -21,7 +21,7 @@ trait ForwardsCalls { try { return $object->{$method}(...$parameters); - } catch (Error | BadMethodCallException $e) { + } catch (Error|BadMethodCallException $e) { $pattern = '~^Call to undefined method (?P[^:]+)::(?P[^\(]+)\(\)$~'; if (! preg_match($pattern, $e->getMessage(), $matches)) { diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php index 0c2112c7f..406f65edc 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php @@ -82,7 +82,7 @@ trait Macroable $macro = static::$macros[$method]; if ($macro instanceof Closure) { - return call_user_func_array(Closure::bind($macro, null, static::class), $parameters); + $macro = $macro->bindTo(null, static::class); } return $macro(...$parameters); @@ -108,7 +108,7 @@ trait Macroable $macro = static::$macros[$method]; if ($macro instanceof Closure) { - return call_user_func_array($macro->bindTo($this, static::class), $parameters); + $macro = $macro->bindTo($this, static::class); } return $macro(...$parameters); diff --git a/vendor/laravel/framework/src/Illuminate/Support/composer.json b/vendor/laravel/framework/src/Illuminate/Support/composer.json index 828c6e7f9..850963e52 100644 --- a/vendor/laravel/framework/src/Illuminate/Support/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Support/composer.json @@ -14,12 +14,12 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "ext-mbstring": "*", "doctrine/inflector": "^1.4|^2.0", "illuminate/contracts": "^6.0", - "nesbot/carbon": "^2.0" + "nesbot/carbon": "^2.31" }, "conflict": { "tightenco/collect": "<5.5.33" diff --git a/vendor/laravel/framework/src/Illuminate/Translation/composer.json b/vendor/laravel/framework/src/Illuminate/Translation/composer.json index 25d2fd7fb..598fdde39 100755 --- a/vendor/laravel/framework/src/Illuminate/Translation/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Translation/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/contracts": "^6.0", "illuminate/filesystem": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php index 8ee3f0aee..737d4173d 100644 --- a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php @@ -336,6 +336,10 @@ trait FormatsMessages return $value ? 'true' : 'false'; } + if (is_null($value)) { + return 'empty'; + } + return $value; } @@ -374,7 +378,7 @@ trait FormatsMessages $callback = $this->replacers[$rule]; if ($callback instanceof Closure) { - return call_user_func_array($callback, func_get_args()); + return $callback(...func_get_args()); } elseif (is_string($callback)) { return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator); } @@ -395,6 +399,6 @@ trait FormatsMessages { [$class, $method] = Str::parseCallback($callback, 'replace'); - return call_user_func_array([$this->container->make($class), $method], array_slice(func_get_args(), 1)); + return $this->container->make($class)->{$method}(...array_slice(func_get_args(), 1)); } } diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index bc340ddeb..67526a81b 100644 --- a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -59,7 +59,7 @@ trait ValidatesAttributes if ($url = parse_url($value, PHP_URL_HOST)) { try { - return count(dns_get_record($url, DNS_A | DNS_AAAA)) > 0; + return count(dns_get_record($url.'.', DNS_A | DNS_AAAA)) > 0; } catch (Exception $e) { return false; } @@ -248,7 +248,7 @@ trait ValidatesAttributes { try { if ($this->isTestingRelativeDateTime($value)) { - return Date::parse($value); + return @Date::parse($value) ?: null; } return date_create($value) ?: null; @@ -486,7 +486,7 @@ trait ValidatesAttributes $length = strlen((string) $value); - return ! preg_match('/[^0-9]/', $value) + return ! preg_match('/[^0-9.]/', $value) && $length >= $parameters[0] && $length <= $parameters[1]; } @@ -1054,7 +1054,7 @@ trait ValidatesAttributes */ public function validateImage($attribute, $value) { - return $this->validateMimes($attribute, $value, ['jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']); + return $this->validateMimes($attribute, $value, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']); } /** @@ -1160,7 +1160,11 @@ trait ValidatesAttributes */ public function validateJson($attribute, $value) { - if (! is_scalar($value) && ! method_exists($value, '__toString')) { + if (is_array($value)) { + return false; + } + + if (! is_scalar($value) && ! is_null($value) && ! method_exists($value, '__toString')) { return false; } @@ -1206,6 +1210,10 @@ trait ValidatesAttributes return false; } + if (in_array('jpg', $parameters) || in_array('jpeg', $parameters)) { + $parameters = array_unique(array_merge($parameters, ['jpg', 'jpeg'])); + } + return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters); } @@ -1246,7 +1254,7 @@ trait ValidatesAttributes } $phpExtensions = [ - 'php', 'php3', 'php4', 'php5', 'phtml', + 'php', 'php3', 'php4', 'php5', 'phtml', 'phar', ]; return ($value instanceof UploadedFile) @@ -1412,9 +1420,13 @@ trait ValidatesAttributes { $this->requireParameterCount(2, $parameters, 'required_if'); + if (! Arr::has($this->data, $parameters[0])) { + return true; + } + [$values, $other] = $this->prepareValuesAndOther($parameters); - if (in_array($other, $values)) { + if (in_array($other, $values, is_bool($other) || is_null($other))) { return $this->validateRequired($attribute, $value); } @@ -1433,9 +1445,13 @@ trait ValidatesAttributes { $this->requireParameterCount(2, $parameters, 'exclude_if'); + if (! Arr::has($this->data, $parameters[0])) { + return true; + } + [$values, $other] = $this->prepareValuesAndOther($parameters); - return ! in_array($other, $values); + return ! in_array($other, $values, is_bool($other) || is_null($other)); } /** @@ -1452,7 +1468,28 @@ trait ValidatesAttributes [$values, $other] = $this->prepareValuesAndOther($parameters); - return in_array($other, $values); + return in_array($other, $values, is_bool($other) || is_null($other)); + } + + /** + * Validate that an attribute exists when another attribute does not have a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredUnless($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_unless'); + + [$values, $other] = $this->prepareValuesAndOther($parameters); + + if (! in_array($other, $values, is_bool($other) || is_null($other))) { + return $this->validateRequired($attribute, $value); + } + + return true; } /** @@ -1467,13 +1504,28 @@ trait ValidatesAttributes $values = array_slice($parameters, 1); - if (is_bool($other)) { + if ($this->shouldConvertToBoolean($parameters[0]) || is_bool($other)) { $values = $this->convertValuesToBoolean($values); } + if (is_null($other)) { + $values = $this->convertValuesToNull($values); + } + return [$values, $other]; } + /** + * Check if parameter should be converted to boolean. + * + * @param string $parameter + * @return bool + */ + protected function shouldConvertToBoolean($parameter) + { + return in_array('boolean', Arr::get($this->rules, $parameter, [])); + } + /** * Convert the given values to boolean if they are string "true" / "false". * @@ -1494,24 +1546,16 @@ trait ValidatesAttributes } /** - * Validate that an attribute exists when another attribute does not have a given value. + * Convert the given values to null if they are string "null". * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool + * @param array $values + * @return array */ - public function validateRequiredUnless($attribute, $value, $parameters) + protected function convertValuesToNull($values) { - $this->requireParameterCount(2, $parameters, 'required_unless'); - - [$values, $other] = $this->prepareValuesAndOther($parameters); - - if (! in_array($other, $values)) { - return $this->validateRequired($attribute, $value); - } - - return true; + return array_map(function ($value) { + return Str::lower($value) === 'null' ? null : $value; + }, $values); } /** @@ -1889,7 +1933,6 @@ trait ValidatesAttributes * * @param string $attribute * @param string $rule - * * @return void */ protected function shouldBeNumeric($attribute, $rule) diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php index 354d071c3..e2326c773 100644 --- a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php @@ -14,7 +14,7 @@ class Dimensions /** * Create a new dimensions rule instance. * - * @param array $constraints; + * @param array $constraints * @return void */ public function __construct(array $constraints = []) diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php index c4a1001d0..a1ab74915 100644 --- a/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php @@ -2,6 +2,8 @@ namespace Illuminate\Validation\Rules; +use InvalidArgumentException; + class RequiredIf { /** @@ -19,7 +21,11 @@ class RequiredIf */ public function __construct($condition) { - $this->condition = $condition; + if (! is_string($condition)) { + $this->condition = $condition; + } else { + throw new InvalidArgumentException('The provided condition must be a callable or boolean.'); + } } /** diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Validator.php b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php index df06c5077..d7dae353e 100755 --- a/vendor/laravel/framework/src/Illuminate/Validation/Validator.php +++ b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php @@ -280,7 +280,7 @@ class Validator implements ValidatorContract public function after($callback) { $this->after[] = function () use ($callback) { - return call_user_func_array($callback, [$this]); + return $callback($this); }; return $this; @@ -364,7 +364,6 @@ class Validator implements ValidatorContract * Remove the given attribute. * * @param string $attribute - * * @return void */ protected function removeAttribute($attribute) @@ -1268,7 +1267,7 @@ class Validator implements ValidatorContract $callback = $this->extensions[$rule]; if (is_callable($callback)) { - return call_user_func_array($callback, $parameters); + return $callback(...array_values($parameters)); } elseif (is_string($callback)) { return $this->callClassBasedExtension($callback, $parameters); } @@ -1285,7 +1284,7 @@ class Validator implements ValidatorContract { [$class, $method] = Str::parseCallback($callback, 'validate'); - return call_user_func_array([$this->container->make($class), $method], $parameters); + return $this->container->make($class)->{$method}(...array_values($parameters)); } /** diff --git a/vendor/laravel/framework/src/Illuminate/Validation/composer.json b/vendor/laravel/framework/src/Illuminate/Validation/composer.json index e7475a2b5..a879fd681 100755 --- a/vendor/laravel/framework/src/Illuminate/Validation/composer.json +++ b/vendor/laravel/framework/src/Illuminate/Validation/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "egulias/email-validator": "^2.1.10", "illuminate/container": "^6.0", diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php index 08648ad17..d2a9f26ce 100755 --- a/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php @@ -48,7 +48,7 @@ abstract class Compiler */ public function getCompiledPath($path) { - return $this->cachePath.'/'.sha1($path).'.php'; + return $this->cachePath.'/'.sha1('v2'.$path).'.php'; } /** diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php index aaef61747..fc6a63afa 100644 --- a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php @@ -2,8 +2,6 @@ namespace Illuminate\View\Compilers\Concerns; -use Illuminate\View\Factory as ViewFactory; - trait CompilesLayouts { /** @@ -50,7 +48,9 @@ trait CompilesLayouts */ protected function compileParent() { - return ViewFactory::parentPlaceholder($this->lastSection ?: ''); + $escapedLastSection = strtr($this->lastSection, ['\\' => '\\\\', "'" => "\\'"]); + + return ""; } /** diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php index 1889a6b6f..39902905d 100644 --- a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php @@ -121,9 +121,7 @@ trait ManagesEvents // the instance out of the IoC container and call the method on it with the // given arguments that are passed to the Closure as the composer's data. return function () use ($class, $method) { - return call_user_func_array( - [$this->container->make($class), $method], func_get_args() - ); + return $this->container->make($class)->{$method}(...func_get_args()); }; } diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php index 29d71552a..82fb77b07 100644 --- a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php @@ -3,6 +3,7 @@ namespace Illuminate\View\Concerns; use Illuminate\Contracts\View\View; +use Illuminate\Support\Str; use InvalidArgumentException; trait ManagesLayouts @@ -28,6 +29,13 @@ trait ManagesLayouts */ protected static $parentPlaceholder = []; + /** + * The parent placeholder salt for the request. + * + * @var string + */ + protected static $parentPlaceholderSalt; + /** * Start injecting content into a section. * @@ -168,12 +176,28 @@ trait ManagesLayouts public static function parentPlaceholder($section = '') { if (! isset(static::$parentPlaceholder[$section])) { - static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##'; + $salt = static::parentPlaceholderSalt(); + + static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($salt.$section).'##'; } return static::$parentPlaceholder[$section]; } + /** + * Get the parent placeholder salt. + * + * @return string + */ + protected static function parentPlaceholderSalt() + { + if (! static::$parentPlaceholderSalt) { + return static::$parentPlaceholderSalt = Str::random(40); + } + + return static::$parentPlaceholderSalt; + } + /** * Check if section exists. * diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php index 03717bad0..cf6dac70e 100755 --- a/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php @@ -2,9 +2,9 @@ namespace Illuminate\View\Engines; -use ErrorException; use Exception; use Illuminate\View\Compilers\CompilerInterface; +use Illuminate\View\ViewException; class CompilerEngine extends PhpEngine { @@ -74,7 +74,7 @@ class CompilerEngine extends PhpEngine */ protected function handleViewException(Exception $e, $obLevel) { - $e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + $e = new ViewException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); parent::handleViewException($e, $obLevel); } diff --git a/vendor/laravel/framework/src/Illuminate/View/ViewException.php b/vendor/laravel/framework/src/Illuminate/View/ViewException.php new file mode 100644 index 000000000..e6797a29a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/ViewException.php @@ -0,0 +1,41 @@ +getPrevious(); + + if (Reflector::isCallable($reportCallable = [$exception, 'report'])) { + return Container::getInstance()->call($reportCallable); + } + + return false; + } + + /** + * Render the exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function render($request) + { + $exception = $this->getPrevious(); + + if ($exception && method_exists($exception, 'render')) { + return $exception->render($request); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/composer.json b/vendor/laravel/framework/src/Illuminate/View/composer.json index e170e507d..2ec1e8321 100644 --- a/vendor/laravel/framework/src/Illuminate/View/composer.json +++ b/vendor/laravel/framework/src/Illuminate/View/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2.5|^8.0", "ext-json": "*", "illuminate/container": "^6.0", "illuminate/contracts": "^6.0", diff --git a/vendor/laravel/scout/LICENSE.md b/vendor/laravel/scout/LICENSE.md new file mode 100644 index 000000000..79810c848 --- /dev/null +++ b/vendor/laravel/scout/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/vendor/laravel/scout/README.md b/vendor/laravel/scout/README.md new file mode 100644 index 000000000..51a80418a --- /dev/null +++ b/vendor/laravel/scout/README.md @@ -0,0 +1,32 @@ +

+ +
+ +## Introduction + +Laravel Scout provides a simple, driver-based solution for adding full-text search to your Eloquent models. Once Scout is installed and configured, it will automatically sync your model changes to your search indexes. Currently, Scout supports [Algolia](https://www.algolia.com/), a blazing-fast and hosted search service. + +## Official Documentation + +Documentation for Scout can be found on the [Laravel website](https://laravel.com/docs/master/scout). + +## Contributing + +Thank you for considering contributing to Scout! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). + +## Code of Conduct + +In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/laravel/scout/security/policy) on how to report security vulnerabilities. + +## License + +Laravel Scout is open-sourced software licensed under the [MIT license](LICENSE.md). diff --git a/vendor/laravel/scout/UPGRADE.md b/vendor/laravel/scout/UPGRADE.md new file mode 100644 index 000000000..33c15d359 --- /dev/null +++ b/vendor/laravel/scout/UPGRADE.md @@ -0,0 +1,33 @@ +# Upgrade Guide + +## Upgrading To 8.0 From 7.x + +### Minimum Laravel Version + +Laravel 6.0 is now the minimum supported version of the framework. + +### Minimum PHP Version + +PHP 7.2 is now the minimum supported version of the language. + +## Upgrading To 7.0 From 6.x + +### Updating Dependencies + +Update your `laravel/scout` dependency to `^7.0` in your `composer.json` file. + +### Algolia Driver + +If you are using Algolia as your search provider, update your `algolia/algoliasearch-client-php` dependency to `^2.2` in your `composer.json` file. + +#### Exception Renaming + +The `AlgoliaSearch\AlgoliaException` exception class was renamed to `Algolia\AlgoliaSearch\Exceptions\AlgoliaException`. + +#### The `search` Method Callback + +If you are passing a callback to the `search` method, the callback will now receive an instance of `Algolia/AlgoliaSearch/SearchIndex` as its first argument. + +#### Misc. + +If you are using the Algolia API client directly, consider reviewing the [full changelog provided by Algolia](https://github.com/algolia/algoliasearch-client-php/blob/master/docs/UPGRADE-from-v1-to-v2.md). diff --git a/vendor/laravel/scout/composer.json b/vendor/laravel/scout/composer.json new file mode 100644 index 000000000..11a9fd5a2 --- /dev/null +++ b/vendor/laravel/scout/composer.json @@ -0,0 +1,58 @@ +{ + "name": "laravel/scout", + "description": "Laravel Scout provides a driver based solution to searching your Eloquent models.", + "keywords": ["algolia", "laravel", "search"], + "license": "MIT", + "support": { + "issues": "https://github.com/laravel/scout/issues", + "source": "https://github.com/laravel/scout" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.2|^8.0", + "illuminate/bus": "^6.0|^7.0|^8.0", + "illuminate/contracts": "^6.0|^7.0|^8.0", + "illuminate/database": "^6.0|^7.0|^8.0", + "illuminate/http": "^6.0|^7.0|^8.0", + "illuminate/pagination": "^6.0|^7.0|^8.0", + "illuminate/queue": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^8.0|^9.3" + }, + "autoload": { + "psr-4": { + "Laravel\\Scout\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Laravel\\Scout\\Tests\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Scout\\ScoutServiceProvider" + ] + } + }, + "suggest": { + "algolia/algoliasearch-client-php": "Required to use the Algolia engine (^2.2)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/laravel/scout/config/scout.php b/vendor/laravel/scout/config/scout.php new file mode 100644 index 000000000..e425bb0e8 --- /dev/null +++ b/vendor/laravel/scout/config/scout.php @@ -0,0 +1,119 @@ + env('SCOUT_DRIVER', 'algolia'), + + /* + |-------------------------------------------------------------------------- + | Index Prefix + |-------------------------------------------------------------------------- + | + | Here you may specify a prefix that will be applied to all search index + | names used by Scout. This prefix may be useful if you have multiple + | "tenants" or applications sharing the same search infrastructure. + | + */ + + 'prefix' => env('SCOUT_PREFIX', ''), + + /* + |-------------------------------------------------------------------------- + | Queue Data Syncing + |-------------------------------------------------------------------------- + | + | This option allows you to control if the operations that sync your data + | with your search engines are queued. When this is set to "true" then + | all automatic data syncing will get queued for better performance. + | + */ + + 'queue' => env('SCOUT_QUEUE', false), + + /* + |-------------------------------------------------------------------------- + | Database Transactions + |-------------------------------------------------------------------------- + | + | This configuration option determines if your data will only be synced + | with your search indexes after every open database transaction has + | been committed, thus preventing any discarded data from syncing. + | + */ + + 'after_commit' => false, + + /* + |-------------------------------------------------------------------------- + | Chunk Sizes + |-------------------------------------------------------------------------- + | + | These options allow you to control the maximum chunk size when you are + | mass importing data into the search engine. This allows you to fine + | tune each of these chunk sizes based on the power of the servers. + | + */ + + 'chunk' => [ + 'searchable' => 500, + 'unsearchable' => 500, + ], + + /* + |-------------------------------------------------------------------------- + | Soft Deletes + |-------------------------------------------------------------------------- + | + | This option allows to control whether to keep soft deleted records in + | the search indexes. Maintaining soft deleted records can be useful + | if your application still needs to search for the records later. + | + */ + + 'soft_delete' => false, + + /* + |-------------------------------------------------------------------------- + | Identify User + |-------------------------------------------------------------------------- + | + | This option allows you to control whether to notify the search engine + | of the user performing the search. This is sometimes useful if the + | engine supports any analytics based on this application's users. + | + | Supported engines: "algolia" + | + */ + + 'identify' => env('SCOUT_IDENTIFY', false), + + /* + |-------------------------------------------------------------------------- + | Algolia Configuration + |-------------------------------------------------------------------------- + | + | Here you may configure your Algolia settings. Algolia is a cloud hosted + | search engine which works great with Scout out of the box. Just plug + | in your application ID and admin API key to get started searching. + | + */ + + 'algolia' => [ + 'id' => env('ALGOLIA_APP_ID', ''), + 'secret' => env('ALGOLIA_SECRET', ''), + ], + +]; diff --git a/vendor/laravel/scout/src/Builder.php b/vendor/laravel/scout/src/Builder.php new file mode 100644 index 000000000..f9e72fca5 --- /dev/null +++ b/vendor/laravel/scout/src/Builder.php @@ -0,0 +1,366 @@ +model = $model; + $this->query = $query; + $this->callback = $callback; + + if ($softDelete) { + $this->wheres['__soft_deleted'] = 0; + } + } + + /** + * Specify a custom index to perform this search on. + * + * @param string $index + * @return $this + */ + public function within($index) + { + $this->index = $index; + + return $this; + } + + /** + * Add a constraint to the search query. + * + * @param string $field + * @param mixed $value + * @return $this + */ + public function where($field, $value) + { + $this->wheres[$field] = $value; + + return $this; + } + + /** + * Include soft deleted records in the results. + * + * @return $this + */ + public function withTrashed() + { + unset($this->wheres['__soft_deleted']); + + return $this; + } + + /** + * Include only soft deleted records in the results. + * + * @return $this + */ + public function onlyTrashed() + { + return tap($this->withTrashed(), function () { + $this->wheres['__soft_deleted'] = 1; + }); + } + + /** + * Set the "limit" for the search query. + * + * @param int $limit + * @return $this + */ + public function take($limit) + { + $this->limit = $limit; + + return $this; + } + + /** + * Add an "order" for the search query. + * + * @param string $column + * @param string $direction + * @return $this + */ + public function orderBy($column, $direction = 'asc') + { + $this->orders[] = [ + 'column' => $column, + 'direction' => strtolower($direction) == 'asc' ? 'asc' : 'desc', + ]; + + return $this; + } + + /** + * Apply the callback's query changes if the given "value" is true. + * + * @param mixed $value + * @param callable $callback + * @param callable $default + * @return mixed + */ + public function when($value, $callback, $default = null) + { + if ($value) { + return $callback($this, $value) ?: $this; + } elseif ($default) { + return $default($this, $value) ?: $this; + } + + return $this; + } + + /** + * Pass the query to a given callback. + * + * @param \Closure $callback + * @return $this + */ + public function tap($callback) + { + return $this->when(true, $callback); + } + + /** + * Set the callback that should have an opportunity to modify the database query. + * + * @param callable $callback + * @return $this + */ + public function query($callback) + { + $this->queryCallback = $callback; + + return $this; + } + + /** + * Get the raw results of the search. + * + * @return mixed + */ + public function raw() + { + return $this->engine()->search($this); + } + + /** + * Get the keys of search results. + * + * @return \Illuminate\Support\Collection + */ + public function keys() + { + return $this->engine()->keys($this); + } + + /** + * Get the first result from the search. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function first() + { + return $this->get()->first(); + } + + /** + * Get the results of the search. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get() + { + return $this->engine()->get($this); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $pageName = 'page', $page = null) + { + $engine = $this->engine(); + + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $results = $this->model->newCollection($engine->map( + $this, $rawResults = $engine->paginate($this, $perPage, $page), $this->model + )->all()); + + $total = $engine->getTotalCount($rawResults); + + $hasMorePages = ($perPage * $page) < $engine->getTotalCount($rawResults); + + $paginator = Container::getInstance()->makeWith(Paginator::class, [ + 'items' => $results, + 'perPage' => $perPage, + 'currentPage' => $page, + 'options' => [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ], + ])->hasMorePagesWhen($hasMorePages); + + return $paginator->appends('query', $this->query); + } + + /** + * Paginate the given query into a paginator. + * + * @param int $perPage + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $pageName = 'page', $page = null) + { + $engine = $this->engine(); + + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $results = $this->model->newCollection($engine->map( + $this, $rawResults = $engine->paginate($this, $perPage, $page), $this->model + )->all()); + + $paginator = Container::getInstance()->makeWith(LengthAwarePaginator::class, [ + 'items' => $results, + 'total' => $engine->getTotalCount($rawResults), + 'perPage' => $perPage, + 'currentPage' => $page, + 'options' => [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ], + ]); + + return $paginator->appends('query', $this->query); + } + + /** + * Paginate the given query into a simple paginator with raw data. + * + * @param int $perPage + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginateRaw($perPage = null, $pageName = 'page', $page = null) + { + $engine = $this->engine(); + + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $results = $engine->paginate($this, $perPage, $page); + + $paginator = Container::getInstance()->makeWith(LengthAwarePaginator::class, [ + 'items' => $results, + 'total' => $engine->getTotalCount($results), + 'perPage' => $perPage, + 'currentPage' => $page, + 'options' => [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ], + ]); + + return $paginator->appends('query', $this->query); + } + + /** + * Get the engine that should handle the query. + * + * @return mixed + */ + protected function engine() + { + return $this->model->searchableUsing(); + } +} diff --git a/vendor/laravel/scout/src/Console/FlushCommand.php b/vendor/laravel/scout/src/Console/FlushCommand.php new file mode 100644 index 000000000..1a1b5019f --- /dev/null +++ b/vendor/laravel/scout/src/Console/FlushCommand.php @@ -0,0 +1,38 @@ +argument('model'); + + $model = new $class; + + $model::removeAllFromSearch(); + + $this->info('All ['.$class.'] records have been flushed.'); + } +} diff --git a/vendor/laravel/scout/src/Console/ImportCommand.php b/vendor/laravel/scout/src/Console/ImportCommand.php new file mode 100644 index 000000000..e03eb6acb --- /dev/null +++ b/vendor/laravel/scout/src/Console/ImportCommand.php @@ -0,0 +1,51 @@ +argument('model'); + + $model = new $class; + + $events->listen(ModelsImported::class, function ($event) use ($class) { + $key = $event->models->last()->getScoutKey(); + + $this->line('Imported ['.$class.'] models up to ID: '.$key); + }); + + $model::makeAllSearchable($this->option('chunk')); + + $events->forget(ModelsImported::class); + + $this->info('All ['.$class.'] records have been imported.'); + } +} diff --git a/vendor/laravel/scout/src/EngineManager.php b/vendor/laravel/scout/src/EngineManager.php new file mode 100644 index 000000000..f48465e01 --- /dev/null +++ b/vendor/laravel/scout/src/EngineManager.php @@ -0,0 +1,128 @@ +driver($name); + } + + /** + * Create an Algolia engine instance. + * + * @return \Laravel\Scout\Engines\AlgoliaEngine + */ + public function createAlgoliaDriver() + { + $this->ensureAlgoliaClientIsInstalled(); + + UserAgent::addCustomUserAgent('Laravel Scout', '8.6.1'); + + $config = SearchConfig::create( + config('scout.algolia.id'), + config('scout.algolia.secret') + )->setDefaultHeaders( + $this->defaultAlgoliaHeaders() + ); + + return new AlgoliaEngine(Algolia::createWithConfig($config), config('scout.soft_delete')); + } + + /** + * Ensure the Algolia API client is installed. + * + * @return void + * + * @throws \Exception + */ + protected function ensureAlgoliaClientIsInstalled() + { + if (class_exists(Algolia::class)) { + return; + } + + if (class_exists('AlgoliaSearch\Client')) { + throw new Exception('Please upgrade your Algolia client to version: ^2.2.'); + } + + throw new Exception('Please install the Algolia client: algolia/algoliasearch-client-php.'); + } + + /** + * Set the default Algolia configuration headers. + * + * @return array + */ + protected function defaultAlgoliaHeaders() + { + if (! config('scout.identify')) { + return []; + } + + $headers = []; + + if (! config('app.debug') && + filter_var($ip = request()->ip(), FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) + ) { + $headers['X-Forwarded-For'] = $ip; + } + + if (($user = request()->user()) && method_exists($user, 'getKey')) { + $headers['X-Algolia-UserToken'] = $user->getKey(); + } + + return $headers; + } + + /** + * Create a Null engine instance. + * + * @return \Laravel\Scout\Engines\NullEngine + */ + public function createNullDriver() + { + return new NullEngine; + } + + /** + * Forget all of the resolved engine instances. + * + * @return $this + */ + public function forgetEngines() + { + $this->drivers = []; + + return $this; + } + + /** + * Get the default Scout driver name. + * + * @return string + */ + public function getDefaultDriver() + { + if (is_null($driver = config('scout.driver'))) { + return 'null'; + } + + return $driver; + } +} diff --git a/vendor/laravel/scout/src/Engines/AlgoliaEngine.php b/vendor/laravel/scout/src/Engines/AlgoliaEngine.php new file mode 100644 index 000000000..626ac23e5 --- /dev/null +++ b/vendor/laravel/scout/src/Engines/AlgoliaEngine.php @@ -0,0 +1,244 @@ +algolia = $algolia; + $this->softDelete = $softDelete; + } + + /** + * Update the given model in the index. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + * + * @throws \Algolia\AlgoliaSearch\Exceptions\AlgoliaException + */ + public function update($models) + { + if ($models->isEmpty()) { + return; + } + + $index = $this->algolia->initIndex($models->first()->searchableAs()); + + if ($this->usesSoftDelete($models->first()) && $this->softDelete) { + $models->each->pushSoftDeleteMetadata(); + } + + $objects = $models->map(function ($model) { + if (empty($searchableData = $model->toSearchableArray())) { + return; + } + + return array_merge( + ['objectID' => $model->getScoutKey()], + $searchableData, + $model->scoutMetadata() + ); + })->filter()->values()->all(); + + if (! empty($objects)) { + $index->saveObjects($objects); + } + } + + /** + * Remove the given model from the index. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + public function delete($models) + { + $index = $this->algolia->initIndex($models->first()->searchableAs()); + + $index->deleteObjects( + $models->map(function ($model) { + return $model->getScoutKey(); + })->values()->all() + ); + } + + /** + * Perform the given search on the engine. + * + * @param \Laravel\Scout\Builder $builder + * @return mixed + */ + public function search(Builder $builder) + { + return $this->performSearch($builder, array_filter([ + 'numericFilters' => $this->filters($builder), + 'hitsPerPage' => $builder->limit, + ])); + } + + /** + * Perform the given search on the engine. + * + * @param \Laravel\Scout\Builder $builder + * @param int $perPage + * @param int $page + * @return mixed + */ + public function paginate(Builder $builder, $perPage, $page) + { + return $this->performSearch($builder, [ + 'numericFilters' => $this->filters($builder), + 'hitsPerPage' => $perPage, + 'page' => $page - 1, + ]); + } + + /** + * Perform the given search on the engine. + * + * @param \Laravel\Scout\Builder $builder + * @param array $options + * @return mixed + */ + protected function performSearch(Builder $builder, array $options = []) + { + $algolia = $this->algolia->initIndex( + $builder->index ?: $builder->model->searchableAs() + ); + + if ($builder->callback) { + return call_user_func( + $builder->callback, + $algolia, + $builder->query, + $options + ); + } + + return $algolia->search($builder->query, $options); + } + + /** + * Get the filter array for the query. + * + * @param \Laravel\Scout\Builder $builder + * @return array + */ + protected function filters(Builder $builder) + { + return collect($builder->wheres)->map(function ($value, $key) { + return $key.'='.$value; + })->values()->all(); + } + + /** + * Pluck and return the primary keys of the given results. + * + * @param mixed $results + * @return \Illuminate\Support\Collection + */ + public function mapIds($results) + { + return collect($results['hits'])->pluck('objectID')->values(); + } + + /** + * Map the given results to instances of the given model. + * + * @param \Laravel\Scout\Builder $builder + * @param mixed $results + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Collection + */ + public function map(Builder $builder, $results, $model) + { + if (count($results['hits']) === 0) { + return $model->newCollection(); + } + + $objectIds = collect($results['hits'])->pluck('objectID')->values()->all(); + $objectIdPositions = array_flip($objectIds); + + return $model->getScoutModelsByIds( + $builder, $objectIds + )->filter(function ($model) use ($objectIds) { + return in_array($model->getScoutKey(), $objectIds); + })->sortBy(function ($model) use ($objectIdPositions) { + return $objectIdPositions[$model->getScoutKey()]; + })->values(); + } + + /** + * Get the total count from a raw result returned by the engine. + * + * @param mixed $results + * @return int + */ + public function getTotalCount($results) + { + return $results['nbHits']; + } + + /** + * Flush all of the model's records from the engine. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function flush($model) + { + $index = $this->algolia->initIndex($model->searchableAs()); + + $index->clearObjects(); + } + + /** + * Determine if the given model uses soft deletes. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return bool + */ + protected function usesSoftDelete($model) + { + return in_array(SoftDeletes::class, class_uses_recursive($model)); + } + + /** + * Dynamically call the Algolia client instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->algolia->$method(...$parameters); + } +} diff --git a/vendor/laravel/scout/src/Engines/Engine.php b/vendor/laravel/scout/src/Engines/Engine.php new file mode 100644 index 000000000..720aa4df3 --- /dev/null +++ b/vendor/laravel/scout/src/Engines/Engine.php @@ -0,0 +1,100 @@ +mapIds($this->search($builder)); + } + + /** + * Get the results of the given query mapped onto models. + * + * @param \Laravel\Scout\Builder $builder + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get(Builder $builder) + { + return $this->map( + $builder, $this->search($builder), $builder->model + ); + } +} diff --git a/vendor/laravel/scout/src/Engines/NullEngine.php b/vendor/laravel/scout/src/Engines/NullEngine.php new file mode 100644 index 000000000..50f6422b7 --- /dev/null +++ b/vendor/laravel/scout/src/Engines/NullEngine.php @@ -0,0 +1,102 @@ +models = $models; + } +} diff --git a/vendor/laravel/scout/src/Events/ModelsImported.php b/vendor/laravel/scout/src/Events/ModelsImported.php new file mode 100644 index 000000000..06f056cbb --- /dev/null +++ b/vendor/laravel/scout/src/Events/ModelsImported.php @@ -0,0 +1,24 @@ +models = $models; + } +} diff --git a/vendor/laravel/scout/src/Jobs/MakeSearchable.php b/vendor/laravel/scout/src/Jobs/MakeSearchable.php new file mode 100644 index 000000000..6baaa2ccb --- /dev/null +++ b/vendor/laravel/scout/src/Jobs/MakeSearchable.php @@ -0,0 +1,44 @@ +models = $models; + } + + /** + * Handle the job. + * + * @return void + */ + public function handle() + { + if (count($this->models) === 0) { + return; + } + + $this->models->first()->searchableUsing()->update($this->models); + } +} diff --git a/vendor/laravel/scout/src/ModelObserver.php b/vendor/laravel/scout/src/ModelObserver.php new file mode 100644 index 000000000..428d6c252 --- /dev/null +++ b/vendor/laravel/scout/src/ModelObserver.php @@ -0,0 +1,145 @@ +afterCommit = Config::get('scout.after_commit', false); + } + + /** + * Enable syncing for the given class. + * + * @param string $class + * @return void + */ + public static function enableSyncingFor($class) + { + unset(static::$syncingDisabledFor[$class]); + } + + /** + * Disable syncing for the given class. + * + * @param string $class + * @return void + */ + public static function disableSyncingFor($class) + { + static::$syncingDisabledFor[$class] = true; + } + + /** + * Determine if syncing is disabled for the given class or model. + * + * @param object|string $class + * @return bool + */ + public static function syncingDisabledFor($class) + { + $class = is_object($class) ? get_class($class) : $class; + + return isset(static::$syncingDisabledFor[$class]); + } + + /** + * Handle the saved event for the model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function saved($model) + { + if (static::syncingDisabledFor($model)) { + return; + } + + if (! $model->shouldBeSearchable()) { + $model->unsearchable(); + + return; + } + + $model->searchable(); + } + + /** + * Handle the deleted event for the model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function deleted($model) + { + if (static::syncingDisabledFor($model)) { + return; + } + + if ($this->usesSoftDelete($model) && config('scout.soft_delete', false)) { + $this->saved($model); + } else { + $model->unsearchable(); + } + } + + /** + * Handle the force deleted event for the model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function forceDeleted($model) + { + if (static::syncingDisabledFor($model)) { + return; + } + + $model->unsearchable(); + } + + /** + * Handle the restored event for the model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function restored($model) + { + $this->saved($model); + } + + /** + * Determine if the given model uses soft deletes. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return bool + */ + protected function usesSoftDelete($model) + { + return in_array(SoftDeletes::class, class_uses_recursive($model)); + } +} diff --git a/vendor/laravel/scout/src/ScoutServiceProvider.php b/vendor/laravel/scout/src/ScoutServiceProvider.php new file mode 100644 index 000000000..a2415ba69 --- /dev/null +++ b/vendor/laravel/scout/src/ScoutServiceProvider.php @@ -0,0 +1,43 @@ +mergeConfigFrom(__DIR__.'/../config/scout.php', 'scout'); + + $this->app->singleton(EngineManager::class, function ($app) { + return new EngineManager($app); + }); + } + + /** + * Bootstrap any application services. + * + * @return void + */ + public function boot() + { + if ($this->app->runningInConsole()) { + $this->commands([ + ImportCommand::class, + FlushCommand::class, + ]); + + $this->publishes([ + __DIR__.'/../config/scout.php' => $this->app['path.config'].DIRECTORY_SEPARATOR.'scout.php', + ]); + } + } +} diff --git a/vendor/laravel/scout/src/Searchable.php b/vendor/laravel/scout/src/Searchable.php new file mode 100644 index 000000000..13fc11383 --- /dev/null +++ b/vendor/laravel/scout/src/Searchable.php @@ -0,0 +1,350 @@ +registerSearchableMacros(); + } + + /** + * Register the searchable macros. + * + * @return void + */ + public function registerSearchableMacros() + { + $self = $this; + + BaseCollection::macro('searchable', function () use ($self) { + $self->queueMakeSearchable($this); + }); + + BaseCollection::macro('unsearchable', function () use ($self) { + $self->queueRemoveFromSearch($this); + }); + } + + /** + * Dispatch the job to make the given models searchable. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + public function queueMakeSearchable($models) + { + if ($models->isEmpty()) { + return; + } + + if (! config('scout.queue')) { + return $models->first()->searchableUsing()->update($models); + } + + dispatch((new MakeSearchable($models)) + ->onQueue($models->first()->syncWithSearchUsingQueue()) + ->onConnection($models->first()->syncWithSearchUsing())); + } + + /** + * Dispatch the job to make the given models unsearchable. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + public function queueRemoveFromSearch($models) + { + if ($models->isEmpty()) { + return; + } + + return $models->first()->searchableUsing()->delete($models); + } + + /** + * Determine if the model should be searchable. + * + * @return bool + */ + public function shouldBeSearchable() + { + return true; + } + + /** + * Perform a search against the model's indexed data. + * + * @param string $query + * @param \Closure $callback + * @return \Laravel\Scout\Builder + */ + public static function search($query = '', $callback = null) + { + return app(Builder::class, [ + 'model' => new static, + 'query' => $query, + 'callback' => $callback, + 'softDelete'=> static::usesSoftDelete() && config('scout.soft_delete', false), + ]); + } + + /** + * Make all instances of the model searchable. + * + * @param int $chunk + * @return void + */ + public static function makeAllSearchable($chunk = null) + { + $self = new static; + + $softDelete = static::usesSoftDelete() && config('scout.soft_delete', false); + + $self->newQuery() + ->when(true, function ($query) use ($self) { + $self->makeAllSearchableUsing($query); + }) + ->when($softDelete, function ($query) { + $query->withTrashed(); + }) + ->orderBy($self->getKeyName()) + ->searchable($chunk); + } + + /** + * Modify the query used to retrieve models when making all of the models searchable. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function makeAllSearchableUsing($query) + { + return $query; + } + + /** + * Make the given model instance searchable. + * + * @return void + */ + public function searchable() + { + $this->newCollection([$this])->searchable(); + } + + /** + * Remove all instances of the model from the search index. + * + * @return void + */ + public static function removeAllFromSearch() + { + $self = new static; + + $self->searchableUsing()->flush($self); + } + + /** + * Remove the given model instance from the search index. + * + * @return void + */ + public function unsearchable() + { + $this->newCollection([$this])->unsearchable(); + } + + /** + * Get the requested models from an array of object IDs. + * + * @param \Laravel\Scout\Builder $builder + * @param array $ids + * @return mixed + */ + public function getScoutModelsByIds(Builder $builder, array $ids) + { + $query = static::usesSoftDelete() + ? $this->withTrashed() : $this->newQuery(); + + if ($builder->queryCallback) { + call_user_func($builder->queryCallback, $query); + } + + return $query->whereIn( + $this->getScoutKeyName(), $ids + )->get(); + } + + /** + * Enable search syncing for this model. + * + * @return void + */ + public static function enableSearchSyncing() + { + ModelObserver::enableSyncingFor(get_called_class()); + } + + /** + * Disable search syncing for this model. + * + * @return void + */ + public static function disableSearchSyncing() + { + ModelObserver::disableSyncingFor(get_called_class()); + } + + /** + * Temporarily disable search syncing for the given callback. + * + * @param callable $callback + * @return mixed + */ + public static function withoutSyncingToSearch($callback) + { + static::disableSearchSyncing(); + + try { + return $callback(); + } finally { + static::enableSearchSyncing(); + } + } + + /** + * Get the index name for the model. + * + * @return string + */ + public function searchableAs() + { + return config('scout.prefix').$this->getTable(); + } + + /** + * Get the indexable data array for the model. + * + * @return array + */ + public function toSearchableArray() + { + return $this->toArray(); + } + + /** + * Get the Scout engine for the model. + * + * @return mixed + */ + public function searchableUsing() + { + return app(EngineManager::class)->engine(); + } + + /** + * Get the queue connection that should be used when syncing. + * + * @return string + */ + public function syncWithSearchUsing() + { + return config('scout.queue.connection') ?: config('queue.default'); + } + + /** + * Get the queue that should be used with syncing. + * + * @return string + */ + public function syncWithSearchUsingQueue() + { + return config('scout.queue.queue'); + } + + /** + * Sync the soft deleted status for this model into the metadata. + * + * @return $this + */ + public function pushSoftDeleteMetadata() + { + return $this->withScoutMetadata('__soft_deleted', $this->trashed() ? 1 : 0); + } + + /** + * Get all Scout related metadata. + * + * @return array + */ + public function scoutMetadata() + { + return $this->scoutMetadata; + } + + /** + * Set a Scout related metadata. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function withScoutMetadata($key, $value) + { + $this->scoutMetadata[$key] = $value; + + return $this; + } + + /** + * Get the value used to index the model. + * + * @return mixed + */ + public function getScoutKey() + { + return $this->getKey(); + } + + /** + * Get the key name used to index the model. + * + * @return mixed + */ + public function getScoutKeyName() + { + return $this->getQualifiedKeyName(); + } + + /** + * Determine if the current class should use soft deletes with searching. + * + * @return bool + */ + protected static function usesSoftDelete() + { + return in_array(SoftDeletes::class, class_uses_recursive(get_called_class())); + } +} diff --git a/vendor/laravel/scout/src/SearchableScope.php b/vendor/laravel/scout/src/SearchableScope.php new file mode 100644 index 000000000..2998582db --- /dev/null +++ b/vendor/laravel/scout/src/SearchableScope.php @@ -0,0 +1,66 @@ +macro('searchable', function (EloquentBuilder $builder, $chunk = null) { + $builder->chunkById($chunk ?: config('scout.chunk.searchable', 500), function ($models) { + $models->filter->shouldBeSearchable()->searchable(); + + event(new ModelsImported($models)); + }); + }); + + $builder->macro('unsearchable', function (EloquentBuilder $builder, $chunk = null) { + $builder->chunkById($chunk ?: config('scout.chunk.unsearchable', 500), function ($models) { + $models->unsearchable(); + + event(new ModelsFlushed($models)); + }); + }); + + HasManyThrough::macro('searchable', function ($chunk = null) { + $this->chunkById($chunk ?: config('scout.chunk.searchable', 500), function ($models) { + $models->filter->shouldBeSearchable()->searchable(); + + event(new ModelsImported($models)); + }); + }); + + HasManyThrough::macro('unsearchable', function ($chunk = null) { + $this->chunkById($chunk ?: config('scout.chunk.searchable', 500), function ($models) { + $models->filter->shouldBeSearchable()->searchable(); + + event(new ModelsImported($models)); + }); + }); + } +} diff --git a/vendor/laravel/tinker/CHANGELOG.md b/vendor/laravel/tinker/CHANGELOG.md deleted file mode 100644 index 2c5c7fbca..000000000 --- a/vendor/laravel/tinker/CHANGELOG.md +++ /dev/null @@ -1,62 +0,0 @@ -# Release Notes - -## [Unreleased](https://github.com/laravel/tinker/compare/v2.4.2...2.x) - - -## [v2.4.2 (2020-08-11)](https://github.com/laravel/tinker/compare/v2.4.1...v2.4.2) - -### Fixed -- Fix missing output while using execute option ([#109](https://github.com/laravel/tinker/pull/109)) - - -## [v2.4.1 (2020-07-07)](https://github.com/laravel/tinker/compare/v2.4.0...v2.4.1) - -### Fixed -- Fixed execute not unregistering loader and exit code ([#100](https://github.com/laravel/tinker/pull/100)) - - -## [v2.4.0 (2020-04-07)](https://github.com/laravel/tinker/compare/v2.3.0...v2.4.0) - -### Changed -- Forward input options to psysh ([#98](https://github.com/laravel/tinker/pull/98)) - - -## [v2.3.0 (2020-03-17)](https://github.com/laravel/tinker/compare/v2.2.0...v2.3.0) - -### Added -- Allow Laravel 8 ([#90](https://github.com/laravel/tinker/pull/90)) -- Allow psy/psysh 0.10 ([#95](https://github.com/laravel/tinker/pull/95)) - - -## [v2.2.0 (2020-02-05)](https://github.com/laravel/tinker/compare/v2.1.0...v2.2.0) - -### Added -- Support vendor class aliasing ([#88](https://github.com/laravel/tinker/pull/88)) -- Add `--execute` option to console command ([#89](https://github.com/laravel/tinker/pull/89)) - - -## [v2.1.0 (2020-01-14)](https://github.com/laravel/tinker/compare/v2.0.0...v2.1.0) - -### Added -- Add `HtmlString` caster ([#87](https://github.com/laravel/tinker/pull/87)) - - -## [v2.0.0 (2019-11-26)](https://github.com/laravel/tinker/compare/v1.0.10...v2.0.0) - -### Added -- Allow Laravel 7 ([#74](https://github.com/laravel/tinker/pull/74)) - -### Changed -- Require PHP 7.2 as the new minimum version ([8d6104c](https://github.com/laravel/tinker/commit/8d6104cf50695e3f256d0389626c692e144d946b)) -- Allow Symfony 5 ([49982fd](https://github.com/laravel/tinker/commit/49982fd563035025998efe7f32d005bc6da2ce0a)) -- Laravel now only check for `DeferrableProvider` ([#81](https://github.com/laravel/tinker/pull/81)) - -### Removed -- Drop support for old Psysh versions ([a05922f](https://github.com/laravel/tinker/commit/a05922fa3b959d92efd16defe8e30a9895a69727)) -- Drop Symfony 3.x support ([7175b49](https://github.com/laravel/tinker/commit/7175b4931917d507989cda2c753113f71aa18816)) -- Drop support for Laravel 5.x ([4f3e609](https://github.com/laravel/tinker/commit/4f3e6098dff7ec4c0eedc5348184838598bc30c8)) - - -## v1.0.0 (2016-12-30) - -Initial commit. diff --git a/vendor/laravel/tinker/README.md b/vendor/laravel/tinker/README.md index 6bd5f1235..40284ac69 100644 --- a/vendor/laravel/tinker/README.md +++ b/vendor/laravel/tinker/README.md @@ -1,10 +1,10 @@ -

+

Logo Laravel Tinker

-Build Status -Total Downloads -Latest Stable Version -License +Build Status +Total Downloads +Latest Stable Version +License

## Introduction diff --git a/vendor/laravel/tinker/composer.json b/vendor/laravel/tinker/composer.json index 4929d6c93..a75eaf823 100644 --- a/vendor/laravel/tinker/composer.json +++ b/vendor/laravel/tinker/composer.json @@ -10,19 +10,19 @@ } ], "require": { - "php": "^7.2", - "illuminate/console": "^6.0|^7.0|^8.0", - "illuminate/contracts": "^6.0|^7.0|^8.0", - "illuminate/support": "^6.0|^7.0|^8.0", - "psy/psysh": "^0.10.3", - "symfony/var-dumper": "^4.3|^5.0" + "php": "^7.2.5|^8.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "psy/psysh": "^0.10.4|^0.11.1", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0" }, "require-dev": { - "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^8.4|^9.0" + "mockery/mockery": "~1.3.3|^1.4.2", + "phpunit/phpunit": "^8.5.8|^9.3.3" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." }, "autoload": { "psr-4": { diff --git a/vendor/laravel/tinker/src/ClassAliasAutoloader.php b/vendor/laravel/tinker/src/ClassAliasAutoloader.php index 4d1834491..994d75c14 100644 --- a/vendor/laravel/tinker/src/ClassAliasAutoloader.php +++ b/vendor/laravel/tinker/src/ClassAliasAutoloader.php @@ -47,8 +47,8 @@ class ClassAliasAutoloader * * @param \Psy\Shell $shell * @param string $classMapPath - * @param array $includedAliases - * @param array $excludedAliases + * @param array $includedAliases + * @param array $excludedAliases * @return static */ public static function register(Shell $shell, $classMapPath, array $includedAliases = [], array $excludedAliases = []) diff --git a/vendor/laravel/tinker/src/Console/TinkerCommand.php b/vendor/laravel/tinker/src/Console/TinkerCommand.php index 5fcfbeb98..9c12158bf 100644 --- a/vendor/laravel/tinker/src/Console/TinkerCommand.php +++ b/vendor/laravel/tinker/src/Console/TinkerCommand.php @@ -19,7 +19,7 @@ class TinkerCommand extends Command * @var array */ protected $commandWhitelist = [ - 'clear-compiled', 'down', 'env', 'inspire', 'migrate', 'optimize', 'up', + 'clear-compiled', 'down', 'env', 'inspire', 'migrate', 'migrate:install', 'optimize', 'up', ]; /** @@ -52,6 +52,10 @@ class TinkerCommand extends Command $this->getCasters() ); + if ($this->option('execute')) { + $config->setRawOutput(true); + } + $shell = new Shell($config); $shell->addCommands($this->getCommands()); $shell->setIncludes($this->argument('include')); @@ -102,7 +106,9 @@ class TinkerCommand extends Command $config = $this->getLaravel()->make('config'); foreach ($config->get('tinker.commands', []) as $command) { - $commands[] = $this->getApplication()->resolve($command); + $commands[] = $this->getApplication()->add( + $this->getLaravel()->make($command) + ); } return $commands; @@ -118,6 +124,7 @@ class TinkerCommand extends Command $casters = [ 'Illuminate\Support\Collection' => 'Laravel\Tinker\TinkerCaster::castCollection', 'Illuminate\Support\HtmlString' => 'Laravel\Tinker\TinkerCaster::castHtmlString', + 'Illuminate\Support\Stringable' => 'Laravel\Tinker\TinkerCaster::castStringable', ]; if (class_exists('Illuminate\Database\Eloquent\Model')) { @@ -128,7 +135,9 @@ class TinkerCommand extends Command $casters['Illuminate\Foundation\Application'] = 'Laravel\Tinker\TinkerCaster::castApplication'; } - return $casters; + $config = $this->getLaravel()->make('config'); + + return array_merge($casters, (array) $config->get('tinker.casters', [])); } /** diff --git a/vendor/laravel/tinker/src/TinkerCaster.php b/vendor/laravel/tinker/src/TinkerCaster.php index 92f869609..a5c04deed 100644 --- a/vendor/laravel/tinker/src/TinkerCaster.php +++ b/vendor/laravel/tinker/src/TinkerCaster.php @@ -81,6 +81,19 @@ class TinkerCaster ]; } + /** + * Get an array representing the properties of a fluent string. + * + * @param \Illuminate\Support\Stringable $stringable + * @return array + */ + public static function castStringable($stringable) + { + return [ + Caster::PREFIX_VIRTUAL.'value' => (string) $stringable, + ]; + } + /** * Get an array representing the properties of a model. * @@ -97,10 +110,30 @@ class TinkerCaster $model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden()) ); + $hidden = array_flip($model->getHidden()); + + $appends = (function () { + return array_combine($this->appends, $this->appends); + })->bindTo($model, $model)(); + + foreach ($appends as $appended) { + $attributes[$appended] = $model->{$appended}; + } + $results = []; - foreach (array_intersect_key($attributes, $visible) as $key => $value) { - $results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value; + foreach ($attributes as $key => $value) { + $prefix = ''; + + if (isset($visible[$key])) { + $prefix = Caster::PREFIX_VIRTUAL; + } + + if (isset($hidden[$key])) { + $prefix = Caster::PREFIX_PROTECTED; + } + + $results[$prefix.$key] = $value; } return $results; diff --git a/vendor/league/csv/CHANGELOG.md b/vendor/league/csv/CHANGELOG.md index 54b98fc63..9816a040d 100644 --- a/vendor/league/csv/CHANGELOG.md +++ b/vendor/league/csv/CHANGELOG.md @@ -2,17 +2,216 @@ All Notable changes to `Csv` will be documented in this file -## 9.5.0 - 2019-12-15 +## [9.8.0] - 2022-01-04 ### Added -- Improve package exception throwing by adding new exceptions classes that extends +- Added PHP7.4 typed properties where applicable +- `TabularDataReader::fetchColumnByName` to replace `TabularDataReader::fetchColumn` +- `TabularDataReader::fetchColumnByOffset` to replace `TabularDataReader::fetchColumn` + +### Deprecated + +- `TabularDataReader::fetchColumn` use `TabularDataReader::fetchColumnByOffset` or `TabularDataReader::fetchColumnByName` instead + +### Fixed + +- `AbstractCsv` constructor is marked final via docblock. + The method should never be extended or changed in child classes to avoid unexpected behaviour + +### Removed + +- PHP7.3 support +- Remove internal `EmptyEscapeParser` Polyfill used in `Reader` class +- Remove PHP7.4 polyfill features in `Writer` class + +## [9.7.4] - 2021-11-30 + +### Added + +- None + +### Deprecated + +- None + +### Fixed + +- Bug fix `EscapeFormula` to follow OWASP latest recommendation [PR #452](https://github.com/thephpleague/csv/pull/452) +thanks to [@robertfausk](https://github.com/robertfausk) and [@Lehmub](https://github.com/Lehmhub) + +### Removed + +- None + +## [9.7.3] - 2021-11-21 + +### Added + +- None + +### Deprecated + +- None + +### Fixed + +- Update PHPStan requirement for development +- Improve Documentation generation thanks to [pdelre](https://github.com/pdelre) +- PHP8.1 compliance: using `ReturnTypeWillChange` to avoid emitting a unnecessary deprecation notice. thanks to [cedric-anne](https://github.com/cedric-anne) + +### Removed + +- None + +## [9.7.2] - 2021-10-05 + +### Added + +- None + +### Deprecated + +- None + +### Fixed + +- Update dependencies requirement for development +- PHP8.1 compliance: replace `FILTER_SANITIZE_STRING` by `FILTER_UNSAFE_RAW` +- PHP8.1 compliance: remove duplicated public properties declaration +- PHP8.1 compliance: add support for fputcsv `$eol` argument + +### Removed + +- None + +## [9.7.1] - 2021-04-17 + +### Added + +- None + +### Deprecated + +- None + +### Fixed + +- fix writer filter [#421](https://github.com/thephpleague/csv/pull/421) by [LosingBattle](https://github.com/cpj555) + +### Removed + +- None + +## [9.7.0] - 2021-03-26 + +### Added + +- `League\Csv\SyntaxError::duplicateColumnNames` to expose column name duplicates during header usage +- `League\Csv\UnableToProcessCsv` as the new Exception Marker Interface +- `League\Csv\UnavailableStream` as the new Exception +- `League\Csv\Info::getDelimiterStats` to replace the namespace function `delimiter_detect` +- `League\Csv\Info::fetchBOMSequence` to replace the namespace function `bom_match` +- `League\Csv\AbstractCsv::toString` to replace `League\Csv\AbstractCsv::getContent` and `League\Csv\AbstractCsv::__toString` +- `League\Csv\XMLConverter::create` to replace `League\Csv\XMLConverter::__construct` +- `League\Csv\HTMLConverter::create` to replace `League\Csv\HTMLConverter::__construct` +- `League\Csv\AbstractCsv::supportsStreamFilterOnRead` and `League\Csv\AbstractCsv::supportsStreamFilterOnWrite` to replace `League\Csv\AbstractCsv::supportsStreamFilter` and `League\Csv\AbstractCsv::getStreamFilterMode` + +### Deprecated + +- `League\Csv\delimiter_detect` use `League\Csv\Info::getDelimiterStats` +- `League\Csv\bom_match` use `League\Csv\Info::fetchBOMSequence` +- `League\Csv\AbstractCsv::getContent` use `League\Csv\AbstractCsv::toString` +- `League\Csv\AbstractCsv::getStreamFilterMode` use `League\Csv\AbstractCsv::supportsStreamFilterOnRead` or `League\Csv\AbstractCsv::supportsStreamFilterOnWrite` +- `League\Csv\AbstractCsv::supportsStreamFilter` use `League\Csv\AbstractCsv::supportsStreamFilterOnRead` or `League\Csv\AbstractCsv::supportsStreamFilterOnWrite` +- Calling exceptions constructor, use named constructors instead. +- `League\Csv\XMLConverter::__construct` use `League\Csv\XMLConverter::create` +- `League\Csv\HTMLConverter::__construct` use `League\Csv\HTMLConverter::create` + +### Fixed + +- Move tests into the `src` directory +- Fixed encoder method resolver implementation +- all classes marked as `@internal` are now final +- `League\Csv\AbstractCsv::STREAM_FILTER_MODE` constant replaces `League\Csv\AbstractCsv::$stream_filter_mode` + +### Removed + +- PHP7.2 support +- `League\Csv\AbstractCsv::$stream_filter_mode` + +## [9.6.2] - 2020-12-10 + +### Added + +- Using Github actions as development tools. + +### Deprecated + +- None + +### Fixed + +- Adding official support for PHP8 [#405](https://github.com/thephpleague/csv/pull/405) and [#406](https://github.com/thephpleague/csv/pull/406) by [Ion Bazan](https://github.com/IonBazan) + +### Removed + +- Removing Travis and Scrutinizr as development tools + +## [9.6.1] - 2020-09-05 + +### Added + +- None + +### Deprecated + +- None + +### Fixed + +- BOM sequence processing fix [#394](https://github.com/thephpleague/csv/issues/394) + +### Removed + +- None + +## [9.6.0] - 2020-03-17 + +### Added + +- More return types and type parameters as supported in PHP7.2+ +- `League\Csv\Statement::create` named constructor to ease constraint builder instantiation +- `League\Csv\Statement` can now also process `League\Csv\ResultSet` instances. +- `League\Csv\TabularDataReader` interface to represent how to read tabular data +- `League\Csv\ResultSet::getRecords` has an optional `$header` second argument to make the method works like `League\Csv\Reader::getRecords` +- `League\Csv\ResultSet::createFromTabularDataReader` create a new instance from `League\Csv\TabularDataReader` implementing class. + +### Deprecated + +- Nothing + +### Fixed + +- `League\Csv\Reader` no longer uses `__call` to implement `fetchOne`, `fetchPairs` and `fetchColumn` methods. + +### Removed + +- Internal polyfill for `is_iterable` +- Internal polyfill for `is_nullable_int` +- Support for PHP7.0 and PHP7.1 + +## [9.5.0] - 2019-12-15 + +### Added + +- Improve package exception throwing by adding new exceptions classes that extends the `League\Csv\Exception` exception marker class [#360](https://github.com/thephpleague/csv/issues/360), [#361](https://github.com/thephpleague/csv/issues/360) feature proposed and developed by [Darren Miller](https://github.com/dmlogic) - - `League\Csv\UnavailableFeature` - - `League\Csv\InvalidArgument` - - `League\Csv\SyntaxError` - + - `League\Csv\UnavailableFeature` + - `League\Csv\InvalidArgument` + - `League\Csv\SyntaxError` + ### Deprecated - Nothing @@ -26,7 +225,7 @@ feature proposed and developed by [Darren Miller](https://github.com/dmlogic) - Nothing -## 9.4.1 - 2019-10-17 +## [9.4.1] - 2019-10-17 ### Added @@ -44,19 +243,19 @@ feature proposed and developed by [Darren Miller](https://github.com/dmlogic) - Nothing -## 9.4.0 - 2019-10-02 +## [9.4.0] - 2019-10-02 ### Added - Adding support for controlling empty record presence in `Reader::getRecords` return value. - - `Reader::includeEmptyRecords` - - `Reader::skipEmptyRecords` - - `Reader::isEmptyRecordsIncluded` + - `Reader::includeEmptyRecords` + - `Reader::skipEmptyRecords` + - `Reader::isEmptyRecordsIncluded` - Adding support for controlling Input BOM usage in the library: - - `AbstractCsv::skipInputBOM` - - `AbstractCsv::includeInputBOM` - - `AbstractCsv::isInputBOMIncluded` + - `AbstractCsv::skipInputBOM` + - `AbstractCsv::includeInputBOM` + - `AbstractCsv::isInputBOMIncluded` ### Deprecated @@ -70,12 +269,12 @@ feature proposed and developed by [Darren Miller](https://github.com/dmlogic) - Nothing -## 9.3.0 - 2019-07-30 +## [9.3.0] - 2019-07-30 ### Added - `XMLConverter::import` see [#348](https://github.com/thephpleague/csv/pull/348) thanks [@kusabi](https://github.com/kusabi) -- Support for `thead`, `tfoot` and `tbody` in `HTMLConverter::convert` via the addition of +- Support for `thead`, `tfoot` and `tbody` in `HTMLConverter::convert` via the addition of protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendHeaderSection` [#348](https://github.com/thephpleague/csv/pull/348) thanks [@kusabi](https://github.com/kusabi) ### Deprecated @@ -86,13 +285,13 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Internal improvement in `Reader` dockblock thanks [@ghobaty](https://github.com/ghobaty). - Improve strict comparison when using `preg_match`. -- Improve CSV control in `Stream`. +- Improve CSV control in `Stream`. ### Removed - Nothing -## 9.2.1 - 2019-06-08 +## [9.2.1] - 2019-06-08 ### Added @@ -111,7 +310,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.2.0 - 2019-03-08 +## [9.2.0] - 2019-03-08 ### Added @@ -133,7 +332,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Internal `Stream::createFromString` named constructor default argument is now the empty string - Internal `Stream::fwrite` improved - Internal `Stream::__destruct` no longer emit warning on invalid stream filter removal. -- Internal `Stream::seek` returns `0` if the seeked position `0` is valid see [#321](https://github.com/thephpleague/csv/pull/332) thanks [@HaozhouChen](https://github.com/HaozhouChen) +- Internal `Stream::seek` returns `0` if the seeked position `0` is valid see [#321](https://github.com/thephpleague/csv/pull/332) thanks [@HaozhouChen](https://github.com/HaozhouChen) - `Reader:getHeader` when the record is an empty line. @@ -141,7 +340,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.1.4 - 2018-05-01 +## [9.1.4] - 2018-05-01 ### Added @@ -160,7 +359,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.1.3 - 2018-03-12 +## [9.1.3] - 2018-03-12 ### Added @@ -180,7 +379,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.1.2 - 2018-02-05 +## [9.1.2] - 2018-02-05 ### Added @@ -199,7 +398,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.1.1 - 2017-11-28 +## [9.1.1] - 2017-11-28 ### Added @@ -219,7 +418,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.1.0 - 2017-10-20 +## [9.1.0] - 2017-10-20 ### Added @@ -243,7 +442,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.0.1 - 2017-08-21 +## [9.0.1] - 2017-08-21 ### Added @@ -261,37 +460,37 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Nothing -## 9.0.0 - 2017-08-18 +## [9.0.0] - 2017-08-18 ### Added - Improved CSV Records selection - - `League\Csv\Reader::getRecords` to access all CSV records - - `League\Csv\Statement` provides a constraint builder to select CSV records. - - `League\Csv\ResultSet` represents the result set of the selected CSV records. - - `League\Csv\delimiter_detect` function to detect CSV delimiter character + - `League\Csv\Reader::getRecords` to access all CSV records + - `League\Csv\Statement` provides a constraint builder to select CSV records. + - `League\Csv\ResultSet` represents the result set of the selected CSV records. + - `League\Csv\delimiter_detect` function to detect CSV delimiter character - Improved CSV document header selection. - - `League\Csv\Reader::getHeader` - - `League\Csv\Reader::getHeaderOffset` - - `League\Csv\Reader::setHeaderOffset` + - `League\Csv\Reader::getHeader` + - `League\Csv\Reader::getHeaderOffset` + - `League\Csv\Reader::setHeaderOffset` - Improved CSV Records conversion - - `League\Csv\CharsetConverter` converts CSV records charset. - - `League\Csv\XMLConverter` converts CSV records into DOMDocument - - `League\Csv\HTMLConverter` converts CSV records into HTML table. + - `League\Csv\CharsetConverter` converts CSV records charset. + - `League\Csv\XMLConverter` converts CSV records into DOMDocument + - `League\Csv\HTMLConverter` converts CSV records into HTML table. - Improved Exception handling - - `League\Csv\Exception` the default exception - - `League\Csv\CannotInsertRecord` + - `League\Csv\Exception` the default exception + - `League\Csv\CannotInsertRecord` - Improved CSV document output - - `League\Csv\AbstractCsv::chunk` method to output the CSV document in chunk - - `League\Csv\bom_match` function to detect BOM sequence in a given string - - `League\Csv\ByteSequence` interface to decoupled BOM sequence from CSV documents + - `League\Csv\AbstractCsv::chunk` method to output the CSV document in chunk + - `League\Csv\bom_match` function to detect BOM sequence in a given string + - `League\Csv\ByteSequence` interface to decoupled BOM sequence from CSV documents - Improved CSV records column count consistency on insertion - - `League\Csv\ColumnConsistency` + - `League\Csv\ColumnConsistency` - Improved CSV document flush mechanism on insertion - - `League\Csv\Writer::setFlushThreshold` - - `League\Csv\Writer::getFlushThreshold` + - `League\Csv\Writer::setFlushThreshold` + - `League\Csv\Writer::getFlushThreshold` - Improve RFC4180 compliance - - `League\Csv\RFC4180Field` to format field according to RFC4180 rules + - `League\Csv\RFC4180Field` to format field according to RFC4180 rules ### Deprecated @@ -300,61 +499,61 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH ### Fixed - Improved CSV record insertion - - `League\Csv\Writer::insertOne` only accepts an array and returns a integer - - `League\Csv\Writer::insertAll` only accepts an iterable of array and returns an integer + - `League\Csv\Writer::insertOne` only accepts an array and returns a integer + - `League\Csv\Writer::insertAll` only accepts an iterable of array and returns an integer - Normalized CSV offset returned value - - `League\Csv\Reader::fetchColumn` always returns the CSV document original offset. + - `League\Csv\Reader::fetchColumn` always returns the CSV document original offset. ### Removed - `examples` directory - `PHP5` support - The following method is removed because The BOM API is simplified: - - `League\Csv\AbstractCsv::stripBOM` + - `League\Csv\AbstractCsv::stripBOM` - All conversion methods are removed in favor of the conversion classes: - - `League\Csv\Writer::jsonSerialize` - - `League\Csv\AbstractCsv::toHTML` - - `League\Csv\AbstractCsv::toXML` - - `League\Csv\AbstractCsv::setInputEncoding` - - `League\Csv\AbstractCsv::getInputEncoding` + - `League\Csv\Writer::jsonSerialize` + - `League\Csv\AbstractCsv::toHTML` + - `League\Csv\AbstractCsv::toXML` + - `League\Csv\AbstractCsv::setInputEncoding` + - `League\Csv\AbstractCsv::getInputEncoding` - The following methods are removed because the PHP stream filter API is simplified: - - `League\Csv\AbstractCsv::isActiveStreamFilter` - - `League\Csv\AbstractCsv::setStreamFilterMode` - - `League\Csv\AbstractCsv::appendStreamFilter` - - `League\Csv\AbstractCsv::prependStreamFilter` - - `League\Csv\AbstractCsv::removeStreamFilter` - - `League\Csv\AbstractCsv::clearStreamFilters` + - `League\Csv\AbstractCsv::isActiveStreamFilter` + - `League\Csv\AbstractCsv::setStreamFilterMode` + - `League\Csv\AbstractCsv::appendStreamFilter` + - `League\Csv\AbstractCsv::prependStreamFilter` + - `League\Csv\AbstractCsv::removeStreamFilter` + - `League\Csv\AbstractCsv::clearStreamFilters` - The following methods are removed because switching between connections is no longer possible: - - `League\Csv\AbstractCsv::newReader` - - `League\Csv\AbstractCsv::newWriter` - - `League\Csv\Reader::getNewline` - - `League\Csv\Reader::setNewline` + - `League\Csv\AbstractCsv::newReader` + - `League\Csv\AbstractCsv::newWriter` + - `League\Csv\Reader::getNewline` + - `League\Csv\Reader::setNewline` - The Exception mechanism is improved thus the following class is removed: - - `League\Csv\Exception\InvalidRowException`; + - `League\Csv\Exception\InvalidRowException`; - The CSV records filtering methods are removed in favor of the `League\Csv\Statement` class: - - `League\Csv\AbstractCsv::addFilter`, - - `League\Csv\AbstractCsv::addSortBy`, - - `League\Csv\AbstractCsv::setOffset`, - - `League\Csv\AbstractCsv::setLimit`; + - `League\Csv\AbstractCsv::addFilter`, + - `League\Csv\AbstractCsv::addSortBy`, + - `League\Csv\AbstractCsv::setOffset`, + - `League\Csv\AbstractCsv::setLimit`; - CSV records selecting API methods is simplified: - - `League\Csv\Reader::each` - - `League\Csv\Reader::fetch` - - `League\Csv\Reader::fetchAll` - - `League\Csv\Reader::fetchAssoc` - - `League\Csv\Reader::fetchPairsWithoutDuplicates` + - `League\Csv\Reader::each` + - `League\Csv\Reader::fetch` + - `League\Csv\Reader::fetchAll` + - `League\Csv\Reader::fetchAssoc` + - `League\Csv\Reader::fetchPairsWithoutDuplicates` - Formatting and validating CSV records on insertion is simplified, the following methods are removed: - - `League\Csv\Writer::hasFormatter` - - `League\Csv\Writer::removeFormatter` - - `League\Csv\Writer::clearFormatters` - - `League\Csv\Writer::hasValidator` - - `League\Csv\Writer::removeValidator` - - `League\Csv\Writer::clearValidators` - - `League\Csv\Writer::getIterator` + - `League\Csv\Writer::hasFormatter` + - `League\Csv\Writer::removeFormatter` + - `League\Csv\Writer::clearFormatters` + - `League\Csv\Writer::hasValidator` + - `League\Csv\Writer::removeValidator` + - `League\Csv\Writer::clearValidators` + - `League\Csv\Writer::getIterator` - The following Formatters and Validators classes are removed from the package: - - `League\Csv\Plugin\SkipNullValuesFormatter` - - `League\Csv\Plugin\ForbiddenNullValuesValidator` - - `League\Csv\Plugin\ColumnConsistencyValidator` *replace by `League\Csv\ColumnConsistency`* + - `League\Csv\Plugin\SkipNullValuesFormatter` + - `League\Csv\Plugin\ForbiddenNullValuesValidator` + - `League\Csv\Plugin\ColumnConsistencyValidator` *replace by `League\Csv\ColumnConsistency`* - `League\Csv\Writer` no longers implements the `IteratorAggregate` interface - `League\Csv\AbstractCsv::fetchDelimitersOccurrence` is removed *replace by `League\Csv\delimiter_detect` function* @@ -512,7 +711,7 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - `Reader::fetchColumn` and `Reader::fetchAssoc` now return `Iterator` - `Reader::fetchAssoc` callable argument expects an indexed row using the submitted keys as its first argument - `Reader::fetchColumn` callable argument expects the selected column value as its first argument -- Default value on `setOutputBOM` is removed +- Default value on `setOutputBOM` is removed - `AbstractCsv::getOutputBOM` always return a string - `AbstractCsv::getInputBOM` always return a string @@ -633,19 +832,19 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH ### Added - A new flexible mechanism to format and validate a row before its insertion by adding - - `Writer::addFormatter` to add a formatter to the `Writer` object - - `Writer::removeFormatter` to remove an already registered formatter - - `Writer::hasFormatter` to detect the presence of a formatter - - `Writer::clearFormatters` to clear all registered formatter - - `Writer::addValidator` to add a validator to the `Writer` object - - `Writer::removeValidator` to remove an already registered validator - - `Writer::hasValidator` to detect the presence of a validator - - `Writer::clearValidators` to clear all registered validator - - `League\Csv\Exception\InvalidRowException` exception thrown when row validation failed + - `Writer::addFormatter` to add a formatter to the `Writer` object + - `Writer::removeFormatter` to remove an already registered formatter + - `Writer::hasFormatter` to detect the presence of a formatter + - `Writer::clearFormatters` to clear all registered formatter + - `Writer::addValidator` to add a validator to the `Writer` object + - `Writer::removeValidator` to remove an already registered validator + - `Writer::hasValidator` to detect the presence of a validator + - `Writer::clearValidators` to clear all registered validator + - `League\Csv\Exception\InvalidRowException` exception thrown when row validation failed - Classes to maintain removed features from the `Writer` class - - `League\Csv\Plugin\ColumnConsistencyValidator` to validate column consistency on insertion - - `League\Csv\Plugin\ForbiddenNullValuesValidator` to validate `null` value on insertion - - `League\Csv\Plugin\SkipNullValuesFormatter` to format `null` value on insertion + - `League\Csv\Plugin\ColumnConsistencyValidator` to validate column consistency on insertion + - `League\Csv\Plugin\ForbiddenNullValuesValidator` to validate `null` value on insertion + - `League\Csv\Plugin\SkipNullValuesFormatter` to format `null` value on insertion ### Deprecated @@ -669,14 +868,14 @@ protected methods `HTMLConverter::addHTMLAttributes` and `HTMLConverter::appendH - Setting `ini_set("auto_detect_line_endings", true);` is no longer set in the class constructor. Mac OS X users must explicitly set this ini options in their script. - `Writer` and `Reader` default constructor are removed from public API in favor of the named constructors. - All `Writer` methods and constant related to CSV data validation and formatting before insertion - - `Writer::getNullHandlingMode` - - `Writer::setNullHandlingMode` - - `Writer::setColumnsCount` - - `Writer::getColumnsCount` - - `Writer::autodetectColumnsCount` - - `Writer::NULL_AS_EXCEPTION` - - `Writer::NULL_AS_EMPTY` - - `Writer::NULL_AS_SKIP_CELL` + - `Writer::getNullHandlingMode` + - `Writer::setNullHandlingMode` + - `Writer::setColumnsCount` + - `Writer::getColumnsCount` + - `Writer::autodetectColumnsCount` + - `Writer::NULL_AS_EXCEPTION` + - `Writer::NULL_AS_EMPTY` + - `Writer::NULL_AS_SKIP_CELL` ## 6.3.0 - 2015-01-21 @@ -1048,3 +1247,27 @@ to manage BOM character with CSV. ## 1.0.0 - 2013-12-03 Initial Release of `Bakame\Csv` + +[Next]: https://github.com/thephpleague/csv/compare/9.8.0...master +[9.8.0]: https://github.com/thephpleague/csv/compare/9.7.4...9.8.0 +[9.7.4]: https://github.com/thephpleague/csv/compare/9.7.3...9.7.4 +[9.7.3]: https://github.com/thephpleague/csv/compare/9.7.2...9.7.3 +[9.7.2]: https://github.com/thephpleague/csv/compare/9.7.1...9.7.2 +[9.7.1]: https://github.com/thephpleague/csv/compare/9.7.0...9.7.1 +[9.7.0]: https://github.com/thephpleague/csv/compare/9.6.2...9.7.0 +[9.6.2]: https://github.com/thephpleague/csv/compare/9.6.1...9.6.2 +[9.6.1]: https://github.com/thephpleague/csv/compare/9.6.0...9.6.1 +[9.6.0]: https://github.com/thephpleague/csv/compare/9.5.0...9.6.0 +[9.5.0]: https://github.com/thephpleague/csv/compare/9.4.1...9.5.0 +[9.4.1]: https://github.com/thephpleague/csv/compare/9.4.0...9.4.1 +[9.4.0]: https://github.com/thephpleague/csv/compare/9.3.0...9.4.0 +[9.3.0]: https://github.com/thephpleague/csv/compare/9.2.1...9.3.0 +[9.2.1]: https://github.com/thephpleague/csv/compare/9.2.0...9.2.1 +[9.2.0]: https://github.com/thephpleague/csv/compare/9.1.4...9.2.0 +[9.1.4]: https://github.com/thephpleague/csv/compare/9.1.3...9.1.4 +[9.1.3]: https://github.com/thephpleague/csv/compare/9.1.2...9.1.3 +[9.1.2]: https://github.com/thephpleague/csv/compare/9.1.1...9.1.2 +[9.1.1]: https://github.com/thephpleague/csv/compare/9.1.0...9.1.1 +[9.1.0]: https://github.com/thephpleague/csv/compare/9.0.1...9.1.0 +[9.0.1]: https://github.com/thephpleague/csv/compare/9.0.0...9.0.1 +[9.0.0]: https://github.com/thephpleague/csv/compare/8.2.2...9.0.0 diff --git a/vendor/league/csv/composer.json b/vendor/league/csv/composer.json index 120b115ac..ebaea31e0 100644 --- a/vendor/league/csv/composer.json +++ b/vendor/league/csv/composer.json @@ -1,10 +1,10 @@ { "name": "league/csv", "type": "library", - "description" : "Csv data manipulation made easy in PHP", - "keywords": ["csv", "import", "export", "read", "write", "filter"], + "description" : "CSV data manipulation made easy in PHP", + "keywords": ["csv", "import", "export", "read", "write", "filter", "convert", "transform"], "license": "MIT", - "homepage" : "http://csv.thephpleague.com", + "homepage" : "https://csv.thephpleague.com", "authors": [ { "name" : "Ignace Nyamagana Butera", @@ -15,24 +15,29 @@ ], "support": { "docs": "https://csv.thephpleague.com", - "forum": "https://groups.google.com/forum/#!forum/thephpleague", "issues": "https://github.com/thephpleague/csv/issues", "rss": "https://github.com/thephpleague/csv/releases.atom", "source": "https://github.com/thephpleague/csv" }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/nyamsprod" + } + ], "require": { - "php" : ">=7.0.10", - "ext-dom" : "*", + "php" : "^7.4 || ^8.0", "ext-json" : "*", "ext-mbstring" : "*" }, "require-dev": { "ext-curl" : "*", - "friendsofphp/php-cs-fixer": "^2.12", - "phpunit/phpunit" : "^6.0", - "phpstan/phpstan": "^0.9.2", - "phpstan/phpstan-strict-rules": "^0.9.0", - "phpstan/phpstan-phpunit": "^0.9.4" + "ext-dom": "*", + "friendsofphp/php-cs-fixer": "^v3.4.0", + "phpunit/phpunit" : "^9.5.11", + "phpstan/phpstan": "^1.3.0", + "phpstan/phpstan-strict-rules": "^1.1.0", + "phpstan/phpstan-phpunit": "^1.0.0" }, "autoload": { "psr-4": { @@ -46,30 +51,25 @@ } }, "scripts": { - "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes --ansi", - "phpstan-src": "phpstan analyse -l max -c phpstan.src.neon src --ansi", - "phpstan-tests": "phpstan analyse -l max -c phpstan.tests.neon tests --ansi", - "phpstan": [ - "@phpstan-src", - "@phpstan-tests" - ], + "phpcs": "php-cs-fixer fix -vvv --diff --dry-run --allow-risky=yes --ansi", + "phpcs:fix": "php-cs-fixer fix -vvv --allow-risky=yes --ansi", + "phpstan": "phpstan analyse -l max -c phpstan.neon src --ansi --memory-limit=192M", "phpunit": "phpunit --coverage-text", "test": [ - "@phpcs", + "@phpunit", "@phpstan", - "@phpunit" + "@phpcs" ] }, "scripts-descriptions": { "phpcs": "Runs coding style test suite", "phpstan": "Runs complete codebase static analysis", - "phpstan-src": "Runs source code static analysis", - "phpstan-test": "Runs test suite static analysis", "phpunit": "Runs unit and functional testing", "test": "Runs full test suite" }, "suggest": { - "ext-iconv" : "Needed to ease transcoding CSV using iconv stream filters" + "ext-iconv" : "Needed to ease transcoding CSV using iconv stream filters", + "ext-dom" : "Required to use the XMLConverter and or the HTMLConverter classes" }, "extra": { "branch-alias": { diff --git a/vendor/league/csv/src/AbstractCsv.php b/vendor/league/csv/src/AbstractCsv.php index 0c358370a..18d965ba2 100644 --- a/vendor/league/csv/src/AbstractCsv.php +++ b/vendor/league/csv/src/AbstractCsv.php @@ -26,109 +26,51 @@ use function strcspn; use function strlen; use const FILTER_FLAG_STRIP_HIGH; use const FILTER_FLAG_STRIP_LOW; -use const FILTER_SANITIZE_STRING; +use const FILTER_UNSAFE_RAW; /** * An abstract class to enable CSV document loading. */ abstract class AbstractCsv implements ByteSequence { - /** - * The stream filter mode (read or write). - * - * @var int - */ - protected $stream_filter_mode; + protected const STREAM_FILTER_MODE = STREAM_FILTER_READ; - /** - * collection of stream filters. - * - * @var bool[] - */ - protected $stream_filters = []; - - /** - * The CSV document BOM sequence. - * - * @var string|null - */ - protected $input_bom = null; - - /** - * The Output file BOM character. - * - * @var string - */ - protected $output_bom = ''; - - /** - * the field delimiter (one character only). - * - * @var string - */ - protected $delimiter = ','; - - /** - * the field enclosure character (one character only). - * - * @var string - */ - protected $enclosure = '"'; - - /** - * the field escape character (one character only). - * - * @var string - */ - protected $escape = '\\'; - - /** - * The CSV document. - * - * @var SplFileObject|Stream - */ + /** @var SplFileObject|Stream The CSV document. */ protected $document; + /** @var array collection of stream filters. */ + protected array $stream_filters = []; + protected ?string $input_bom = null; + protected string $output_bom = ''; + protected string $delimiter = ','; + protected string $enclosure = '"'; + protected string $escape = '\\'; + protected bool $is_input_bom_included = false; /** - * Tells whether the Input BOM must be included or skipped. - * - * @var bool - */ - protected $is_input_bom_included = false; - - /** - * New instance. + * @final This method should not be overwritten in child classes * * @param SplFileObject|Stream $document The CSV Object instance */ protected function __construct($document) { $this->document = $document; - list($this->delimiter, $this->enclosure, $this->escape) = $this->document->getCsvControl(); + [$this->delimiter, $this->enclosure, $this->escape] = $this->document->getCsvControl(); $this->resetProperties(); } /** * Reset dynamic object properties to improve performance. */ - protected function resetProperties() - { - } + abstract protected function resetProperties(): void; - /** - * {@inheritdoc} - */ public function __destruct() { unset($this->document); } - /** - * {@inheritdoc} - */ public function __clone() { - throw new Exception(sprintf('An object of class %s cannot be cloned', static::class)); + throw UnavailableStream::dueToForbiddenCloning(static::class); } /** @@ -226,20 +168,32 @@ abstract class AbstractCsv implements ByteSequence $this->document->setFlags(SplFileObject::READ_CSV); $this->document->rewind(); - $this->input_bom = bom_match((string) $this->document->fread(4)); + $this->input_bom = Info::fetchBOMSequence((string) $this->document->fread(4)) ?? ''; return $this->input_bom; } /** + * DEPRECATION WARNING! This method will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + * @see AbstractCsv::supportsStreamFilterOnRead + * @see AbstractCsv::supportsStreamFilterOnWrite + * * Returns the stream filter mode. */ public function getStreamFilterMode(): int { - return $this->stream_filter_mode; + return static::STREAM_FILTER_MODE; } /** + * DEPRECATION WARNING! This method will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + * @see AbstractCsv::supportsStreamFilterOnRead + * @see AbstractCsv::supportsStreamFilterOnWrite + * * Tells whether the stream filter capabilities can be used. */ public function supportsStreamFilter(): bool @@ -247,6 +201,24 @@ abstract class AbstractCsv implements ByteSequence return $this->document instanceof Stream; } + /** + * Tells whether the stream filter read capabilities can be used. + */ + public function supportsStreamFilterOnRead(): bool + { + return $this->document instanceof Stream + && (static::STREAM_FILTER_MODE & STREAM_FILTER_READ) === STREAM_FILTER_READ; + } + + /** + * Tells whether the stream filter write capabilities can be used. + */ + public function supportsStreamFilterOnWrite(): bool + { + return $this->document instanceof Stream + && (static::STREAM_FILTER_MODE & STREAM_FILTER_WRITE) === STREAM_FILTER_WRITE; + } + /** * Tell whether the specify stream filter is attach to the current stream. */ @@ -264,7 +236,7 @@ abstract class AbstractCsv implements ByteSequence } /** - * Retuns the CSV document as a Generator of string chunk. + * Returns the CSV document as a Generator of string chunk. * * @param int $length number of bytes read * @@ -273,14 +245,16 @@ abstract class AbstractCsv implements ByteSequence public function chunk(int $length): Generator { if ($length < 1) { - throw new InvalidArgument(sprintf('%s() expects the length to be a positive integer %d given', __METHOD__, $length)); + throw InvalidArgument::dueToInvalidChunkSize($length, __METHOD__); } $input_bom = $this->getInputBOM(); $this->document->rewind(); $this->document->setFlags(0); $this->document->fseek(strlen($input_bom)); - foreach (str_split($this->output_bom.$this->document->fread($length), $length) as $chunk) { + /** @var array $chunks */ + $chunks = str_split($this->output_bom.$this->document->fread($length), $length); + foreach ($chunks as $chunk) { yield $chunk; } @@ -292,20 +266,35 @@ abstract class AbstractCsv implements ByteSequence /** * DEPRECATION WARNING! This method will be removed in the next major point release. * - * @deprecated deprecated since version 9.1.0 - * @see AbstractCsv::getContent + * @deprecated since version 9.1.0 + * @see AbstractCsv::toString * * Retrieves the CSV content */ public function __toString(): string { - return $this->getContent(); + return $this->toString(); } /** * Retrieves the CSV content. + * + * DEPRECATION WARNING! This method will be removed in the next major point release + * + * @deprecated since version 9.7.0 + * @see AbstractCsv::toString */ public function getContent(): string + { + return $this->toString(); + } + + /** + * Retrieves the CSV content. + * + * @throws Exception If the string representation can not be returned + */ + public function toString(): string { $raw = ''; foreach ($this->chunk(8192) as $chunk) { @@ -334,7 +323,7 @@ abstract class AbstractCsv implements ByteSequence echo $this->output_bom; - return strlen($this->output_bom) + $this->document->fpassthru(); + return strlen($this->output_bom) + (int) $this->document->fpassthru(); } /** @@ -346,10 +335,10 @@ abstract class AbstractCsv implements ByteSequence * * @see https://tools.ietf.org/html/rfc6266#section-4.3 */ - protected function sendHeaders(string $filename) + protected function sendHeaders(string $filename): void { if (strlen($filename) != strcspn($filename, '\\/')) { - throw new InvalidArgument('The filename cannot contain the "/" and "\\" characters.'); + throw InvalidArgument::dueToInvalidHeaderFilename($filename); } $flag = FILTER_FLAG_STRIP_LOW; @@ -357,10 +346,12 @@ abstract class AbstractCsv implements ByteSequence $flag |= FILTER_FLAG_STRIP_HIGH; } - $filenameFallback = str_replace('%', '', filter_var($filename, FILTER_SANITIZE_STRING, $flag)); + /** @var string $filtered_name */ + $filtered_name = filter_var($filename, FILTER_UNSAFE_RAW, $flag); + $filename_fallback = str_replace('%', '', $filtered_name); - $disposition = sprintf('attachment; filename="%s"', str_replace('"', '\\"', $filenameFallback)); - if ($filename !== $filenameFallback) { + $disposition = sprintf('attachment; filename="%s"', str_replace('"', '\\"', $filename_fallback)); + if ($filename !== $filename_fallback) { $disposition .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); } @@ -373,7 +364,7 @@ abstract class AbstractCsv implements ByteSequence /** * Sets the field delimiter. * - * @throws Exception If the Csv control character is not one character only. + * @throws InvalidArgument If the Csv control character is not one character only. * * @return static */ @@ -383,20 +374,20 @@ abstract class AbstractCsv implements ByteSequence return $this; } - if (1 === strlen($delimiter)) { - $this->delimiter = $delimiter; - $this->resetProperties(); - - return $this; + if (1 !== strlen($delimiter)) { + throw InvalidArgument::dueToInvalidDelimiterCharacter($delimiter, __METHOD__); } - throw new InvalidArgument(sprintf('%s() expects delimiter to be a single character %s given', __METHOD__, $delimiter)); + $this->delimiter = $delimiter; + $this->resetProperties(); + + return $this; } /** * Sets the field enclosure. * - * @throws Exception If the Csv control character is not one character only. + * @throws InvalidArgument If the Csv control character is not one character only. * * @return static */ @@ -406,20 +397,20 @@ abstract class AbstractCsv implements ByteSequence return $this; } - if (1 === strlen($enclosure)) { - $this->enclosure = $enclosure; - $this->resetProperties(); - - return $this; + if (1 !== strlen($enclosure)) { + throw InvalidArgument::dueToInvalidEnclosureCharacter($enclosure, __METHOD__); } - throw new InvalidArgument(sprintf('%s() expects enclosure to be a single character %s given', __METHOD__, $enclosure)); + $this->enclosure = $enclosure; + $this->resetProperties(); + + return $this; } /** * Sets the field escape character. * - * @throws Exception If the Csv control character is not one character only. + * @throws InvalidArgument If the Csv control character is not one character only. * * @return static */ @@ -429,14 +420,14 @@ abstract class AbstractCsv implements ByteSequence return $this; } - if ('' === $escape || 1 === strlen($escape)) { - $this->escape = $escape; - $this->resetProperties(); - - return $this; + if ('' !== $escape && 1 !== strlen($escape)) { + throw InvalidArgument::dueToInvalidEscapeCharacter($escape, __METHOD__); } - throw new InvalidArgument(sprintf('%s() expects escape to be a single character or the empty string %s given', __METHOD__, $escape)); + $this->escape = $escape; + $this->resetProperties(); + + return $this; } /** @@ -478,19 +469,20 @@ abstract class AbstractCsv implements ByteSequence /** * append a stream filter. * - * @param null|mixed $params + * @param null|array $params * - * @throws Exception If the stream filter API can not be used + * @throws InvalidArgument If the stream filter API can not be appended + * @throws UnavailableFeature If the stream filter API can not be used * * @return static */ public function addStreamFilter(string $filtername, $params = null): self { if (!$this->document instanceof Stream) { - throw new UnavailableFeature('The stream filter API can not be used with a '.get_class($this->document).' instance.'); + throw UnavailableFeature::dueToUnsupportedStreamFilterApi(get_class($this->document)); } - $this->document->appendFilter($filtername, $this->stream_filter_mode, $params); + $this->document->appendFilter($filtername, static::STREAM_FILTER_MODE, $params); $this->stream_filters[$filtername] = true; $this->resetProperties(); $this->input_bom = null; diff --git a/vendor/league/csv/src/ByteSequence.php b/vendor/league/csv/src/ByteSequence.php index deb01863f..6ae9d231f 100644 --- a/vendor/league/csv/src/ByteSequence.php +++ b/vendor/league/csv/src/ByteSequence.php @@ -16,28 +16,9 @@ namespace League\Csv; */ interface ByteSequence { - /** - * UTF-8 BOM sequence. - */ const BOM_UTF8 = "\xEF\xBB\xBF"; - - /** - * UTF-16 BE BOM sequence. - */ const BOM_UTF16_BE = "\xFE\xFF"; - - /** - * UTF-16 LE BOM sequence. - */ const BOM_UTF16_LE = "\xFF\xFE"; - - /** - * UTF-32 BE BOM sequence. - */ const BOM_UTF32_BE = "\x00\x00\xFE\xFF"; - - /** - * UTF-32 LE BOM sequence. - */ const BOM_UTF32_LE = "\xFF\xFE\x00\x00"; } diff --git a/vendor/league/csv/src/CannotInsertRecord.php b/vendor/league/csv/src/CannotInsertRecord.php index da26e5fd2..040168ecc 100644 --- a/vendor/league/csv/src/CannotInsertRecord.php +++ b/vendor/league/csv/src/CannotInsertRecord.php @@ -18,26 +18,17 @@ namespace League\Csv; */ class CannotInsertRecord extends Exception { - /** - * The record submitted for insertion. - * - * @var array - */ - protected $record; - - /** - * Validator which did not validated the data. - * - * @var string - */ - protected $name = ''; + /** The record submitted for insertion. */ + protected array $record; + /** Validator which did not validated the data. */ + protected string $name = ''; /** * Create an Exception from a record insertion into a stream. */ public static function triggerOnInsertion(array $record): self { - $exception = new static('Unable to write record to the CSV document'); + $exception = new self('Unable to write record to the CSV document'); $exception->record = $record; return $exception; @@ -48,7 +39,7 @@ class CannotInsertRecord extends Exception */ public static function triggerOnValidation(string $name, array $record): self { - $exception = new static('Record validation failed'); + $exception = new self('Record validation failed'); $exception->name = $name; $exception->record = $record; diff --git a/vendor/league/csv/src/CharsetConverter.php b/vendor/league/csv/src/CharsetConverter.php index e585c640f..4f06a909e 100644 --- a/vendor/league/csv/src/CharsetConverter.php +++ b/vendor/league/csv/src/CharsetConverter.php @@ -16,13 +16,9 @@ namespace League\Csv; use OutOfRangeException; use php_user_filter; use Traversable; -use TypeError; use function array_combine; use function array_map; -use function array_walk; -use function gettype; use function in_array; -use function is_iterable; use function is_numeric; use function mb_convert_encoding; use function mb_list_encodings; @@ -43,34 +39,8 @@ class CharsetConverter extends php_user_filter { const FILTERNAME = 'convert.league.csv'; - /** - * the filter name used to instantiate the class with. - * - * @var string - */ - public $filtername; - - /** - * Contents of the params parameter passed to stream_filter_append - * or stream_filter_prepend functions. - * - * @var mixed - */ - public $params; - - /** - * The records input encoding charset. - * - * @var string - */ - protected $input_encoding = 'UTF-8'; - - /** - * The records output encoding charset. - * - * @var string - */ - protected $output_encoding = 'UTF-8'; + protected string $input_encoding = 'UTF-8'; + protected string $output_encoding = 'UTF-8'; /** * Static method to add the stream filter to a {@link AbstractCsv} object. @@ -85,11 +55,11 @@ class CharsetConverter extends php_user_filter /** * Static method to register the class as a stream filter. */ - public static function register() + public static function register(): void { - $filtername = self::FILTERNAME.'.*'; - if (!in_array($filtername, stream_get_filters(), true)) { - stream_filter_register($filtername, self::class); + $filter_name = self::FILTERNAME.'.*'; + if (!in_array($filter_name, stream_get_filters(), true)) { + stream_filter_register($filter_name, self::class); } } @@ -124,13 +94,10 @@ class CharsetConverter extends php_user_filter return $encoding_list[$key]; } - throw new OutOfRangeException(sprintf('The submitted charset %s is not supported by the mbstring extension', $encoding)); + throw new OutOfRangeException('The submitted charset '.$encoding.' is not supported by the mbstring extension.'); } - /** - * {@inheritdoc} - */ - public function onCreate() + public function onCreate(): bool { $prefix = self::FILTERNAME.'.'; if (0 !== strpos($this->filtername, $prefix)) { @@ -143,8 +110,8 @@ class CharsetConverter extends php_user_filter } try { - $this->input_encoding = $this->filterEncoding($matches['input']); - $this->output_encoding = $this->filterEncoding($matches['output']); + $this->input_encoding = self::filterEncoding($matches['input']); + $this->output_encoding = self::filterEncoding($matches['output']); } catch (OutOfRangeException $e) { return false; } @@ -153,14 +120,17 @@ class CharsetConverter extends php_user_filter } /** - * {@inheritdoc} + * @param resource $in + * @param resource $out + * @param int $consumed + * @param bool $closing */ - public function filter($in, $out, &$consumed, $closing) + public function filter($in, $out, &$consumed, $closing): int { - while ($res = stream_bucket_make_writeable($in)) { - $res->data = @mb_convert_encoding($res->data, $this->output_encoding, $this->input_encoding); - $consumed += $res->datalen; - stream_bucket_append($out, $res); + while (null !== ($bucket = stream_bucket_make_writeable($in))) { + $bucket->data = @mb_convert_encoding($bucket->data, $this->output_encoding, $this->input_encoding); + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; @@ -168,17 +138,9 @@ class CharsetConverter extends php_user_filter /** * Convert Csv records collection into UTF-8. - * - * @param array|Traversable $records - * - * @return array|Traversable */ - public function convert($records) + public function convert(iterable $records): iterable { - if (!is_iterable($records)) { - throw new TypeError(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($records))); - } - if ($this->output_encoding === $this->input_encoding) { return $records; } @@ -187,6 +149,7 @@ class CharsetConverter extends php_user_filter return array_map($this, $records); } + /* @var Traversable $records */ return new MapIterator($records, $this); } @@ -195,26 +158,32 @@ class CharsetConverter extends php_user_filter */ public function __invoke(array $record): array { - array_walk($record, [$this, 'encodeField']); + $outputRecord = []; + foreach ($record as $offset => $value) { + [$newOffset, $newValue] = $this->encodeField($value, $offset); + $outputRecord[$newOffset] = $newValue; + } - return $record; + return $outputRecord; } /** * Walker method to convert the offset and the value of a CSV record field. * - * @param mixed $value - * @param mixed $offset + * @param int|float|string|null $value can be a scalar type or null + * @param int|string $offset can be a string or an int */ - protected function encodeField(&$value, &$offset) + protected function encodeField($value, $offset): array { if (null !== $value && !is_numeric($value)) { - $value = mb_convert_encoding((string) $value, $this->output_encoding, $this->input_encoding); + $value = mb_convert_encoding($value, $this->output_encoding, $this->input_encoding); } if (!is_numeric($offset)) { - $offset = mb_convert_encoding((string) $offset, $this->output_encoding, $this->input_encoding); + $offset = mb_convert_encoding($offset, $this->output_encoding, $this->input_encoding); } + + return [$offset, $value]; } /** @@ -222,7 +191,7 @@ class CharsetConverter extends php_user_filter */ public function inputEncoding(string $encoding): self { - $encoding = $this->filterEncoding($encoding); + $encoding = self::filterEncoding($encoding); if ($encoding === $this->input_encoding) { return $this; } @@ -238,7 +207,7 @@ class CharsetConverter extends php_user_filter */ public function outputEncoding(string $encoding): self { - $encoding = $this->filterEncoding($encoding); + $encoding = self::filterEncoding($encoding); if ($encoding === $this->output_encoding) { return $this; } diff --git a/vendor/league/csv/src/ColumnConsistency.php b/vendor/league/csv/src/ColumnConsistency.php index 7b2cd689c..5386997c7 100644 --- a/vendor/league/csv/src/ColumnConsistency.php +++ b/vendor/league/csv/src/ColumnConsistency.php @@ -14,29 +14,21 @@ declare(strict_types=1); namespace League\Csv; use function count; -use function sprintf; /** * Validates column consistency when inserting records into a CSV document. */ class ColumnConsistency { - /** - * The number of column per record. - * - * @var int - */ - protected $columns_count; + protected int $columns_count; /** - * New Instance. - * - * @throws OutOfRangeException if the column count is lesser than -1 + * @throws InvalidArgument if the column count is lesser than -1 */ public function __construct(int $columns_count = -1) { if ($columns_count < -1) { - throw new Exception(sprintf('%s() expects the column count to be greater or equal to -1 %s given', __METHOD__, $columns_count)); + throw InvalidArgument::dueToInvalidColumnCount($columns_count, __METHOD__); } $this->columns_count = $columns_count; diff --git a/vendor/league/csv/src/EncloseField.php b/vendor/league/csv/src/EncloseField.php index e0cb65bd5..08c44c5a1 100644 --- a/vendor/league/csv/src/EncloseField.php +++ b/vendor/league/csv/src/EncloseField.php @@ -15,6 +15,7 @@ namespace League\Csv; use InvalidArgumentException; use php_user_filter; +use function array_map; use function in_array; use function str_replace; use function strcspn; @@ -34,34 +35,10 @@ class EncloseField extends php_user_filter { const FILTERNAME = 'convert.league.csv.enclosure'; - /** - * the filter name used to instantiate the class with. - * - * @var string - */ - public $filtername; - - /** - * Contents of the params parameter passed to stream_filter_append - * or stream_filter_prepend functions. - * - * @var mixed - */ - public $params; - - /** - * Default sequence. - * - * @var string - */ - protected $sequence; - - /** - * Characters that triggers enclosure in PHP. - * - * @var string - */ - protected static $force_enclosure = "\n\r\t "; + /** Default sequence. */ + protected string $sequence; + /** Characters that triggers enclosure in PHP. */ + protected static string $force_enclosure = "\n\r\t "; /** * Static method to return the stream filter filtername. @@ -74,7 +51,7 @@ class EncloseField extends php_user_filter /** * Static method to register the class as a stream filter. */ - public static function register() + public static function register(): void { if (!in_array(self::FILTERNAME, stream_get_filters(), true)) { stream_filter_register(self::FILTERNAME, self::class); @@ -85,6 +62,7 @@ class EncloseField extends php_user_filter * Static method to add the stream filter to a {@link Writer} object. * * @throws InvalidArgumentException if the sequence is malformed + * @throws Exception */ public static function addTo(Writer $csv, string $sequence): Writer { @@ -94,17 +72,8 @@ class EncloseField extends php_user_filter throw new InvalidArgumentException('The sequence must contain at least one character to force enclosure'); } - $formatter = static function (array $record) use ($sequence) { - foreach ($record as &$value) { - $value = $sequence.$value; - } - unset($value); - - return $record; - }; - return $csv - ->addFormatter($formatter) + ->addFormatter(fn (array $record): array => array_map(fn (?string $value): string => $sequence.$value, $record)) ->addStreamFilter(self::FILTERNAME, ['sequence' => $sequence]); } @@ -118,24 +87,24 @@ class EncloseField extends php_user_filter return strlen($sequence) != strcspn($sequence, self::$force_enclosure); } - /** - * {@inheritdoc} - */ - public function onCreate() + public function onCreate(): bool { return isset($this->params['sequence']) - && $this->isValidSequence($this->params['sequence']); + && self::isValidSequence($this->params['sequence']); } /** - * {@inheritdoc} + * @param resource $in + * @param resource $out + * @param int $consumed + * @param bool $closing */ - public function filter($in, $out, &$consumed, $closing) + public function filter($in, $out, &$consumed, $closing): int { - while ($res = stream_bucket_make_writeable($in)) { - $res->data = str_replace($this->params['sequence'], '', $res->data); - $consumed += $res->datalen; - stream_bucket_append($out, $res); + while (null !== ($bucket = stream_bucket_make_writeable($in))) { + $bucket->data = str_replace($this->params['sequence'], '', $bucket->data); + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; diff --git a/vendor/league/csv/src/EscapeFormula.php b/vendor/league/csv/src/EscapeFormula.php index 5b8065113..215544e49 100644 --- a/vendor/league/csv/src/EscapeFormula.php +++ b/vendor/league/csv/src/EscapeFormula.php @@ -22,7 +22,6 @@ use function array_unique; use function is_object; use function is_string; use function method_exists; -use function sprintf; /** * A Formatter to tackle CSV Formula Injection. @@ -31,41 +30,26 @@ use function sprintf; */ class EscapeFormula { - /** - * Spreadsheet formula starting character. - */ - const FORMULA_STARTING_CHARS = ['=', '-', '+', '@']; + /** Spreadsheet formula starting character. */ + const FORMULA_STARTING_CHARS = ['=', '-', '+', '@', "\t", "\r"]; + + /** Effective Spreadsheet formula starting characters. */ + protected array $special_chars = []; + /** Escape character to escape each CSV formula field. */ + protected string $escape; /** - * Effective Spreadsheet formula starting characters. - * - * @var array - */ - protected $special_chars = []; - - /** - * Escape character to escape each CSV formula field. - * - * @var string - */ - protected $escape; - - /** - * New instance. - * * @param string $escape escape character to escape each CSV formula field * @param string[] $special_chars additional spreadsheet formula starting characters - * */ - public function __construct(string $escape = "\t", array $special_chars = []) + public function __construct(string $escape = "'", array $special_chars = []) { $this->escape = $escape; if ([] !== $special_chars) { $special_chars = $this->filterSpecialCharacters(...$special_chars); } - $chars = array_merge(self::FORMULA_STARTING_CHARS, $special_chars); - $chars = array_unique($chars); + $chars = array_unique(array_merge(self::FORMULA_STARTING_CHARS, $special_chars)); $this->special_chars = array_fill_keys($chars, 1); } @@ -76,13 +60,13 @@ class EscapeFormula * * @throws InvalidArgumentException if the string is not a single character * - * @return string[] + * @return array */ protected function filterSpecialCharacters(string ...$characters): array { foreach ($characters as $str) { if (1 != strlen($str)) { - throw new InvalidArgumentException(sprintf('The submitted string %s must be a single character', $str)); + throw new InvalidArgumentException('The submitted string '.$str.' must be a single character'); } } @@ -92,7 +76,7 @@ class EscapeFormula /** * Returns the list of character the instance will escape. * - * @return string[] + * @return array */ public function getSpecialCharacters(): array { @@ -126,11 +110,15 @@ class EscapeFormula } /** - * Escape a CSV cell. + * Escape a CSV cell if its content is stringable. + * + * @param int|float|string|object|resource|array $cell the content of the cell + * + * @return mixed the escaped content */ protected function escapeField($cell) { - if (!$this->isStringable($cell)) { + if (!is_string($cell) && (!is_object($cell) || !method_exists($cell, '__toString'))) { return $cell; } @@ -143,10 +131,16 @@ class EscapeFormula } /** - * Tell whether the submitted value is stringable. + * @deprecated since 9.7.2 will be removed in the next major release + * @codeCoverageIgnore + * + * Tells whether the submitted value is stringable. + * + * @param mixed $value value to check if it is stringable */ protected function isStringable($value): bool { - return is_string($value) || (is_object($value) && method_exists($value, '__toString')); + return is_string($value) + || (is_object($value) && method_exists($value, '__toString')); } } diff --git a/vendor/league/csv/src/Exception.php b/vendor/league/csv/src/Exception.php index 90facb03e..76865e85d 100644 --- a/vendor/league/csv/src/Exception.php +++ b/vendor/league/csv/src/Exception.php @@ -13,9 +13,11 @@ declare(strict_types=1); namespace League\Csv; +use Exception as PhpException; + /** * League Csv Base Exception. */ -class Exception extends \Exception +class Exception extends PhpException implements UnableToProcessCsv { } diff --git a/vendor/league/csv/src/HTMLConverter.php b/vendor/league/csv/src/HTMLConverter.php index 8d8418003..7924274d9 100644 --- a/vendor/league/csv/src/HTMLConverter.php +++ b/vendor/league/csv/src/HTMLConverter.php @@ -16,7 +16,6 @@ namespace League\Csv; use DOMDocument; use DOMElement; use DOMException; -use Traversable; use function preg_match; /** @@ -24,31 +23,26 @@ use function preg_match; */ class HTMLConverter { + /** table class attribute value. */ + protected string $class_name = 'table-csv-data'; + /** table id attribute value. */ + protected string $id_value = ''; + protected XMLConverter $xml_converter; + + public static function create(): self + { + return new self(); + } + /** - * table class attribute value. + * DEPRECATION WARNING! This method will be removed in the next major point release. * - * @var string - */ - protected $class_name = 'table-csv-data'; - - /** - * table id attribute value. - * - * @var string - */ - protected $id_value = ''; - - /** - * @var XMLConverter - */ - protected $xml_converter; - - /** - * New Instance. + * @deprecated since version 9.7.0 + * @see HTMLConverterTest::create() */ public function __construct() { - $this->xml_converter = (new XMLConverter()) + $this->xml_converter = XMLConverter::create() ->rootElement('table') ->recordElement('tr') ->fieldElement('td') @@ -58,11 +52,10 @@ class HTMLConverter /** * Converts a tabular data collection into a HTML table string. * - * @param array|Traversable $records The tabular data collection - * @param string[] $header_record An optional array of headers outputted using the`` section - * @param string[] $footer_record An optional array of footers to output to the table using `` and `` elements + * @param string[] $header_record An optional array of headers outputted using the`` section + * @param string[] $footer_record An optional array of footers to output to the table using `` and `` elements */ - public function convert($records, array $header_record = [], array $footer_record = []): string + public function convert(iterable $records, array $header_record = [], array $footer_record = []): string { $doc = new DOMDocument('1.0'); if ([] === $header_record && [] === $footer_record) { @@ -70,33 +63,44 @@ class HTMLConverter $this->addHTMLAttributes($table); $doc->appendChild($table); - return $doc->saveHTML(); + /** @var string $content */ + $content = $doc->saveHTML(); + + return $content; } $table = $doc->createElement('table'); + $this->addHTMLAttributes($table); $this->appendHeaderSection('thead', $header_record, $table); $this->appendHeaderSection('tfoot', $footer_record, $table); + $table->appendChild($this->xml_converter->rootElement('tbody')->import($records, $doc)); + $doc->appendChild($table); - return $doc->saveHTML(); + /** @var string $content */ + $content = $doc->saveHTML(); + + return $content; } /** * Creates a DOMElement representing a HTML table heading section. */ - protected function appendHeaderSection(string $node_name, array $record, DOMElement $table) + protected function appendHeaderSection(string $node_name, array $record, DOMElement $table): void { if ([] === $record) { return; } + /** @var DOMDocument $ownerDocument */ + $ownerDocument = $table->ownerDocument; $node = $this->xml_converter ->rootElement($node_name) ->recordElement('tr') ->fieldElement('th') - ->import([$record], $table->ownerDocument) + ->import([$record], $ownerDocument) ; /** @var DOMElement $element */ @@ -110,7 +114,7 @@ class HTMLConverter /** * Adds class and id attributes to an HTML tag. */ - protected function addHTMLAttributes(DOMElement $node) + protected function addHTMLAttributes(DOMElement $node): void { $node->setAttribute('class', $this->class_name); $node->setAttribute('id', $this->id_value); diff --git a/vendor/league/csv/src/Info.php b/vendor/league/csv/src/Info.php new file mode 100644 index 000000000..e9cc634d4 --- /dev/null +++ b/vendor/league/csv/src/Info.php @@ -0,0 +1,99 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\Csv; + +use function array_fill_keys; +use function array_filter; +use function array_reduce; +use function array_unique; +use function count; +use function iterator_to_array; +use function strlen; +use function strpos; +use const COUNT_RECURSIVE; + +final class Info implements ByteSequence +{ + private const BOM_SEQUENCE_LIST = [ + self::BOM_UTF32_BE, + self::BOM_UTF32_LE, + self::BOM_UTF16_BE, + self::BOM_UTF16_LE, + self::BOM_UTF8, + ]; + + /** + * Returns the BOM sequence found at the start of the string. + * + * If no valid BOM sequence is found an empty string is returned + */ + public static function fetchBOMSequence(string $str): ?string + { + foreach (self::BOM_SEQUENCE_LIST as $sequence) { + if (0 === strpos($str, $sequence)) { + return $sequence; + } + } + + return null; + } + + /** + * Detect Delimiters usage in a {@link Reader} object. + * + * Returns a associative array where each key represents + * a submitted delimiter and each value the number CSV fields found + * when processing at most $limit CSV records with the given delimiter + * + * @param string[] $delimiters + * + * @return array + */ + public static function getDelimiterStats(Reader $csv, array $delimiters, int $limit = 1): array + { + $delimiterFilter = static fn (string $value): bool => 1 === strlen($value); + + $recordFilter = static fn (array $record): bool => 1 < count($record); + + $stmt = Statement::create()->offset(0)->limit($limit); + + $delimiterStats = static function (array $stats, string $delimiter) use ($csv, $stmt, $recordFilter): array { + $csv->setDelimiter($delimiter); + $foundRecords = array_filter( + iterator_to_array($stmt->process($csv)->getRecords(), false), + $recordFilter + ); + + $stats[$delimiter] = count($foundRecords, COUNT_RECURSIVE); + + return $stats; + }; + + $currentDelimiter = $csv->getDelimiter(); + $currentHeaderOffset = $csv->getHeaderOffset(); + + $csv->setHeaderOffset(null); + + $stats = array_reduce( + array_unique(array_filter($delimiters, $delimiterFilter)), + $delimiterStats, + array_fill_keys($delimiters, 0) + ); + + $csv->setHeaderOffset($currentHeaderOffset); + $csv->setDelimiter($currentDelimiter); + + return $stats; + } +} diff --git a/vendor/league/csv/src/InvalidArgument.php b/vendor/league/csv/src/InvalidArgument.php index 7cc94932d..fbfecc4a9 100644 --- a/vendor/league/csv/src/InvalidArgument.php +++ b/vendor/league/csv/src/InvalidArgument.php @@ -13,9 +13,88 @@ declare(strict_types=1); namespace League\Csv; +use Throwable; + /** * InvalidArgument Exception. */ class InvalidArgument extends Exception { + /** + * DEPRECATION WARNING! This class will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + */ + public function __construct(string $message = '', int $code = 0, Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + } + + public static function dueToInvalidChunkSize(int $length, string $method): self + { + return new self($method.'() expects the length to be a positive integer '.$length.' given.'); + } + + public static function dueToInvalidHeaderFilename(string $filename): self + { + return new self('The filename `'.$filename.'` cannot contain the "/" and "\\" characters.'); + } + + public static function dueToInvalidDelimiterCharacter(string $delimiter, string $method): self + { + return new self($method.'() expects delimiter to be a single character; `'.$delimiter.'` given.'); + } + + public static function dueToInvalidEnclosureCharacter(string $enclosure, string $method): self + { + return new self($method.'() expects enclosure to be a single character; `'.$enclosure.'` given.'); + } + + public static function dueToInvalidEscapeCharacter(string $escape, string $method): self + { + return new self($method.'() expects escape to be a single character or the empty string; `'.$escape.'` given.'); + } + + public static function dueToInvalidColumnCount(int $columns_count, string $method): self + { + return new self($method.'() expects the column count to be greater or equal to -1 '.$columns_count.' given.'); + } + + public static function dueToInvalidHeaderOffset(int $offset, string $method): self + { + return new self($method.'() expects header offset to be greater or equal to 0; `'.$offset.'` given.'); + } + + public static function dueToInvalidRecordOffset(int $offset, string $method): self + { + return new self($method.'() expects the submitted offset to be a positive integer or 0, '.$offset.' given'); + } + + /** + * @param string|int $index + */ + public static function dueToInvalidColumnIndex($index, string $type, string $method): self + { + return new self($method.'() expects the '.$type.' index to be a valid string or integer, `'.$index.'` given'); + } + + public static function dueToInvalidLimit(int $limit, string $method): self + { + return new self($method.'() expects the limit to be greater or equal to -1, '.$limit.' given.'); + } + + public static function dueToInvalidSeekingPosition(int $position, string $method): self + { + return new self($method.'() can\'t seek stream to negative line '.$position); + } + + public static function dueToStreamFilterNotFound(string $filtername): self + { + return new self('unable to locate filter `'.$filtername.'`'); + } + + public static function dueToInvalidThreshold(int $threshold, string $method): self + { + return new self($method.'() expects threshold to be null or a valid integer greater or equal to 1'); + } } diff --git a/vendor/league/csv/src/MapIterator.php b/vendor/league/csv/src/MapIterator.php index 3c96733af..ffaab6559 100644 --- a/vendor/league/csv/src/MapIterator.php +++ b/vendor/league/csv/src/MapIterator.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace League\Csv; use IteratorIterator; +use ReturnTypeWillChange; use Traversable; /** @@ -21,18 +22,11 @@ use Traversable; * * @internal used internally to modify CSV content */ -class MapIterator extends IteratorIterator +final class MapIterator extends IteratorIterator { - /** - * The callback to apply on all InnerIterator current value. - * - * @var callable - */ - protected $callable; + /** @var callable The callback to apply on all InnerIterator current value. */ + private $callable; - /** - * New instance. - */ public function __construct(Traversable $iterator, callable $callable) { parent::__construct($iterator); @@ -40,10 +34,11 @@ class MapIterator extends IteratorIterator } /** - * {@inheritdoc} + * @return mixed The value of the current element. */ + #[ReturnTypeWillChange] public function current() { - return ($this->callable)(parent::current(), $this->key()); + return ($this->callable)(parent::current(), parent::key()); } } diff --git a/vendor/league/csv/src/Polyfill/EmptyEscapeParser.php b/vendor/league/csv/src/Polyfill/EmptyEscapeParser.php deleted file mode 100644 index c479aba36..000000000 --- a/vendor/league/csv/src/Polyfill/EmptyEscapeParser.php +++ /dev/null @@ -1,254 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace League\Csv\Polyfill; - -use Generator; -use League\Csv\Stream; -use SplFileObject; -use TypeError; -use function explode; -use function get_class; -use function gettype; -use function in_array; -use function is_object; -use function ltrim; -use function rtrim; -use function sprintf; -use function str_replace; -use function substr; - -/** - * A Polyfill to PHP's SplFileObject to enable parsing the CSV document - * without taking into account the escape character. - * - * @see https://php.net/manual/en/function.fgetcsv.php - * @see https://php.net/manual/en/function.fgets.php - * @see https://tools.ietf.org/html/rfc4180 - * @see http://edoceo.com/utilitas/csv-file-format - * - * @internal used internally to parse a CSV document without using the escape character - */ -final class EmptyEscapeParser -{ - /** - * @internal - */ - const FIELD_BREAKS = [false, '', "\r\n", "\n", "\r"]; - - /** - * @var SplFileObject|Stream - */ - private static $document; - - /** - * @var string - */ - private static $delimiter; - - /** - * @var string - */ - private static $enclosure; - - /** - * @var string - */ - private static $trim_mask; - - /** - * @var string|false - */ - private static $line; - - /** - * @codeCoverageIgnore - */ - private function __construct() - { - } - - /** - * Converts the document into a CSV record iterator. - * - * In PHP7.4+ you'll be able to do - * - * - * $file = new SplFileObject('/path/to/file.csv', 'r'); - * $file->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY); - * $file->setCsvControl($delimiter, $enclosure, ''); - * foreach ($file as $record) { - * //$record escape mechanism is blocked by the empty string - * } - * - * - * In PHP7.3- you can do - * - * - * $file = new SplFileObject('/path/to/file.csv', 'r'); - * $it = EmptyEscapeParser::parse($file); //parsing will be done while ignoring the escape character value. - * foreach ($it as $record) { - * //fgetcsv is not directly use hence the escape char is not taken into account - * } - * - * - * Each record array contains strings elements. - * - * @param SplFileObject|Stream $document - * - * @return Generator|array[] - */ - public static function parse($document): Generator - { - self::$document = self::filterDocument($document); - list(self::$delimiter, self::$enclosure, ) = self::$document->getCsvControl(); - self::$trim_mask = str_replace([self::$delimiter, self::$enclosure], '', " \t\0\x0B"); - self::$document->setFlags(0); - self::$document->rewind(); - while (self::$document->valid()) { - $record = self::extractRecord(); - if ([null] === $record || !in_array(null, $record, true)) { - yield $record; - } - } - } - - /** - * Filters the submitted document. - * - * @param SplFileObject|Stream $document - * - * @return SplFileObject|Stream - */ - private static function filterDocument($document) - { - if ($document instanceof Stream || $document instanceof SplFileObject) { - return $document; - } - - throw new TypeError(sprintf( - '%s::parse expects parameter 1 to be a %s or a SplFileObject object, %s given', - self::class, - Stream::class, - is_object($document) ? get_class($document) : gettype($document) - )); - } - - /** - * Extracts a record form the CSV document. - */ - private static function extractRecord(): array - { - $record = []; - self::$line = self::$document->fgets(); - do { - $method = 'extractFieldContent'; - $buffer = ''; - if (false !== self::$line) { - $buffer = ltrim(self::$line, self::$trim_mask); - } - if (($buffer[0] ?? '') === self::$enclosure) { - $method = 'extractEnclosedFieldContent'; - self::$line = $buffer; - } - - $record[] = self::$method(); - } while (false !== self::$line); - - return $record; - } - - /** - * Extracts the content from a field without enclosure. - * - * - Field content can not spread on multiple document lines. - * - Content must be preserved. - * - Trailing line-breaks must be removed. - * - * @return string|null - */ - private static function extractFieldContent() - { - if (in_array(self::$line, self::FIELD_BREAKS, true)) { - self::$line = false; - - return null; - } - - list($content, self::$line) = explode(self::$delimiter, self::$line, 2) + [1 => false]; - if (false === self::$line) { - return rtrim($content, "\r\n"); - } - - return $content; - } - - /** - * Extracts the content from a field with enclosure. - * - * - Field content can spread on multiple document lines. - * - Content between consecutive enclosure characters must be preserved. - * - Double enclosure sequence must be replaced by single enclosure character. - * - Trailing line break must be removed if they are not part of the field content. - * - Invalid field content is treated as per fgetcsv behavior. - * - * @return string|null - */ - private static function extractEnclosedFieldContent() - { - if ((self::$line[0] ?? '') === self::$enclosure) { - self::$line = substr(self::$line, 1); - } - - $content = ''; - while (false !== self::$line) { - list($buffer, $remainder) = explode(self::$enclosure, self::$line, 2) + [1 => false]; - $content .= $buffer; - self::$line = $remainder; - if (false !== self::$line) { - break; - } - - if (self::$document->valid()) { - self::$line = self::$document->fgets(); - continue; - } - - if ($buffer === rtrim($content, "\r\n")) { - return null; - } - } - - if (in_array(self::$line, self::FIELD_BREAKS, true)) { - self::$line = false; - if (!self::$document->valid()) { - return $content; - } - - return rtrim($content, "\r\n"); - } - - $char = self::$line[0] ?? ''; - if ($char === self::$delimiter) { - self::$line = substr(self::$line, 1); - - return $content; - } - - if ($char === self::$enclosure) { - return $content.self::$enclosure.self::extractEnclosedFieldContent(); - } - - return $content.self::extractFieldContent(); - } -} diff --git a/vendor/league/csv/src/RFC4180Field.php b/vendor/league/csv/src/RFC4180Field.php index e054868e8..aa2ffe97c 100644 --- a/vendor/league/csv/src/RFC4180Field.php +++ b/vendor/league/csv/src/RFC4180Field.php @@ -33,50 +33,34 @@ use const STREAM_FILTER_WRITE; * * DEPRECATION WARNING! This class will be removed in the next major point release * - * @deprecated deprecated since version 9.2.0 + * @deprecated since version 9.2.0 * @see AbstractCsv::setEscape * * @see https://tools.ietf.org/html/rfc4180#section-2 */ class RFC4180Field extends php_user_filter { - const FILTERNAME = 'convert.league.csv.rfc4180'; - - /** - * the filter name used to instantiate the class with. - * - * @var string - */ - public $filtername; - - /** - * Contents of the params parameter passed to stream_filter_append - * or stream_filter_prepend functions. - * - * @var mixed - */ - public $params; + public const FILTERNAME = 'convert.league.csv.rfc4180'; /** * The value being search for. * * @var string[] */ - protected $search; + protected array $search; /** * The replacement value that replace found $search values. * * @var string[] */ - protected $replace; + protected array $replace; /** * Characters that triggers enclosure with PHP fputcsv. * - * @var string */ - protected static $force_enclosure = "\n\r\t "; + protected static string $force_enclosure = "\n\r\t "; /** * Static method to add the stream filter to a {@link AbstractCsv} object. @@ -109,25 +93,17 @@ class RFC4180Field extends php_user_filter throw new InvalidArgumentException('The sequence contains a character that enforces enclosure or is a CSV control character or is the empty string.'); } - $mapper = static function ($value) use ($whitespace_replace) { - if (is_string($value)) { - return str_replace(' ', $whitespace_replace, $value); - } + $mapper = fn ($value) => is_string($value) + ? str_replace(' ', $whitespace_replace, $value) + : $value; - return $value; - }; - - $formatter = static function (array $record) use ($mapper): array { - return array_map($mapper, $record); - }; - - return $csv->addFormatter($formatter); + return $csv->addFormatter(fn (array $record): array => array_map($mapper, $record)); } /** * Static method to register the class as a stream filter. */ - public static function register() + public static function register(): void { if (!in_array(self::FILTERNAME, stream_get_filters(), true)) { stream_filter_register(self::FILTERNAME, self::class); @@ -143,11 +119,14 @@ class RFC4180Field extends php_user_filter } /** - * {@inheritdoc} + * @param resource $in + * @param resource $out + * @param int $consumed + * @param bool $closing */ - public function filter($in, $out, &$consumed, $closing) + public function filter($in, $out, &$consumed, $closing): int { - while ($bucket = stream_bucket_make_writeable($in)) { + while (null !== ($bucket = stream_bucket_make_writeable($in))) { $bucket->data = str_replace($this->search, $this->replace, $bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); @@ -156,10 +135,7 @@ class RFC4180Field extends php_user_filter return PSFS_PASS_ON; } - /** - * {@inheritdoc} - */ - public function onCreate() + public function onCreate(): bool { if (!$this->isValidParams($this->params)) { return false; diff --git a/vendor/league/csv/src/Reader.php b/vendor/league/csv/src/Reader.php index 10abdf864..c663b6ca8 100644 --- a/vendor/league/csv/src/Reader.php +++ b/vendor/league/csv/src/Reader.php @@ -13,111 +13,55 @@ declare(strict_types=1); namespace League\Csv; -use BadMethodCallException; use CallbackFilterIterator; -use Countable; -use Generator; use Iterator; -use IteratorAggregate; use JsonSerializable; -use League\Csv\Polyfill\EmptyEscapeParser; use SplFileObject; -use TypeError; use function array_combine; use function array_filter; use function array_pad; use function array_slice; use function array_unique; use function count; -use function gettype; use function is_array; use function iterator_count; use function iterator_to_array; use function mb_strlen; use function mb_substr; -use function sprintf; use function strlen; use function substr; -use const PHP_VERSION_ID; use const STREAM_FILTER_READ; /** * A class to parse and read records from a CSV document. - * - * @method array fetchOne(int $nth_record = 0) Returns a single record from the CSV - * @method Generator fetchColumn(string|int $column_index) Returns the next value from a single CSV record field - * @method Generator fetchPairs(string|int $offset_index = 0, string|int $value_index = 1) Fetches the next key-value pairs from the CSV document */ -class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSerializable +class Reader extends AbstractCsv implements TabularDataReader, JsonSerializable { - /** - * header offset. - * - * @var int|null - */ - protected $header_offset; + protected const STREAM_FILTER_MODE = STREAM_FILTER_READ; - /** - * header record. - * - * @var string[] - */ - protected $header = []; + protected ?int $header_offset = null; + protected int $nb_records = -1; + protected bool $is_empty_records_included = false; + /** @var array header record. */ + protected array $header = []; - /** - * records count. - * - * @var int - */ - protected $nb_records = -1; - - /** - * {@inheritdoc} - */ - protected $stream_filter_mode = STREAM_FILTER_READ; - - /** - * @var bool - */ - protected $is_empty_records_included = false; - - /** - * {@inheritdoc} - */ public static function createFromPath(string $path, string $open_mode = 'r', $context = null) { return parent::createFromPath($path, $open_mode, $context); } - /** - * {@inheritdoc} - */ - protected function resetProperties() + protected function resetProperties(): void { - parent::resetProperties(); $this->nb_records = -1; $this->header = []; } - /** - * Returns the header offset. - * - * If no CSV header offset is set this method MUST return null - * - * @return int|null - */ - public function getHeaderOffset() + /** Returns the header offset. */ + public function getHeaderOffset(): ?int { return $this->header_offset; } - /** - * Returns the CSV record used as header. - * - * The returned header is represented as an array of string values - * - * @return string[] - */ public function getHeader(): array { if (null === $this->header_offset) { @@ -138,28 +82,29 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe * * @throws Exception If the header offset is set and no record is found or is the empty array * - * @return string[] + * @return array */ protected function setHeader(int $offset): array { $header = $this->seekRow($offset); - if (false === $header || [] === $header || [null] === $header) { - throw new SyntaxError(sprintf('The header record does not exist or is empty at offset: `%s`', $offset)); + if (in_array($header, [[], [null]], true)) { + throw SyntaxError::dueToHeaderNotFound($offset); } - if (0 === $offset) { - return $this->removeBOM($header, mb_strlen($this->getInputBOM()), $this->enclosure); + if (0 !== $offset) { + return $header; + } + + $header = $this->removeBOM($header, mb_strlen($this->getInputBOM()), $this->enclosure); + if ([''] === $header) { + throw SyntaxError::dueToHeaderNotFound($offset); } return $header; } - /** - * Returns the row at a given offset. - * - * @return array|false - */ - protected function seekRow(int $offset) + /** Returns the row at a given offset. */ + protected function seekRow(int $offset): array { foreach ($this->getDocument() as $index => $record) { if ($offset === $index) { @@ -167,7 +112,7 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe } } - return false; + return []; } /** @@ -175,12 +120,6 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe */ protected function getDocument(): Iterator { - if (70400 > PHP_VERSION_ID && '' === $this->escape) { - $this->document->setCsvControl($this->delimiter, $this->enclosure); - - return EmptyEscapeParser::parse($this->document); - } - $this->document->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD); $this->document->setCsvControl($this->delimiter, $this->enclosure, $this->escape); $this->document->rewind(); @@ -193,7 +132,7 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe * * @param string[] $record * - * @return string[] + * @return array */ protected function removeBOM(array $record, int $bom_length, string $enclosure): array { @@ -211,22 +150,31 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe return $record; } - /** - * {@inheritdoc} - */ - public function __call($method, array $arguments) + public function fetchColumnByName(string $name): Iterator { - static $whitelisted = ['fetchColumn' => 1, 'fetchOne' => 1, 'fetchPairs' => 1]; - if (isset($whitelisted[$method])) { - return (new ResultSet($this->getRecords(), $this->getHeader()))->$method(...$arguments); - } - - throw new BadMethodCallException(sprintf('%s::%s() method does not exist', static::class, $method)); + return ResultSet::createFromTabularDataReader($this)->fetchColumnByName($name); + } + + public function fetchColumnByOffset(int $offset = 0): Iterator + { + return ResultSet::createFromTabularDataReader($this)->fetchColumnByOffset($offset); + } + + public function fetchColumn($index = 0): Iterator + { + return ResultSet::createFromTabularDataReader($this)->fetchColumn($index); + } + + public function fetchOne(int $nth_record = 0): array + { + return ResultSet::createFromTabularDataReader($this)->fetchOne($nth_record); + } + + public function fetchPairs($offset_index = 0, $value_index = 1): Iterator + { + return ResultSet::createFromTabularDataReader($this)->fetchPairs($offset_index, $value_index); } - /** - * {@inheritdoc} - */ public function count(): int { if (-1 === $this->nb_records) { @@ -236,42 +184,20 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe return $this->nb_records; } - /** - * {@inheritdoc} - */ public function getIterator(): Iterator { return $this->getRecords(); } - /** - * {@inheritdoc} - */ public function jsonSerialize(): array { return iterator_to_array($this->getRecords(), false); } - /** - * Returns the CSV records as an iterator object. - * - * Each CSV record is represented as a simple array containing strings or null values. - * - * If the CSV document has a header record then each record is combined - * to the header record and the header record is removed from the iterator. - * - * If the CSV document is inconsistent. Missing record fields are - * filled with null values while extra record fields are strip from - * the returned object. - * - * @param string[] $header an optional header to use instead of the CSV document header - */ public function getRecords(array $header = []): Iterator { $header = $this->computeHeader($header); - $normalized = function ($record): bool { - return is_array($record) && ($this->is_empty_records_included || $record != [null]); - }; + $normalized = fn ($record): bool => is_array($record) && ($this->is_empty_records_included || $record != [null]); $bom = ''; if (!$this->is_input_bom_included) { @@ -281,21 +207,14 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe $document = $this->getDocument(); $records = $this->stripBOM(new CallbackFilterIterator($document, $normalized), $bom); if (null !== $this->header_offset) { - $records = new CallbackFilterIterator($records, function (array $record, int $offset): bool { - return $offset !== $this->header_offset; - }); + $records = new CallbackFilterIterator($records, fn (array $record, int $offset): bool => $offset !== $this->header_offset); } if ($this->is_empty_records_included) { - $normalized_empty_records = static function (array $record): array { - if ([null] === $record) { - return []; - } - - return $record; - }; - - return $this->combineHeader(new MapIterator($records, $normalized_empty_records), $header); + return $this->combineHeader(new MapIterator( + $records, + fn (array $record): array => ([null] === $record) ? [] : $record + ), $header); } return $this->combineHeader($records, $header); @@ -308,7 +227,7 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe * * @throws Exception If the header contains non unique column name * - * @return string[] + * @return array */ protected function computeHeader(array $header) { @@ -316,11 +235,15 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe $header = $this->getHeader(); } - if ($header === array_unique(array_filter($header, 'is_string'))) { - return $header; + if ($header !== ($filtered_header = array_filter($header, 'is_string'))) { + throw SyntaxError::dueToInvalidHeaderColumnNames(); } - throw new SyntaxError('The header record must be empty or a flat array with unique string values'); + if ($header !== array_unique($filtered_header)) { + throw SyntaxError::dueToDuplicateHeaderColumnNames($header); + } + + return $header; } /** @@ -340,7 +263,10 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe $record = array_slice(array_pad($record, $field_count, null), 0, $field_count); } - return array_combine($header, $record); + /** @var array $assocRecord */ + $assocRecord = array_combine($header, $record); + + return $assocRecord; }; return new MapIterator($iterator, $mapper); @@ -361,10 +287,18 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe return $record; } - return $this->removeBOM($record, $bom_length, $this->enclosure); + $record = $this->removeBOM($record, $bom_length, $this->enclosure); + if ([''] === $record) { + return [null]; + } + + return $record; }; - return new MapIterator($iterator, $mapper); + return new CallbackFilterIterator( + new MapIterator($iterator, $mapper), + fn (array $record): bool => $this->is_empty_records_included || $record != [null] + ); } /** @@ -379,18 +313,14 @@ class Reader extends AbstractCsv implements Countable, IteratorAggregate, JsonSe * * @return static */ - public function setHeaderOffset($offset): self + public function setHeaderOffset(?int $offset): self { if ($offset === $this->header_offset) { return $this; } - if (!is_nullable_int($offset)) { - throw new TypeError(sprintf(__METHOD__.'() expects 1 Argument to be null or an integer %s given', gettype($offset))); - } - if (null !== $offset && 0 > $offset) { - throw new InvalidArgument(__METHOD__.'() expects 1 Argument to be greater or equal to 0'); + throw InvalidArgument::dueToInvalidHeaderOffset($offset, __METHOD__); } $this->header_offset = $offset; diff --git a/vendor/league/csv/src/ResultSet.php b/vendor/league/csv/src/ResultSet.php index d27e90fcf..492746195 100644 --- a/vendor/league/csv/src/ResultSet.php +++ b/vendor/league/csv/src/ResultSet.php @@ -14,10 +14,8 @@ declare(strict_types=1); namespace League\Csv; use CallbackFilterIterator; -use Countable; use Generator; use Iterator; -use IteratorAggregate; use JsonSerializable; use LimitIterator; use function array_flip; @@ -25,176 +23,212 @@ use function array_search; use function is_string; use function iterator_count; use function iterator_to_array; -use function sprintf; /** * Represents the result set of a {@link Reader} processed by a {@link Statement}. */ -class ResultSet implements Countable, IteratorAggregate, JsonSerializable +class ResultSet implements TabularDataReader, JsonSerializable { - /** - * The CSV records collection. - * - * @var Iterator - */ - protected $records; + /** The CSV records collection. */ + protected Iterator $records; + /** @var array The CSV records collection header. */ + protected array $header = []; - /** - * The CSV records collection header. - * - * @var array - */ - protected $header = []; - - /** - * New instance. - * - * @param Iterator $records a CSV records collection iterator - * @param array $header the associated collection column names - */ public function __construct(Iterator $records, array $header) { + $this->validateHeader($header); + $this->records = $records; $this->header = $header; } /** - * {@inheritdoc} + * @throws SyntaxError if the header syntax is invalid */ + protected function validateHeader(array $header): void + { + if ($header !== ($filtered_header = array_filter($header, 'is_string'))) { + throw SyntaxError::dueToInvalidHeaderColumnNames(); + } + + if ($header !== array_unique($filtered_header)) { + throw SyntaxError::dueToDuplicateHeaderColumnNames($header); + } + } + public function __destruct() { unset($this->records); } + /** + * Returns a new instance from an object implementing the TabularDataReader interface. + */ + public static function createFromTabularDataReader(TabularDataReader $reader): self + { + return new self($reader->getRecords(), $reader->getHeader()); + } + /** * Returns the header associated with the result set. * - * @return string[] + * @return array */ public function getHeader(): array { return $this->header; } - /** - * {@inheritdoc} - */ - public function getRecords(): Generator + public function getIterator(): Iterator { - foreach ($this->records as $offset => $value) { + return $this->getRecords(); + } + + public function getRecords(array $header = []): Iterator + { + $this->validateHeader($header); + $records = $this->combineHeader($header); + foreach ($records as $offset => $value) { yield $offset => $value; } } /** - * {@inheritdoc} + * Combine the header to each record if present. */ - public function getIterator(): Generator + protected function combineHeader(array $header): Iterator { - return $this->getRecords(); + if ($header === $this->header || [] === $header) { + return $this->records; + } + + $field_count = count($header); + $mapper = static function (array $record) use ($header, $field_count): array { + if (count($record) != $field_count) { + $record = array_slice(array_pad($record, $field_count, null), 0, $field_count); + } + + /** @var array $assocRecord */ + $assocRecord = array_combine($header, $record); + + return $assocRecord; + }; + + return new MapIterator($this->records, $mapper); } - /** - * {@inheritdoc} - */ public function count(): int { return iterator_count($this->records); } - /** - * {@inheritdoc} - */ public function jsonSerialize(): array { return iterator_to_array($this->records, false); } - /** - * Returns the nth record from the result set. - * - * By default if no index is provided the first record of the resultet is returned - * - * @param int $nth_record the CSV record offset - * - * @throws Exception if argument is lesser than 0 - */ public function fetchOne(int $nth_record = 0): array { if ($nth_record < 0) { - throw new InvalidArgument(sprintf('%s() expects the submitted offset to be a positive integer or 0, %s given', __METHOD__, $nth_record)); + throw InvalidArgument::dueToInvalidRecordOffset($nth_record, __METHOD__); } $iterator = new LimitIterator($this->records, $nth_record, 1); $iterator->rewind(); - return (array) $iterator->current(); + $result = $iterator->current(); + if (!is_array($result)) { + return []; + } + + return $result; } /** - * Returns a single column from the next record of the result set. - * - * By default if no value is supplied the first column is fetch - * - * @param string|int $index CSV column index + * @throws Exception */ - public function fetchColumn($index = 0): Generator + public function fetchColumnByName(string $name): Iterator { - $offset = $this->getColumnIndex($index, __METHOD__.'() expects the column index to be a valid string or integer, `%s` given'); - $filter = static function (array $record) use ($offset): bool { - return isset($record[$offset]); - }; + return $this->yieldColumn( + $this->getColumnIndexByValue($name, 'name', __METHOD__) + ); + } - $select = static function (array $record) use ($offset): string { - return $record[$offset]; - }; + /** + * @throws Exception + */ + public function fetchColumnByOffset(int $offset): Iterator + { + return $this->yieldColumn( + $this->getColumnIndexByKey($offset, 'offset', __METHOD__) + ); + } - $iterator = new MapIterator(new CallbackFilterIterator($this->records, $filter), $select); - foreach ($iterator as $offset => $value) { - yield $offset => $value; + public function fetchColumn($index = 0): Iterator + { + return $this->yieldColumn( + $this->getColumnIndex($index, 'offset', __METHOD__) + ); + } + + /** + * @param string|int $offset + */ + protected function yieldColumn($offset): Generator + { + $iterator = new MapIterator( + new CallbackFilterIterator($this->records, fn (array $record): bool => isset($record[$offset])), + fn (array $record): string => $record[$offset] + ); + + foreach ($iterator as $key => $value) { + yield $key => $value; } } /** * Filter a column name against the header if any. * - * @param string|int $field the field name or the field index - * @param string $error_message the associated error message + * @param string|int $field the field name or the field index + * + * @throws InvalidArgument if the field is invalid or not found * * @return string|int */ - protected function getColumnIndex($field, string $error_message) + protected function getColumnIndex($field, string $type, string $method) { - $method = is_string($field) ? 'getColumnIndexByValue' : 'getColumnIndexByKey'; + if (is_string($field)) { + return $this->getColumnIndexByValue($field, $type, $method); + } - return $this->$method($field, $error_message); + return $this->getColumnIndexByKey($field, $type, $method); } /** * Returns the selected column name. * - * @throws Exception if the column is not found + * @throws InvalidArgument if the column is not found */ - protected function getColumnIndexByValue(string $value, string $error_message): string + protected function getColumnIndexByValue(string $value, string $type, string $method): string { - if (false !== array_search($value, $this->header, true)) { - return $value; + if (false === array_search($value, $this->header, true)) { + throw InvalidArgument::dueToInvalidColumnIndex($value, $type, $method); } - throw new InvalidArgument(sprintf($error_message, $value)); + return $value; } /** * Returns the selected column name according to its offset. * - * @throws Exception if the field is invalid or not found + * @throws InvalidArgument if the field is invalid or not found * * @return int|string */ - protected function getColumnIndexByKey(int $index, string $error_message) + protected function getColumnIndexByKey(int $index, string $type, string $method) { if ($index < 0) { - throw new InvalidArgument($error_message); + throw InvalidArgument::dueToInvalidColumnIndex($index, $type, $method); } if ([] === $this->header) { @@ -202,38 +236,24 @@ class ResultSet implements Countable, IteratorAggregate, JsonSerializable } $value = array_search($index, array_flip($this->header), true); - if (false !== $value) { - return $value; + if (false === $value) { + throw InvalidArgument::dueToInvalidColumnIndex($index, $type, $method); } - throw new InvalidArgument(sprintf($error_message, $index)); + return $value; } - /** - * Returns the next key-value pairs from a result set (first - * column is the key, second column is the value). - * - * By default if no column index is provided: - * - the first column is used to provide the keys - * - the second column is used to provide the value - * - * @param string|int $offset_index The column index to serve as offset - * @param string|int $value_index The column index to serve as value - */ - public function fetchPairs($offset_index = 0, $value_index = 1): Generator + public function fetchPairs($offset_index = 0, $value_index = 1): Iterator { - $offset = $this->getColumnIndex($offset_index, __METHOD__.'() expects the offset index value to be a valid string or integer, `%s` given'); - $value = $this->getColumnIndex($value_index, __METHOD__.'() expects the value index value to be a valid string or integer, `%s` given'); + $offset = $this->getColumnIndex($offset_index, 'offset', __METHOD__); + $value = $this->getColumnIndex($value_index, 'value', __METHOD__); - $filter = static function (array $record) use ($offset): bool { - return isset($record[$offset]); - }; + $iterator = new MapIterator( + new CallbackFilterIterator($this->records, fn (array $record): bool => isset($record[$offset])), + fn (array $record): array => [$record[$offset], $record[$value] ?? null] + ); - $select = static function (array $record) use ($offset, $value): array { - return [$record[$offset], $record[$value] ?? null]; - }; - - $iterator = new MapIterator(new CallbackFilterIterator($this->records, $filter), $select); + /** @var array{0:int|string, 1:string|null} $pair */ foreach ($iterator as $pair) { yield $pair[0] => $pair[1]; } diff --git a/vendor/league/csv/src/Statement.php b/vendor/league/csv/src/Statement.php index b45fbde28..422771990 100644 --- a/vendor/league/csv/src/Statement.php +++ b/vendor/league/csv/src/Statement.php @@ -18,48 +18,41 @@ use CallbackFilterIterator; use Iterator; use LimitIterator; use function array_reduce; -use function iterator_to_array; /** * Criteria to filter a {@link Reader} object. */ class Statement { - /** - * Callables to filter the iterator. - * - * @var callable[] - */ - protected $where = []; + /** @var array Callables to filter the iterator. */ + protected array $where = []; + /** @var array Callables to sort the iterator. */ + protected array $order_by = []; + /** iterator Offset. */ + protected int $offset = 0; + /** iterator maximum length. */ + protected int $limit = -1; /** - * Callables to sort the iterator. - * - * @var callable[] + * @throws Exception */ - protected $order_by = []; + public static function create(callable $where = null, int $offset = 0, int $limit = -1): self + { + $stmt = new self(); + if (null !== $where) { + $stmt = $stmt->where($where); + } - /** - * iterator Offset. - * - * @var int - */ - protected $offset = 0; - - /** - * iterator maximum length. - * - * @var int - */ - protected $limit = -1; + return $stmt->offset($offset)->limit($limit); + } /** * Set the Iterator filter method. */ - public function where(callable $callable): self + public function where(callable $where): self { $clone = clone $this; - $clone->where[] = $callable; + $clone->where[] = $where; return $clone; } @@ -67,10 +60,10 @@ class Statement /** * Set an Iterator sorting callable function. */ - public function orderBy(callable $callable): self + public function orderBy(callable $order_by): self { $clone = clone $this; - $clone->order_by[] = $callable; + $clone->order_by[] = $order_by; return $clone; } @@ -83,7 +76,7 @@ class Statement public function offset(int $offset): self { if (0 > $offset) { - throw new InvalidArgument(sprintf('%s() expects the offset to be a positive integer or 0, %s given', __METHOD__, $offset)); + throw InvalidArgument::dueToInvalidRecordOffset($offset, __METHOD__); } if ($offset === $this->offset) { @@ -104,7 +97,7 @@ class Statement public function limit(int $limit): self { if (-1 > $limit) { - throw new InvalidArgument(sprintf('%s() expects the limit to be greater or equal to -1, %s given', __METHOD__, $limit)); + throw InvalidArgument::dueToInvalidLimit($limit, __METHOD__); } if ($limit === $this->limit) { @@ -120,15 +113,16 @@ class Statement /** * Execute the prepared Statement on the {@link Reader} object. * - * @param string[] $header an optional header to use instead of the CSV document header + * @param array $header an optional header to use instead of the CSV document header */ - public function process(Reader $csv, array $header = []): ResultSet + public function process(TabularDataReader $tabular_data, array $header = []): TabularDataReader { if ([] === $header) { - $header = $csv->getHeader(); + $header = $tabular_data->getHeader(); } - $iterator = array_reduce($this->where, [$this, 'filter'], $csv->getRecords($header)); + $iterator = $tabular_data->getRecords($header); + $iterator = array_reduce($this->where, [$this, 'filter'], $iterator); $iterator = $this->buildOrderBy($iterator); return new ResultSet(new LimitIterator($iterator, $this->offset, $this->limit), $header); @@ -161,9 +155,12 @@ class Statement return $cmp ?? 0; }; - $iterator = new ArrayIterator(iterator_to_array($iterator)); - $iterator->uasort($compare); + $it = new ArrayIterator(); + foreach ($iterator as $offset => $value) { + $it[$offset] = $value; + } + $it->uasort($compare); - return $iterator; + return $it; } } diff --git a/vendor/league/csv/src/Stream.php b/vendor/league/csv/src/Stream.php index 33ba55c7c..a083291a2 100644 --- a/vendor/league/csv/src/Stream.php +++ b/vendor/league/csv/src/Stream.php @@ -13,6 +13,7 @@ declare(strict_types=1); namespace League\Csv; +use ReturnTypeWillChange; use SeekableIterator; use SplFileObject; use TypeError; @@ -31,9 +32,9 @@ use function fseek; use function fwrite; use function get_resource_type; use function gettype; +use function is_array; use function is_resource; use function rewind; -use function sprintf; use function stream_filter_append; use function stream_filter_remove; use function stream_get_meta_data; @@ -46,107 +47,44 @@ use const SEEK_SET; * * @internal used internally to iterate over a stream resource */ -class Stream implements SeekableIterator +final class Stream implements SeekableIterator { - /** - * Attached filters. - * - * @var resource[] - */ - protected $filters = []; + /** @var array> Attached filters. */ + private array $filters = []; + /** @var resource */ + private $stream; + private bool $should_close_stream = false; + /** @var mixed can be a null false or a scalar type value. Current iterator value. */ + private $value; + /** Current iterator key. */ + private int $offset; + /** Flags for the Document.*/ + private int $flags = 0; + private string $delimiter = ','; + private string $enclosure = '"'; + private string $escape = '\\'; + private bool $is_seekable = false; /** - * stream resource. - * - * @var resource - */ - protected $stream; - - /** - * Tell whether the stream should be closed on object destruction. - * - * @var bool - */ - protected $should_close_stream = false; - - /** - * Current iterator value. - * - * @var mixed - */ - protected $value; - - /** - * Current iterator key. - * - * @var int - */ - protected $offset; - - /** - * Flags for the Document. - * - * @var int - */ - protected $flags = 0; - - /** - * the field delimiter (one character only). - * - * @var string - */ - protected $delimiter = ','; - - /** - * the field enclosure character (one character only). - * - * @var string - */ - protected $enclosure = '"'; - - /** - * the field escape character (one character only). - * - * @var string - */ - protected $escape = '\\'; - - /** - * Tell whether the current stream is seekable;. - * - * @var bool - */ - protected $is_seekable = false; - - /** - * New instance. - * - * @param resource $stream stream type resource + * @param mixed $stream stream type resource */ public function __construct($stream) { if (!is_resource($stream)) { - throw new TypeError(sprintf('Argument passed must be a stream resource, %s given', gettype($stream))); + throw new TypeError('Argument passed must be a stream resource, '.gettype($stream).' given.'); } if ('stream' !== ($type = get_resource_type($stream))) { - throw new TypeError(sprintf('Argument passed must be a stream resource, %s resource given', $type)); + throw new TypeError('Argument passed must be a stream resource, '.$type.' resource given'); } $this->is_seekable = stream_get_meta_data($stream)['seekable']; $this->stream = $stream; } - /** - * {@inheritdoc} - */ public function __destruct() { - $walker = static function ($filter): bool { - return @stream_filter_remove($filter); - }; - - array_walk_recursive($this->filters, $walker); + array_walk_recursive($this->filters, fn ($filter): bool => @stream_filter_remove($filter)); if ($this->should_close_stream && is_resource($this->stream)) { fclose($this->stream); @@ -155,18 +93,12 @@ class Stream implements SeekableIterator unset($this->stream); } - /** - * {@inheritdoc} - */ public function __clone() { - throw new Exception(sprintf('An object of class %s cannot be cloned', static::class)); + throw UnavailableStream::dueToForbiddenCloning(self::class); } - /** - * {@inheritdoc} - */ - public function __debugInfo() + public function __debugInfo(): array { return stream_get_meta_data($this->stream) + [ 'delimiter' => $this->delimiter, @@ -182,10 +114,8 @@ class Stream implements SeekableIterator * @param resource|null $context * * @throws Exception if the stream resource can not be created - * - * @return static */ - public static function createFromPath(string $path, string $open_mode = 'r', $context = null) + public static function createFromPath(string $path, string $open_mode = 'r', $context = null): self { $args = [$path, $open_mode]; if (null !== $context) { @@ -193,11 +123,12 @@ class Stream implements SeekableIterator $args[] = $context; } - if (!$resource = @fopen(...$args)) { - throw new Exception(sprintf('`%s`: failed to open stream: No such file or directory', $path)); + $resource = @fopen(...$args); + if (!is_resource($resource)) { + throw UnavailableStream::dueToPathNotFound($path); } - $instance = new static($resource); + $instance = new self($resource); $instance->should_close_stream = true; return $instance; @@ -205,22 +136,23 @@ class Stream implements SeekableIterator /** * Return a new instance from a string. - * - * @return static */ - public static function createFromString(string $content = '') + public static function createFromString(string $content = ''): self { + /** @var resource $resource */ $resource = fopen('php://temp', 'r+'); fwrite($resource, $content); - $instance = new static($resource); + $instance = new self($resource); $instance->should_close_stream = true; return $instance; } /** - * Return the URI of the underlying stream. + * returns the URI of the underlying stream. + * + * @see https://www.php.net/manual/en/splfileinfo.getpathname.php */ public function getPathname(): string { @@ -232,60 +164,58 @@ class Stream implements SeekableIterator * * @see http://php.net/manual/en/function.stream-filter-append.php * - * @param null|mixed $params - * @throws Exception if the filter can not be appended + * @throws InvalidArgument if the filter can not be appended */ - public function appendFilter(string $filtername, int $read_write, $params = null) + public function appendFilter(string $filtername, int $read_write, array $params = null): void { - $res = @stream_filter_append($this->stream, $filtername, $read_write, $params); - if (is_resource($res)) { - $this->filters[$filtername][] = $res; - return; + $res = @stream_filter_append($this->stream, $filtername, $read_write, $params ?? []); + if (!is_resource($res)) { + throw InvalidArgument::dueToStreamFilterNotFound($filtername); } - throw new InvalidArgument(sprintf('unable to locate filter `%s`', $filtername)); + $this->filters[$filtername][] = $res; } /** * Set CSV control. * - * @see http://php.net/manual/en/splfileobject.setcsvcontrol.php + * @see http://php.net/manual/en/SplFileObject.setcsvcontrol.php */ - public function setCsvControl(string $delimiter = ',', string $enclosure = '"', string $escape = '\\') + public function setCsvControl(string $delimiter = ',', string $enclosure = '"', string $escape = '\\'): void { - list($this->delimiter, $this->enclosure, $this->escape) = $this->filterControl($delimiter, $enclosure, $escape, __METHOD__); + [$this->delimiter, $this->enclosure, $this->escape] = $this->filterControl($delimiter, $enclosure, $escape, __METHOD__); } /** * Filter Csv control characters. * - * @throws Exception If the Csv control character is not one character only. + * @throws InvalidArgument If the Csv control character is not one character only. */ - protected function filterControl(string $delimiter, string $enclosure, string $escape, string $caller): array + private function filterControl(string $delimiter, string $enclosure, string $escape, string $caller): array { if (1 !== strlen($delimiter)) { - throw new InvalidArgument(sprintf('%s() expects delimiter to be a single character', $caller)); + throw InvalidArgument::dueToInvalidDelimiterCharacter($delimiter, $caller); } if (1 !== strlen($enclosure)) { - throw new InvalidArgument(sprintf('%s() expects enclosure to be a single character', $caller)); + throw InvalidArgument::dueToInvalidEnclosureCharacter($enclosure, $caller); } if (1 === strlen($escape) || ('' === $escape && 70400 <= PHP_VERSION_ID)) { return [$delimiter, $enclosure, $escape]; } - throw new InvalidArgument(sprintf('%s() expects escape to be a single character', $caller)); + throw InvalidArgument::dueToInvalidEscapeCharacter($escape, $caller); } /** * Set CSV control. * - * @see http://php.net/manual/en/splfileobject.getcsvcontrol.php + * @see http://php.net/manual/en/SplFileObject.getcsvcontrol.php * - * @return string[] + * @return array */ - public function getCsvControl() + public function getCsvControl(): array { return [$this->delimiter, $this->enclosure, $this->escape]; } @@ -293,9 +223,9 @@ class Stream implements SeekableIterator /** * Set CSV stream flags. * - * @see http://php.net/manual/en/splfileobject.setflags.php + * @see http://php.net/manual/en/SplFileObject.setflags.php */ - public function setFlags(int $flags) + public function setFlags(int $flags): void { $this->flags = $flags; } @@ -303,13 +233,16 @@ class Stream implements SeekableIterator /** * Write a field array as a CSV line. * - * @see http://php.net/manual/en/splfileobject.fputcsv.php + * @see http://php.net/manual/en/SplFileObject.fputcsv.php * * @return int|false */ - public function fputcsv(array $fields, string $delimiter = ',', string $enclosure = '"', string $escape = '\\') + public function fputcsv(array $fields, string $delimiter = ',', string $enclosure = '"', string $escape = '\\', string $eol = "\n") { $controls = $this->filterControl($delimiter, $enclosure, $escape, __METHOD__); + if (80100 <= PHP_VERSION_ID) { + $controls[] = $eol; + } return fputcsv($this->stream, $fields, ...$controls); } @@ -317,11 +250,9 @@ class Stream implements SeekableIterator /** * Get line number. * - * @see http://php.net/manual/en/splfileobject.key.php - * - * @return int + * @see http://php.net/manual/en/SplFileObject.key.php */ - public function key() + public function key(): int { return $this->offset; } @@ -329,9 +260,9 @@ class Stream implements SeekableIterator /** * Read next line. * - * @see http://php.net/manual/en/splfileobject.next.php + * @see http://php.net/manual/en/SplFileObject.next.php */ - public function next() + public function next(): void { $this->value = false; $this->offset++; @@ -340,20 +271,20 @@ class Stream implements SeekableIterator /** * Rewind the file to the first line. * - * @see http://php.net/manual/en/splfileobject.rewind.php + * @see http://php.net/manual/en/SplFileObject.rewind.php * * @throws Exception if the stream resource is not seekable */ - public function rewind() + public function rewind(): void { if (!$this->is_seekable) { - throw new Exception('stream does not support seeking'); + throw UnavailableFeature::dueToMissingStreamSeekability(); } rewind($this->stream); $this->offset = 0; $this->value = false; - if ($this->flags & SplFileObject::READ_AHEAD) { + if (0 !== ($this->flags & SplFileObject::READ_AHEAD)) { $this->current(); } } @@ -361,13 +292,11 @@ class Stream implements SeekableIterator /** * Not at EOF. * - * @see http://php.net/manual/en/splfileobject.valid.php - * - * @return bool + * @see http://php.net/manual/en/SplFileObject.valid.php */ - public function valid() + public function valid(): bool { - if ($this->flags & SplFileObject::READ_AHEAD) { + if (0 !== ($this->flags & SplFileObject::READ_AHEAD)) { return $this->current() !== false; } @@ -377,8 +306,11 @@ class Stream implements SeekableIterator /** * Retrieves the current line of the file. * - * @see http://php.net/manual/en/splfileobject.current.php + * @see http://php.net/manual/en/SplFileObject.current.php + * + * @return mixed The value of the current element. */ + #[ReturnTypeWillChange] public function current() { if (false !== $this->value) { @@ -395,11 +327,12 @@ class Stream implements SeekableIterator * * @return array|false */ - protected function getCurrentRecord() + private function getCurrentRecord() { + $flag = 0 !== ($this->flags & SplFileObject::SKIP_EMPTY); do { $ret = fgetcsv($this->stream, 0, $this->delimiter, $this->enclosure, $this->escape); - } while ($this->flags & SplFileObject::SKIP_EMPTY && $ret !== false && $ret[0] === null); + } while ($flag && is_array($ret) && null === $ret[0]); return $ret; } @@ -407,15 +340,15 @@ class Stream implements SeekableIterator /** * Seek to specified line. * - * @see http://php.net/manual/en/splfileobject.seek.php + * @see http://php.net/manual/en/SplFileObject.seek.php * * @param int $position * @throws Exception if the position is negative */ - public function seek($position) + public function seek($position): void { if ($position < 0) { - throw new Exception(sprintf('%s() can\'t seek stream to negative line %d', __METHOD__, $position)); + throw InvalidArgument::dueToInvalidSeekingPosition($position, __METHOD__); } $this->rewind(); @@ -434,9 +367,9 @@ class Stream implements SeekableIterator /** * Output all remaining data on a file pointer. * - * @see http://php.net/manual/en/splfileobject.fpatssthru.php + * @see http://php.net/manual/en/SplFileObject.fpatssthru.php * - * @return int + * @return int|false */ public function fpassthru() { @@ -446,13 +379,13 @@ class Stream implements SeekableIterator /** * Read from file. * - * @see http://php.net/manual/en/splfileobject.fread.php + * @see http://php.net/manual/en/SplFileObject.fread.php * - * @param int $length The number of bytes to read + * @param int<0, max> $length The number of bytes to read * * @return string|false */ - public function fread($length) + public function fread(int $length) { return fread($this->stream, $length); } @@ -460,7 +393,7 @@ class Stream implements SeekableIterator /** * Gets a line from file. * - * @see http://php.net/manual/en/splfileobject.fgets.php + * @see http://php.net/manual/en/SplFileObject.fgets.php * * @return string|false */ @@ -472,16 +405,14 @@ class Stream implements SeekableIterator /** * Seek to a position. * - * @see http://php.net/manual/en/splfileobject.fseek.php + * @see http://php.net/manual/en/SplFileObject.fseek.php * * @throws Exception if the stream resource is not seekable - * - * @return int */ - public function fseek(int $offset, int $whence = SEEK_SET) + public function fseek(int $offset, int $whence = SEEK_SET): int { if (!$this->is_seekable) { - throw new Exception('stream does not support seeking'); + throw UnavailableFeature::dueToMissingStreamSeekability(); } return fseek($this->stream, $offset, $whence); @@ -490,7 +421,7 @@ class Stream implements SeekableIterator /** * Write to stream. * - * @see http://php.net/manual/en/splfileobject.fwrite.php + * @see http://php.net/manual/en/SplFileObject.fwrite.php * * @return int|false */ @@ -507,11 +438,9 @@ class Stream implements SeekableIterator /** * Flushes the output to a file. * - * @see http://php.net/manual/en/splfileobject.fwrite.php - * - * @return bool + * @see http://php.net/manual/en/SplFileObject.fwrite.php */ - public function fflush() + public function fflush(): bool { return fflush($this->stream); } diff --git a/vendor/league/csv/src/SyntaxError.php b/vendor/league/csv/src/SyntaxError.php index 4794d9a74..e3549afbb 100644 --- a/vendor/league/csv/src/SyntaxError.php +++ b/vendor/league/csv/src/SyntaxError.php @@ -13,9 +13,48 @@ declare(strict_types=1); namespace League\Csv; +use Throwable; + /** * SyntaxError Exception. */ class SyntaxError extends Exception { + /** + * @var array + */ + protected array $duplicateColumnNames = []; + + /** + * DEPRECATION WARNING! This class will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + */ + public function __construct(string $message = '', int $code = 0, Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + } + + public static function dueToHeaderNotFound(int $offset): self + { + return new self('The header record does not exist or is empty at offset: `'.$offset.'`'); + } + + public static function dueToInvalidHeaderColumnNames(): self + { + return new self('The header record contains non string colum names.'); + } + + public static function dueToDuplicateHeaderColumnNames(array $header): self + { + $instance = new self('The header record contains duplicate column names.'); + $instance->duplicateColumnNames = array_keys(array_filter(array_count_values($header), fn (int $value): bool => $value > 1)); + + return $instance; + } + + public function duplicateColumnNames(): array + { + return $this->duplicateColumnNames; + } } diff --git a/vendor/league/csv/src/TabularDataReader.php b/vendor/league/csv/src/TabularDataReader.php new file mode 100644 index 000000000..c7558a358 --- /dev/null +++ b/vendor/league/csv/src/TabularDataReader.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\Csv; + +use Countable; +use Iterator; +use IteratorAggregate; + +/** + * Represents a Tabular data. + * + * @method Iterator fetchColumnByName(string $name) returns a column from its name + * @method Iterator fetchColumnByOffset(int $offset) returns a column from its offset + */ +interface TabularDataReader extends Countable, IteratorAggregate +{ + /** + * Returns the number of records contained in the tabular data structure + * excluding the header record. + */ + public function count(): int; + + /** + * Returns the tabular data records as an iterator object. + * + * Each record is represented as a simple array containing strings or null values. + * + * If the CSV document has a header record then each record is combined + * to the header record and the header record is removed from the iterator. + * + * If the CSV document is inconsistent. Missing record fields are + * filled with null values while extra record fields are strip from + * the returned object. + */ + public function getIterator(): Iterator; + + /** + * Returns the header associated with the tabular data. + * + * The header must contains unique string or is an empty array + * if no header was specified. + * + * @return array + */ + public function getHeader(): array; + + /** + * Returns the tabular data records as an iterator object. + * + * Each record is represented as a simple array containing strings or null values. + * + * If the tabular data has a header record then each record is combined + * to the header record and the header record is removed from the iterator. + * + * If the tabular data is inconsistent. Missing record fields are + * filled with null values while extra record fields are strip from + * the returned object. + * + * @param array $header an optional header to use instead of the CSV document header + */ + public function getRecords(array $header = []): Iterator; + + /** + * Returns the nth record from the tabular data. + * + * By default if no index is provided the first record of the tabular data is returned + * + * @param int $nth_record the tabular data record offset + * + * @throws UnableToProcessCsv if argument is lesser than 0 + */ + public function fetchOne(int $nth_record = 0): array; + + /** + * DEPRECATION WARNING! This class will be removed in the next major point release. + * + * @deprecated since version 9.8.0 + * + * @see ::fetchColumnByName + * @see ::fetchColumnByOffset + * + * Returns a single column from the next record of the tabular data. + * + * By default if no value is supplied the first column is fetch + * + * @param string|int $index CSV column index + * + * @throws UnableToProcessCsv if the column index is invalid or not found + */ + public function fetchColumn($index = 0): Iterator; + + /** + * Returns the next key-value pairs from the tabular data (first + * column is the key, second column is the value). + * + * By default if no column index is provided: + * - the first column is used to provide the keys + * - the second column is used to provide the value + * + * @param string|int $offset_index The column index to serve as offset + * @param string|int $value_index The column index to serve as value + * + * @throws UnableToProcessCsv if the column index is invalid or not found + */ + public function fetchPairs($offset_index = 0, $value_index = 1): Iterator; +} diff --git a/vendor/league/csv/src/UnableToProcessCsv.php b/vendor/league/csv/src/UnableToProcessCsv.php new file mode 100644 index 000000000..327095305 --- /dev/null +++ b/vendor/league/csv/src/UnableToProcessCsv.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\Csv; + +use Throwable; + +interface UnableToProcessCsv extends Throwable +{ +} diff --git a/vendor/league/csv/src/UnavailableFeature.php b/vendor/league/csv/src/UnavailableFeature.php index 67edd7ffd..201363707 100644 --- a/vendor/league/csv/src/UnavailableFeature.php +++ b/vendor/league/csv/src/UnavailableFeature.php @@ -13,9 +13,30 @@ declare(strict_types=1); namespace League\Csv; +use Throwable; + /** * StreamFilterSupportMissing Exception. */ class UnavailableFeature extends Exception { + /** + * DEPRECATION WARNING! This class will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + */ + public function __construct(string $message = '', int $code = 0, Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + } + + public static function dueToUnsupportedStreamFilterApi(string $className): self + { + return new self('The stream filter API can not be used with a '.$className.' instance.'); + } + + public static function dueToMissingStreamSeekability(): self + { + return new self('stream does not support seeking'); + } } diff --git a/vendor/league/csv/src/UnavailableStream.php b/vendor/league/csv/src/UnavailableStream.php new file mode 100644 index 000000000..bc2d391e0 --- /dev/null +++ b/vendor/league/csv/src/UnavailableStream.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\Csv; + +final class UnavailableStream extends Exception +{ + private function __construct(string $message) + { + parent::__construct($message); + } + + public static function dueToPathNotFound(string $path): self + { + return new self('`'.$path.'`: failed to open stream: No such file or directory.'); + } + + public static function dueToForbiddenCloning(string $class_name): self + { + return new self('An object of class '.$class_name.' cannot be cloned.'); + } +} diff --git a/vendor/league/csv/src/Writer.php b/vendor/league/csv/src/Writer.php index b2c0099f1..1cf908971 100644 --- a/vendor/league/csv/src/Writer.php +++ b/vendor/league/csv/src/Writer.php @@ -13,16 +13,7 @@ declare(strict_types=1); namespace League\Csv; -use Traversable; -use TypeError; use function array_reduce; -use function gettype; -use function implode; -use function is_iterable; -use function preg_match; -use function preg_quote; -use function sprintf; -use function str_replace; use function strlen; use const PHP_VERSION_ID; use const SEEK_CUR; @@ -33,69 +24,18 @@ use const STREAM_FILTER_WRITE; */ class Writer extends AbstractCsv { - /** - * callable collection to format the record before insertion. - * - * @var callable[] - */ - protected $formatters = []; + protected const STREAM_FILTER_MODE = STREAM_FILTER_WRITE; - /** - * callable collection to validate the record before insertion. - * - * @var callable[] - */ - protected $validators = []; + /** @var array callable collection to format the record before insertion. */ + protected array $formatters = []; + /** @var array callable collection to validate the record before insertion. */ + protected array $validators = []; + protected string $newline = "\n"; + protected int $flush_counter = 0; + protected ?int $flush_threshold = null; - /** - * newline character. - * - * @var string - */ - protected $newline = "\n"; - - /** - * Insert records count for flushing. - * - * @var int - */ - protected $flush_counter = 0; - - /** - * Buffer flush threshold. - * - * @var int|null - */ - protected $flush_threshold; - - /** - * {@inheritdoc} - */ - protected $stream_filter_mode = STREAM_FILTER_WRITE; - - /** - * Regular expression used to detect if RFC4180 formatting is necessary. - * - * @var string - */ - protected $rfc4180_regexp; - - /** - * double enclosure for RFC4180 compliance. - * - * @var string - */ - protected $rfc4180_enclosure; - - /** - * {@inheritdoc} - */ - protected function resetProperties() + protected function resetProperties(): void { - parent::resetProperties(); - $characters = preg_quote($this->delimiter, '/').'|'.preg_quote($this->enclosure, '/'); - $this->rfc4180_regexp = '/[\s|'.$characters.']/x'; - $this->rfc4180_enclosure = $this->enclosure.$this->enclosure; } /** @@ -108,10 +48,8 @@ class Writer extends AbstractCsv /** * Get the flush threshold. - * - * @return int|null */ - public function getFlushThreshold() + public function getFlushThreshold(): ?int { return $this->flush_threshold; } @@ -120,15 +58,9 @@ class Writer extends AbstractCsv * Adds multiple records to the CSV document. * * @see Writer::insertOne - * - * @param Traversable|array $records */ - public function insertAll($records): int + public function insertAll(iterable $records): int { - if (!is_iterable($records)) { - throw new TypeError(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($records))); - } - $bytes = 0; foreach ($records as $record) { $bytes += $this->insertOne($record); @@ -150,19 +82,14 @@ class Writer extends AbstractCsv */ public function insertOne(array $record): int { - $method = 'addRecord'; - if (70400 > PHP_VERSION_ID && '' === $this->escape) { - $method = 'addRFC4180CompliantRecord'; - } - - $record = array_reduce($this->formatters, [$this, 'formatRecord'], $record); + $record = array_reduce($this->formatters, fn (array $record, callable $formatter): array => $formatter($record), $record); $this->validateRecord($record); - $bytes = $this->$method($record); - if (false !== $bytes && 0 !== $bytes) { - return $bytes + $this->consolidate(); + $bytes = $this->addRecord($record); + if (false === $bytes || 0 >= $bytes) { + throw CannotInsertRecord::triggerOnInsertion($record); } - throw CannotInsertRecord::triggerOnInsertion($record); + return $bytes + $this->consolidate(); } /** @@ -174,52 +101,19 @@ class Writer extends AbstractCsv */ protected function addRecord(array $record) { - return $this->document->fputcsv($record, $this->delimiter, $this->enclosure, $this->escape); - } - - /** - * Adds a single record to a CSV Document using RFC4180 algorithm. - * - * @see https://php.net/manual/en/function.fputcsv.php - * @see https://php.net/manual/en/function.fwrite.php - * @see https://tools.ietf.org/html/rfc4180 - * @see http://edoceo.com/utilitas/csv-file-format - * - * String conversion is done without any check like fputcsv. - * - * - Emits E_NOTICE on Array conversion (returns the 'Array' string) - * - Throws catchable fatal error on objects that can not be converted - * - Returns resource id without notice or error (returns 'Resource id #2') - * - Converts boolean true to '1', boolean false to the empty string - * - Converts null value to the empty string - * - * Fields must be delimited with enclosures if they contains : - * - * - Embedded whitespaces - * - Embedded delimiters - * - Embedded line-breaks - * - Embedded enclosures. - * - * Embedded enclosures must be doubled. - * - * The LF character is added at the end of each record to mimic fputcsv behavior - * - * @return int|false - */ - protected function addRFC4180CompliantRecord(array $record) - { - foreach ($record as &$field) { - $field = (string) $field; - if (1 === preg_match($this->rfc4180_regexp, $field)) { - $field = $this->enclosure.str_replace($this->enclosure, $this->rfc4180_enclosure, $field).$this->enclosure; - } + if (PHP_VERSION_ID < 80100) { + return $this->document->fputcsv($record, $this->delimiter, $this->enclosure, $this->escape); } - unset($field); - return $this->document->fwrite(implode($this->delimiter, $record)."\n"); + return $this->document->fputcsv($record, $this->delimiter, $this->enclosure, $this->escape, $this->newline); } /** + * DEPRECATION WARNING! This method will be removed in the next major point release. + * + * @deprecated since version 9.8.0 + * @codeCoverageIgnore + * * Format a record. * * The returned array must contain @@ -237,7 +131,7 @@ class Writer extends AbstractCsv * * @throws CannotInsertRecord If the validation failed */ - protected function validateRecord(array $record) + protected function validateRecord(array $record): void { foreach ($this->validators as $name => $validator) { if (true !== $validator($record)) { @@ -252,9 +146,11 @@ class Writer extends AbstractCsv protected function consolidate(): int { $bytes = 0; - if ("\n" !== $this->newline) { + if (80100 > PHP_VERSION_ID && "\n" !== $this->newline) { $this->document->fseek(-1, SEEK_CUR); - $bytes = $this->document->fwrite($this->newline, strlen($this->newline)) - 1; + /** @var int $newlineBytes */ + $newlineBytes = $this->document->fwrite($this->newline, strlen($this->newline)); + $bytes = $newlineBytes - 1; } if (null === $this->flush_threshold) { @@ -303,22 +199,18 @@ class Writer extends AbstractCsv /** * Set the flush threshold. * - * @param int|null $threshold + * @param ?int $threshold * - * @throws Exception if the threshold is a integer lesser than 1 + * @throws InvalidArgument if the threshold is a integer lesser than 1 */ - public function setFlushThreshold($threshold): self + public function setFlushThreshold(?int $threshold): self { if ($threshold === $this->flush_threshold) { return $this; } - if (!is_nullable_int($threshold)) { - throw new TypeError(sprintf(__METHOD__.'() expects 1 Argument to be null or an integer %s given', gettype($threshold))); - } - if (null !== $threshold && 1 > $threshold) { - throw new InvalidArgument(__METHOD__.'() expects 1 Argument to be null or a valid integer greater or equal to 1'); + throw InvalidArgument::dueToInvalidThreshold($threshold, __METHOD__); } $this->flush_threshold = $threshold; diff --git a/vendor/league/csv/src/XMLConverter.php b/vendor/league/csv/src/XMLConverter.php index 24a091197..2468d63df 100644 --- a/vendor/league/csv/src/XMLConverter.php +++ b/vendor/league/csv/src/XMLConverter.php @@ -17,79 +17,57 @@ use DOMAttr; use DOMDocument; use DOMElement; use DOMException; -use Traversable; -use TypeError; -use function gettype; -use function is_iterable; -use function sprintf; /** - * Converts tabular data into a DOMDOcument object. + * Converts tabular data into a DOMDocument object. */ class XMLConverter { /** * XML Root name. - * - * @var string */ - protected $root_name = 'csv'; + protected string $root_name = 'csv'; /** * XML Node name. - * - * @var string */ - protected $record_name = 'row'; + protected string $record_name = 'row'; /** * XML Item name. - * - * @var string */ - protected $field_name = 'cell'; + protected string $field_name = 'cell'; /** * XML column attribute name. - * - * @var string */ - protected $column_attr = ''; + protected string $column_attr = ''; /** * XML offset attribute name. - * - * @var string */ - protected $offset_attr = ''; + protected string $offset_attr = ''; + + public static function create(): self + { + return new self(); + } /** - * Conversion method list. + * DEPRECATION WARNING! This method will be removed in the next major point release. * - * @var array + * @deprecated since version 9.7.0 + * @see XMLConverter::create() */ - protected $encoder = [ - 'field' => [ - true => 'fieldToElementWithAttribute', - false => 'fieldToElement', - ], - 'record' => [ - true => 'recordToElementWithAttribute', - false => 'recordToElement', - ], - ]; + public function __construct() + { + } /** * Convert a Record collection into a DOMDocument. - * - * @param array|Traversable $records the CSV records collection */ - public function convert($records): DOMDocument + public function convert(iterable $records): DOMDocument { - if (!is_iterable($records)) { - throw new TypeError(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($records))); - } - $doc = new DOMDocument('1.0'); $node = $this->import($records, $doc); $doc->appendChild($node); @@ -101,20 +79,12 @@ class XMLConverter * Create a new DOMElement related to the given DOMDocument. * * **DOES NOT** attach to the DOMDocument - * - * @param array|Traversable $records */ - public function import($records, DOMDocument $doc): DOMElement + public function import(iterable $records, DOMDocument $doc): DOMElement { - if (!is_iterable($records)) { - throw new TypeError(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($records))); - } - - $field_encoder = $this->encoder['field']['' !== $this->column_attr]; - $record_encoder = $this->encoder['record']['' !== $this->offset_attr]; $root = $doc->createElement($this->root_name); foreach ($records as $offset => $record) { - $node = $this->$record_encoder($doc, $record, $field_encoder, $offset); + $node = $this->recordToElement($doc, $record, $offset); $root->appendChild($node); } @@ -125,29 +95,18 @@ class XMLConverter * Convert a CSV record into a DOMElement and * adds its offset as DOMElement attribute. */ - protected function recordToElementWithAttribute( - DOMDocument $doc, - array $record, - string $field_encoder, - int $offset - ): DOMElement { - $node = $this->recordToElement($doc, $record, $field_encoder); - $node->setAttribute($this->offset_attr, (string) $offset); - - return $node; - } - - /** - * Convert a CSV record into a DOMElement. - */ - protected function recordToElement(DOMDocument $doc, array $record, string $field_encoder): DOMElement + protected function recordToElement(DOMDocument $doc, array $record, int $offset): DOMElement { $node = $doc->createElement($this->record_name); foreach ($record as $node_name => $value) { - $item = $this->$field_encoder($doc, (string) $value, $node_name); + $item = $this->fieldToElement($doc, (string) $value, $node_name); $node->appendChild($item); } + if ('' !== $this->offset_attr) { + $node->setAttribute($this->offset_attr, (string) $offset); + } + return $node; } @@ -159,24 +118,15 @@ class XMLConverter * * @param int|string $node_name */ - protected function fieldToElementWithAttribute(DOMDocument $doc, string $value, $node_name): DOMElement - { - $item = $this->fieldToElement($doc, $value); - $item->setAttribute($this->column_attr, (string) $node_name); - - return $item; - } - - /** - * Convert Cell to Item. - * - * @param string $value Record item value - */ - protected function fieldToElement(DOMDocument $doc, string $value): DOMElement + protected function fieldToElement(DOMDocument $doc, string $value, $node_name): DOMElement { $item = $doc->createElement($this->field_name); $item->appendChild($doc->createTextNode($value)); + if ('' !== $this->column_attr) { + $item->setAttribute($this->column_attr, (string) $node_name); + } + return $item; } diff --git a/vendor/league/csv/src/functions.php b/vendor/league/csv/src/functions.php index e999d302e..c36569e7e 100644 --- a/vendor/league/csv/src/functions.php +++ b/vendor/league/csv/src/functions.php @@ -11,128 +11,38 @@ declare(strict_types=1); -namespace League\Csv { +namespace League\Csv; - use ReflectionClass; - use Traversable; - use function array_fill_keys; - use function array_filter; - use function array_reduce; - use function array_unique; - use function count; - use function is_array; - use function iterator_to_array; - use function rsort; - use function strlen; - use function strpos; - use const COUNT_RECURSIVE; - - /** - * Returns the BOM sequence found at the start of the string. - * - * If no valid BOM sequence is found an empty string is returned - */ - function bom_match(string $str): string - { - static $list; - if (null === $list) { - $list = (new ReflectionClass(ByteSequence::class))->getConstants(); - - rsort($list); - } - - foreach ($list as $sequence) { - if (0 === strpos($str, $sequence)) { - return $sequence; - } - } - - return ''; - } - - /** - * Detect Delimiters usage in a {@link Reader} object. - * - * Returns a associative array where each key represents - * a submitted delimiter and each value the number CSV fields found - * when processing at most $limit CSV records with the given delimiter - * - * @param string[] $delimiters - * - * @return int[] - */ - function delimiter_detect(Reader $csv, array $delimiters, int $limit = 1): array - { - $delimiter_filter = static function (string $value): bool { - return 1 === strlen($value); - }; - - $record_filter = static function (array $record): bool { - return count($record) > 1; - }; - - $stmt = (new Statement())->limit($limit); - - $delimiter_stats = static function (array $stats, string $delimiter) use ($csv, $stmt, $record_filter): array { - $csv->setDelimiter($delimiter); - $found_records = array_filter( - iterator_to_array($stmt->process($csv), false), - $record_filter - ); - - $stats[$delimiter] = count($found_records, COUNT_RECURSIVE); - - return $stats; - }; - - $current_delimiter = $csv->getDelimiter(); - $current_header_offset = $csv->getHeaderOffset(); - $csv->setHeaderOffset(null); - - $stats = array_reduce( - array_unique(array_filter($delimiters, $delimiter_filter)), - $delimiter_stats, - array_fill_keys($delimiters, 0) - ); - - $csv->setHeaderOffset($current_header_offset); - $csv->setDelimiter($current_delimiter); - - return $stats; - } - - /** - * Tell whether the content of the variable is iterable. - * - * @see http://php.net/manual/en/function.is-iterable.php - */ - function is_iterable($iterable): bool - { - return is_array($iterable) || $iterable instanceof Traversable; - } - - /** - * Tell whether the content of the variable is an int or null. - * - * @see https://wiki.php.net/rfc/nullable_types - */ - function is_nullable_int($value): bool - { - return null === $value || is_int($value); - } +/** + * DEPRECATION WARNING! This class will be removed in the next major point release. + * + * @deprecated since version 9.7.0 + * @see Info::fetchBOMSequence() + * + * Returns the BOM sequence found at the start of the string. + * + * If no valid BOM sequence is found an empty string is returned + */ +function bom_match(string $str): string +{ + return Info::fetchBOMSequence($str) ?? ''; } -namespace { - - use League\Csv; - - if (PHP_VERSION_ID < 70100 && !function_exists('\is_iterable')) { - /** - * @codeCoverageIgnore - */ - function is_iterable($iterable) - { - return Csv\is_iterable($iterable); - } - } +/** + * @param array $delimiters + * + * @return array + * @deprecated since version 9.7.0 + * @see Info::getDelimiterStats() + * + * Detect Delimiters usage in a {@link Reader} object. + * + * Returns a associative array where each key represents + * a submitted delimiter and each value the number CSV fields found + * when processing at most $limit CSV records with the given delimiter + * + */ +function delimiter_detect(Reader $csv, array $delimiters, int $limit = 1): array +{ + return Info::getDelimiterStats($csv, $delimiters, $limit); } diff --git a/vendor/league/flysystem/CODE_OF_CONDUCT.md b/vendor/league/flysystem/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..89569c015 --- /dev/null +++ b/vendor/league/flysystem/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at info+flysystem@frankdejonge.nl. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/vendor/league/flysystem/composer.json b/vendor/league/flysystem/composer.json index b0a68ec4b..32ec81d1b 100644 --- a/vendor/league/flysystem/composer.json +++ b/vendor/league/flysystem/composer.json @@ -21,12 +21,13 @@ } ], "require": { - "php": ">=5.5.9", - "ext-fileinfo": "*" + "php": "^7.2.5 || ^8.0", + "ext-fileinfo": "*", + "league/mime-type-detection": "^1.3" }, "require-dev": { - "phpspec/phpspec": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "phpunit/phpunit": "^5.7.26" + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" }, "autoload": { "psr-4": { @@ -36,13 +37,9 @@ "autoload-dev": { "psr-4": { "League\\Flysystem\\Stub\\": "stub/" - }, - "files": [ - "tests/PHPUnitHacks.php" - ] + } }, "suggest": { - "ext-fileinfo": "Required for MimeType", "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", diff --git a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php index e577ac4a7..a6a8ed026 100644 --- a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php @@ -67,6 +67,6 @@ abstract class AbstractAdapter implements AdapterInterface */ public function removePathPrefix($path) { - return substr($path, strlen($this->getPathPrefix())); + return substr($path, strlen((string) $this->getPathPrefix())); } } diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php index 95a6b4d09..25d949ead 100644 --- a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php @@ -440,7 +440,13 @@ abstract class AbstractFtpAdapter extends AbstractAdapter $path = $base === '' ? $name : $base . $this->separator . $name; if ($type === 'dir') { - return compact('type', 'path'); + $result = compact('type', 'path'); + if ($this->enableTimestampsOnUnixListings) { + $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); + $result += compact('timestamp'); + } + + return $result; } $permissions = $this->normalizePermissions($permissions); @@ -533,7 +539,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ protected function detectSystemType($item) { - return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; + return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', trim($item)) ? 'windows' : 'unix'; } /** @@ -639,10 +645,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ public function getConnection() { - $tries = 0; - - while ( ! $this->isConnected() && $tries < 3) { - $tries++; + if ( ! $this->isConnected()) { $this->disconnect(); $this->connect(); } @@ -694,4 +697,9 @@ abstract class AbstractFtpAdapter extends AbstractAdapter * @return bool */ abstract public function isConnected(); + + protected function escapePath($path) + { + return str_replace(['*', '[', ']'], ['\\*', '\\[', '\\]'], $path); + } } diff --git a/vendor/league/flysystem/src/Adapter/Ftp.php b/vendor/league/flysystem/src/Adapter/Ftp.php index dc89e4318..b7886bb2d 100644 --- a/vendor/league/flysystem/src/Adapter/Ftp.php +++ b/vendor/league/flysystem/src/Adapter/Ftp.php @@ -2,7 +2,6 @@ namespace League\Flysystem\Adapter; -use ErrorException; use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; use League\Flysystem\AdapterInterface; use League\Flysystem\Config; @@ -12,6 +11,8 @@ use League\Flysystem\InvalidRootException; use League\Flysystem\Util; use League\Flysystem\Util\MimeType; +use function in_array; + class Ftp extends AbstractFtpAdapter { use StreamedCopyTrait; @@ -130,6 +131,9 @@ class Ftp extends AbstractFtpAdapter */ public function connect() { + $tries = 3; + start_connecting: + if ($this->ssl) { $this->connection = @ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); } else { @@ -137,6 +141,10 @@ class Ftp extends AbstractFtpAdapter } if ( ! $this->connection) { + $tries--; + + if ($tries > 0) goto start_connecting; + throw new ConnectionRuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); } @@ -154,7 +162,7 @@ class Ftp extends AbstractFtpAdapter { if ($this->utf8) { $response = ftp_raw($this->connection, "OPTS UTF8 ON"); - if (substr($response[0], 0, 3) !== '200') { + if (!in_array(substr($response[0], 0, 3), ['200', '202'])) { throw new ConnectionRuntimeException( 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() ); @@ -229,7 +237,7 @@ class Ftp extends AbstractFtpAdapter */ public function disconnect() { - if (is_resource($this->connection)) { + if ($this->hasFtpConnection()) { @ftp_close($this->connection); } @@ -394,7 +402,7 @@ class Ftp extends AbstractFtpAdapter return ['type' => 'dir', 'path' => $path]; } - $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); + $listing = $this->ftpRawlist('-A', $path); if (empty($listing) || in_array('total 0', $listing, true)) { return false; @@ -490,8 +498,6 @@ class Ftp extends AbstractFtpAdapter */ protected function listDirectoryContents($directory, $recursive = true) { - $directory = str_replace('*', '\\*', $directory); - if ($recursive && $this->recurseManually) { return $this->listDirectoryContentsRecursive($directory); } @@ -532,8 +538,7 @@ class Ftp extends AbstractFtpAdapter */ public function isConnected() { - return is_resource($this->connection) - && $this->getRawExecResponseCode('NOOP') === 200; + return $this->hasFtpConnection() && $this->getRawExecResponseCode('NOOP') === 200; } /** @@ -559,16 +564,21 @@ class Ftp extends AbstractFtpAdapter $connection = $this->getConnection(); if ($this->isPureFtpd) { - $path = str_replace(' ', '\ ', $path); + $path = str_replace([' ', '[', ']'], ['\ ', '\\[', '\\]'], $path); } - return ftp_rawlist($connection, $options . ' ' . $path); + return ftp_rawlist($connection, $options . ' ' . $this->escapePath($path)); } private function getRawExecResponseCode($command) { - $response = @ftp_raw($this->connection, trim($command)); + $response = @ftp_raw($this->connection, trim($command)) ?: []; - return (int) preg_replace('/\D/', '', implode(' ', $response)); + return (int) preg_replace('/\D/', '', implode(' ', (array) $response)); + } + + private function hasFtpConnection(): bool + { + return is_resource($this->connection) || $this->connection instanceof \FTP\Connection; } } diff --git a/vendor/league/flysystem/src/Adapter/Ftpd.php b/vendor/league/flysystem/src/Adapter/Ftpd.php index d5349e475..7e71d19f6 100644 --- a/vendor/league/flysystem/src/Adapter/Ftpd.php +++ b/vendor/league/flysystem/src/Adapter/Ftpd.php @@ -12,13 +12,16 @@ class Ftpd extends Ftp if ($path === '') { return ['type' => 'dir', 'path' => '']; } + if (@ftp_chdir($this->getConnection(), $path) === true) { $this->setConnectionRoot(); return ['type' => 'dir', 'path' => $path]; } - if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { + $object = ftp_raw($this->getConnection(), 'STAT ' . $this->escapePath($path)); + + if ( ! $object || count($object) < 3) { return false; } @@ -34,7 +37,7 @@ class Ftpd extends Ftp */ protected function listDirectoryContents($directory, $recursive = true) { - $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); + $listing = ftp_rawlist($this->getConnection(), $this->escapePath($directory), $recursive); if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { return []; diff --git a/vendor/league/flysystem/src/CorruptedPathDetected.php b/vendor/league/flysystem/src/CorruptedPathDetected.php new file mode 100644 index 000000000..81a27e5f2 --- /dev/null +++ b/vendor/league/flysystem/src/CorruptedPathDetected.php @@ -0,0 +1,17 @@ + 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/csv', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'xlt' => 'application/vnd.ms-excel', - 'xla' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pot' => 'application/vnd.ms-powerpoint', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppa' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'rdf' => 'application/rdf+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'markdown' => 'text/markdown', - 'md' => 'text/markdown', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'dmn' => 'application/octet-stream', - 'bpmn' => 'application/octet-stream', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - 'tex' => 'application/x-tex', - 'latex' => 'application/x-latex', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'webp' => 'image/webp', - 'ico' => 'image/x-icon', - ]; + protected static $extensionToMimeTypeMap = GeneratedExtensionToMimeTypeMap::MIME_TYPES_FOR_EXTENSIONS; + protected static $detector; + + public static function useDetector(MimeTypeDetector $detector) + { + static::$detector = $detector; + } + + /** + * @return MimeTypeDetector + */ + protected static function detector() + { + if ( ! static::$detector instanceof MimeTypeDetector) { + static::$detector = new FinfoMimeTypeDetector(); + } + + return static::$detector; + } + /** * Detects MIME Type based on given content. * * @param mixed $content * - * @return string|null MIME Type or NULL if no mime type detected + * @return string MIME Type */ public static function detectByContent($content) { - if ( ! class_exists('finfo') || ! is_string($content)) { - return null; + if (is_string($content)) { + return static::detector()->detectMimeTypeFromBuffer($content); } - try { - $finfo = new finfo(FILEINFO_MIME_TYPE); - return $finfo->buffer($content) ?: null; - // @codeCoverageIgnoreStart - } catch (ErrorException $e) { - // This is caused by an array to string conversion error. - } - } // @codeCoverageIgnoreEnd + return 'text/plain'; + } /** * Detects MIME Type based on file extension. * * @param string $extension * - * @return string|null MIME Type or NULL if no extension detected + * @return string MIME Type */ public static function detectByFileExtension($extension) { - return isset(static::$extensionToMimeTypeMap[$extension]) - ? static::$extensionToMimeTypeMap[$extension] - : 'text/plain'; + return static::detector()->detectMimeTypeFromPath('artificial.' . $extension) ?: 'text/plain'; } /** * @param string $filename * - * @return string|null MIME Type or NULL if no extension detected + * @return string MIME Type */ public static function detectByFilename($filename) { - $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - - return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); + return static::detector()->detectMimeTypeFromPath($filename) ?: 'text/plain'; } /** diff --git a/vendor/league/mime-type-detection/CHANGELOG.md b/vendor/league/mime-type-detection/CHANGELOG.md new file mode 100644 index 000000000..2264f7ad8 --- /dev/null +++ b/vendor/league/mime-type-detection/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +## 1.10.0 - 2022-04-11 + +### Fixed + +- Added Flysystem v1 inconclusive mime-types and made it configurable as a constructor parameter. + +## 1.9.0 - 2021-11-21 + +### Updated + +- Updated lookup + +## 1.8.0 - 2021-09-25 + +### Added + +- Added the decorator `OverridingExtensionToMimeTypeMap` which allows you to override values. + +## 1.7.0 - 2021-01-18 + +### Added + +- Added a `bufferSampleSize` parameter to the `FinfoMimeTypeDetector` class that allows you to send a reduced content sample which costs less memory. + +## 1.6.0 - 2021-01-18 + +### Changes + +- Updated generated mime-type map diff --git a/vendor/league/mime-type-detection/LICENSE b/vendor/league/mime-type-detection/LICENSE new file mode 100644 index 000000000..1f0165218 --- /dev/null +++ b/vendor/league/mime-type-detection/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2022 Frank de Jonge + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +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/vendor/league/mime-type-detection/composer.json b/vendor/league/mime-type-detection/composer.json new file mode 100644 index 000000000..80ca1af81 --- /dev/null +++ b/vendor/league/mime-type-detection/composer.json @@ -0,0 +1,34 @@ +{ + "name": "league/mime-type-detection", + "description": "Mime-type detection for Flysystem", + "license": "MIT", + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "scripts": { + "test": "vendor/bin/phpunit", + "phpstan": "vendor/bin/phpstan analyse -l 6 src" + }, + "require": { + "php": "^7.2 || ^8.0", + "ext-fileinfo": "*" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.8 || ^9.3", + "phpstan/phpstan": "^0.12.68", + "friendsofphp/php-cs-fixer": "^3.2" + }, + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "config": { + "platform": { + "php": "7.2.0" + } + } +} diff --git a/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php new file mode 100644 index 000000000..fc0424161 --- /dev/null +++ b/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php @@ -0,0 +1,13 @@ +extensions = $extensions ?: new GeneratedExtensionToMimeTypeMap(); + } + + public function detectMimeType(string $path, $contents): ?string + { + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromPath(string $path): ?string + { + $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION)); + + return $this->extensions->lookupMimeType($extension); + } + + public function detectMimeTypeFromFile(string $path): ?string + { + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromBuffer(string $contents): ?string + { + return null; + } +} diff --git a/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php new file mode 100644 index 000000000..1dad7bc1a --- /dev/null +++ b/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php @@ -0,0 +1,10 @@ + + */ + private $inconclusiveMimetypes; + + public function __construct( + string $magicFile = '', + ExtensionToMimeTypeMap $extensionMap = null, + ?int $bufferSampleSize = null, + array $inconclusiveMimetypes = self::INCONCLUSIVE_MIME_TYPES + ) { + $this->finfo = new finfo(FILEINFO_MIME_TYPE, $magicFile); + $this->extensionMap = $extensionMap ?: new GeneratedExtensionToMimeTypeMap(); + $this->bufferSampleSize = $bufferSampleSize; + $this->inconclusiveMimetypes = $inconclusiveMimetypes; + } + + public function detectMimeType(string $path, $contents): ?string + { + $mimeType = is_string($contents) + ? (@$this->finfo->buffer($this->takeSample($contents)) ?: null) + : null; + + if ($mimeType !== null && ! in_array($mimeType, $this->inconclusiveMimetypes)) { + return $mimeType; + } + + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromPath(string $path): ?string + { + $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION)); + + return $this->extensionMap->lookupMimeType($extension); + } + + public function detectMimeTypeFromFile(string $path): ?string + { + return @$this->finfo->file($path) ?: null; + } + + public function detectMimeTypeFromBuffer(string $contents): ?string + { + return @$this->finfo->buffer($this->takeSample($contents)) ?: null; + } + + private function takeSample(string $contents): string + { + if ($this->bufferSampleSize === null) { + return $contents; + } + + return (string) substr($contents, 0, $this->bufferSampleSize); + } +} diff --git a/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php new file mode 100644 index 000000000..f092388dd --- /dev/null +++ b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php @@ -0,0 +1,1227 @@ + 'application/vnd.1000minds.decision-model+xml', + '3dml' => 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + '3gpp' => 'video/3gpp', + '3mf' => 'model/3mf', + '7z' => 'application/x-7z-compressed', + '7zip' => 'application/x-7z-compressed', + '123' => 'application/vnd.lotus-1-2-3', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/x-acc', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/vnd.nokia.n-gage.ac+xml', + 'ac3' => 'audio/ac3', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'age' => 'application/vnd.age', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/pdf', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'amr' => 'audio/amr', + 'apk' => 'application/vnd.android.package-archive', + 'apng' => 'image/apng', + 'appcache' => 'text/cache-manifest', + 'application' => 'application/x-ms-application', + 'apr' => 'application/vnd.lotus-approach', + 'arc' => 'application/x-freearc', + 'arj' => 'application/x-arj', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomdeleted' => 'application/atomdeleted+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/x-au', + 'avci' => 'image/avci', + 'avcs' => 'image/avcs', + 'avi' => 'video/x-msvideo', + 'avif' => 'image/avif', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azv' => 'image/vnd.airzip.accelerator.azv', + 'azw' => 'application/vnd.amazon.ebook', + 'b16' => 'image/vnd.pco.b16', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bdoc' => 'application/x-bdoc', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmml' => 'application/vnd.balsamiq.bmml+xml', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btif' => 'image/prs.btif', + 'buffer' => 'application/octet-stream', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cco' => 'application/x-cocoa', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdfx' => 'application/cdfx+xml', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdr' => 'application/cdr', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cjs' => 'application/node', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/octet-stream', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'coffee' => 'text/coffeescript', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpl' => 'application/cpl+xml', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'crx' => 'application/x-chrome-extension', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'csh' => 'application/x-csh', + 'csl' => 'application/vnd.citationstyles.style+xml', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'csr' => 'application/octet-stream', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbf' => 'application/vnd.dbf', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'ddf' => 'application/vnd.syncml.dmddf+xml', + 'dds' => 'image/vnd.ms-dds', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'disposition-notification' => 'message/disposition-notification', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/octet-stream', + 'dmg' => 'application/x-apple-diskimage', + 'dmn' => 'application/octet-stream', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dra' => 'audio/vnd.dra', + 'drle' => 'image/dicom-rle', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwd' => 'application/atsc-dwd+xml', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ear' => 'application/java-archive', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'image/emf', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emotionml' => 'application/emotionml+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es' => 'application/ecmascript', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/octet-stream', + 'exi' => 'application/exi', + 'exp' => 'application/express', + 'exr' => 'image/aces', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/mp4', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fdt' => 'application/fdt+xml', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'fits' => 'image/fits', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'fo' => 'application/vnd.software602.filler.form+xml', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'gdoc' => 'application/vnd.google-apps.document', + 'ged' => 'text/vnd.familysearch.gedcom', + 'geo' => 'application/vnd.dynageo', + 'geojson' => 'application/geo+json', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'glb' => 'model/gltf-binary', + 'gltf' => 'model/gltf+json', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gpg' => 'application/gpg-keys', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gsheet' => 'application/vnd.google-apps.spreadsheet', + 'gslides' => 'application/vnd.google-apps.presentation', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'gz' => 'application/gzip', + 'gzip' => 'application/gzip', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hbs' => 'text/x-handlebars-template', + 'hdd' => 'application/x-virtualbox-hdd', + 'hdf' => 'application/x-hdf', + 'heic' => 'image/heic', + 'heics' => 'image/heic-sequence', + 'heif' => 'image/heif', + 'heifs' => 'image/heif-sequence', + 'hej2' => 'image/hej2k', + 'held' => 'application/atsc-held+xml', + 'hh' => 'text/x-c', + 'hjson' => 'application/hjson', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'hsj2' => 'image/hsj2', + 'htc' => 'text/x-component', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'img' => 'application/octet-stream', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ini' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'its' => 'application/its+xml', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jade' => 'text/jade', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'jardiff' => 'application/x-java-archive-diff', + 'java' => 'text/x-java-source', + 'jhc' => 'image/jphc', + 'jisp' => 'application/vnd.jisp', + 'jls' => 'image/jls', + 'jlt' => 'application/vnd.hp-jlyt', + 'jng' => 'image/x-jng', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jp2' => 'image/jp2', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpf' => 'image/jpx', + 'jpg' => 'image/jpeg', + 'jpg2' => 'image/jp2', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jph' => 'image/jph', + 'jpm' => 'video/jpm', + 'jpx' => 'image/jpx', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'json5' => 'application/json5', + 'jsonld' => 'application/ld+json', + 'jsonml' => 'application/jsonml+json', + 'jsx' => 'text/jsx', + 'jxr' => 'image/jxr', + 'jxra' => 'image/jxra', + 'jxrs' => 'image/jxrs', + 'jxs' => 'image/jxs', + 'jxsc' => 'image/jxsc', + 'jxsi' => 'image/jxsi', + 'jxss' => 'image/jxss', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kdb' => 'application/octet-stream', + 'kdbx' => 'application/x-keepass2', + 'key' => 'application/x-iwork-keynote-sffkey', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktx2' => 'image/ktx2', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'less' => 'text/less', + 'lgr' => 'application/lgr+xml', + 'lha' => 'application/octet-stream', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'litcoffee' => 'text/coffeescript', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lua' => 'text/x-lua', + 'luac' => 'application/x-lua-bytecode', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/octet-stream', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'text/plain', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/x-m4a', + 'm4p' => 'application/mp4', + 'm4s' => 'video/iso.segment', + 'm4u' => 'application/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm21' => 'application/mp21', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'maei' => 'application/mmt-aei+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'manifest' => 'text/cache-manifest', + 'map' => 'application/json', + 'mar' => 'application/octet-stream', + 'markdown' => 'text/markdown', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'md' => 'text/markdown', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'mdx' => 'text/mdx', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mjs' => 'application/javascript', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mkd' => 'text/x-markdown', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mml' => 'text/mathml', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mp21' => 'application/mp21', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpd' => 'application/dash+xml', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpf' => 'application/media-policy-dataset+xml', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msg' => 'application/vnd.ms-outlook', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msl' => 'application/vnd.mobius.msl', + 'msm' => 'application/octet-stream', + 'msp' => 'application/octet-stream', + 'msty' => 'application/vnd.muvee.style', + 'mtl' => 'model/mtl', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musd' => 'application/mmt-usd+xml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mvt' => 'application/vnd.mapbox-vector-tile', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxmf' => 'audio/mobile-xmf', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nq' => 'application/n-quads', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'nt' => 'application/n-triples', + 'ntf' => 'application/vnd.nitf', + 'numbers' => 'application/x-iwork-numbers-sffnumbers', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obgx' => 'application/vnd.openblox.game+xml', + 'obj' => 'model/obj', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogex' => 'model/vnd.opengex', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'opus' => 'audio/ogg', + 'org' => 'text/x-org', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'osm' => 'application/vnd.openstreetmap.data+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'font/otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'ova' => 'application/x-virtualbox-ova', + 'ovf' => 'application/x-virtualbox-ovf', + 'owl' => 'application/rdf+xml', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p7a' => 'application/x-pkcs7-signature', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'pac' => 'application/x-ns-proxy-autoconfig', + 'pages' => 'application/x-iwork-pages-sffpages', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/x-pilot', + 'pde' => 'text/x-processing', + 'pdf' => 'application/pdf', + 'pem' => 'application/x-x509-user-cert', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp', + 'phar' => 'application/octet-stream', + 'php' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'phtml' => 'application/x-httpd-php', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'pkpass' => 'application/vnd.apple.pkpass', + 'pl' => 'application/x-perl', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pm' => 'application/x-perl', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'model/prc', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'provx' => 'application/provenance+xml', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'application/x-photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'pti' => 'image/prs.pti', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'raml' => 'application/raml+yaml', + 'rapd' => 'application/route-apd+xml', + 'rar' => 'application/x-rar', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'relo' => 'application/p2p-overlay+xml', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rng' => 'application/xml', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsa' => 'application/x-pkcs7', + 'rsat' => 'application/atsc-rsat+xml', + 'rsd' => 'application/rsd+xml', + 'rsheet' => 'application/urc-ressheet+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'run' => 'application/x-makeself', + 'rusd' => 'application/route-usd+xml', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sass' => 'text/x-sass', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scss' => 'text/x-scss', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'sea' => 'application/octet-stream', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'senmlx' => 'application/senml+xml', + 'sensmlx' => 'application/sensml+xml', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shex' => 'text/shex', + 'shf' => 'application/shf+xml', + 'shtml' => 'text/html', + 'sid' => 'image/x-mrsid-image', + 'sieve' => 'application/sieve', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'siv' => 'application/sieve', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slim' => 'text/slim', + 'slm' => 'text/slim', + 'sls' => 'application/route-s-tsid+xml', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spdx' => 'text/spdx', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'sst' => 'application/octet-stream', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'model/stl', + 'stpx' => 'model/step+xml', + 'stpxz' => 'model/step-xml+zip', + 'stpz' => 'model/step+zip', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'styl' => 'text/stylus', + 'stylus' => 'text/stylus', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'swidtag' => 'application/swid+xml', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 't38' => 'image/t38', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tap' => 'image/vnd.tencent.tap', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'td' => 'application/urc-targetdesc+xml', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tfx' => 'image/tiff-fx', + 'tga' => 'image/x-tga', + 'tgz' => 'application/x-tar', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tk' => 'application/x-tcl', + 'tmo' => 'application/vnd.tmobile-livetv', + 'toml' => 'application/toml', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trig' => 'application/trig', + 'trm' => 'application/x-msterminal', + 'ts' => 'video/mp2t', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'font/collection', + 'ttf' => 'font/ttf', + 'ttl' => 'text/turtle', + 'ttml' => 'application/ttml+xml', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u3d' => 'model/u3d', + 'u8dsn' => 'message/global-delivery-status', + 'u8hdr' => 'message/global-headers', + 'u8mdn' => 'message/global-disposition-notification', + 'u8msg' => 'message/global', + 'u32' => 'application/x-authorware-bin', + 'ubj' => 'application/ubjson', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'usdz' => 'model/vnd.usdz+zip', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vbox' => 'application/x-virtualbox-vbox', + 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vdi' => 'application/x-virtualbox-vdi', + 'vds' => 'model/vnd.sap.vds', + 'vhd' => 'application/x-virtualbox-vhd', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vlc' => 'application/videolan', + 'vmdk' => 'application/x-virtualbox-vmdk', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtf' => 'image/vnd.valve.source.texture', + 'vtt' => 'text/vtt', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wadl' => 'application/vnd.sun.wadl+xml', + 'war' => 'application/java-archive', + 'wasm' => 'application/wasm', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webapp' => 'application/x-web-app-manifest+json', + 'webm' => 'video/webm', + 'webmanifest' => 'application/manifest+json', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgt' => 'application/widget', + 'wif' => 'application/watcherinfo+xml', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'image/wmf', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + 'word' => 'application/msword', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsc' => 'message/vnd.wfa.wsc', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+fastinfoset', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d-vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'x32' => 'application/x-authorware-bin', + 'x_b' => 'model/vnd.parasolid.transmit.binary', + 'x_t' => 'model/vnd.parasolid.transmit.text', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xav' => 'application/xcap-att+xml', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xca' => 'application/xcap-caps+xml', + 'xcs' => 'application/calendar+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xel' => 'application/xcap-el+xml', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xns' => 'application/xcap-ns+xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsd' => 'application/xml', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yaml' => 'text/yaml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'yml' => 'text/yaml', + 'ymp' => 'text/x-suse-ymp', + 'z' => 'application/x-compress', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'zsh' => 'text/x-scriptzsh', + ]; + + public function lookupMimeType(string $extension): ?string + { + return self::MIME_TYPES_FOR_EXTENSIONS[$extension] ?? null; + } +} diff --git a/vendor/league/mime-type-detection/src/MimeTypeDetector.php b/vendor/league/mime-type-detection/src/MimeTypeDetector.php new file mode 100644 index 000000000..5d799d2a8 --- /dev/null +++ b/vendor/league/mime-type-detection/src/MimeTypeDetector.php @@ -0,0 +1,19 @@ + $overrides + */ + public function __construct(ExtensionToMimeTypeMap $innerMap, array $overrides) + { + $this->innerMap = $innerMap; + $this->overrides = $overrides; + } + + public function lookupMimeType(string $extension): ?string + { + return $this->overrides[$extension] ?? $this->innerMap->lookupMimeType($extension); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.editorconfig b/vendor/meilisearch/meilisearch-laravel-scout/.editorconfig new file mode 100644 index 000000000..6601406c7 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.editorconfig @@ -0,0 +1,23 @@ +# https://editorconfig.org/ + +root = true + +[*] +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf +charset = utf-8 +tab_width = 4 +indent_style = space + +[*.php] +indent_size = 4 +indent_style = space + +[*.md] +indent_style = space +max_line_length = 80 + +[*.{yml,yaml}] +indent_size = 2 +indent_style = space diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.github/release-draft-template.yml b/vendor/meilisearch/meilisearch-laravel-scout/.github/release-draft-template.yml new file mode 100644 index 000000000..c3c59e1d3 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.github/release-draft-template.yml @@ -0,0 +1,27 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +exclude-labels: + - 'skip-changelog' +version-resolver: + minor: + labels: + - 'breaking-change' + default: patch +categories: + - title: 'Breaking changes ⚠️' + label: 'breaking-change' +template: | + ## Changes + + $CHANGES + + Thanks again to $CONTRIBUTORS! 🎉 +no-changes-template: 'Changes are coming soon 😎' +sort-direction: 'ascending' +replacers: + - search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g' + replace: '' + - search: '/(?:and )?@bors(?:\[bot\])?,?/g' + replace: '' + - search: '/(?:and )?@meili-bot,?/g' + replace: '' diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/release-drafter.yml b/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..9ec8b9d64 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-draft-template.yml + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_DRAFTER_TOKEN }} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/tests.yml b/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/tests.yml new file mode 100644 index 000000000..ae89bee79 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.github/workflows/tests.yml @@ -0,0 +1,52 @@ +name: Tests + +on: + pull_request: + push: + # trying and staging branches are for BORS config + branches: + - trying + - staging + - main + +jobs: + tests: + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + env: + MEILISEARCH_KEY: masterKey + name: tests (php ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer update --prefer-dist --no-progress --no-interaction + - name: MeiliSearch setup with Docker + run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=${{ env.MEILISEARCH_KEY }} --no-analytics=true + - name: Run tests + run: composer test + + linter: + name: linter-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer update --prefer-dist --no-progress --no-interaction + - name: Run linter + env: + PHP_CS_FIXER_IGNORE_ENV: 1 + run: composer lint diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.gitignore b/vendor/meilisearch/meilisearch-laravel-scout/.gitignore new file mode 100644 index 000000000..416ec57d3 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.gitignore @@ -0,0 +1,6 @@ +/vendor/ +composer.lock +phpunit.xml +.phpunit.result.cache +.php_cs.cache +.DS_Store diff --git a/vendor/meilisearch/meilisearch-laravel-scout/.php_cs.dist b/vendor/meilisearch/meilisearch-laravel-scout/.php_cs.dist new file mode 100644 index 000000000..8db412bad --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/.php_cs.dist @@ -0,0 +1,16 @@ +in(__DIR__.DIRECTORY_SEPARATOR.'src') + ->in(__DIR__.DIRECTORY_SEPARATOR.'tests') + ->append(['.php_cs.dist']); + +$rules = [ + '@Symfony' => true, +]; + +return \PhpCsFixer\Config::create() + ->setRules($rules) + ->setFinder($finder); diff --git a/vendor/meilisearch/meilisearch-laravel-scout/CONTRIBUTING.md b/vendor/meilisearch/meilisearch-laravel-scout/CONTRIBUTING.md new file mode 100644 index 000000000..801fb68e0 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/CONTRIBUTING.md @@ -0,0 +1,102 @@ +# Contributing + +First of all, thank you for contributing to MeiliSearch! The goal of this document is to provide everything you need to know in order to contribute to MeiliSearch and its different integrations. + +- [Assumptions](#assumptions) +- [How to Contribute](#how-to-contribute) +- [Development Workflow](#development-workflow) +- [Git Guidelines](#git-guidelines) +- [Release Process (for internal team only)](#release-process-for-internal-team-only) + +## Assumptions + +1. **You're familiar with [GitHub](https://github.com) and the [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)(PR) workflow.** +2. **You've read the MeiliSearch [documentation](https://docs.meilisearch.com) and the [README](/README.md).** +3. **You know about the [MeiliSearch community](https://docs.meilisearch.com/learn/what_is_meilisearch/contact.html). Please use this for help.** + +## How to Contribute + +1. Make sure that the contribution you want to make is explained or detailed in a GitHub issue! Find an [existing issue](https://github.com/meilisearch/meilisearch-laravel-scout/issues/) or [open a new one](https://github.com/meilisearch/meilisearch-laravel-scout/issues/new). +2. Once done, [fork the meilisearch-laravel-scout repository](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) in your own GitHub account. Ask a maintainer if you want your issue to be checked before making a PR. +3. [Create a new Git branch](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository). +4. Review the [Development Workflow](#workflow) section that describes the steps to maintain the repository. +5. Make the changes on your branch. +6. [Submit the branch as a PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `main` branch of the main meilisearch-laravel-scout repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.
+ We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://github.com/meilisearch/meilisearch-laravel-scout/releases/). + +## Development Workflow + +### Setup + +```bash +$ composer install +``` + +### Tests and Linter + +Each PR should pass the tests and the linter to be accepted. + +```bash +# Tests +$ export MEILISEARCH_KEY='masterKey' +$ docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub +$ docker run -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics=true +$ composer test +# Linter (with auto-fix) +$ composer lint:fix +# Linter (without auto-fix) +$ composer lint +``` + +## Git Guidelines + +### Git Branches + +All changes must be made in a branch and submitted as PR. +We do not enforce any branch naming style, but please use something descriptive of your changes. + +### Git Commits + +As minimal requirements, your commit message should: +- be capitalized +- not finish by a dot or any other punctuation character (!,?) +- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message. + e.g.: "Fix the home page button" or "Add more tests for create_index method" + +We don't follow any other convention, but if you want to use one, we recommend [this one](https://chris.beams.io/posts/git-commit/). + +### GitHub Pull Requests + +Some notes on GitHub PRs: + +- [Convert your PR as a draft](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request) if your changes are a work in progress: no one will review it until you pass your PR as ready for review.
+ The draft PR can be very useful if you want to show that you are working on something and make your work visible. +- The branch related to the PR must be **up-to-date with `main`** before merging. Fortunately, this project [integrates a bot](https://github.com/meilisearch/integration-guides/blob/main/guides/bors.md) to automatically enforce this requirement without the PR author having to do it manually.. +- All PRs must be reviewed and approved by at least one maintainer. +- The PR title should be accurate and descriptive of the changes. The title of the PR will be indeed automatically added to the next [release changelogs](https://github.com/meilisearch/meilisearch-laravel-scout/releases/). + +## Release Process (for internal team only) + +MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/). + +### Automation to Rebase and Merge the PRs + +This project integrates a bot that helps us manage pull requests merging.
+_[Read more about this](https://github.com/meilisearch/integration-guides/blob/main/guides/bors.md)._ + +### Automated Changelogs + +This project integrates a tool to create automated changelogs.
+_[Read more about this](https://github.com/meilisearch/integration-guides/blob/main/guides/release-drafter.md)._ + +### How to Publish the Release + +⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration Tool](https://github.com/meilisearch/integration-guides/blob/main/guides/integration-tool-release.md). + +Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-laravel-scout/releases). + +A WebHook will be triggered and push the package to [Packagist](https://packagist.org/packages/meilisearch/meilisearch-laravel-scout). + +
+ +Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide ❤️ diff --git a/vendor/meilisearch/meilisearch-laravel-scout/LICENSE b/vendor/meilisearch/meilisearch-laravel-scout/LICENSE new file mode 100644 index 000000000..35b13198b --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2021 Meili + +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/vendor/meilisearch/meilisearch-laravel-scout/README.md b/vendor/meilisearch/meilisearch-laravel-scout/README.md new file mode 100644 index 000000000..78be6d372 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/README.md @@ -0,0 +1,264 @@ +

+ MeiliSearch Laravel Scout +

+ +

MeiliSearch Laravel Scout

+ +

+ MeiliSearch | + Documentation | + Slack | + Roadmap | + Website | + FAQ +

+ +

+ Latest Stable Version + Actions Status + License + Bors enabled +

+ +

⚡ The MeiliSearch driver for Laravel Scout

+ +**MeiliSearch Laravel Scout** is a **MeiliSearch** driver for Laravel. + +**MeiliSearch** is an open-source search engine. [Discover what MeiliSearch is!](https://github.com/meilisearch/MeiliSearch) + +## Table of Contents + +- [📖 Documentation](#-documentation) +- [🔧 Installation](#-installation) +- [🚀 Getting Started](#-getting-started) + - [Indexes](#indexes) + - [Search](#search) +- [🤖 Compatibility with MeiliSearch](#-compatibility-with-meilisearch) +- [💡 Learn More](#-learn-more) +- [Development Workflow and Contributing](#development-workflow-and-contributing) + +## 📖 Documentation + +See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/). + +Also, take a look at the [Wiki](https://github.com/meilisearch/meilisearch-laravel-scout/wiki) of this repository! + +## 🔧 Installation + +### Install the Plugin + +```bash +$ composer require meilisearch/meilisearch-laravel-scout +``` + +### Install the HTTP Client + +You could use any [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible client to use with this SDK. No additional configurations are required.
+A list of compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html). + +If you use **Laravel 8** you can skip this section as laravel pre-install Guzzle 7 by default. + +Guzzle 7: +```bash +$ composer require guzzlehttp/guzzle +``` + +If you already have guzzle installed with a version < 7, don't forget to update the version inside your composer.json +```json +"require": { + "guzzlehttp/guzzle": "^7.0" +} +``` + +Guzzle 6: + +```bash +$ composer require php-http/guzzle6-adapter +``` + +Symfony Http Client: + +```bash +$ composer require symfony/http-client nyholm/psr7 +``` + +Curl: + +```bash +$ composer require php-http/curl-client nyholm/psr7 +``` + +### Export Configuration + +```bash +$ php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider" +$ php artisan vendor:publish --provider="Meilisearch\Scout\MeilisearchServiceProvider" --tag="config" +``` + +### Update the `.env` file + +```dotenv +SCOUT_DRIVER=meilisearch +MEILISEARCH_HOST=http://127.0.0.1:7700 +MEILISEARCH_KEY=masterKey +``` + +### Run MeiliSearch + +There are many easy ways to [download and run a MeiliSearch instance](https://docs.meilisearch.com/reference/features/installation.html#download-and-launch). + +For example, if you use Docker: +```bash +$ docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey +``` + +NB: you can also download MeiliSearch from **Homebrew** or **APT**. + +## 🚀 Getting Started + +### Indexes + +#### Create an Index + +```bash +// Create an index +$ php artisan scout:index books +// Create an index and give the primary-key +$ php artisan scout:index books --key book_id +``` + +#### Add Documents + +```php +title = 'Pride and Prejudice'; + ... + $book->save(); + } +} +``` +You can also import all your table to meilisearch by using the artisan command: +```bash +$ php artisan scout:import "App\Book" +``` + +#### Search in an Index + +```php +class BookController extends Controller +{ + public function search() + { + // MeiliSearch is typo-tolerant: + Book::search('harry pottre')->get(); + // Or if you want to get the result from meilisearch: + Book::search('harry pottre')->raw(); + } +} +``` + +#### Delete Documents + +```php +class BookController extends Controller +{ + public function destroy($id) + { + // Delete one document + Book::find($id)->delete(); + // Delete several documents + Book::destroy([1, 42]); + // Delete all documents /!\ + Book::query()->delete(); + } +} +``` +or you can use the artisan command to delete all documents from an index: +```bash +$ php artisan scout:flush "App\Book" +``` + +#### Delete an Index +```bash +$ php artisan scout:index -d books +``` + +### Search + +#### Custom Search + +All the supported options are described in the [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) section of the documentation. + +```php +class BookController extends Controller +{ + public function customSearch() + { + Book::search('prince', function (Indexes $meilisearch, $query, $options) { + $options['filters'] = 'author="Antoine de Saint-Exupéry"'; + + return $meilisearch->search($query, $options); + })->take(3)->get(); + } +} +``` + +#### Pagination + +```php +class BookController extends Controller +{ + public function search() + { + Book::search('mustang')->paginate(); + // with a limit of items per page: + Book::search('mustang')->paginate(5); + // using meilisearch response: + Book::search('mustang')->paginateRaw(); + } +} +``` + +## 🤖 Compatibility with MeiliSearch + +This package only guarantees the compatibility with the [version v0.19.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.19.0). + +## 💡 Learn More + +If you're not familiar with MeiliSerach yet, the following sections may interest you: + +- **Manipulate documents**: see the [API references](https://docs.meilisearch.com/reference/api/documents.html) or read more about [documents](https://docs.meilisearch.com/learn/core_concepts/documents.html). +- **Search**: see the [API references](https://docs.meilisearch.com/reference/api/search.html) or follow our guide on [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html). +- **Manage the indexes**: see the [API references](https://docs.meilisearch.com/reference/api/indexes.html) or read more about [indexes](https://docs.meilisearch.com/learn/core_concepts/indexes.html). +- **Configure the index settings**: see the [API references](https://docs.meilisearch.com/reference/api/settings.html) or follow our guide on [settings parameters](https://docs.meilisearch.com/reference/features/settings.html). Also, the [Wiki](https://github.com/meilisearch/meilisearch-laravel-scout/wiki) of this repository will guide you through the configuration! + +💡 You can use more advance function by reading the documentation of [MeiliSearch PHP Client](https://github.com/meilisearch/meilisearch-php). + +👍 This package is a custom engine of [Laravel Scout](https://laravel.com/docs/master/scout). + +## Development Workflow and Contributing + +Any new contribution is more than welcome in this project! + +If you want to know more about the development workflow or want to contribute, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions! + +
+ +**MeiliSearch** provides and maintains many **SDKs and Integration tools** like this one. We want to provide everyone with an **amazing search experience for any kind of project**. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the [integration-guides](https://github.com/meilisearch/integration-guides) repository. diff --git a/vendor/meilisearch/meilisearch-laravel-scout/bors.toml b/vendor/meilisearch/meilisearch-laravel-scout/bors.toml new file mode 100644 index 000000000..a514d1ec0 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/bors.toml @@ -0,0 +1,9 @@ +status = [ + 'tests (php 7.2)', + 'tests (php 7.3)', + 'tests (php 7.4)', + 'tests (php 8.0)', + 'linter-check' +] +# 1 hour timeout +timeout-sec = 3600 diff --git a/vendor/meilisearch/meilisearch-laravel-scout/composer.json b/vendor/meilisearch/meilisearch-laravel-scout/composer.json new file mode 100644 index 000000000..d469bf580 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/composer.json @@ -0,0 +1,56 @@ +{ + "name": "meilisearch/meilisearch-laravel-scout", + "description": "Laravel Scout custom engine for MeiliSearch", + "keywords": ["meilisearch", "laravel", "scout", "search"], + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Jordan Massart", + "email": "hello@jordan-massart.be" + } + ], + "scripts": { + "lint": [ + "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --verbose --config=./.php_cs.dist --show-progress=estimating --dry-run --using-cache=yes" + ], + "lint:fix": [ + "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --verbose --config=./.php_cs.dist --diff --show-progress=estimating --using-cache=no" + ], + "test": [ + "./vendor/bin/phpunit --coverage-text --color" + ] + }, + "require": { + "php": "^7.2|^8.0", + "laravel/scout": "^8.0", + "meilisearch/meilisearch-php": "^0.17", + "http-interop/http-factory-guzzle": "^1.0" + }, + "require-dev": { + "orchestra/testbench": "^5.0|^6.0", + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^8.5|^9.5", + "friendsofphp/php-cs-fixer": "^2.16", + "guzzlehttp/guzzle": "^7.2" + }, + "autoload": { + "psr-4": { + "Meilisearch\\Scout\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Meilisearch\\Scout\\Tests\\": "tests" + } + }, + "extra": { + "laravel": { + "providers": [ + "Meilisearch\\Scout\\MeilisearchServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/config/config.php b/vendor/meilisearch/meilisearch-laravel-scout/config/config.php new file mode 100644 index 000000000..4f4bbab4a --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/config/config.php @@ -0,0 +1,38 @@ + env('MEILISEARCH_HOST', 'http://localhost:7700'), + + /* + |-------------------------------------------------------------------------- + | MeiliSearch Master Key + |-------------------------------------------------------------------------- + | + | This value is used to authenticate with your MeiliSearch instance. During + | development this is not required, but it MUST be set during a production + | environment. + | + | For more information on the master key, check out the MeiliSearch + | documentation here: + | https://docs.meilisearch.com/guides/advanced_guides/configuration.html + | + */ + + 'key' => env('MEILISEARCH_KEY', null), + +]; diff --git a/vendor/meilisearch/meilisearch-laravel-scout/phpunit.xml.dist b/vendor/meilisearch/meilisearch-laravel-scout/phpunit.xml.dist new file mode 100644 index 000000000..ff9a3a9c4 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + ./tests/Unit + + + ./tests/Feature + + + + + ./src + + + + + + diff --git a/vendor/meilisearch/meilisearch-laravel-scout/src/Console/IndexMeilisearch.php b/vendor/meilisearch/meilisearch-laravel-scout/src/Console/IndexMeilisearch.php new file mode 100644 index 000000000..a076e7012 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/src/Console/IndexMeilisearch.php @@ -0,0 +1,58 @@ +option('delete')) { + $client->deleteIndex($this->argument('name')); + $this->info('Index "'.$this->argument('name').'" deleted.'); + + return; + } + + $creation_options = []; + if ($this->option('key')) { + $creation_options = ['primaryKey' => $this->option('key')]; + } + $client->createIndex( + $this->argument('name'), + $creation_options + ); + $this->info('Index "'.$this->argument('name').'" created.'); + } catch (ApiException $exception) { + $this->error($exception->getMessage()); + } + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/src/Engines/MeilisearchEngine.php b/vendor/meilisearch/meilisearch-laravel-scout/src/Engines/MeilisearchEngine.php new file mode 100644 index 000000000..f2556f0fd --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/src/Engines/MeilisearchEngine.php @@ -0,0 +1,244 @@ +meilisearch = $meilisearch; + $this->softDelete = $softDelete; + } + + /** + * Update the given model in the index. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * + * @return void + * + * @throws \MeiliSearch\Exceptions\ApiException + */ + public function update($models) + { + if ($models->isEmpty()) { + return; + } + + $index = $this->meilisearch->getOrCreateIndex($models->first()->searchableAs(), ['primaryKey' => $models->first()->getKeyName()]); + + if ($this->usesSoftDelete($models->first()) && $this->softDelete) { + $models->each->pushSoftDeleteMetadata(); + } + + $objects = $models->map(function ($model) { + if (empty($searchableData = $model->toSearchableArray())) { + return; + } + + return array_merge($searchableData, $model->scoutMetadata()); + })->filter()->values()->all(); + + if (!empty($objects)) { + $index->addDocuments($objects, $models->first()->getKeyName()); + } + } + + /** + * Remove the given model from the index. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * + * @return void + */ + public function delete($models) + { + $index = $this->meilisearch->index($models->first()->searchableAs()); + + $index->deleteDocuments( + $models->map->getScoutKey() + ->values() + ->all() + ); + } + + /** + * Perform the given search on the engine. + * + * @return mixed + */ + public function search(Builder $builder) + { + return $this->performSearch($builder, array_filter([ + 'filters' => $this->filters($builder), + 'limit' => $builder->limit, + ])); + } + + /** + * Perform the given search on the engine. + * + * @param int $perPage + * @param int $page + * + * @return mixed + */ + public function paginate(Builder $builder, $perPage, $page) + { + return $this->performSearch($builder, array_filter([ + 'filters' => $this->filters($builder), + 'limit' => (int) $perPage, + 'offset' => ($page - 1) * $perPage, + ])); + } + + /** + * Perform the given search on the engine. + * + * @return mixed + */ + protected function performSearch(Builder $builder, array $searchParams = []) + { + $meilisearch = $this->meilisearch->index($builder->index ?: $builder->model->searchableAs()); + + if ($builder->callback) { + $result = call_user_func( + $builder->callback, + $meilisearch, + $builder->query, + $searchParams + ); + + return $result instanceof SearchResult ? $result->getRaw() : $result; + } + + return $meilisearch->rawSearch($builder->query, $searchParams); + } + + /** + * Get the filter array for the query. + * + * @return string + */ + protected function filters(Builder $builder) + { + return collect($builder->wheres)->map(function ($value, $key) { + return sprintf('%s="%s"', $key, $value); + })->values()->implode(' AND '); + } + + /** + * Pluck and return the primary keys of the given results. + * + * @param mixed $results + * + * @return \Illuminate\Support\Collection + */ + public function mapIds($results) + { + if (0 === count($results['hits'])) { + return collect(); + } + + $hits = collect($results['hits']); + $key = key($hits->first()); + + return $hits->pluck($key)->values(); + } + + /** + * Map the given results to instances of the given model. + * + * @param mixed $results + * @param \Illuminate\Database\Eloquent\Model $model + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public function map(Builder $builder, $results, $model) + { + if (is_null($results) || 0 === count($results['hits'])) { + return $model->newCollection(); + } + + $objectIds = collect($results['hits'])->pluck($model->getKeyName())->values()->all(); + $objectIdPositions = array_flip($objectIds); + + return $model->getScoutModelsByIds( + $builder, $objectIds + )->filter(function ($model) use ($objectIds) { + return in_array($model->getScoutKey(), $objectIds); + })->sortBy(function ($model) use ($objectIdPositions) { + return $objectIdPositions[$model->getScoutKey()]; + })->values(); + } + + /** + * Get the total count from a raw result returned by the engine. + * + * @param mixed $results + * + * @return int + */ + public function getTotalCount($results) + { + return $results['nbHits']; + } + + /** + * Flush all of the model's records from the engine. + * + * @param \Illuminate\Database\Eloquent\Model $model + * + * @return void + */ + public function flush($model) + { + $index = $this->meilisearch->index($model->searchableAs()); + + $index->deleteAllDocuments(); + } + + /** + * Determine if the given model uses soft deletes. + * + * @param \Illuminate\Database\Eloquent\Model $model + * + * @return bool + */ + protected function usesSoftDelete($model) + { + return in_array(\Illuminate\Database\Eloquent\SoftDeletes::class, class_uses_recursive($model)); + } + + /** + * Dynamically call the MeiliSearch client instance. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->meilisearch->$method(...$parameters); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/src/MeilisearchServiceProvider.php b/vendor/meilisearch/meilisearch-laravel-scout/src/MeilisearchServiceProvider.php new file mode 100644 index 000000000..319014758 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/src/MeilisearchServiceProvider.php @@ -0,0 +1,49 @@ +mergeConfigFrom(__DIR__.'/../config/config.php', 'meilisearch'); + + $this->app->singleton(Client::class, function () { + return new Client(config('meilisearch.host'), config('meilisearch.key')); + }); + } + + /** + * Bootstrap any application services. + * + * @return void + */ + public function boot() + { + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/../config/config.php' => config_path('meilisearch.php'), + ], 'config'); + + $this->commands([IndexMeilisearch::class]); + } + + resolve(EngineManager::class)->extend('meilisearch', function () { + return new MeilisearchEngine( + resolve(Client::class), + config('scout.soft_delete', false) + ); + }); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/FeatureTestCase.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/FeatureTestCase.php new file mode 100644 index 000000000..39107a547 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/FeatureTestCase.php @@ -0,0 +1,42 @@ +increments('id'); + $table->string('title'); + $table->timestamps(); + }); + + $this->cleanUp(); + } + + public function tearDown(): void + { + $this->cleanUp(); + + parent::tearDown(); + } + + protected function cleanUp(): void + { + collect(resolve(Client::class)->getAllIndexes())->each(function (Indexes $index) { + // Starts with prefix + if (substr($index->getUid(), 0, strlen($this->getPrefix())) === $this->getPrefix()) { + $index->delete(); + } + }); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchConsoleCommandTest.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchConsoleCommandTest.php new file mode 100644 index 000000000..c4d8a33a2 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchConsoleCommandTest.php @@ -0,0 +1,50 @@ +expectExceptionMessage('Not enough arguments (missing: "name").'); + $this->artisan('scout:index') + ->execute(); + } + + /** @test */ + public function indexCanBeCreatedAndDeleted() + { + $indexUid = $this->getPrefixedIndexUid('testindex'); + + $this->artisan('scout:index', [ + 'name' => $indexUid, + ]) + ->expectsOutput('Index "'.$indexUid.'" created.') + ->assertExitCode(0) + ->run(); + + $indexResponse = resolve(Client::class)->index($indexUid)->fetchRawInfo(); + + $this->assertIsArray($indexResponse); + $this->assertSame($indexUid, $indexResponse['uid']); + + $this->artisan('scout:index', [ + 'name' => $indexUid, + '--delete' => true, + ]) + ->expectsOutput('Index "'.$indexUid.'" deleted.') + ->assertExitCode(0) + ->run(); + + try { + resolve(Client::class)->index($indexUid)->fetchRawInfo(); + $this->fail('Exception should be thrown that index doesn\'t exist!'); + } catch (ApiException $exception) { + $this->assertTrue(true); + } + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchTest.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchTest.php new file mode 100644 index 000000000..381c7e992 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Feature/MeilisearchTest.php @@ -0,0 +1,156 @@ +assertInstanceOf(Client::class, resolve(Client::class)); + $this->assertInstanceOf(EngineManager::class, resolve(EngineManager::class)); + $this->assertInstanceOf(MeilisearchEngine::class, resolve(EngineManager::class)->engine('meilisearch')); + } + + /** @test */ + public function clientCanTalkToMeilisearch() + { + /** @var Client $engine */ + $engine = resolve(Client::class); + + $this->assertNull($engine->health()); + $versionResponse = $engine->version(); + $this->assertIsArray($versionResponse); + $this->assertArrayHasKey('commitSha', $versionResponse); + $this->assertArrayHasKey('buildDate', $versionResponse); + $this->assertArrayHasKey('pkgVersion', $versionResponse); + } + + /** @test */ + public function searchReturnsModels() + { + $model = $this->createSearchableModel('foo'); + $this->createSearchableModel('bar'); + + $this->assertDatabaseCount('searchable_models', 2); + + $searchResponse = $this->waitForPendingUpdates($model, function () { + return SearchableModel::search('bar')->raw(); + }); + + $this->assertIsArray($searchResponse); + $this->assertArrayHasKey('hits', $searchResponse); + $this->assertArrayHasKey('query', $searchResponse); + $this->assertTrue(1 === count($searchResponse['hits'])); + } + + /** @test */ + public function searchReturnsCorrectModelAfterUpdate() + { + $fooModel = $this->createSearchableModel('foo'); + $this->createSearchableModel('bar'); + + $this->assertDatabaseCount('searchable_models', 2); + + $searchResponse = $this->waitForPendingUpdates($fooModel, function () { + return SearchableModel::search('foo')->raw(); + }); + + $this->assertIsArray($searchResponse); + $this->assertArrayHasKey('hits', $searchResponse); + $this->assertArrayHasKey('query', $searchResponse); + $this->assertTrue(1 === count($searchResponse['hits'])); + $this->assertTrue('foo' === $searchResponse['hits'][0]['title']); + + $fooModel->update(['title' => 'lorem']); + + $searchResponse = $this->waitForPendingUpdates($fooModel, function () { + return SearchableModel::search('lorem')->raw(); + }); + + $this->assertIsArray($searchResponse); + $this->assertArrayHasKey('hits', $searchResponse); + $this->assertArrayHasKey('query', $searchResponse); + $this->assertTrue(1 === count($searchResponse['hits'])); + $this->assertTrue('lorem' === $searchResponse['hits'][0]['title']); + } + + /** @test */ + public function customSearchReturnsResults() + { + $models = $this->createMultipleSearchableModels(10); + + $this->assertDatabaseCount('searchable_models', 10); + + $searchResponse = $this->waitForPendingUpdates($models->first(), function () { + return SearchableModel::search('', function ($meilisearch, $query, $options) { + $options['limit'] = 2; + + return $meilisearch->search($query, $options); + })->raw(); + }); + + $this->assertIsArray($searchResponse); + $this->assertArrayHasKey('hits', $searchResponse); + $this->assertArrayHasKey('query', $searchResponse); + $this->assertTrue(2 === $searchResponse['limit']); + $this->assertTrue(2 === count($searchResponse['hits'])); + } + + /** + * Fixes race condition and waits some time for the indexation to complete. + * + * @param Model $model + * @param callable $callback + * + * @return mixed + */ + protected function waitForPendingUpdates($model, $callback) + { + $index = resolve(Client::class)->index($model->searchableAs()); + $pendingUpdates = $index->getAllUpdateStatus(); + + foreach ($pendingUpdates as $pendingUpdate) { + if ('processed' !== $pendingUpdate['status']) { + $index->waitForPendingUpdate($pendingUpdate['updateId']); + } + } + + return $callback(); + } + + protected function createMultipleSearchableModels(int $times = 1) + { + $models = collect(); + + for ($i = 1; $i <= $times; ++$i) { + $models->add($this->createSearchableModel()); + } + + return $models; + } + + protected function createSearchableModel(?string $title = null) + { + return SearchableModel::create([ + 'title' => $title ?? $this->faker->sentence, + ]); + } +} + +class SearchableModel extends BaseSearchableModel +{ + public function searchableAs() + { + return config('scout.prefix').$this->getTable(); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Fixtures/SearchableModel.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Fixtures/SearchableModel.php new file mode 100644 index 000000000..3d2f5e69a --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Fixtures/SearchableModel.php @@ -0,0 +1,28 @@ +set('database.default', env('DB_CONNECTION')); + } else { + config()->set('database.default', 'testing'); + config()->set('database.connections.testing', [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + ]); + } + config()->set('scout.driver', 'meilisearch'); + config()->set('scout.prefix', $this->getPrefix()); + } + + protected function getPrefixedIndexUid(string $indexUid) + { + return sprintf('%s_%s', $this->getPrefix(), $indexUid); + } + + protected function getPrefix() + { + return 'meilisearch-laravel-scout_testing'; + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchConsoleCommandTest.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchConsoleCommandTest.php new file mode 100644 index 000000000..23970d92a --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchConsoleCommandTest.php @@ -0,0 +1,92 @@ +mock(Client::class); + $client->expects('createIndex')->with($indexUid = 'testindex', [])->andReturn(m::mock(Indexes::class)); + + $engineManager = $this->mock(EngineManager::class); + $engineManager->shouldReceive('engine')->with('meilisearch')->andReturn(new MeilisearchEngine( + $client + )); + + $this->artisan('scout:index', [ + 'name' => $indexUid, + ]) + ->expectsOutput('Index "'.$indexUid.'" created.') + ->assertExitCode(0) + ->run(); + } + + /** @test */ + public function keyParameterSetsPrimaryKeyOption() + { + $client = $this->mock(Client::class); + $client + ->expects('createIndex') + ->with($indexUid = 'testindex', ['primaryKey' => $testPrimaryKey = 'foobar']) + ->andReturn(m::mock(Indexes::class)); + + $engineManager = $this->mock(EngineManager::class); + $engineManager->shouldReceive('engine')->with('meilisearch')->andReturn(new MeilisearchEngine( + $client + )); + + $this->artisan('scout:index', [ + 'name' => $indexUid, + '--key' => $testPrimaryKey, + ]) + ->expectsOutput('Index "'.$indexUid.'" created.') + ->assertExitCode(0) + ->run(); + } + + /** @test */ + public function deleteParameterDeletesIndex() + { + $client = $this->mock(Client::class); + $client->expects('deleteIndex')->with($indexUid = 'testindex')->andReturn([]); + + $engineManager = $this->mock(EngineManager::class); + $engineManager->shouldReceive('engine')->with('meilisearch')->andReturn(new MeilisearchEngine( + $client + )); + + $this->artisan('scout:index', [ + 'name' => $indexUid, + '--delete' => true, + ]) + ->expectsOutput('Index "'.$indexUid.'" deleted.') + ->assertExitCode(0) + ->run(); + } + + /** @test */ + public function commandReturnsErrorStatusCodeOnException() + { + $client = $this->mock(Client::class); + $client->expects('createIndex')->andThrow(new ApiException(404, ['message' => 'Testmessage'])); + + $engineManager = $this->mock(EngineManager::class); + $engineManager->shouldReceive('engine')->with('meilisearch')->andReturn(new MeilisearchEngine($client)); + + $this->artisan('scout:index', [ + 'name' => 'foobar', + ]) + ->assertExitCode(0) + ->execute(); + } +} diff --git a/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchEngineTest.php b/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchEngineTest.php new file mode 100644 index 000000000..7c570db58 --- /dev/null +++ b/vendor/meilisearch/meilisearch-laravel-scout/tests/Unit/MeilisearchEngineTest.php @@ -0,0 +1,350 @@ +shouldReceive('getOrCreateIndex')->with('table', ['primaryKey' => 'id'])->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('addDocuments')->with([ + [ + 'id' => 1, + ], + ]); + + $engine = new MeilisearchEngine($client); + $engine->update(Collection::make([new SearchableModel()])); + } + + /** @test */ + public function deleteRemovesObjectsToIndex() + { + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('deleteDocuments')->with([1]); + + $engine = new MeilisearchEngine($client); + $engine->delete(Collection::make([new SearchableModel(['id' => 1])])); + } + + /** @test */ + public function searchSendsCorrectParametersToMeilisearch() + { + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('search')->with('mustang', [ + 'filters' => 'foo=1', + ]); + + $engine = new MeilisearchEngine($client); + $builder = new Builder(new SearchableModel(), 'mustang', function ($meilisearch, $query, $options) { + $options['filters'] = 'foo=1'; + + return $meilisearch->search($query, $options); + }); + $engine->search($builder); + } + + /** + * @test + */ + public function submittingACallableSearchWithSearchMethodReturnsArray() + { + $builder = new Builder( + new SearchableModel(), + $query = 'mustang', + $callable = function ($meilisearch, $query, $options) { + $options['filters'] = 'foo=1'; + + return $meilisearch->search($query, $options); + } + ); + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('search')->with($query, ['filters' => 'foo=1'])->andReturn(new SearchResult($expectedResult = [ + 'hits' => [], + 'offset' => 0, + 'limit' => 20, + 'nbHits' => 0, + 'exhaustiveNbHits' => false, + 'processingTimeMs' => 1, + 'query' => 'mustang', + ])); + + $engine = new MeilisearchEngine($client); + $result = $engine->search($builder); + + $this->assertSame($expectedResult, $result); + } + + /** + * @test + */ + public function submittingACallableSearchWithRawSearchMethodWorks() + { + $builder = new Builder( + new SearchableModel(), + $query = 'mustang', + $callable = function ($meilisearch, $query, $options) { + $options['filters'] = 'foo=1'; + + return $meilisearch->rawSearch($query, $options); + } + ); + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('rawSearch')->with($query, ['filters' => 'foo=1'])->andReturn($expectedResult = [ + 'hits' => [], + 'offset' => 0, + 'limit' => 20, + 'nbHits' => 0, + 'exhaustiveNbHits' => false, + 'processingTimeMs' => 1, + 'query' => 'mustang', + ]); + + $engine = new MeilisearchEngine($client); + $result = $engine->search($builder); + + $this->assertSame($expectedResult, $result); + } + + /** @test */ + public function mapIdsReturnsEmptyCollectionIfNoHits() + { + $client = m::mock(Client::class); + $engine = new MeilisearchEngine($client); + + $results = $engine->mapIds([ + 'nbHits' => 0, 'hits' => [], + ]); + + $this->assertEquals(0, count($results)); + } + + /** @test */ + public function mapCorrectlyMapsResultsToModels() + { + $client = m::mock(Client::class); + $engine = new MeilisearchEngine($client); + + $model = m::mock(stdClass::class); + $model->shouldReceive(['getKeyName' => 'id']); + $model->shouldReceive('getScoutModelsByIds')->andReturn($models = Collection::make([new SearchableModel(['id' => 1])])); + $builder = m::mock(Builder::class); + + $results = $engine->map($builder, [ + 'nbHits' => 1, 'hits' => [ + ['id' => 1], + ], + ], $model); + + $this->assertEquals(1, count($results)); + } + + /** @test */ + public function mapMethodRespectsOrder() + { + $client = m::mock(Client::class); + $engine = new MeilisearchEngine($client); + + $model = m::mock(stdClass::class); + $model->shouldReceive(['getKeyName' => 'id']); + $model->shouldReceive('getScoutModelsByIds')->andReturn($models = Collection::make([ + new SearchableModel(['id' => 1]), + new SearchableModel(['id' => 2]), + new SearchableModel(['id' => 3]), + new SearchableModel(['id' => 4]), + ])); + + $builder = m::mock(Builder::class); + + $results = $engine->map($builder, [ + 'nbHits' => 4, 'hits' => [ + ['id' => 1], + ['id' => 2], + ['id' => 4], + ['id' => 3], + ], + ], $model); + + $this->assertEquals(4, count($results)); + $this->assertEquals([ + 0 => ['id' => 1], + 1 => ['id' => 2], + 2 => ['id' => 4], + 3 => ['id' => 3], + ], $results->toArray()); + } + + /** @test */ + public function aModelIsIndexedWithACustomMeilisearchKey() + { + $client = m::mock(Client::class); + $client->shouldReceive('getOrCreateIndex')->with('table', ['primaryKey' => 'id'])->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('addDocuments')->with([['id' => 'my-meilisearch-key.1']]); + + $engine = new MeilisearchEngine($client); + $engine->update(Collection::make([new CustomKeySearchableModel()])); + } + + /** @test */ + public function flushAModelWithACustomMeilisearchKey() + { + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('deleteAllDocuments'); + + $engine = new MeilisearchEngine($client); + $engine->flush(new CustomKeySearchableModel()); + } + + /** @test */ + public function updateEmptySearchableArrayDoesNotAddObjectsToIndex() + { + $client = m::mock(Client::class); + $client->shouldReceive('getOrCreateIndex')->with('table', ['primaryKey' => 'id'])->andReturn($index = m::mock(Indexes::class)); + $index->shouldNotReceive('addObjects'); + + $engine = new MeilisearchEngine($client); + $engine->update(Collection::make([new EmptySearchableModel()])); + } + + /** @test */ + public function paginationCorrectParameters() + { + $perPage = 5; + $page = 2; + + $client = m::mock(Client::class); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('search')->with('mustang', [ + 'filters' => 'foo=1', + 'limit' => $perPage, + 'offset' => ($page - 1) * $perPage, + ]); + + $engine = new MeilisearchEngine($client); + $builder = new Builder(new SearchableModel(), 'mustang', function ($meilisearch, $query, $options) { + $options['filters'] = 'foo=1'; + + return $meilisearch->search($query, $options); + }); + $engine->paginate($builder, $perPage, $page); + } + + /** @test */ + public function updateEmptySearchableArrayFromSoftDeletedModelDoesNotAddObjectsToIndex() + { + $client = m::mock(Client::class); + $client->shouldReceive('getOrCreateIndex')->with('table', ['primaryKey' => 'id'])->andReturn(m::mock(Indexes::class)); + $client->shouldReceive('index')->with('table')->andReturn($index = m::mock(Indexes::class)); + $index->shouldNotReceive('addDocuments'); + + $engine = new MeilisearchEngine($client, true); + $engine->update(Collection::make([new SoftDeleteEmptySearchableModel()])); + } + + /** @test */ + public function engineForwardsCallsToMeilisearchClient() + { + $client = m::mock(Client::class); + $client->shouldReceive('testMethodOnClient')->once(); + + $engine = new MeilisearchEngine($client); + $engine->testMethodOnClient(); + } + + /** @test */ + public function updatingEmptyEloquentCollectionDoesNothing() + { + $client = m::mock(Client::class); + $engine = new MeilisearchEngine($client); + $engine->update(new Collection()); + $this->assertTrue(true); + } + + /** @test */ + public function performingSearchWithoutCallbackWorks() + { + $client = m::mock(Client::class); + $client->shouldReceive('index')->once()->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('rawSearch')->once()->andReturn([]); + + $engine = new MeilisearchEngine($client); + $builder = new Builder(new SearchableModel(), ''); + $engine->search($builder); + } + + /** @test */ + public function whereConditionsAreApplied() + { + $builder = new Builder(new SearchableModel(), ''); + $builder->where('foo', 'bar'); + $builder->where('key', 'value'); + $client = m::mock(Client::class); + $client->shouldReceive('index')->once()->andReturn($index = m::mock(Indexes::class)); + $index->shouldReceive('rawSearch')->once()->with($builder->query, array_filter([ + 'filters' => 'foo="bar" AND key="value"', + 'limit' => $builder->limit, + ]))->andReturn([]); + + $engine = new MeilisearchEngine($client); + $engine->search($builder); + } + + /** @test */ + public function engineReturnsHitsEntryFromSearchResponse() + { + $this->assertTrue(3 === resolve(MeilisearchEngine::class)->getTotalCount([ + 'nbHits' => 3, + ])); + } +} + +class CustomKeySearchableModel extends SearchableModel +{ + public function getScoutKey() + { + return 'my-meilisearch-key.'.$this->getKey(); + } +} + +class EmptySearchableModel extends SearchableModel +{ + public function toSearchableArray() + { + return []; + } +} + +class SoftDeleteEmptySearchableModel extends SearchableModel +{ + public function toSearchableArray() + { + return []; + } + + public function pushSoftDeleteMetadata() + { + } + + public function scoutMetadata() + { + return ['__soft_deleted' => 1]; + } +} diff --git a/vendor/meilisearch/meilisearch-php/.code-samples.meilisearch.yaml b/vendor/meilisearch/meilisearch-php/.code-samples.meilisearch.yaml new file mode 100644 index 000000000..9b226b48a --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.code-samples.meilisearch.yaml @@ -0,0 +1,309 @@ +# This code-samples file is used by the MeiliSearch documentation +# Every example written here will be automatically fetched by +# the documentation on build +# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples +--- +get_one_index_1: |- + $client->index('movies')->fetchRawInfo(); +list_all_indexes_1: |- + $client->getAllIndexes(); +create_an_index_1: |- + $client->createIndex('movies', ['primaryKey' => 'movie_id']); +update_an_index_1: |- + $client->updateIndex('movies', ['primaryKey' => 'movie_id']); + // OR + $client->index('movies')->update(['primaryKey' => 'movie_id']); +delete_an_index_1: |- + $client->deleteIndex('movies'); + // OR + $client->index('movies')->delete(); +get_one_document_1: |- + $client->index('movies')->getDocument(25684); +get_documents_1: |- + $client->index('movies')->getDocuments(['limit' => 2]); +add_or_replace_documents_1: |- + $client->index('movies')->addDocuments([ + [ + 'id' => 287947 + 'title' => 'Shazam', + 'poster' => 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg', + 'overview' => 'A boy is given the ability to become an adult superhero in times of need with a single magic word.', + 'release_date' => '2019-03-23' + ] + ]); +add_or_update_documents_1: |- + $client->index('movies')->updateDocuments([ + [ + 'id' => 287947 + 'title' => 'Shazam ⚡️', + 'genres' => 'comedy' + ] + ]); +delete_all_documents_1: |- + $client->index('movies')->deleteAllDocuments(); +delete_one_document_1: |- + $client->index('movies')->deleteDocument(25684); +delete_documents_1: |- + $client->index('movies')->deleteDocuments([23488, 153738, 437035, 363869]); +search_1: |- + // Do a search + $searchResults = $client->index('movies')->search('american ninja'); + + // Get results in an Array using a getter + $hits = $searchResults->getHits(); + + // Get the decoded response of MeiliSearch, see response below + $response = $searchResults->getRaw(); +get_update_1: |- + $client->index('movies')->getUpdateStatus(1); +get_all_updates_1: |- + $client->index('movies')->getAllUpdateStatus(); +get_keys_1: |- + $client->getKeys(); +get_settings_1: |- + $client->index('movies')->getSettings(); +update_settings_1: |- + $client->index('movies')->updateSettings([ + 'rankingRules' => [ + 'typo', + 'words', + 'proximity', + 'attribute', + 'wordsPosition', + 'exactness', + 'desc(release_date)', + 'desc(rank)' + ], + 'distinctAttribute' => 'movie_id', + 'searchableAttributes' => [ + 'title', + 'description', + 'genre' + ], + 'displayedAttributes' => [ + 'title', + 'description', + 'genre', + 'release_date' + ], + 'stopWords' => [ + 'the', + 'a', + 'an' + ], + 'synonyms' => [ + 'wolverine': ['xmen', 'logan'], + 'logan': ['wolverine'] + ] + ]); +reset_settings_1: |- + $client->index('movies')->resetSettings(); +get_synonyms_1: |- + $client->index('movies')->getSynonyms(); +update_synonyms_1: |- + $client->index('movies')->updateSynonyms([ + 'wolverine': ['xmen', 'logan'], + 'logan': ['wolverine', 'xmen'], + 'wow': ['world of warcraft'] + ]); +reset_synonyms_1: |- + $client->index('movies')->resetSynonyms(); +get_stop_words_1: |- + $client->index('movies')->getStopWords(); +update_stop_words_1: |- + $client->index('movies')->updateStopWords(['the', 'of', 'to']); +reset_stop_words_1: |- + $client->index('movies')->resetStopWords(); +get_ranking_rules_1: |- + $client->index('movies')->getRankingRules(); +update_ranking_rules_1: |- + $client->index('movies')->updateRankingRules([ + 'typo', + 'words', + 'proximity', + 'attribute', + 'wordsPosition', + 'exactness', + 'asc(release_date)', + 'desc(rank)' + ]); +reset_ranking_rules_1: |- + $client->index('movies')->resetRankingRules(); +get_distinct_attribute_1: |- + $client->index('movies')->getDistinctAttribute(); +update_distinct_attribute_1: |- + $client->index('movies')->updateDistinctAttribute('movie_id'); +reset_distinct_attribute_1: |- + $client->index('movies')->resetDistinctAttribute(); +get_searchable_attributes_1: |- + $client->index('movies')->getSearchableAttributes(); +update_searchable_attributes_1: |- + $client->index('movies')->updateSearchableAttributes([ + 'title', + 'description', + 'genre' + ]); +reset_searchable_attributes_1: |- + $client->index('movies')->resetSearchableAttributes(); +get_attributes_for_faceting_1: |- + $client->index('movies')->getAttributesForFaceting(); +update_attributes_for_faceting_1: |- + $client->index('movies')->updateAttributesForFaceting([ + 'genres', + 'director' + ]); +reset_attributes_for_faceting_1: |- + $client->index('movies')->resetAttributesForFaceting(); +get_displayed_attributes_1: |- + $client->index('movies')->getDisplayedAttributes(); +update_displayed_attributes_1: |- + $client->index('movies')->updateDisplayedAttributes([ + 'title', + 'description', + 'genre', + 'release_date' + ]); +reset_displayed_attributes_1: |- + $client->index('movies')->resetDisplayedAttributes(); +get_index_stats_1: |- + $client->index('movies')->stats(); +get_indexes_stats_1: |- + $client->stats(); +get_health_1: |- + $client->health(); +get_version_1: |- + $client->version(); +distinct_attribute_guide_1: |- + $client->index('jackets')->updateDistinctAttribute('product_id'); +field_properties_guide_searchable_1: |- + $client->index('movies')->updateSearchableAttributes([ + 'title', + 'description', + 'genre' + ]); +field_properties_guide_displayed_1: |- + $client->index('movies')->updateDisplayedAttributes([ + 'title', + 'description', + 'genre', + 'release_date' + ]); +filtering_guide_1: |- + $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800']); +filtering_guide_2: |- + $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")']); +filtering_guide_3: |- + $client->index('movies')->search('horror', ['filters' => 'director = "Jordan Peele"']); +filtering_guide_4: |- + $client->index('movies')->search('Planet of the Apes', ['filters' => 'rating >= 3 AND (NOT director = "Tim Burton")']); +search_parameter_guide_query_1: |- + $client->index('movies')->search('shifu'); +search_parameter_guide_offset_1: |- + $client->index('movies')->search('shifu', ['offset' => 1]); +search_parameter_guide_limit_1: |- + $client->index('movies')->search('shifu', ['limit' => 1]); +search_parameter_guide_retrieve_1: |- + $client->index('movies')->search('shifu', ['attributesToRetrieve' => ['overview', 'title']]); +search_parameter_guide_crop_1: |- + $client->index('movies')->search('shifu', ['attributesToCrop' => ['overview'], 'cropLength' => 10]); +search_parameter_guide_highlight_1: |- + $client->index('movies')->search('shifu', ['attributesToHighlight' => ['overview']]); +search_parameter_guide_filter_1: |- + $client->index('movies')->search('n', ['filters' => 'title = Nightshift']); +search_parameter_guide_filter_2: |- + $client->index('movies')->search('shifu', ['filters' => 'title="Kung Fu Panda"']); +search_parameter_guide_matches_1: |- + $client->index('movies')->search('shifu', ['attributesToHighlight' => ['overview'], 'matches' => true]); +settings_guide_synonyms_1: |- + $client->index('tops')->updateSynonyms(['sweater' => ['jumper'], 'jumper' => ['sweater']]); +settings_guide_stop_words_1: |- + $client->index('movies')->updateStopWords(['the', 'a', 'an']); +settings_guide_ranking_rules_1: |- + $client->index('movies')->updateRankingRules([ + 'typo', + 'words', + 'proximity', + 'attribute', + 'wordsPosition', + 'exactness', + 'asc(release_date)', + 'desc(rank)' + ]); +settings_guide_distinct_1: |- + $client->index('jackets')->updateDistinctAttribute('product_id'); +settings_guide_searchable_1: |- + $client->index('movies')->updateSearchableAttributes([ + 'title', + 'description', + 'genre' + ]); +settings_guide_displayed_1: |- + $client->index('movies')->updateDisplayedAttributes([ + 'title', + 'description', + 'genre', + 'release_date' + ]); +add_movies_json_1: |- + $moviesJson = file_get_contents('movies.json'); + $movies = json_decode($moviesJson); + + $client->index('movies')->addDocuments($movies) +documents_guide_add_movie_1: |- + $client->index('movies')->addDocuments([['movie_id' => '123sq178', 'title' => 'Amelie Poulain']]); +search_guide_1: |- + $client->index('movies')->search('shifu', ['limit' => 5, 'offset' => 10]); +search_guide_2: |- + $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800']); +getting_started_add_documents_md: |- + Using `meilisearch-php` with the Guzzle HTTP client: + + ```bash + composer require meilisearch/meilisearch-php \ + guzzlehttp/guzzle \ + http-interop/http-factory-guzzle:^1.0 + ``` + + ```php + index('movies')->addDocuments($movies); + ``` + + [About this SDK](https://github.com/meilisearch/meilisearch-php/) +getting_started_search_md: |- + ```php + $index->search('botman'); + ``` + + [About this SDK](https://github.com/meilisearch/meilisearch-php/) +faceted_search_update_settings_1: |- + $client->index('movies')->updateAttributesForFaceting(['director', 'genres']); +faceted_search_facet_filters_1: |- + $client->index('movies')->search('thriller', ['facetFilters' => [['genres:Horror', 'genres:Mystery']], 'director' => "Jordan Peele"']); +faceted_search_facets_distribution_1: |- + $client->index('movies')->search('Batman', ['facetsDistribution' => ['genres']]); +faceted_search_walkthrough_attributes_for_faceting_1: |- + $client->index('movies')->updateAttributesForFaceting([ + 'director', + 'producer', + 'genres', + 'production_companies' + ]); +faceted_search_walkthrough_facet_filters_1: |- + $client->index('movies')->search('thriller', ['facetFilters' => [['genres:Horror', 'genres:Mystery']], 'director' => "Jordan Peele"]); +faceted_search_walkthrough_facets_distribution_1: |- + $client->index('movies')->search('Batman', ['facetsDistribution' => ['genres']); +post_dump_1: |- + $client->createDump(); +get_dump_status_1: |- + $client->getDumpStatus('20201101-110357260'); diff --git a/vendor/meilisearch/meilisearch-php/.editorconfig b/vendor/meilisearch/meilisearch-php/.editorconfig new file mode 100644 index 000000000..a6ed9ebaf --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.editorconfig @@ -0,0 +1,20 @@ +# https://editorconfig.org/ + +root = true + +[*] +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf +charset = utf-8 +tab_width = 4 +indent_style = space + +[*.php] +indent_size = 4 + +[*.md] +max_line_length = 80 + +[*.{yaml,yml}] +indent_size = 2 diff --git a/vendor/meilisearch/meilisearch-php/.github/release-draft-template.yml b/vendor/meilisearch/meilisearch-php/.github/release-draft-template.yml new file mode 100644 index 000000000..0a3d0b7d2 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.github/release-draft-template.yml @@ -0,0 +1,27 @@ +name-template: 'v$RESOLVED_VERSION 🐘' +tag-template: 'v$RESOLVED_VERSION' +exclude-labels: + - 'skip-changelog' +version-resolver: + minor: + labels: + - 'breaking-change' + default: patch +categories: + - title: 'Breaking changes ⚠️' + label: 'breaking-change' +template: | + ## Changes + + $CHANGES + + Thanks again to $CONTRIBUTORS! 🎉 +no-changes-template: 'Changes are coming soon 😎' +sort-direction: 'ascending' +replacers: + - search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g' + replace: '' + - search: '/(?:and )?@bors(?:\[bot\])?,?/g' + replace: '' + - search: '/(?:and )?@meili-bot,?/g' + replace: '' diff --git a/vendor/meilisearch/meilisearch-php/.github/workflows/pre-release-tests.yml b/vendor/meilisearch/meilisearch-php/.github/workflows/pre-release-tests.yml new file mode 100644 index 000000000..ff08145e2 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.github/workflows/pre-release-tests.yml @@ -0,0 +1,66 @@ +# Testing the code base against the MeiliSearch pre-releases +name: Pre-Release Tests + +# Will only run for PRs and pushes to bump-meilisearch-v* +on: + push: + branches: bump-meilisearch-v* + pull_request: + branches: bump-meilisearch-v* + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + name: integration-tests-against-rc (PHP ${{ matrix.php-versions }}) + steps: + - uses: actions/checkout@v1 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: | + composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction + composer install --prefer-dist --no-progress --no-suggest + - name: Get the latest MeiliSearch RC + run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV + - name: MeiliSearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker + run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} ./meilisearch --master-key=masterKey --no-analytics=true + - name: Run test suite - default HTTP client (Guzzle 7) + run: | + sh scripts/tests.sh + composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle + - name: Run test suite - php-http/guzzle6-adapter + # Don't run on PHP 8 + # Guzzle 6 is not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle + sh scripts/tests.sh + composer remove --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle + - name: Run test suite - symfony/http-client + run: | + composer require --dev symfony/http-client nyholm/psr7 + sh scripts/tests.sh + composer remove --dev symfony/http-client nyholm/psr7 + - name: Run test suite - php-http/curl-client + # Don't run on PHP 8 + # php-http/curl-client is currently not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev php-http/curl-client nyholm/psr7 + sh scripts/tests.sh + composer remove --dev php-http/curl-client nyholm/psr7 + - name: Run test suite - kriswallsmith/buzz + # Don't run on PHP 8 + # kriswallsmith/buzz is currently not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev kriswallsmith/buzz nyholm/psr7 + sh scripts/tests.sh + composer remove --dev kriswallsmith/buzz nyholm/psr7 diff --git a/vendor/meilisearch/meilisearch-php/.github/workflows/release-drafter.yml b/vendor/meilisearch/meilisearch-php/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..9ec8b9d64 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-draft-template.yml + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_DRAFTER_TOKEN }} diff --git a/vendor/meilisearch/meilisearch-php/.github/workflows/tests.yml b/vendor/meilisearch/meilisearch-php/.github/workflows/tests.yml new file mode 100644 index 000000000..d75b22404 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.github/workflows/tests.yml @@ -0,0 +1,82 @@ +name: Tests + +on: + pull_request: + push: + # trying and staging branches are for BORS config + branches: + - trying + - staging + - main + +jobs: + lint: + runs-on: ubuntu-latest + name: linter-check + steps: + - uses: actions/checkout@v1 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + - name: Install dependencies + run: composer update --prefer-dist --no-progress + - name: Run linter + run: vendor/bin/php-cs-fixer fix -v --config=.php_cs.dist --using-cache=no --dry-run --allow-risky=yes + + tests: + # Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR) + # Will still run for each push to bump-meilisearch-v* + if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v') + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + name: integration-tests (PHP ${{ matrix.php-versions }}) + steps: + - uses: actions/checkout@v1 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: | + composer remove --dev friendsofphp/php-cs-fixer --no-update --no-interaction + composer update --prefer-dist --no-progress + - name: MeiliSearch (latest version) setup with Docker + run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics=true + - name: Run test suite - default HTTP client (Guzzle 7) + run: | + sh scripts/tests.sh + composer remove --dev guzzlehttp/guzzle http-interop/http-factory-guzzle + - name: Run test suite - php-http/guzzle6-adapter + # Don't run on PHP 8 + # Guzzle 6 is not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle + sh scripts/tests.sh + composer remove --dev php-http/guzzle6-adapter http-interop/http-factory-guzzle + - name: Run test suite - symfony/http-client + run: | + composer require --dev symfony/http-client nyholm/psr7 + sh scripts/tests.sh + composer remove --dev symfony/http-client nyholm/psr7 + - name: Run test suite - php-http/curl-client + # Don't run on PHP 8 + # php-http/curl-client is currently not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev php-http/curl-client nyholm/psr7 + sh scripts/tests.sh + composer remove --dev php-http/curl-client nyholm/psr7 + - name: Run test suite - kriswallsmith/buzz + # Don't run on PHP 8 + # kriswallsmith/buzz is currently not compatible with PHP 8.0 + if: ${{ !startsWith(matrix.php-versions, '8.') }} + run: | + composer require --dev kriswallsmith/buzz nyholm/psr7 + sh scripts/tests.sh + composer remove --dev kriswallsmith/buzz nyholm/psr7 diff --git a/vendor/meilisearch/meilisearch-php/.gitignore b/vendor/meilisearch/meilisearch-php/.gitignore new file mode 100644 index 000000000..95abd0dff --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.gitignore @@ -0,0 +1,3 @@ +composer.lock +/vendor/ +.php_cs.cache diff --git a/vendor/meilisearch/meilisearch-php/.php_cs.dist b/vendor/meilisearch/meilisearch-php/.php_cs.dist new file mode 100644 index 000000000..21c9893d0 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/.php_cs.dist @@ -0,0 +1,19 @@ +in(__DIR__.DIRECTORY_SEPARATOR.'src') + ->in(__DIR__.DIRECTORY_SEPARATOR.'tests') + ->append(['.php_cs.dist']); + +$rules = [ + '@Symfony' => true, + 'declare_strict_types' => true, + 'void_return' => true, + 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'], +]; + +return \PhpCsFixer\Config::create() + ->setRules($rules) + ->setFinder($finder); diff --git a/vendor/meilisearch/meilisearch-php/CONTRIBUTING.md b/vendor/meilisearch/meilisearch-php/CONTRIBUTING.md new file mode 100644 index 000000000..0bd357747 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/CONTRIBUTING.md @@ -0,0 +1,111 @@ +# Contributing + +First of all, thank you for contributing to MeiliSearch! The goal of this document is to provide everything you need to know in order to contribute to MeiliSearch and its different integrations. + + + +- [Assumptions](#assumptions) +- [How to Contribute](#how-to-contribute) +- [Development Workflow](#development-workflow) +- [Git Guidelines](#git-guidelines) +- [Release Process (for internal team only)](#release-process-for-internal-team-only) + + + +## Assumptions + +1. **You're familiar with [GitHub](https://github.com) and the [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) (PR) workflow.** +2. **You've read the MeiliSearch [documentation](https://docs.meilisearch.com) and the [README](/README.md).** +3. **You know about the [MeiliSearch community](https://docs.meilisearch.com/learn/what_is_meilisearch/contact.html). Please use this for help.** + +## How to Contribute + +1. Make sure that the contribution you want to make is explained or detailed in a GitHub issue! Find an [existing issue](https://github.com/meilisearch/meilisearch-php/issues/) or [open a new one](https://github.com/meilisearch/meilisearch-php/issues/new). +2. Once done, [fork the meilisearch-php repository](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) in your own GitHub account. Ask a maintainer if you want your issue to be checked before making a PR. +3. [Create a new Git branch](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository). +4. Review the [Development Workflow](#workflow) section that describes the steps to maintain the repository. +5. Make the changes on your branch. +6. [Submit the branch as a PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `main` branch of the main meilisearch-php repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.
+ We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://github.com/meilisearch/meilisearch-php/releases/). + +## Development Workflow + +### Setup + +```bash +composer install +``` + +### Tests and Linter + +Each PR should pass the tests and the linter to be accepted. + +```bash +# Tests +docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub +docker run -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics=true +composer test +# Linter (with auto-fix) +composer lint:fix +# Linter (without auto-fix) +composer lint +``` + +## Git Guidelines + +### Git Branches + +All changes must be made in a branch and submitted as PR. +We do not enforce any branch naming style, but please use something descriptive of your changes. + +### Git Commits + +As minimal requirements, your commit message should: +- be capitalized +- not finish by a dot or any other punctuation character (!,?) +- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message. + e.g.: "Fix the home page button" or "Add more tests for create_index method" + +We don't follow any other convention, but if you want to use one, we recommend [this one](https://chris.beams.io/posts/git-commit/). + +### GitHub Pull Requests + +Some notes on GitHub PRs: + +- [Convert your PR as a draft](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request) if your changes are a work in progress: no one will review it until you pass your PR as ready for review.
+ The draft PR can be very useful if you want to show that you are working on something and make your work visible. +- The branch related to the PR must be **up-to-date with `main`** before merging. Fortunately, this project [integrates a bot](https://github.com/meilisearch/integration-guides/blob/main/guides/bors.md) to automatically enforce this requirement without the PR author having to do it manually.. +- All PRs must be reviewed and approved by at least one maintainer. +- The PR title should be accurate and descriptive of the changes. The title of the PR will be indeed automatically added to the next [release changelogs](https://github.com/meilisearch/meilisearch-php/releases/). + +## Release Process (for internal team only) + +MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/). + +### Automation to Rebase and Merge the PRs + +This project integrates a bot that helps us manage pull requests merging.
+_[Read more about this](https://github.com/meilisearch/integration-guides/blob/main/guides/bors.md)._ + +### Automated Changelogs + +This project integrates a tool to create automated changelogs.
+_[Read more about this](https://github.com/meilisearch/integration-guides/blob/main/guides/release-drafter.md)._ + +### How to Publish the Release + +⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/guides/integration-release.md). + +Make a PR modifying the file [`src/MeiliSearch.php`](/src/MeiliSearch.php) with the right version. + +```php +const VERSION = 'X.X.X'; +``` + +Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-php/releases). + +A WebHook will be triggered and push the package to [Packagist](https://packagist.org/packages/meilisearch/meilisearch-php). + +
+ +Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide ❤️ diff --git a/vendor/meilisearch/meilisearch-php/LICENSE b/vendor/meilisearch/meilisearch-php/LICENSE new file mode 100644 index 000000000..88bc8aea1 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2021 Meili + +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/vendor/meilisearch/meilisearch-php/README.md b/vendor/meilisearch/meilisearch-php/README.md new file mode 100644 index 000000000..fe4e95fcb --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/README.md @@ -0,0 +1,232 @@ +

+ MeiliSearch-PHP +

+ +

MeiliSearch PHP

+ +

+ MeiliSearch | + Documentation | + Slack | + Roadmap | + Website | + FAQ +

+ +

+ Latest Stable Version + Test + License + Bors enabled +

+ +

⚡ The MeiliSearch API client written for PHP 🐘

+ +**MeiliSearch PHP** is the MeiliSearch API client for PHP developers. + +**MeiliSearch** is an open-source search engine. [Discover what MeiliSearch is!](https://github.com/meilisearch/MeiliSearch) + +## Table of Contents + +- [📖 Documentation](#-documentation) +- [🔧 Installation](#-installation) +- [🚀 Getting Started](#-getting-started) +- [🤖 Compatibility with MeiliSearch](#-compatibility-with-meilisearch) +- [💡 Learn More](#-learn-more) +- [🧰 HTTP Client Compatibilities](#-http-client-compatibilities) + - [Customize your HTTP Client](#customize-your-http-client) +- [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing) + +## 📖 Documentation + +See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/). + +## 🔧 Installation + +To get started, simply require the project using [Composer](https://getcomposer.org/).
+You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation).
+A list with compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html). + +**If you don't know which HTTP client to use, we recommend using Guzzle 7**: + +```bash +composer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0 +``` + +Here is an example of installation with the `symfony/http-client`: + +```bash +composer require meilisearch/meilisearch-php symfony/http-client nyholm/psr7:^1.0 +``` + +💡 *More HTTP client installations compatible with this package can be found [in this section](#-http-client-compatibilities).* + +### Run MeiliSearch + +There are many easy ways to [download and run a MeiliSearch instance](https://docs.meilisearch.com/reference/features/installation.html#download-and-launch). + +For example, if you use Docker: + +```bash +docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub +docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey +``` + +NB: you can also download MeiliSearch from **Homebrew** or **APT**. + +## 🚀 Getting Started + +#### Add documents + +```php +index('books'); + +$documents = [ + ['book_id' => 123, 'title' => 'Pride and Prejudice', 'author' => 'Jane Austen'], + ['book_id' => 456, 'title' => 'Le Petit Prince', 'author' => 'Antoine de Saint-Exupéry'], + ['book_id' => 1, 'title' => 'Alice In Wonderland', 'author' => 'Lewis Carroll'], + ['book_id' => 1344, 'title' => 'The Hobbit', 'author' => 'J. R. R. Tolkien'], + ['book_id' => 4, 'title' => 'Harry Potter and the Half-Blood Prince', 'author' => 'J. K. Rowling'], + ['book_id' => 42, 'title' => 'The Hitchhiker\'s Guide to the Galaxy', 'author' => 'Douglas Adams, Eoin Colfer, Thomas Tidholm'], +]; + +# If the index 'books' does not exist, MeiliSearch creates it when you first add the documents. +$index->addDocuments($documents); // => { "updateId": 0 } +``` + +With the `updateId`, you can check the status (`enqueued`, `processed` or `failed`) of your documents addition using the [update endpoint](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status). + + +#### Basic Search + +```php +// MeiliSearch is typo-tolerant: +$hits = $index->search('harry pottre')->getHits(); +print_r($hits); +``` + +Output: + +```php +Array +( + [0] => Array + ( + [id] => 4 + [title] => Harry Potter and the Half-Blood Prince + ) +) +``` + +#### Custom Search + +All the supported options are described in the [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) section of the documentation. + +💡 **More about the `search()` method in [the Wiki](https://github.com/meilisearch/meilisearch-php/wiki/Search).** + +```php +$index->search( + 'prince', + [ + 'attributesToHighlight' => ['*'], + 'filters' => 'book_id > 10' + ] +)->getRaw(); // Return in Array format +``` + +JSON output: + +```json +{ + "hits": [ + { + "book_id": 456, + "title": "Le Petit Prince" + } + ], + "offset": 0, + "limit": 20, + "processingTimeMs": 10, + "query": "prince" +} +``` + +## 🤖 Compatibility with MeiliSearch + +This package only guarantees the compatibility with the [version v0.20.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.20.0). + +## 💡 Learn More + +The following sections may interest you: + +- **Manipulate documents**: see the [API references](https://docs.meilisearch.com/reference/api/documents.html) or read more about [documents](https://docs.meilisearch.com/learn/core_concepts/documents.html). +- **Search**: see the [API references](https://docs.meilisearch.com/reference/api/search.html) or follow our guide on [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html). +- **Manage the indexes**: see the [API references](https://docs.meilisearch.com/reference/api/indexes.html) or read more about [indexes](https://docs.meilisearch.com/learn/core_concepts/indexes.html). +- **Configure the index settings**: see the [API references](https://docs.meilisearch.com/reference/api/settings.html) or follow our guide on [settings parameters](https://docs.meilisearch.com/reference/features/settings.html). + +## 🧰 HTTP Client Compatibilities + +You could use any [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible client to use with this SDK. No additional configurations are required.
+A list of compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html). + +If you want to use this `meilisearch-php`: + +- with `guzzlehttp/guzzle` (Guzzle 7), run: + +```bash +composer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0 +``` + +- with `php-http/guzzle6-adapter` (Guzzle < 7), run: + +```bash +composer require meilisearch/meilisearch-php php-http/guzzle6-adapter:^2.0 http-interop/http-factory-guzzle:^1.0 +``` + +- with `symfony/http-client`, run: + +```bash +composer require meilisearch/meilisearch-php symfony/http-client nyholm/psr7:^1.0 +``` + +- with `php-http/curl-client`, run: + +```bash +composer require meilisearch/meilisearch-php php-http/curl-client nyholm/psr7:^1.0 +``` + +- with `kriswallsmith/buzz`, run: + +```bash +composer require meilisearch/meilisearch-php kriswallsmith/buzz nyholm/psr7:^1.0 +``` + +### Customize your HTTP Client + +For some reason, you might want to pass a custom configuration to your own HTTP client.
+Make sure you have a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible client when you initialize the MeiliSearch client. + +Following the example in the [Getting Started](#-getting-started) section, with the Guzzle HTTP client: + +```php +new Client('http://127.0.0.1:7700', 'masterKey', new GuzzleHttpClient(['timeout' => 2])); +``` + +## ⚙️ Development Workflow and Contributing + +Any new contribution is more than welcome in this project! + +If you want to know more about the development workflow or want to contribute, please visit our [contributing guidelines](/CONTRIBUTING.md) for detailed instructions! + +
+ +**MeiliSearch** provides and maintains many **SDKs and Integration tools** like this one. We want to provide everyone with an **amazing search experience for any kind of project**. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the [integration-guides](https://github.com/meilisearch/integration-guides) repository. diff --git a/vendor/meilisearch/meilisearch-php/bors.toml b/vendor/meilisearch/meilisearch-php/bors.toml new file mode 100644 index 000000000..f71c5cea7 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/bors.toml @@ -0,0 +1,9 @@ +status = [ + 'linter-check', + 'integration-tests (PHP 7.2)', + 'integration-tests (PHP 7.3)', + 'integration-tests (PHP 7.4)', + 'integration-tests (PHP 8.0)' +] +# 1 hour timeout +timeout-sec = 3600 diff --git a/vendor/meilisearch/meilisearch-php/composer.json b/vendor/meilisearch/meilisearch-php/composer.json new file mode 100644 index 000000000..e9233d37e --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/composer.json @@ -0,0 +1,52 @@ +{ + "name": "meilisearch/meilisearch-php", + "description": "PHP wrapper for the MeiliSearch API", + "keywords": ["meilisearch", "instant", "search", "api", "client", "php"], + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Clementine Urquizar", + "email": "clementine@meilisearch.com" + } + ], + "minimum-stability": "stable", + "require": { + "php": ">=7.2", + "ext-json": "*", + "php-http/discovery": "^1.7", + "php-http/httplug": "^2.1", + "php-http/client-common": "^2.0" + }, + "autoload": { + "psr-4": { + "MeiliSearch\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "suggest": { + "guzzlehttp/guzzle": "Use Guzzle ^7 as HTTP client", + "http-interop/http-factory-guzzle": "Factory for guzzlehttp/guzzle" + }, + "require-dev": { + "phpunit/phpunit": "^8.5 || ^9.0", + "friendsofphp/php-cs-fixer": "^2.16", + "guzzlehttp/guzzle": "^7.1", + "http-interop/http-factory-guzzle": "^1.0" + }, + "scripts": { + "lint": [ + "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --verbose --config=./.php_cs.dist --diff --show-progress=estimating --dry-run --using-cache=yes --allow-risky=yes" + ], + "lint:fix": [ + "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --verbose --config=./.php_cs.dist --diff --show-progress=estimating --using-cache=no --allow-risky=yes" + ], + "test": [ + "sh scripts/tests.sh" + ] + } +} diff --git a/vendor/meilisearch/meilisearch-php/phpunit.xml b/vendor/meilisearch/meilisearch-php/phpunit.xml new file mode 100644 index 000000000..bd4bddc66 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/phpunit.xml @@ -0,0 +1,14 @@ + + + + + ./tests + + + \ No newline at end of file diff --git a/vendor/meilisearch/meilisearch-php/scripts/tests.sh b/vendor/meilisearch/meilisearch-php/scripts/tests.sh new file mode 100644 index 000000000..39794396f --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/scripts/tests.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo 'Setting FDs limit to 1000' +ulimit -Sn 1000 + +echo "Launching tests..." +vendor/bin/phpunit --color tests/ diff --git a/vendor/meilisearch/meilisearch-php/src/Client.php b/vendor/meilisearch/meilisearch-php/src/Client.php new file mode 100644 index 000000000..47b10dc76 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Client.php @@ -0,0 +1,66 @@ +http = new Http\Client($url, $apiKey, $httpClient); + $this->index = new Indexes($this->http); + $this->health = new Health($this->http); + $this->version = new Version($this->http); + $this->stats = new Stats($this->http); + $this->keys = new Keys($this->http); + $this->dumps = new Dumps($this->http); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Contracts/Endpoint.php b/vendor/meilisearch/meilisearch-php/src/Contracts/Endpoint.php new file mode 100644 index 000000000..b3f43c722 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Contracts/Endpoint.php @@ -0,0 +1,23 @@ +http = $http; + } + + public function show(): ?array + { + return $this->http->get(static::PATH); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Contracts/Http.php b/vendor/meilisearch/meilisearch-php/src/Contracts/Http.php new file mode 100644 index 000000000..f9d44d8d0 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Contracts/Http.php @@ -0,0 +1,18 @@ +index->all(); + } + + public function index(string $uid): Indexes + { + return new Indexes($this->http, $uid); + } + + public function getIndex(string $uid): Indexes + { + return $this->index($uid)->fetchInfo(); + } + + public function deleteIndex(string $uid): array + { + return $this->index($uid)->delete(); + } + + public function deleteAllIndexes(): void + { + $indexes = $this->getAllIndexes(); + foreach ($indexes as $index) { + $index->delete(); + } + } + + public function createIndex(string $uid, array $options = []): Indexes + { + return $this->index->create($uid, $options); + } + + public function updateIndex(string $uid, array $options = []): Indexes + { + return $this->index($uid)->update($options); + } + + /** + * @throws ApiException + */ + public function getOrCreateIndex(string $uid, array $options = []): Indexes + { + try { + $index = $this->getIndex($uid, $options); + } catch (ApiException $e) { + if (\is_array($e->httpBody) && 'index_not_found' === $e->httpBody['errorCode']) { + $index = $this->createIndex($uid, $options); + } else { + throw $e; + } + } + + return $index; + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Delegates/HandlesSystem.php b/vendor/meilisearch/meilisearch-php/src/Delegates/HandlesSystem.php new file mode 100644 index 000000000..ef096a6e5 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Delegates/HandlesSystem.php @@ -0,0 +1,52 @@ +health->show(); + } + + public function isHealthy(): bool + { + try { + $this->health->show(); + } catch (\Exception $e) { + return false; + } + + return true; + } + + public function version(): array + { + return $this->version->show(); + } + + public function stats(): array + { + return $this->stats->show(); + } + + public function getKeys(): array + { + return $this->keys->show(); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDocuments.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDocuments.php new file mode 100644 index 000000000..85d4a20cf --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDocuments.php @@ -0,0 +1,64 @@ +assertValidDocumentId($documentId); + + return $this->http->get(self::PATH.'/'.$this->uid.'/documents/'.$documentId); + } + + public function getDocuments(array $query = []) + { + return $this->http->get(self::PATH.'/'.$this->uid.'/documents', $query); + } + + public function addDocuments(array $documents, ?string $primaryKey = null) + { + return $this->http->post(self::PATH.'/'.$this->uid.'/documents', $documents, ['primaryKey' => $primaryKey]); + } + + public function updateDocuments(array $documents, ?string $primaryKey = null) + { + return $this->http->put(self::PATH.'/'.$this->uid.'/documents', $documents, ['primaryKey' => $primaryKey]); + } + + public function deleteAllDocuments(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/documents'); + } + + public function deleteDocument($documentId): array + { + $this->assertValidDocumentId($documentId); + + return $this->http->delete(self::PATH.'/'.$this->uid.'/documents/'.$documentId); + } + + public function deleteDocuments(array $documents): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/documents/delete-batch', $documents); + } + + private function assertValidDocumentId($documentId): void + { + if (!\is_string($documentId) && !\is_int($documentId)) { + throw InvalidArgumentException::invalidType('documentId', ['string', 'int']); + } + + if (\is_string($documentId) && '' === trim($documentId)) { + throw InvalidArgumentException::emptyArgument('documentId'); + } + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDumps.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDumps.php new file mode 100644 index 000000000..ee7b3de93 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesDumps.php @@ -0,0 +1,23 @@ +dumps->create(); + } + + public function getDumpStatus(string $uid): array + { + return $this->dumps->status($uid); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesSettings.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesSettings.php new file mode 100644 index 000000000..492710999 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Delegates/HandlesSettings.php @@ -0,0 +1,132 @@ +http->get(self::PATH.'/'.$this->uid.'/settings/ranking-rules'); + } + + public function updateRankingRules(array $rankingRules): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/ranking-rules', $rankingRules); + } + + public function resetRankingRules(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/ranking-rules'); + } + + // Settings - Distinct attribute + + public function getDistinctAttribute() + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/distinct-attribute'); + } + + public function updateDistinctAttribute(string $distinctAttribute): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/distinct-attribute', $distinctAttribute); + } + + public function resetDistinctAttribute(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/distinct-attribute'); + } + + // Settings - Searchable attributes + + public function getSearchableAttributes(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/searchable-attributes'); + } + + public function updateSearchableAttributes(array $searchableAttributes): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/searchable-attributes', $searchableAttributes); + } + + public function resetSearchableAttributes(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/searchable-attributes'); + } + + // Settings - Displayed attributes + + public function getDisplayedAttributes(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/displayed-attributes'); + } + + public function updateDisplayedAttributes(array $displayedAttributes): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/displayed-attributes', $displayedAttributes); + } + + public function resetDisplayedAttributes(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/displayed-attributes'); + } + + // Settings - Stop-words + + public function getStopWords(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/stop-words'); + } + + public function updateStopWords(array $stopWords): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/stop-words', $stopWords); + } + + public function resetStopWords(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/stop-words'); + } + + // Settings - Synonyms + + public function getSynonyms(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/synonyms'); + } + + public function updateSynonyms(array $synonyms): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/synonyms', $synonyms); + } + + public function resetSynonyms(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/synonyms'); + } + + // Settings - Attributes for faceting + + public function getAttributesForFaceting(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings/attributes-for-faceting'); + } + + public function updateAttributesForFaceting(array $attributesForFaceting): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings/attributes-for-faceting', $attributesForFaceting); + } + + public function resetAttributesForFaceting(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings/attributes-for-faceting'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Dumps.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Dumps.php new file mode 100644 index 000000000..b56ca0706 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Dumps.php @@ -0,0 +1,22 @@ +http->post(self::PATH); + } + + public function status(string $uid): array + { + return $this->http->get(self::PATH.'/'.$uid.'/status'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Health.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Health.php new file mode 100644 index 000000000..6c1cee7f5 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Health.php @@ -0,0 +1,12 @@ +uid = $uid; + $this->primaryKey = $primaryKey; + parent::__construct($http); + } + + /** + * @return $this + * + * @throws Exception|ApiException + */ + public function create(string $uid, array $options = []): self + { + $options['uid'] = $uid; + + $response = $this->http->post(self::PATH, $options); + + return new self($this->http, $response['uid'], $response['primaryKey']); + } + + public function all(): array + { + $indexes = []; + + foreach ($this->http->get(self::PATH) as $index) { + $indexes[] = new self($this->http, $index['uid']); + } + + return $indexes; + } + + public function getPrimaryKey(): ?string + { + return $this->primaryKey; + } + + public function fetchPrimaryKey(): ?string + { + return $this->fetchInfo()->getPrimaryKey(); + } + + public function getUid(): ?string + { + return $this->uid; + } + + public function fetchRawInfo(): ?array + { + return $this->http->get(self::PATH.'/'.$this->uid); + } + + public function fetchInfo(): self + { + $response = $this->fetchRawInfo(); + $this->uid = $response['uid']; + $this->primaryKey = $response['primaryKey']; + + return $this; + } + + public function update($body): self + { + $response = $this->http->put(self::PATH.'/'.$this->uid, $body); + $this->uid = $response['uid']; + $this->primaryKey = $response['primaryKey']; + + return $this; + } + + public function delete(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid) ?? []; + } + + // Updates + + public function getUpdateStatus($updateId): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/updates/'.$updateId); + } + + public function getAllUpdateStatus(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/updates'); + } + + /** + * @param $updateId + * @param int $timeoutInMs + * @param int $intervalInMs + * + * @return mixed + * + * @throws TimeOutException + */ + public function waitForPendingUpdate($updateId, $timeoutInMs = 5000, $intervalInMs = 50): array + { + $timeout_temp = 0; + while ($timeoutInMs > $timeout_temp) { + $res = $this->getUpdateStatus($updateId); + if ('enqueued' != $res['status']) { + return $res; + } + $timeout_temp += $intervalInMs; + usleep(1000 * $intervalInMs); + } + throw new TimeOutException(); + } + + // Search + + /** + * @param string $query + * + * @return SearchResult|array + */ + public function search($query, array $searchParams = [], array $options = []) + { + $result = $this->rawSearch($query, $searchParams); + + if (\array_key_exists('raw', $options) && $options['raw']) { + return $result; + } + + $searchResult = new SearchResult($result); + $searchResult->applyOptions($options); + + return $searchResult; + } + + /** + * @param string $query + * + * @return array + */ + public function rawSearch($query, array $searchParams = []) + { + $parameters = array_merge( + ['q' => $query], + $searchParams + ); + + return $this->http->post(self::PATH.'/'.$this->uid.'/search', $parameters); + } + + // Stats + + public function stats(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/stats'); + } + + // Settings - Global + + public function getSettings(): array + { + return $this->http->get(self::PATH.'/'.$this->uid.'/settings'); + } + + public function updateSettings($settings): array + { + return $this->http->post(self::PATH.'/'.$this->uid.'/settings', $settings); + } + + public function resetSettings(): array + { + return $this->http->delete(self::PATH.'/'.$this->uid.'/settings'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Endpoints/Keys.php b/vendor/meilisearch/meilisearch-php/src/Endpoints/Keys.php new file mode 100644 index 000000000..11af51989 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Endpoints/Keys.php @@ -0,0 +1,12 @@ +httpBody = $httpBody; + $this->httpStatus = $httpStatus; + $this->message = $this->getMessageFromHttpBody(); + $this->errorCode = $this->getErrorCodeFromHttpBody(); + $this->errorLink = $this->getErrorLinkFromHttpBody(); + $this->errorType = $this->getErrorTypeFromHttpBody(); + + parent::__construct($this->message, $this->httpStatus, $previous); + } + + public function __toString() + { + $base = 'MeiliSearch HTTPRequestException: Http Status: '.$this->httpStatus; + + if ($this->message) { + $base .= ' - Message: '.$this->message; + } + + if ($this->errorCode) { + $base .= ' - Error code: '.$this->errorCode; + } + + if ($this->errorType) { + $base .= ' - Error type: '.$this->errorType; + } + + if ($this->errorLink) { + $base .= ' - Error link: '.$this->errorLink; + } + + return $base; + } + + private function getMessageFromHttpBody(): ?string + { + if (\is_array($this->httpBody) && \array_key_exists('message', $this->httpBody)) { + return $this->httpBody['message']; + } + + return null; + } + + private function getErrorCodeFromHttpBody(): ?string + { + if (\is_array($this->httpBody) && \array_key_exists('errorCode', $this->httpBody)) { + return $this->httpBody['errorCode']; + } + + return null; + } + + private function getErrorTypeFromHttpBody(): ?string + { + if (\is_array($this->httpBody) && \array_key_exists('errorType', $this->httpBody)) { + return $this->httpBody['errorType']; + } + + return null; + } + + private function getErrorLinkFromHttpBody(): ?string + { + if (\is_array($this->httpBody) && \array_key_exists('errorLink', $this->httpBody)) { + return $this->httpBody['errorLink']; + } + + return null; + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Exceptions/CommunicationException.php b/vendor/meilisearch/meilisearch-php/src/Exceptions/CommunicationException.php new file mode 100644 index 000000000..800d44523 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Exceptions/CommunicationException.php @@ -0,0 +1,15 @@ +getMessage(); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Exceptions/InvalidArgumentException.php b/vendor/meilisearch/meilisearch-php/src/Exceptions/InvalidArgumentException.php new file mode 100644 index 000000000..983aef814 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Exceptions/InvalidArgumentException.php @@ -0,0 +1,28 @@ +message = $message; + } + if (isset($code)) { + $this->code = $code; + } + parent::__construct($this->message, $this->code, $previous); + } + + public function __toString() + { + $base = 'MeiliSearch TimeOutException: Code: '.$this->code; + if (isset($this->message)) { + return $base.' - Message: '.$this->message; + } else { + return $base; + } + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/Http/Client.php b/vendor/meilisearch/meilisearch-php/src/Http/Client.php new file mode 100644 index 000000000..3ddfe7cff --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/Http/Client.php @@ -0,0 +1,195 @@ +baseUrl = $url; + $this->apiKey = $apiKey; + $this->http = $httpClient ?? Psr18ClientDiscovery::find(); + $this->requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $this->streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + $this->headers = array_filter([ + 'Content-type' => 'application/json', + 'X-Meili-API-Key' => $this->apiKey, + ]); + } + + /** + * @param $path + * @param array $query + * + * @return mixed + * + * @throws ClientExceptionInterface + * @throws ApiException + */ + public function get($path, $query = []) + { + $request = $this->requestFactory->createRequest( + 'GET', + $this->baseUrl.$path.$this->buildQueryString($query) + ); + + return $this->execute($request); + } + + /** + * @param string $path + * @param null $body + * @param array $query + * + * @return mixed + * + * @throws ClientExceptionInterface + * @throws ApiException + */ + public function post($path, $body = null, $query = []) + { + $request = $this->requestFactory->createRequest( + 'POST', + $this->baseUrl.$path.$this->buildQueryString($query) + )->withBody($this->streamFactory->createStream(json_encode($body))); + + return $this->execute($request); + } + + public function put($path, $body = null, $query = []) + { + $request = $this->requestFactory->createRequest( + 'PUT', + $this->baseUrl.$path.$this->buildQueryString($query) + )->withBody($this->streamFactory->createStream(json_encode($body))); + + return $this->execute($request); + } + + /** + * @param string $path + * @param null $body + * @param array $query + * + * @return mixed + * + * @throws ClientExceptionInterface + * @throws ApiException + */ + public function patch($path, $body = null, $query = []) + { + $request = $this->requestFactory->createRequest( + 'PATCH', + $this->baseUrl.$path.$this->buildQueryString($query) + )->withBody($this->streamFactory->createStream(json_encode($body))); + + return $this->execute($request); + } + + /** + * @param $path + * @param array $query + * + * @return mixed + * + * @throws ClientExceptionInterface + * @throws ApiException + */ + public function delete($path, $query = []) + { + $request = $this->requestFactory->createRequest( + 'DELETE', + $this->baseUrl.$path.$this->buildQueryString($query) + ); + + return $this->execute($request); + } + + /** + * @return mixed + * + * @throws ApiException + * @throws ClientExceptionInterface + * @throws CommunicationException + * @throws ApiException + */ + private function execute(RequestInterface $request) + { + foreach ($this->headers as $header => $value) { + $request = $request->withAddedHeader($header, $value); + } + + try { + return $this->parseResponse($this->http->sendRequest($request)); + } catch (NetworkExceptionInterface $e) { + throw new CommunicationException($e->getMessage(), $e->getCode(), $e); + } + } + + private function buildQueryString(array $queryParams = []): string + { + return $queryParams ? '?'.http_build_query($queryParams) : ''; + } + + /** + * @return mixed + * + * @throws ApiException + */ + private function parseResponse(ResponseInterface $response) + { + if ($response->getStatusCode() >= 300) { + $body = json_decode($response->getBody()->getContents(), true) ?? $response->getReasonPhrase(); + throw new ApiException($response->getStatusCode(), $body); + } + + return json_decode($response->getBody()->getContents(), true); + } +} diff --git a/vendor/meilisearch/meilisearch-php/src/MeiliSearch.php b/vendor/meilisearch/meilisearch-php/src/MeiliSearch.php new file mode 100644 index 000000000..003f348d7 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/src/MeiliSearch.php @@ -0,0 +1,10 @@ +> + */ + private $hits; + + /** + * @var int + */ + private $offset; + + /** + * @var int + */ + private $limit; + + /** + * `nbHits` is the attributes returned by the MeiliSearch server + * and its value will not be modified by the methods in this class. + * Please, use `hitsCount` if you want to know the real size of the `hits` array at any time. + * + * @var int + */ + private $nbHits; + + /** + * @var int + */ + private $hitsCount; + + /** + * @var bool + */ + private $exhaustiveNbHits; + + /** + * @var int + */ + private $processingTimeMs; + + /** + * @var string + */ + private $query; + + /** + * @var bool|null + */ + private $exhaustiveFacetsCount; + + /** + * @var array + */ + private $facetsDistribution; + + /** + * @var array + */ + private $raw; + + public function __construct(array $body) + { + $this->hits = $body['hits'] ?? []; + $this->offset = $body['offset']; + $this->limit = $body['limit']; + $this->nbHits = $body['nbHits']; + $this->hitsCount = \count($body['hits']); + $this->exhaustiveNbHits = $body['exhaustiveNbHits'] ?? false; + $this->processingTimeMs = $body['processingTimeMs']; + $this->query = $body['query']; + $this->exhaustiveFacetsCount = $body['exhaustiveFacetsCount'] ?? null; + $this->facetsDistribution = $body['facetsDistribution'] ?? []; + $this->raw = $body; + } + + /** + * Return a new {@see SearchResult} instance. + * + * The $options parameter is an array, and the following keys are accepted: + * - removeZeroFacets (boolean) + * - transformFacetsDistribution (callable) + * - transformHits (callable) + * + * The method does NOT trigger a new search. + * + * @return SearchResult + */ + public function applyOptions($options): self + { + if (\array_key_exists('removeZeroFacets', $options) && true === $options['removeZeroFacets']) { + $this->removeZeroFacets(); + } + if (\array_key_exists('transformHits', $options) && \is_callable($options['transformHits'])) { + $this->transformHits($options['transformHits']); + } + if (\array_key_exists('transformFacetsDistribution', $options) && \is_callable($options['transformFacetsDistribution'])) { + $this->transformFacetsDistribution($options['transformFacetsDistribution']); + } + + return $this; + } + + public function transformHits(callable $callback): self + { + $this->hits = $callback($this->hits); + $this->hitsCount = \count($this->hits); + + return $this; + } + + public function transformFacetsDistribution(callable $callback): self + { + $this->facetsDistribution = $callback($this->facetsDistribution); + + return $this; + } + + public function removeZeroFacets(): self + { + $filterAllFacets = function (array $facets) { + $filterOneFacet = function (array $facet) { + return array_filter( + $facet, + function ($v, $k) { return 0 !== $v; }, + ARRAY_FILTER_USE_BOTH + ); + }; + + return array_map($filterOneFacet, $facets); + }; + + return $this->transformFacetsDistribution($filterAllFacets); + } + + public function getHit(int $key, $default = null) + { + return $this->hits[$key] ?? $default; + } + + /** + * @return array + */ + public function getHits(): array + { + return $this->hits; + } + + public function getOffset(): int + { + return $this->offset; + } + + public function getLimit(): int + { + return $this->limit; + } + + public function getHitsCount(): int + { + return $this->hitsCount; + } + + public function count(): int + { + return $this->hitsCount; + } + + public function getNbHits(): int + { + return $this->nbHits; + } + + public function getExhaustiveNbHits(): bool + { + return $this->exhaustiveNbHits; + } + + public function getProcessingTimeMs(): int + { + return $this->processingTimeMs; + } + + public function getQuery(): string + { + return $this->query; + } + + public function getExhaustiveFacetsCount(): ?bool + { + return $this->exhaustiveFacetsCount; + } + + /** + * @return array + */ + public function getFacetsDistribution(): array + { + return $this->facetsDistribution; + } + + /** + * Return the original search result. + * + * @return array + */ + public function getRaw(): array + { + return $this->raw; + } + + public function toArray(): array + { + return [ + 'hits' => $this->hits, + 'offset' => $this->offset, + 'limit' => $this->limit, + 'nbHits' => $this->nbHits, + 'hitsCount' => $this->hitsCount, + 'exhaustiveNbHits' => $this->exhaustiveNbHits, + 'processingTimeMs' => $this->processingTimeMs, + 'query' => $this->query, + 'exhaustiveFacetsCount' => $this->exhaustiveFacetsCount, + 'facetsDistribution' => $this->facetsDistribution, + ]; + } + + public function toJSON(): string + { + return \json_encode($this->toArray(), JSON_PRETTY_PRINT); + } + + public function getIterator(): ArrayIterator + { + return new ArrayIterator($this->hits); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/ClientTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/ClientTest.php new file mode 100644 index 000000000..637bcfbcd --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/ClientTest.php @@ -0,0 +1,310 @@ +client->getAllIndexes(); + + $this->assertIsArray($response); + $this->assertEmpty($response); + } + + public function testCreateIndexWithOnlyUid(): void + { + $index = $this->client->createIndex('index'); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertNull($index->getPrimaryKey()); + } + + public function testCreateIndexWithUidAndPrimaryKey(): void + { + $index = $this->client->createIndex( + 'index', + ['primaryKey' => 'ObjectId'] + ); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertSame('ObjectId', $index->getPrimaryKey()); + } + + public function testCreateIndexWithUidInOptions(): void + { + $index = $this->client->createIndex( + 'index', + [ + 'uid' => 'wrong', + 'primaryKey' => 'ObjectId', + ] + ); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertSame('ObjectId', $index->getPrimaryKey()); + } + + public function testGetAllIndexes(): void + { + $indexA = 'indexA'; + $indexB = 'indexB'; + $this->client->createIndex($indexA); + $this->client->createIndex($indexB); + + $response = $this->client->getAllIndexes(); + + $this->assertIsArray($response); + $this->assertCount(2, $response); + + $uids = array_map(function ($index) { + return $index->getUid(); + }, $response); + + $this->assertContains($indexA, $uids); + $this->assertContains($indexB, $uids); + } + + public function testUpdateIndex(): void + { + $this->client->createIndex('indexA'); + + $index = $this->client->updateIndex('indexA', ['primaryKey' => 'id']); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame($index->getPrimaryKey(), 'id'); + $this->assertSame($index->getUid(), 'indexA'); + } + + public function testDeleteIndex(): void + { + $this->client->createIndex('index'); + + $response = $this->client->getAllIndexes(); + $this->assertCount(1, $response); + + $response = $this->client->deleteIndex('index'); + + $this->assertEmpty($response); + $response = $this->client->getAllIndexes(); + + $this->assertCount(0, $response); + } + + public function testDeleteAllIndexes(): void + { + $this->client->createIndex('index-1'); + $this->client->createIndex('index-2'); + + $response = $this->client->getAllIndexes(); + + $this->assertCount(2, $response); + + $this->client->deleteAllIndexes(); + $response = $this->client->getAllIndexes(); + + $this->assertCount(0, $response); + } + + public function testDeleteAllIndexesWhenThereAreNoIndexes(): void + { + $response = $this->client->getAllIndexes(); + $this->assertCount(0, $response); + + $this->client->deleteAllIndexes(); + + $this->assertCount(0, $response); + } + + public function testGetIndex(): void + { + $this->client->createIndex('index'); + + $index = $this->client->getIndex('index'); + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertNull($index->getPrimaryKey()); + } + + public function testIndex(): void + { + $this->client->createIndex('index'); + + $index = $this->client->index('index'); + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertNull($index->getPrimaryKey()); + } + + public function testGetOrCreateIndexWithOnlyUid(): void + { + $index = $this->client->getOrCreateIndex('index'); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertNull($index->getPrimaryKey()); + } + + public function testGetOrCreateIndexWithUidAndPrimaryKey(): void + { + $index = $this->client->getOrCreateIndex( + 'index', + ['primaryKey' => 'ObjectId'] + ); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertSame('ObjectId', $index->getPrimaryKey()); + } + + public function testGetOrCreateIndexWithUidInOptions(): void + { + $index = $this->client->getOrCreateIndex( + 'index', + [ + 'uid' => 'wrong', + 'primaryKey' => 'ObjectId', + ] + ); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('index', $index->getUid()); + $this->assertSame('ObjectId', $index->getPrimaryKey()); + } + + public function testGetOrCreateWithIndexAlreadyExists(): void + { + $index1 = $this->client->getOrCreateIndex('index'); + $index2 = $this->client->getOrCreateIndex('index'); + $index3 = $this->client->getOrCreateIndex('index'); + + $this->assertSame('index', $index1->getUid()); + $this->assertSame('index', $index2->getUid()); + $this->assertSame('index', $index3->getUid()); + + $update = $index1->addDocuments([['book_id' => 1, 'name' => 'Some book']]); + $index1->waitForPendingUpdate($update['updateId']); + + $documents = $index2->getDocuments(); + $this->assertCount(1, $documents); + $index2->delete(); + } + + public function testExceptionIsThrownWhenOverwritingPrimaryKeyUsingUpdateIndex(): void + { + $this->client->createIndex( + 'indexB', + ['primaryKey' => 'objectId'] + ); + + $this->expectException(ApiException::class); + + $this->client->updateIndex('indexB', ['primaryKey' => 'objectID']); + } + + public function testExceptionIsThrownWhenUpdateIndexUseANoneExistingIndex(): void + { + $this->expectException(ApiException::class); + + $this->client->updateIndex( + 'IndexNotExist', + ['primaryKey' => 'objectId'] + ); + } + + public function testExceptionIfUidTakenWhenCreating(): void + { + $this->client->createIndex('index'); + + $this->expectException(ApiException::class); + + $this->client->createIndex('index'); + } + + public function testExceptionIfUidIsNullWhenCreating(): void + { + $this->expectException(\TypeError::class); + $this->client->createIndex(null); + } + + public function testExceptionIfUidIsEmptyStringWhenCreating(): void + { + $this->expectException(ApiException::class); + $this->client->createIndex(''); + } + + public function testExceptionIfNoIndexWhenShowing(): void + { + $this->expectException(ApiException::class); + $this->client->getIndex('a-non-existing-index'); + } + + public function testExceptionIfNoIndexWhenDeleting(): void + { + $this->expectException(ApiException::class); + $this->client->deleteIndex('a-non-existing-index'); + } + + public function testHealth(): void + { + $response = $this->client->health(); + + $this->assertEquals('available', $response['status']); + } + + public function testIsHealthyIsTrue(): void + { + $response = $this->client->isHealthy(); + + $this->assertTrue($response); + } + + public function testIsHealthyIsFalse(): void + { + $client = new Client('http://127.0.0.1.com:1234', 'masterKey'); + $response = $client->isHealthy(); + + $this->assertFalse($response); + } + + public function testVersion(): void + { + $response = $this->client->version(); + + $this->assertArrayHasKey('commitSha', $response); + $this->assertArrayHasKey('buildDate', $response); + $this->assertArrayHasKey('pkgVersion', $response); + } + + public function testStats(): void + { + $response = $this->client->stats(); + + $this->assertArrayHasKey('databaseSize', $response); + $this->assertArrayHasKey('lastUpdate', $response); + $this->assertArrayHasKey('indexes', $response); + } + + public function testBadClientUrl(): void + { + try { + $client = new Client('http://127.0.0.1.com:1234', 'some-key'); + $client->createIndex('index'); + } catch (\Exception $e) { + $this->assertIsString($e->getMessage()); + + return; + } + $this->fail('Bad client was accepted and the exception was not thrown'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/DocumentsTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/DocumentsTest.php new file mode 100644 index 000000000..bee9ef4f1 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/DocumentsTest.php @@ -0,0 +1,318 @@ +client->createIndex('documents'); + $promise = $index->addDocuments(self::DOCUMENTS); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + + $response = $index->getDocuments(); + $this->assertCount(\count(self::DOCUMENTS), $response); + } + + public function testGetSingleDocumentWithIntegerDocumentId(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + $doc = $this->findDocumentWithId(self::DOCUMENTS, 4); + $response = $index->getDocument($doc['id']); + + $this->assertIsArray($response); + $this->assertSame($doc['id'], $response['id']); + $this->assertSame($doc['title'], $response['title']); + } + + public function testGetSingleDocumentWithStringDocumentId(): void + { + $stringDocumentId = 'myUniqueId'; + $index = $this->client->createIndex('documents'); + $addDocumentResponse = $index->addDocuments([['id' => $stringDocumentId]]); + $index->waitForPendingUpdate($addDocumentResponse['updateId']); + $response = $index->getDocument($stringDocumentId); + + $this->assertIsArray($response); + $this->assertSame($stringDocumentId, $response['id']); + } + + public function testReplaceDocuments(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + $replacement = [ + 'id' => 2, + 'title' => 'The Red And The Black', + ]; + $response = $index->addDocuments([$replacement]); + + $this->assertIsValidPromise($response); + + $index->waitForPendingUpdate($response['updateId']); + $response = $index->getDocument($replacement['id']); + + $this->assertSame($replacement['id'], $response['id']); + $this->assertSame($replacement['title'], $response['title']); + $this->assertFalse(array_search('comment', $response)); + $response = $index->getDocuments(); + $this->assertCount(\count(self::DOCUMENTS), $response); + } + + public function testUpdateDocuments(): void + { + $index = $this->client->createIndex('documents'); + $promise = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($promise['updateId']); + $replacement = [ + 'id' => 456, + 'title' => 'The Little Prince', + ]; + $promise = $index->updateDocuments([$replacement]); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocument($replacement['id']); + + $this->assertSame($replacement['id'], $response['id']); + $this->assertSame($replacement['title'], $response['title']); + $this->assertArrayHasKey('comment', $response); + + $response = $index->getDocuments(); + + $this->assertCount(\count(self::DOCUMENTS), $response); + } + + public function testAddWithUpdateDocuments(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + $document = [ + 'id' => 9, + 'title' => '1984', + ]; + $promise = $index->updateDocuments([$document]); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocument($document['id']); + + $this->assertSame($document['id'], $response['id']); + $this->assertSame($document['title'], $response['title']); + $this->assertFalse(array_search('comment', $response)); + + $response = $index->getDocuments(); + + $this->assertCount(\count(self::DOCUMENTS) + 1, $response); + } + + public function testDeleteNonExistingDocument(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + + $documentId = 9; + $promise = $index->deleteDocument($documentId); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocuments(); + + $this->assertCount(\count(self::DOCUMENTS), $response); + $this->assertNull($this->findDocumentWithId($response, $documentId)); + } + + public function testDeleteSingleExistingDocumentWithDocumentIdAsInteger(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + + $documentId = 123; + $promise = $index->deleteDocument($documentId); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocuments(); + + $this->assertCount(\count(self::DOCUMENTS) - 1, $response); + $this->assertNull($this->findDocumentWithId($response, $documentId)); + } + + public function testDeleteSingleExistingDocumentWithDocumentIdAsString(): void + { + $stringDocumentId = 'myUniqueId'; + $index = $this->client->createIndex('documents'); + $addDocumentResponse = $index->addDocuments([['id' => $stringDocumentId]]); + $index->waitForPendingUpdate($addDocumentResponse['updateId']); + + $promise = $index->deleteDocument($stringDocumentId); + $index->waitForPendingUpdate($promise['updateId']); + + $response = $index->getDocuments(); + + $this->assertEmpty($response); + } + + public function testDeleteMultipleDocumentsWithDocumentIdAsInteger(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + $documentIds = [1, 2]; + $promise = $index->deleteDocuments($documentIds); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocuments(); + + $this->assertCount(\count(self::DOCUMENTS) - 2, $response); + $this->assertNull($this->findDocumentWithId($response, $documentIds[0])); + $this->assertNull($this->findDocumentWithId($response, $documentIds[1])); + } + + public function testDeleteMultipleDocumentsWithDocumentIdAsString(): void + { + $documents = [ + ['id' => 'myUniqueId1'], + ['id' => 'myUniqueId2'], + ['id' => 'myUniqueId3'], + ]; + $index = $this->client->createIndex('documents'); + $addDocumentResponse = $index->addDocuments($documents); + $index->waitForPendingUpdate($addDocumentResponse['updateId']); + + $promise = $index->deleteDocuments(['myUniqueId1', 'myUniqueId3']); + $index->waitForPendingUpdate($promise['updateId']); + + $response = $index->getDocuments(); + $this->assertCount(1, $response); + $this->assertSame([['id' => 'myUniqueId2']], $response); + } + + public function testDeleteAllDocuments(): void + { + $index = $this->client->createIndex('documents'); + $response = $index->addDocuments(self::DOCUMENTS); + $index->waitForPendingUpdate($response['updateId']); + $promise = $index->deleteAllDocuments(); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $response = $index->getDocuments(); + + $this->assertCount(0, $response); + } + + public function testExceptionIfNoDocumentIdWhenGetting(): void + { + $index = $this->client->createIndex('new-index'); + + $this->expectException(ApiException::class); + + $index->getDocument(1); + } + + public function testAddDocumentWithPrimaryKey(): void + { + $documents = [ + [ + 'id' => 1, + 'unique' => 1, + 'title' => 'Le Rouge et le Noir', + ], + ]; + $index = $this->client->createIndex('an-index'); + $response = $index->addDocuments($documents, 'unique'); + + $this->assertArrayHasKey('updateId', $response); + $index->waitForPendingUpdate($response['updateId']); + + $this->assertSame('unique', $index->fetchPrimaryKey()); + $this->assertCount(1, $index->getDocuments()); + } + + public function testUpdateDocumentWithPrimaryKey(): void + { + $documents = [ + [ + 'id' => 1, + 'unique' => 1, + 'title' => 'Le Rouge et le Noir', + ], + ]; + $index = $this->client->createIndex('index'); + $promise = $index->updateDocuments($documents, 'unique'); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + + $this->assertSame('unique', $index->fetchPrimaryKey()); + $this->assertCount(1, $index->getDocuments()); + } + + /** + * @dataProvider invalidDocumentIds + */ + public function testFetchingDocumentWithInvalidId($documentId): void + { + $index = $this->client->createIndex('an-index'); + + $this->expectException(InvalidArgumentException::class); + $index->getDocument($documentId); + } + + /** + * @dataProvider invalidDocumentIds + */ + public function testDeletingDocumentWithInvalidId($documentId): void + { + $index = $this->client->createIndex('an-index'); + + $this->expectException(InvalidArgumentException::class); + $index->deleteDocument($documentId); + } + + public function invalidDocumentIds(): array + { + return [ + 'documentId as null' => [null], + 'documentId as bool' => [true], + 'documentId as empty string' => [''], + 'documentId as float' => [2.1], + 'documentId as array' => [[]], + 'documentId as object' => [new \stdClass()], + 'documentId as resource' => [tmpfile()], + ]; + } + + private function findDocumentWithId($documents, $documentId) + { + foreach ($documents as $document) { + if ($document['id'] == $documentId) { + return $document; + } + } + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/DumpTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/DumpTest.php new file mode 100644 index 000000000..757a31ba7 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/DumpTest.php @@ -0,0 +1,32 @@ +client->createDump(); + + $this->assertArrayHasKey('uid', $dump); + $this->assertArrayHasKey('status', $dump); + $this->assertEquals('in_progress', $dump['status']); + + $dump = $this->client->getDumpStatus($dump['uid']); + + $this->assertArrayHasKey('uid', $dump); + $this->assertArrayHasKey('status', $dump); + } + + public function testDumpNotFound(): void + { + $this->expectException(ApiException::class); + + $this->client->getDumpStatus('not-found'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/IndexTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/IndexTest.php new file mode 100644 index 000000000..0b24c638b --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/IndexTest.php @@ -0,0 +1,215 @@ +index = $this->client->createIndex('index'); + } + + public function testGetPrimaryKey(): void + { + $indexB = $this->client->createIndex( + 'indexB', + ['primaryKey' => 'objectId'] + ); + + $this->assertNull($this->index->getPrimaryKey()); + $this->assertSame('objectId', $indexB->getPrimaryKey()); + } + + public function testGetUid(): void + { + $indexB = $this->client->createIndex( + 'indexB', + ['primaryKey' => 'objectId'] + ); + $this->assertSame('index', $this->index->getUid()); + $this->assertSame('indexB', $indexB->getUid()); + } + + public function testfetchRawInfo(): void + { + $index = $this->client->createIndex( + 'indexB', + ['primaryKey' => 'objectId'] + ); + + $response = $index->fetchRawInfo(); + + $this->assertArrayHasKey('primaryKey', $response); + $this->assertArrayHasKey('uid', $response); + $this->assertArrayHasKey('createdAt', $response); + $this->assertArrayHasKey('updatedAt', $response); + $this->assertSame($response['primaryKey'], 'objectId'); + $this->assertSame($response['uid'], 'indexB'); + } + + public function testPrimaryKeyUpdate(): void + { + $primaryKey = 'id'; + + $index = $this->index->update(['primaryKey' => $primaryKey]); + + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame($index->getPrimaryKey(), $primaryKey); + $this->assertSame($index->getUid(), 'index'); + $this->assertSame($this->index->getPrimaryKey(), $primaryKey); + $this->assertSame($this->index->getUid(), 'index'); + } + + public function testExceptionIsThrownWhenOverwritingPrimaryKey(): void + { + $index = $this->client->createIndex( + 'indexB', + ['primaryKey' => 'objectId'] + ); + + $this->expectException(ApiException::class); + + $index->update(['primaryKey' => 'objectID']); + } + + public function testIndexStats(): void + { + $stats = $this->index->stats(); + + $this->assertArrayHasKey('numberOfDocuments', $stats); + $this->assertEquals(0, $stats['numberOfDocuments']); + $this->assertArrayHasKey('isIndexing', $stats); + $this->assertArrayHasKey('fieldsDistribution', $stats); + } + + public function testFetchInfo(): void + { + $uid = 'indexA'; + $this->client->createIndex( + $uid, + ['primaryKey' => 'objectID'] + ); + + $index = $this->client->index($uid); + $this->assertInstanceOf(Indexes::class, $index); + $this->assertNull($index->getPrimaryKey()); + + $index = $index->fetchInfo(); + $this->assertInstanceOf(Indexes::class, $index); + $this->assertSame('objectID', $index->getPrimaryKey()); + } + + public function testGetAndFetchPrimaryKey(): void + { + $uid = 'indexA'; + $this->client->createIndex( + $uid, + ['primaryKey' => 'objectID'] + ); + + $index = $this->client->index($uid); + $this->assertNull($index->getPrimaryKey()); + $this->assertSame('objectID', $index->fetchPrimaryKey()); + $this->assertSame('objectID', $index->getPrimaryKey()); + } + + public function testWaitForPendingUpdateDefault(): void + { + $promise = $this->index->addDocuments([['id' => 1, 'title' => 'Pride and Prejudice']]); + + $response = $this->index->waitForPendingUpdate($promise['updateId']); + + $this->assertIsArray($response); + $this->assertSame($response['status'], 'processed'); + $this->assertSame($response['updateId'], $promise['updateId']); + $this->assertArrayHasKey('type', $response); + $this->assertIsArray($response['type']); + $this->assertArrayHasKey('duration', $response); + $this->assertArrayHasKey('enqueuedAt', $response); + $this->assertArrayHasKey('processedAt', $response); + } + + public function testWaitForPendingUpdateWithTimeoutAndInterval(): void + { + $promise = $this->index->addDocuments([['id' => 1, 'title' => 'Pride and Prejudice']]); + $response = $this->index->waitForPendingUpdate($promise['updateId'], 100, 20); + + $this->assertIsArray($response); + $this->assertSame($response['status'], 'processed'); + $this->assertSame($response['updateId'], $promise['updateId']); + $this->assertArrayHasKey('type', $response); + $this->assertIsArray($response['type']); + $this->assertArrayHasKey('duration', $response); + $this->assertArrayHasKey('enqueuedAt', $response); + $this->assertArrayHasKey('processedAt', $response); + } + + public function testWaitForPendingUpdateWithTimeout(): void + { + $promise = $this->index->addDocuments([['id' => 1, 'title' => 'Pride and Prejudice']]); + $response = $this->index->waitForPendingUpdate($promise['updateId'], 100); + + $this->assertIsArray($response); + $this->assertSame($response['status'], 'processed'); + $this->assertSame($response['updateId'], $promise['updateId']); + $this->assertArrayHasKey('type', $response); + $this->assertIsArray($response['type']); + $this->assertArrayHasKey('duration', $response); + $this->assertArrayHasKey('enqueuedAt', $response); + $this->assertArrayHasKey('processedAt', $response); + } + + public function testExceptionWhenPendingUpdateTimeOut(): void + { + $this->expectException(TimeOutException::class); + $res = $this->index->addDocuments([['id' => 1, 'title' => 'Pride and Prejudice']]); + $this->index->waitForPendingUpdate($res['updateId'], 0, 20); + } + + public function testDeleteIndexes(): void + { + $this->index = $this->client->createIndex('indexA'); + $indexB = $this->client->createIndex('indexB'); + + $res = $this->index->delete(); + $this->assertEmpty($res); + + $res = $indexB->delete(); + $this->assertEmpty($res); + } + + public function testExceptionIsThrownIfNoIndexWhenShowing(): void + { + $this->index->delete(); + + $this->expectException(ApiException::class); + + $this->index->fetchInfo(); + } + + public function testExceptionIsThrownIfNoIndexWhenUpdating(): void + { + $this->index->delete(); + + $this->expectException(ApiException::class); + $this->index->update(['primaryKey' => 'objectID']); + } + + public function testExceptionIsThrownIfNoIndexWhenDeleting(): void + { + $this->index->delete(); + + $this->expectException(ApiException::class); + $this->index->delete(); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/KeysAndPermissionsTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/KeysAndPermissionsTest.php new file mode 100644 index 000000000..f6ebac5c3 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/KeysAndPermissionsTest.php @@ -0,0 +1,74 @@ +client->getKeys(); + + $this->assertArrayHasKey('private', $response); + $this->assertArrayHasKey('public', $response); + $this->assertIsString($response['private']); + $this->assertNotNull($response['private']); + $this->assertIsString($response['public']); + $this->assertNotNull($response['public']); + } + + public function testSearchingIfPublicKeyProvided(): void + { + $this->client->createIndex('index'); + + $newClient = new Client(self::HOST, $this->getKeys()['public']); + $response = $newClient->index('index')->search('test'); + $this->assertArrayHasKey('hits', $response->toArray()); + } + + public function testGetSettingsIfPrivateKeyProvided(): void + { + $this->client->createIndex('index'); + $newClient = new Client(self::HOST, $this->getKeys()['private']); + $response = $newClient->index('index')->getSettings(); + + $this->assertEquals(['*'], $response['searchableAttributes']); + } + + public function testExceptionIfNoMasterKeyProvided(): void + { + $newClient = new Client(self::HOST); + + $this->expectException(ApiException::class); + $newClient->index('index')->search('test'); + } + + public function testExceptionIfBadKeyProvidedToGetSettings(): void + { + $this->client->createIndex('index'); + $response = $this->client->index('index')->getSettings(); + $this->assertEquals(['*'], $response['searchableAttributes']); + + $newClient = new Client(self::HOST, 'bad-key'); + + $this->expectException(ApiException::class); + $newClient->index('index')->getSettings(); + } + + public function testExceptionIfBadKeyProvidedToGetKeys(): void + { + $this->expectException(ApiException::class); + $client = new Client(self::HOST, 'bad-key'); + $client->getKeys(); + } + + private function getKeys(): array + { + return $this->client->getKeys(); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/SearchTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/SearchTest.php new file mode 100644 index 000000000..7361dcd8b --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/SearchTest.php @@ -0,0 +1,605 @@ +index = $this->client->createIndex('index'); + $promise = $this->index->updateDocuments(self::DOCUMENTS); + $this->index->waitForPendingUpdate($promise['updateId']); + } + + public function testBasicSearch(): void + { + $response = $this->index->search('prince'); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertSame(2, $response->getNbHits()); + $this->assertCount(2, $response->getHits()); + + $response = $this->index->search('prince', [], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(2, $response['nbHits']); + } + + public function testBasicEmptySearch(): void + { + $response = $this->index->search(''); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertCount(7, $response->getHits()); + + $response = $this->index->search('', [], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(7, $response['nbHits']); + } + + public function testBasicPlaceholderSearch(): void + { + $response = $this->index->search(null); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertCount(\count(self::DOCUMENTS), $response->getHits()); + + $response = $this->index->search(null, [], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(\count(self::DOCUMENTS), $response['nbHits']); + } + + public function testSearchWithOptions(): void + { + $response = $this->index->search('prince', ['limit' => 1]); + + $this->assertCount(1, $response->getHits()); + + $response = $this->index->search('prince', ['limit' => 1], [ + 'raw' => true, + ]); + + $this->assertSame(1, \count($response['hits'])); + } + + public function testBasicSearchIfNoPrimaryKeyAndDocumentProvided(): void + { + $emptyIndex = $this->client->createIndex('empty'); + + $res = $emptyIndex->search('prince'); + + $this->assertArrayHasKey('hits', $res->toArray()); + $this->assertArrayHasKey('offset', $res->toArray()); + $this->assertArrayHasKey('limit', $res->toArray()); + $this->assertArrayHasKey('processingTimeMs', $res->toArray()); + $this->assertArrayHasKey('query', $res->toArray()); + $this->assertCount(0, $res->getHits()); + + $res = $emptyIndex->search('prince', [], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('hits', $res); + $this->assertArrayHasKey('offset', $res); + $this->assertArrayHasKey('limit', $res); + $this->assertArrayHasKey('processingTimeMs', $res); + $this->assertArrayHasKey('query', $res); + $this->assertSame(0, $res['nbHits']); + } + + public function testExceptionIfNoIndexWhenSearching(): void + { + $index = $this->client->createIndex('another-index'); + $index->delete(); + + $this->expectException(ApiException::class); + + $index->search('prince'); + } + + public function testParametersArray(): void + { + $response = $this->index->search('prince', [ + 'limit' => 5, + 'offset' => 0, + 'attributesToRetrieve' => ['id', 'title'], + 'attributesToCrop' => ['id', 'title'], + 'cropLength' => 6, + 'attributesToHighlight' => ['title'], + 'filters' => 'title = "Le Petit Prince"', + 'matches' => true, + ]); + + $this->assertArrayHasKey('_matchesInfo', $response->getHit(0)); + $this->assertArrayHasKey('title', $response->getHit(0)['_matchesInfo']); + $this->assertArrayHasKey('_formatted', $response->getHit(0)); + $this->assertArrayNotHasKey('comment', $response->getHit(0)); + $this->assertArrayNotHasKey('comment', $response->getHit(0)['_matchesInfo']); + $this->assertSame('Petit Prince', $response->getHit(0)['_formatted']['title']); + + $response = $this->index->search('prince', [ + 'limit' => 5, + 'offset' => 0, + 'attributesToRetrieve' => ['id', 'title'], + 'attributesToCrop' => ['id', 'title'], + 'cropLength' => 6, + 'attributesToHighlight' => ['title'], + 'filters' => 'title = "Le Petit Prince"', + 'matches' => true, + ], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('_matchesInfo', $response['hits'][0]); + $this->assertArrayHasKey('title', $response['hits'][0]['_matchesInfo']); + $this->assertArrayHasKey('_formatted', $response['hits'][0]); + $this->assertArrayNotHasKey('comment', $response['hits'][0]); + $this->assertArrayNotHasKey('comment', $response['hits'][0]['_matchesInfo']); + $this->assertSame('Petit Prince', $response['hits'][0]['_formatted']['title']); + } + + public function testParametersCanBeAStar(): void + { + $response = $this->index->search('prince', [ + 'limit' => 5, + 'offset' => 0, + 'attributesToRetrieve' => ['*'], + 'attributesToCrop' => ['*'], + 'cropLength' => 6, + 'attributesToHighlight' => ['*'], + 'filters' => 'title = "Le Petit Prince"', + 'matches' => true, + ]); + + $this->assertArrayHasKey('_matchesInfo', $response->getHit(0)); + $this->assertArrayHasKey('title', $response->getHit(0)['_matchesInfo']); + $this->assertArrayHasKey('_formatted', $response->getHit(0)); + $this->assertArrayHasKey('comment', $response->getHit(0)); + $this->assertArrayNotHasKey('comment', $response->getHit(0)['_matchesInfo']); + $this->assertSame('Petit Prince', $response->getHit(0)['_formatted']['title']); + + $response = $this->index->search('prince', [ + 'limit' => 5, + 'offset' => 0, + 'attributesToRetrieve' => ['*'], + 'attributesToCrop' => ['*'], + 'cropLength' => 6, + 'attributesToHighlight' => ['*'], + 'filters' => 'title = "Le Petit Prince"', + 'matches' => true, + ], [ + 'raw' => true, + ]); + + $this->assertArrayHasKey('_matchesInfo', $response['hits'][0]); + $this->assertArrayHasKey('title', $response['hits'][0]['_matchesInfo']); + $this->assertArrayHasKey('_formatted', $response['hits'][0]); + $this->assertArrayHasKey('comment', $response['hits'][0]); + $this->assertArrayNotHasKey('comment', $response['hits'][0]['_matchesInfo']); + $this->assertSame('Petit Prince', $response['hits'][0]['_formatted']['title']); + } + + public function testBasicSearchWithFacetsDistribution(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search('prince', [ + 'facetsDistribution' => ['genre'], + ]); + $this->assertSame(2, $response->getHitsCount()); + $this->assertArrayHasKey('facetsDistribution', $response->toArray()); + $this->assertArrayHasKey('exhaustiveFacetsCount', $response->toArray()); + $this->assertArrayHasKey('genre', $response->getFacetsDistribution()); + $this->assertTrue($response->getExhaustiveFacetsCount()); + $this->assertSame($response->getFacetsDistribution()['genre']['fantasy'], 1); + $this->assertSame($response->getFacetsDistribution()['genre']['adventure'], 1); + $this->assertSame($response->getFacetsDistribution()['genre']['romance'], 0); + + $response = $this->index->search('prince', [ + 'facetsDistribution' => ['genre'], + ], [ + 'raw' => true, + ]); + $this->assertSame(2, $response['nbHits']); + $this->assertArrayHasKey('facetsDistribution', $response); + $this->assertArrayHasKey('exhaustiveFacetsCount', $response); + $this->assertArrayHasKey('genre', $response['facetsDistribution']); + $this->assertTrue($response['exhaustiveFacetsCount']); + $this->assertSame($response['facetsDistribution']['genre']['fantasy'], 1); + $this->assertSame($response['facetsDistribution']['genre']['adventure'], 1); + $this->assertSame($response['facetsDistribution']['genre']['romance'], 0); + } + + public function testBasicSearchWithFacetFilters(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search('prince', [ + 'facetFilters' => [['genre:fantasy']], + ]); + $this->assertSame(1, $response->getHitsCount()); + $this->assertArrayNotHasKey('facetsDistribution', $response->getRaw()); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response->getRaw()); + $this->assertSame(4, $response->getHit(0)['id']); + + $response = $this->index->search('prince', [ + 'facetFilters' => [['genre:fantasy']], + ], [ + 'raw' => true, + ]); + $this->assertSame(1, $response['nbHits']); + $this->assertArrayNotHasKey('facetsDistribution', $response); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response); + $this->assertSame(4, $response['hits'][0]['id']); + } + + public function testBasicSearchWithMultipleFacetFilters(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search('prince', [ + 'facetFilters' => ['genre:fantasy', ['genre:fantasy', 'genre:fantasy']], + ]); + $this->assertSame(1, $response->getHitsCount()); + $this->assertArrayNotHasKey('facetsDistribution', $response->getRaw()); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response->getRaw()); + $this->assertSame(4, $response->getHit(0)['id']); + + $response = $this->index->search('prince', [ + 'facetFilters' => ['genre:fantasy', ['genre:fantasy', 'genre:fantasy']], + ], [ + 'raw' => true, + ]); + $this->assertSame(1, $response['nbHits']); + $this->assertArrayNotHasKey('facetsDistribution', $response); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response); + $this->assertSame(4, $response['hits'][0]['id']); + } + + public function testCustomSearchWithFacetFiltersAndAttributesToRetrieve(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search('prince', [ + 'facetFilters' => [['genre:fantasy']], + 'attributesToRetrieve' => ['id', 'title'], + ]); + $this->assertSame(1, $response->getHitsCount()); + $this->assertArrayNotHasKey('facetsDistribution', $response->getRaw()); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response->getRaw()); + $this->assertSame(4, $response->getHit(0)['id']); + $this->assertArrayHasKey('id', $response->getHit(0)); + $this->assertArrayHasKey('title', $response->getHit(0)); + $this->assertArrayNotHasKey('comment', $response->getHit(0)); + + $response = $this->index->search('prince', [ + 'facetFilters' => [['genre:fantasy']], + 'attributesToRetrieve' => ['id', 'title'], + ], [ + 'raw' => true, + ]); + $this->assertSame(1, $response['nbHits']); + $this->assertArrayNotHasKey('facetsDistribution', $response); + $this->assertArrayNotHasKey('exhaustiveFacetsCount', $response); + $this->assertSame(4, $response['hits'][0]['id']); + $this->assertArrayHasKey('id', $response['hits'][0]); + $this->assertArrayHasKey('title', $response['hits'][0]); + $this->assertArrayNotHasKey('comment', $response['hits'][0]); + } + + public function testBasicSerachWithRawSearch(): void + { + $response = $this->index->rawSearch('prince'); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(2, $response['nbHits']); + $this->assertCount(2, $response['hits']); + $this->assertEquals('Le Petit Prince', $response['hits'][0]['title']); + } + + public function testBasicSearchWithRawOption(): void + { + $response = $this->index->search('prince', [], ['raw' => true]); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(2, $response['nbHits']); + $this->assertCount(2, $response['hits']); + } + + public function testBasicSearchWithTransformHitsOptionToFilter(): void + { + $keepLePetitPrinceFunc = function (array $hits) { + return array_filter( + $hits, + function (array $hit) { return 'Le Petit Prince' === $hit['title']; } + ); + }; + + $response = $this->index->search('prince', [], $options = ['transformHits' => $keepLePetitPrinceFunc]); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertSame('Le Petit Prince', $response->getHit(0)['title']); + $this->assertSame(2, $response->getNbHits()); + $this->assertSame(1, $response->getHitsCount()); + $this->assertSame(1, $response->count()); + } + + public function testBasicSearchWithTransformHitsOptionToMap(): void + { + $titlesToUpperCaseFunc = function (array $hits) { + return array_map( + function (array $hit) { + $hit['title'] = strtoupper($hit['title']); + + return $hit; + }, + $hits + ); + }; + + $response = $this->index->search('prince', [], ['transformHits' => $titlesToUpperCaseFunc]); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertSame(2, $response->getNbHits()); + $this->assertSame(2, $response->getHitsCount()); + $this->assertCount(2, $response->getHits()); + $this->assertSame('LE PETIT PRINCE', $response->getHits()[0]['title']); + } + + public function testBasicSearchCannotBeFilteredOnRawResult(): void + { + $keepLePetitPrinceFunc = function (array $hits) { + return array_filter( + $hits, + function (array $hit) { return 'Le Petit Prince' === $hit['title']; } + ); + }; + + $response = $this->index->search('prince', [], [ + 'raw' => true, + 'transformHits' => $keepLePetitPrinceFunc, + ]); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(2, $response['nbHits']); + $this->assertCount(2, $response['hits']); + } + + public function testBasicSearchCanBeFilteredOnRawResultIfUsingToArray(): void + { + $keepLePetitPrinceFunc = function (array $hits) { + return array_filter( + $hits, + function (array $hit) { return 'Le Petit Prince' === $hit['title']; } + ); + }; + + $response = $this->index->search('prince', [], ['transformHits' => $keepLePetitPrinceFunc])->toArray(); + + $this->assertArrayHasKey('hits', $response); + $this->assertArrayHasKey('offset', $response); + $this->assertArrayHasKey('limit', $response); + $this->assertArrayHasKey('processingTimeMs', $response); + $this->assertArrayHasKey('query', $response); + $this->assertSame(2, $response['nbHits']); + $this->assertCount(1, $response['hits']); + $this->assertEquals('Le Petit Prince', $response['hits'][0]['title']); + } + + public function testBasicSearchWithRemoveZeroFacetsOption(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search( + 'prince', + ['facetsDistribution' => ['genre']], + ['removeZeroFacets' => true] + ); + + $this->assertCount(2, $response->getFacetsDistribution()['genre']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['adventure']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['fantasy']); + $this->assertCount(3, $response->getRaw()['facetsDistribution']['genre']); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + } + + public function testBasicSearchWithRemoveZeroFacetsOptionAndMultipleFacets(): void + { + $response = $this->index->addDocuments([['id' => 32, 'title' => 'The Witcher', 'genre' => 'adventure', 'adaptation' => 'video game']]); + $this->index->waitForPendingUpdate($response['updateId']); + $response = $this->index->updateAttributesForFaceting(['genre', 'adaptation']); + $this->index->waitForPendingUpdate($response['updateId']); + + $response = $this->index->search( + 'prince', + ['facetsDistribution' => ['genre', 'adaptation']], + ['removeZeroFacets' => true] + ); + + $this->assertCount(2, $response->getFacetsDistribution()['genre']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['adventure']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['fantasy']); + $this->assertEquals([], $response->getFacetsDistribution()['adaptation']); + $this->assertCount(1, $response->getRaw()['facetsDistribution']['adaptation']); + $this->assertCount(3, $response->getRaw()['facetsDistribution']['genre']); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + } + + public function testBasicSearchWithTransformFacetsDritributionOptionToFilter(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $filterAllFacets = function (array $facets) { + $filterOneFacet = function (array $facet) { + return array_filter( + $facet, + function ($v, $k) { return $v > 1; }, + ARRAY_FILTER_USE_BOTH + ); + }; + + return array_map($filterOneFacet, $facets); + }; + + $response = $this->index->search( + null, + ['facetsDistribution' => ['genre']], + ['transformFacetsDistribution' => $filterAllFacets] + ); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('facetsDistribution', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + $this->assertCount(3, $response->getRaw()['facetsDistribution']['genre']); + $this->assertCount(2, $response->getFacetsDistribution()['genre']); + $this->assertEquals(3, $response->getFacetsDistribution()['genre']['romance']); + $this->assertEquals(2, $response->getFacetsDistribution()['genre']['fantasy']); + } + + public function testBasicSearchWithTransformFacetsDritributionOptionToMap(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $facetsToUpperFunc = function (array $facets) { + $changeOneFacet = function (array $facet) { + $result = []; + foreach ($facet as $k => $v) { + $result[strtoupper($k)] = $v; + } + + return $result; + }; + + return array_map($changeOneFacet, $facets); + }; + + $response = $this->index->search( + null, + ['facetsDistribution' => ['genre']], + ['transformFacetsDistribution' => $facetsToUpperFunc] + ); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('facetsDistribution', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + $this->assertCount(3, $response->getFacetsDistribution()['genre']); + $this->assertEquals(3, $response->getFacetsDistribution()['genre']['ROMANCE']); + $this->assertEquals(2, $response->getFacetsDistribution()['genre']['FANTASY']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['ADVENTURE']); + } + + public function testBasicSearchWithTransformFacetsDritributionOptionToOder(): void + { + $response = $this->index->updateAttributesForFaceting(['genre']); + $this->index->waitForPendingUpdate($response['updateId']); + + $facetsToUpperFunc = function (array $facets) { + $sortOneFacet = function (array $facet) { + ksort($facet); + + return $facet; + }; + + return array_map($sortOneFacet, $facets); + }; + + $response = $this->index->search( + null, + ['facetsDistribution' => ['genre']], + ['transformFacetsDistribution' => $facetsToUpperFunc] + ); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('facetsDistribution', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertEquals('adventure', array_key_first($response->getFacetsDistribution()['genre'])); + $this->assertEquals('romance', array_key_last($response->getFacetsDistribution()['genre'])); + $this->assertCount(3, $response->getFacetsDistribution()['genre']); + $this->assertEquals(3, $response->getFacetsDistribution()['genre']['romance']); + $this->assertEquals(2, $response->getFacetsDistribution()['genre']['fantasy']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['adventure']); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Endpoints/UpdatesTest.php b/vendor/meilisearch/meilisearch-php/tests/Endpoints/UpdatesTest.php new file mode 100644 index 000000000..497bc66b1 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Endpoints/UpdatesTest.php @@ -0,0 +1,63 @@ +index = $this->client->createIndex('index'); + } + + public function testGetOneUpdate(): void + { + [$promise, $response] = $this->seedIndex(); + + $this->assertIsArray($response); + $this->assertSame($response['status'], 'processed'); + $this->assertSame($response['updateId'], $promise['updateId']); + $this->assertArrayHasKey('type', $response); + $this->assertIsArray($response['type']); + $this->assertArrayHasKey('duration', $response); + $this->assertArrayHasKey('enqueuedAt', $response); + $this->assertArrayHasKey('processedAt', $response); + } + + public function testGetAllUpdates(): void + { + $this->seedIndex(); + + $response = $this->index->getAllUpdateStatus(); + + $this->assertCount(1, $response); + $this->assertSame('processed', $response[0]['status']); + $this->assertArrayHasKey('updateId', $response[0]); + $this->assertArrayHasKey('type', $response[0]); + $this->assertIsArray($response[0]['type']); + $this->assertArrayHasKey('duration', $response[0]); + $this->assertArrayHasKey('enqueuedAt', $response[0]); + $this->assertArrayHasKey('processedAt', $response[0]); + } + + public function testExceptionIfNoUpdateIdWhenGetting(): void + { + $this->expectException(ApiException::class); + $this->index->getUpdateStatus(10000); + } + + private function seedIndex(): array + { + $promise = $this->index->updateDocuments(self::DOCUMENTS); + $response = $this->index->waitForPendingUpdate($promise['updateId']); + + return [$promise, $response]; + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Exceptions/ApiExceptionTest.php b/vendor/meilisearch/meilisearch-php/tests/Exceptions/ApiExceptionTest.php new file mode 100644 index 000000000..d84c81132 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Exceptions/ApiExceptionTest.php @@ -0,0 +1,36 @@ + 'This is the message', + 'errorCode' => 'this_is_the_error_code', + 'errorType' => 'this_is_the_error_type', + 'errorLink' => 'https://docs.meilisearch.com/errors', + ]; + $statusCode = 400; + + try { + throw new ApiException($statusCode, $httpBodyExample); + } catch (ApiException $apiException) { + $this->assertEquals($statusCode, $apiException->httpStatus); + $this->assertEquals($httpBodyExample['message'], + $apiException->message); + $this->assertEquals($httpBodyExample['errorCode'], $apiException->errorCode); + $this->assertEquals($httpBodyExample['errorType'], $apiException->errorType); + $this->assertEquals($httpBodyExample['errorLink'], $apiException->errorLink); + + $expectedExceptionToString = "MeiliSearch HTTPRequestException: Http Status: {$statusCode} - Message: {$httpBodyExample['message']} - Error code: {$httpBodyExample['errorCode']} - Error type: {$httpBodyExample['errorType']} - Error link: {$httpBodyExample['errorLink']}"; + $this->assertEquals($expectedExceptionToString, (string) $apiException); + } + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Http/ClientTest.php b/vendor/meilisearch/meilisearch-php/tests/Http/ClientTest.php new file mode 100644 index 000000000..0795aa1b2 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Http/ClientTest.php @@ -0,0 +1,20 @@ +expectException(CommunicationException::class); + $client->createIndex('some_index'); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Search/SearchResultTest.php b/vendor/meilisearch/meilisearch-php/tests/Search/SearchResultTest.php new file mode 100644 index 000000000..c93ccb57e --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Search/SearchResultTest.php @@ -0,0 +1,227 @@ +basicServerResponse = [ + 'hits' => [ + [ + 'id' => '1', + 'title' => 'American Pie 2', + 'poster' => 'https://image.tmdb.org/t/p/w1280/q4LNgUnRfltxzp3gf1MAGiK5LhV.jpg', + 'overview' => 'The whole gang are back and as close as ever. They decide to get even closer by spending the summer together at a beach house. They decide to hold the biggest...', + 'release_date' => 997405200, + ], + [ + 'id' => '190859', + 'title' => 'American Sniper', + 'poster' => 'https://image.tmdb.org/t/p/w1280/svPHnYE7N5NAGO49dBmRhq0vDQ3.jpg', + 'overview' => 'U.S. Navy SEAL Chris Kyle takes his sole mission—protect his comrades—to heart and becomes one of the most lethal snipers in American history. His pinpoint accuracy not only saves countless lives but also makes him a prime...', + 'release_date' => 1418256000, + ], + ], + 'offset' => 0, + 'limit' => 20, + 'nbHits' => 976, + 'exhaustiveNbHits' => false, + 'processingTimeMs' => 35, + 'query' => 'american', + ]; + $this->basicResult = new SearchResult($this->basicServerResponse); + $this->serverResponseWithFacets = [ + 'hits' => [ + [ + 'genre' => 'adventure', + 'id' => 456, + 'title' => 'Le Petit Prince', + 'author' => 'Antoine de Saint-Exupéry', + ], + [ + 'genre' => 'fantasy', + 'id' => 4, + 'title' => 'Harry Potter and the Half-Blood Prince', + 'author' => 'J. K. Rowling', + ], + ], + 'offset' => 0, + 'limit' => 20, + 'nbHits' => 2, + 'exhaustiveNbHits' => false, + 'processingTimeMs' => 1, + 'query' => 'prinec', + 'facetsDistribution' => [ + 'genre' => [ + 'fantasy' => 1, + 'romance' => 0, + 'adventure' => 1, + ], + ], + 'exhaustiveFacetsCount' => true, + ]; + $this->resultWithFacets = new SearchResult($this->serverResponseWithFacets); + } + + public function testResultCanBeBuilt(): void + { + $this->assertSame(2, $this->basicResult->count()); + $this->assertNotEmpty($this->basicResult->getHits()); + + $this->assertEquals([ + 'id' => '1', + 'title' => 'American Pie 2', + 'poster' => 'https://image.tmdb.org/t/p/w1280/q4LNgUnRfltxzp3gf1MAGiK5LhV.jpg', + 'overview' => 'The whole gang are back and as close as ever. They decide to get even closer by spending the summer together at a beach house. They decide to hold the biggest...', + 'release_date' => 997405200, + ], $this->basicResult->getHit(0)); + $this->assertEquals([ + 'id' => '190859', + 'title' => 'American Sniper', + 'poster' => 'https://image.tmdb.org/t/p/w1280/svPHnYE7N5NAGO49dBmRhq0vDQ3.jpg', + 'overview' => 'U.S. Navy SEAL Chris Kyle takes his sole mission—protect his comrades—to heart and becomes one of the most lethal snipers in American history. His pinpoint accuracy not only saves countless lives but also makes him a prime...', + 'release_date' => 1418256000, + ], $this->basicResult->getHit(1)); + $this->assertNull($this->basicResult->getHit(2)); + $this->assertSame(0, $this->basicResult->getOffset()); + $this->assertSame(20, $this->basicResult->getLimit()); + $this->assertSame(2, $this->basicResult->getHitsCount()); + $this->assertSame(976, $this->basicResult->getNbHits()); + $this->assertFalse($this->basicResult->getExhaustiveNbHits()); + $this->assertSame(35, $this->basicResult->getProcessingTimeMs()); + $this->assertSame('american', $this->basicResult->getQuery()); + $this->assertNull($this->basicResult->getExhaustiveFacetsCount()); + $this->assertEmpty($this->basicResult->getFacetsDistribution()); + $this->assertSame(2, $this->basicResult->getIterator()->count()); + + $this->assertArrayHasKey('hits', $this->basicResult->toArray()); + $this->assertArrayHasKey('offset', $this->basicResult->toArray()); + $this->assertArrayHasKey('limit', $this->basicResult->toArray()); + $this->assertArrayHasKey('nbHits', $this->basicResult->toArray()); + $this->assertArrayHasKey('hitsCount', $this->basicResult->toArray()); + $this->assertArrayHasKey('exhaustiveNbHits', $this->basicResult->toArray()); + $this->assertArrayHasKey('processingTimeMs', $this->basicResult->toArray()); + $this->assertArrayHasKey('query', $this->basicResult->toArray()); + $this->assertArrayHasKey('exhaustiveFacetsCount', $this->basicResult->toArray()); + $this->assertArrayHasKey('facetsDistribution', $this->basicResult->toArray()); + } + + public function testSearchResultCanBeFiltered(): void + { + $keepAmericanSniperFunc = function (array $hits) { + return array_filter( + $hits, + function (array $hit) { return 'American Sniper' === $hit['title']; } + ); + }; + + $options = ['transformHits' => $keepAmericanSniperFunc]; + + $filteredResults = $this->basicResult->applyOptions($options); + + $this->assertSame(1, $filteredResults->count()); + $this->assertSame(1, $filteredResults->getHitsCount()); + $this->assertSame(976, $filteredResults->getNbHits()); + $this->assertEquals([ + 'id' => '190859', + 'title' => 'American Sniper', + 'poster' => 'https://image.tmdb.org/t/p/w1280/svPHnYE7N5NAGO49dBmRhq0vDQ3.jpg', + 'overview' => 'U.S. Navy SEAL Chris Kyle takes his sole mission—protect his comrades—to heart and becomes one of the most lethal snipers in American history. His pinpoint accuracy not only saves countless lives but also makes him a prime...', + 'release_date' => 1418256000, + ], $filteredResults->getHit(1)); // Not getHits(0) because array_filter() does not reorder the indexes after filtering. + } + + public function testResultCanBeReturnedAsJson(): void + { + $json = $this->basicResult->toJSON(); + + $this->assertStringContainsString('hits', $json); + $this->assertStringContainsString('offset', $json); + $this->assertStringContainsString('limit', $json); + $this->assertStringContainsString('hitsCount', $json); + $this->assertStringContainsString('nbHits', $json); + $this->assertStringContainsString('exhaustiveNbHits', $json); + $this->assertStringContainsString('processingTimeMs', $json); + $this->assertStringContainsString('query', $json); + $this->assertStringContainsString('exhaustiveFacetsCount', $json); + $this->assertStringContainsString('facetsDistribution', $json); + } + + public function testGetRaw(): void + { + $this->assertEquals($this->basicServerResponse, $this->basicResult->getRaw()); + } + + public function testTransformHitsMethod(): void + { + $keepAmericanSniperFunc = function (array $hits) { + return array_filter( + $hits, + function (array $hit) { return 'American Sniper' === $hit['title']; } + ); + }; + + $response = $this->basicResult->transformHits($keepAmericanSniperFunc); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertSame('American Sniper', $response->getHit(1)['title']); // Not getHits(0) because array_filter() does not reorder the indexes after filtering. + $this->assertSame(976, $response->getNbHits()); + $this->assertSame(1, $response->getHitsCount()); + $this->assertSame(1, $response->count()); + } + + public function testTransformFacetsDritributionMethod(): void + { + $facetsToUpperFunc = function (array $facets) { + $changeOneFacet = function (array $facet) { + $result = []; + foreach ($facet as $k => $v) { + $result[strtoupper($k)] = $v; + } + + return $result; + }; + + return array_map($changeOneFacet, $facets); + }; + + $response = $this->resultWithFacets->transformFacetsDistribution($facetsToUpperFunc); + + $this->assertArrayHasKey('hits', $response->toArray()); + $this->assertArrayHasKey('facetsDistribution', $response->toArray()); + $this->assertArrayHasKey('offset', $response->toArray()); + $this->assertArrayHasKey('limit', $response->toArray()); + $this->assertArrayHasKey('processingTimeMs', $response->toArray()); + $this->assertArrayHasKey('query', $response->toArray()); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + $this->assertCount(3, $response->getFacetsDistribution()['genre']); + $this->assertEquals(0, $response->getFacetsDistribution()['genre']['ROMANCE']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['FANTASY']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['ADVENTURE']); + } + + public function testRemoveZeroFacetsMethod(): void + { + $response = $this->resultWithFacets->removeZeroFacets(); + + $this->assertCount(2, $response->getFacetsDistribution()['genre']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['adventure']); + $this->assertEquals(1, $response->getFacetsDistribution()['genre']['fantasy']); + $this->assertCount(3, $response->getRaw()['facetsDistribution']['genre']); + $this->assertEquals($response->getRaw()['hits'], $response->getHits()); + $this->assertNotEquals($response->getRaw()['facetsDistribution'], $response->getFacetsDistribution()); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/AttributesForFacetingTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/AttributesForFacetingTest.php new file mode 100644 index 000000000..54a5a9606 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/AttributesForFacetingTest.php @@ -0,0 +1,55 @@ +client->createIndex('index'); + + $attributes = $index->getAttributesForFaceting(); + + $this->assertIsArray($attributes); + $this->assertEmpty($attributes); + } + + public function testUpdateAttributesForFaceting(): void + { + $newAttributes = ['title']; + $index = $this->client->createIndex('index'); + + $promise = $index->updateAttributesForFaceting($newAttributes); + + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $attributesForFaceting = $index->getAttributesForFaceting(); + + $this->assertIsArray($attributesForFaceting); + $this->assertEquals($newAttributes, $attributesForFaceting); + } + + public function testResetAttributesForFaceting(): void + { + $index = $this->client->createIndex('index'); + $newAttributes = ['title']; + + $promise = $index->updateAttributesForFaceting($newAttributes); + $index->waitForPendingUpdate($promise['updateId']); + + $promise = $index->resetAttributesForFaceting(); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + + $attributesForFaceting = $index->getAttributesForFaceting(); + $this->assertIsArray($attributesForFaceting); + $this->assertEmpty($attributesForFaceting); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/DisplayedAttributesTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/DisplayedAttributesTest.php new file mode 100644 index 000000000..c6d332cad --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/DisplayedAttributesTest.php @@ -0,0 +1,60 @@ +client->createIndex('indexA'); + $indexB = $this->client->createIndex('indexB', ['primaryKey' => 'objectID']); + + $attributesA = $indexA->getDisplayedAttributes(); + $attributesB = $indexB->getDisplayedAttributes(); + + $this->assertIsArray($attributesA); + $this->assertEquals(['*'], $attributesA); + + $this->assertIsArray($attributesB); + $this->assertEquals(['*'], $attributesB); + } + + public function testUpdateDisplayedAttributes(): void + { + $newAttributes = ['title']; + $index = $this->client->createIndex('index'); + + $promise = $index->updateDisplayedAttributes($newAttributes); + + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $displayedAttributes = $index->getDisplayedAttributes(); + + $this->assertIsArray($displayedAttributes); + $this->assertEquals($newAttributes, $displayedAttributes); + } + + public function testResetDisplayedAttributes(): void + { + $index = $this->client->createIndex('index'); + $newAttributes = ['title']; + + $promise = $index->updateDisplayedAttributes($newAttributes); + $index->waitForPendingUpdate($promise['updateId']); + + $promise = $index->resetDisplayedAttributes(); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + + $displayedAttributes = $index->getDisplayedAttributes(); + $this->assertIsArray($displayedAttributes); + $this->assertEquals(['*'], $displayedAttributes); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/DistinctAttributeTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/DistinctAttributeTest.php new file mode 100644 index 000000000..8d1c978cc --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/DistinctAttributeTest.php @@ -0,0 +1,48 @@ +index = $this->client->createIndex('index'); + } + + public function testGetDefaultDistinctAttribute(): void + { + $response = $this->index->getDistinctAttribute(); + $this->assertNull($response); + } + + public function testUpdateDistinctAttribute(): void + { + $distinctAttribute = 'description'; + $promise = $this->index->updateDistinctAttribute($distinctAttribute); + + $this->assertIsValidPromise($promise); + $this->index->waitForPendingUpdate($promise['updateId']); + + $this->assertEquals($distinctAttribute, $this->index->getDistinctAttribute()); + } + + public function testResetDistinctAttribute(): void + { + $distinctAttribute = 'description'; + $promise = $this->index->updateDistinctAttribute($distinctAttribute); + $this->index->waitForPendingUpdate($promise['updateId']); + + $promise = $this->index->resetDistinctAttribute(); + + $this->assertIsValidPromise($promise); + $this->index->waitForPendingUpdate($promise['updateId']); + $this->assertNull($this->index->getDistinctAttribute()); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/RankingRulesTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/RankingRulesTest.php new file mode 100644 index 000000000..6b0570adb --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/RankingRulesTest.php @@ -0,0 +1,67 @@ +index = $this->client->createIndex('index'); + } + + public function testGetDefaultRankingRules(): void + { + $response = $this->index->getRankingRules(); + + $this->assertIsArray($response); + $this->assertEquals(self::DEFAULT_RANKING_RULES, $response); + } + + public function testUpdateRankingRules(): void + { + $newRankingRules = [ + 'asc(title)', + 'typo', + 'desc(description)', + ]; + + $promise = $this->index->updateRankingRules($newRankingRules); + + $this->assertIsValidPromise($promise); + $this->index->waitForPendingUpdate($promise['updateId']); + + $rankingRules = $this->index->getRankingRules(); + + $this->assertIsArray($rankingRules); + $this->assertEquals($newRankingRules, $rankingRules); + } + + public function testResetRankingRules(): void + { + $promise = $this->index->resetRankingRules(); + + $this->assertIsValidPromise($promise); + + $this->index->waitForPendingUpdate($promise['updateId']); + $rankingRules = $this->index->getRankingRules(); + + $this->assertIsArray($rankingRules); + $this->assertEquals(self::DEFAULT_RANKING_RULES, $rankingRules); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/SearchableAttributesTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/SearchableAttributesTest.php new file mode 100644 index 000000000..b3d7ec5d1 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/SearchableAttributesTest.php @@ -0,0 +1,57 @@ +client->createIndex('indexA'); + $indexB = $this->client->createIndex('indexB', ['primaryKey' => 'objectID']); + + $searchableAttributesA = $indexA->getSearchableAttributes(); + $searchableAttributesB = $indexB->getSearchableAttributes(); + + $this->assertIsArray($searchableAttributesA); + $this->assertEquals(['*'], $searchableAttributesA); + $this->assertIsArray($searchableAttributesB); + $this->assertEquals(['*'], $searchableAttributesB); + } + + public function testUpdateSearchableAttributes(): void + { + $indexA = $this->client->createIndex('indexA'); + $searchableAttributes = [ + 'title', + 'description', + ]; + + $promise = $indexA->updateSearchableAttributes($searchableAttributes); + + $this->assertIsValidPromise($promise); + + $indexA->waitForPendingUpdate($promise['updateId']); + $updatedAttributes = $indexA->getSearchableAttributes(); + + $this->assertIsArray($updatedAttributes); + $this->assertEquals($searchableAttributes, $updatedAttributes); + } + + public function testResetSearchableAttributes(): void + { + $index = $this->client->createIndex('indexA'); + $promise = $index->resetSearchableAttributes(); + + $this->assertIsValidPromise($promise); + + $index->waitForPendingUpdate($promise['updateId']); + $searchableAttributes = $index->getSearchableAttributes(); + + $this->assertIsArray($searchableAttributes); + $this->assertEquals(['*'], $searchableAttributes); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/SettingsTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/SettingsTest.php new file mode 100644 index 000000000..6d47b6fee --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/SettingsTest.php @@ -0,0 +1,140 @@ +client + ->createIndex('indexA') + ->getSettings(); + $settingB = $this->client + ->createIndex( + 'indexB', + ['primaryKey' => $primaryKey] + )->getSettings(); + + $this->assertEquals(self::DEFAULT_RANKING_RULES, $settingA['rankingRules']); + $this->assertNull($settingA['distinctAttribute']); + $this->assertIsArray($settingA['searchableAttributes']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settingA['searchableAttributes']); + $this->assertIsArray($settingA['displayedAttributes']); + $this->assertEquals(self::DEFAULT_DISPLAYED_ATTRIBUTES, $settingA['displayedAttributes']); + $this->assertIsArray($settingA['stopWords']); + $this->assertEmpty($settingA['stopWords']); + $this->assertIsArray($settingA['synonyms']); + $this->assertEmpty($settingA['synonyms']); + + $this->assertEquals(self::DEFAULT_RANKING_RULES, $settingB['rankingRules']); + $this->assertNull($settingB['distinctAttribute']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settingB['searchableAttributes']); + $this->assertEquals(self::DEFAULT_DISPLAYED_ATTRIBUTES, $settingB['displayedAttributes']); + $this->assertIsArray($settingB['stopWords']); + $this->assertEmpty($settingB['stopWords']); + $this->assertIsArray($settingB['synonyms']); + $this->assertEmpty($settingB['synonyms']); + } + + public function testUpdateSettings(): void + { + $index = $this->client->createIndex('index'); + $promise = $index->updateSettings([ + 'distinctAttribute' => 'title', + 'rankingRules' => ['asc(title)', 'typo'], + 'stopWords' => ['the'], + ]); + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $settings = $index->getSettings(); + + $this->assertEquals(['asc(title)', 'typo'], $settings['rankingRules']); + $this->assertEquals('title', $settings['distinctAttribute']); + $this->assertIsArray($settings['searchableAttributes']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settings['searchableAttributes']); + $this->assertIsArray($settings['displayedAttributes']); + $this->assertEquals(self::DEFAULT_DISPLAYED_ATTRIBUTES, $settings['displayedAttributes']); + $this->assertEquals(['the'], $settings['stopWords']); + $this->assertIsArray($settings['synonyms']); + $this->assertEmpty($settings['synonyms']); + } + + public function testUpdateSettingsWithoutOverwritingThem(): void + { + $index = $this->client->createIndex('index'); + $promise = $index->updateSettings([ + 'distinctAttribute' => 'title', + 'rankingRules' => ['asc(title)', 'typo'], + 'stopWords' => ['the'], + ]); + + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $promise = $index->updateSettings([ + 'searchableAttributes' => ['title'], + ]); + + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $settings = $index->getSettings(); + + $this->assertEquals(['asc(title)', 'typo'], $settings['rankingRules']); + $this->assertEquals('title', $settings['distinctAttribute']); + $this->assertEquals(['title'], $settings['searchableAttributes']); + $this->assertIsArray($settings['displayedAttributes']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settings['displayedAttributes']); + $this->assertEquals(['the'], $settings['stopWords']); + $this->assertIsArray($settings['synonyms']); + $this->assertEmpty($settings['synonyms']); + } + + public function testResetSettings(): void + { + $index = $this->client->createIndex('index'); + $promise = $index->updateSettings([ + 'distinctAttribute' => 'title', + 'rankingRules' => ['asc(title)', 'typo'], + 'stopWords' => ['the'], + ]); + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $promise = $index->resetSettings(); + + $this->assertIsValidPromise($promise); + $index->waitForPendingUpdate($promise['updateId']); + + $settings = $index->getSettings(); + + $this->assertEquals(self::DEFAULT_RANKING_RULES, $settings['rankingRules']); + $this->assertNull($settings['distinctAttribute']); + $this->assertIsArray($settings['searchableAttributes']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settings['searchableAttributes']); + $this->assertIsArray($settings['displayedAttributes']); + $this->assertEquals(self::DEFAULT_SEARCHABLE_ATTRIBUTES, $settings['displayedAttributes']); + $this->assertIsArray($settings['stopWords']); + $this->assertEmpty($settings['stopWords']); + $this->assertIsArray($settings['synonyms']); + $this->assertEmpty($settings['synonyms']); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/StopWordsTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/StopWordsTest.php new file mode 100644 index 000000000..6b6c15c72 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/StopWordsTest.php @@ -0,0 +1,56 @@ +index = $this->client->createIndex('index'); + } + + public function testGetDefaultStopWords(): void + { + $response = $this->index->getStopWords(); + + $this->assertIsArray($response); + $this->assertEmpty($response); + } + + public function testUpdateStopWords(): void + { + $newStopWords = ['the']; + $promise = $this->index->updateStopWords($newStopWords); + + $this->assertIsValidPromise($promise); + + $this->index->waitForPendingUpdate($promise['updateId']); + $stopWords = $this->index->getStopWords(); + + $this->assertIsArray($stopWords); + $this->assertEquals($newStopWords, $stopWords); + } + + public function testResetStopWords(): void + { + $promise = $this->index->updateStopWords(['the']); + $this->index->waitForPendingUpdate($promise['updateId']); + + $promise = $this->index->resetStopWords(); + + $this->assertIsValidPromise($promise); + $this->index->waitForPendingUpdate($promise['updateId']); + + $topWords = $this->index->getStopWords(); + + $this->assertIsArray($topWords); + $this->assertEmpty($topWords); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/Settings/SynonymsTest.php b/vendor/meilisearch/meilisearch-php/tests/Settings/SynonymsTest.php new file mode 100644 index 000000000..22ae550c9 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/Settings/SynonymsTest.php @@ -0,0 +1,59 @@ +index = $this->client->createIndex('index'); + } + + public function testGetDefaultSynonyms(): void + { + $response = $this->index->getSynonyms(); + + $this->assertIsArray($response); + $this->assertEmpty($response); + } + + public function testUpdateSynonyms(): void + { + $newSynonyms = [ + 'hp' => ['harry potter'], + ]; + $promise = $this->index->updateSynonyms($newSynonyms); + + $this->assertIsValidPromise($promise); + + $this->index->waitForPendingUpdate($promise['updateId']); + $synonyms = $this->index->getSynonyms(); + + $this->assertIsArray($synonyms); + $this->assertEquals($newSynonyms, $synonyms); + } + + public function testResetSynonyms(): void + { + $promise = $this->index->updateSynonyms([ + 'hp' => ['harry potter'], + ]); + $this->index->waitForPendingUpdate($promise['updateId']); + $promise = $this->index->resetSynonyms(); + + $this->assertIsValidPromise($promise); + + $this->index->waitForPendingUpdate($promise['updateId']); + $synonyms = $this->index->getSynonyms(); + + $this->assertIsArray($synonyms); + $this->assertEmpty($synonyms); + } +} diff --git a/vendor/meilisearch/meilisearch-php/tests/TestCase.php b/vendor/meilisearch/meilisearch-php/tests/TestCase.php new file mode 100644 index 000000000..3e268e566 --- /dev/null +++ b/vendor/meilisearch/meilisearch-php/tests/TestCase.php @@ -0,0 +1,47 @@ + 123, 'title' => 'Pride and Prejudice', 'comment' => 'A great book', 'genre' => 'romance'], + ['id' => 456, 'title' => 'Le Petit Prince', 'comment' => 'A french book', 'genre' => 'adventure'], + ['id' => 2, 'title' => 'Le Rouge et le Noir', 'comment' => 'Another french book', 'genre' => 'romance'], + ['id' => 1, 'title' => 'Alice In Wonderland', 'comment' => 'A weird book', 'genre' => 'fantasy'], + ['id' => 1344, 'title' => 'The Hobbit', 'comment' => 'An awesome book', 'genre' => 'romance'], + ['id' => 4, 'title' => 'Harry Potter and the Half-Blood Prince', 'comment' => 'The best book', 'genre' => 'fantasy'], + ['id' => 42, 'title' => 'The Hitchhiker\'s Guide to the Galaxy'], + ]; + + protected const HOST = 'http://localhost:7700'; + + protected const DEFAULT_KEY = 'masterKey'; + + /** + * @var Client + */ + protected $client; + + protected function setUp(): void + { + parent::setUp(); + $this->client = new Client(self::HOST, self::DEFAULT_KEY); + } + + protected function tearDown(): void + { + $this->client->deleteAllIndexes(); + } + + public function assertIsValidPromise(array $promise): void + { + $this->assertIsArray($promise); + $this->assertArrayHasKey('updateId', $promise); + } +} diff --git a/vendor/mockery/mockery/.phpstorm.meta.php b/vendor/mockery/mockery/.phpstorm.meta.php index 6c53f80cd..bb7acee5a 100644 --- a/vendor/mockery/mockery/.phpstorm.meta.php +++ b/vendor/mockery/mockery/.phpstorm.meta.php @@ -2,10 +2,10 @@ namespace PHPSTORM_META; -override(\Mockery::mock(0), type(0)); -override(\Mockery::spy(0), type(0)); -override(\Mockery::namedMock(0), type(0)); -override(\Mockery::instanceMock(0), type(0)); -override(\mock(0), type(0)); -override(\spy(0), type(0)); -override(\namedMock(0), type(0)); \ No newline at end of file +override(\Mockery::mock(0), map(["" => "@"])); +override(\Mockery::spy(0), map(["" => "@"])); +override(\Mockery::namedMock(0), map(["" => "@"])); +override(\Mockery::instanceMock(0), map(["" => "@"])); +override(\mock(0), map(["" => "@"])); +override(\spy(0), map(["" => "@"])); +override(\namedMock(0), map(["" => "@"])); \ No newline at end of file diff --git a/vendor/mockery/mockery/CHANGELOG.md b/vendor/mockery/mockery/CHANGELOG.md index 81f229625..937460e9b 100644 --- a/vendor/mockery/mockery/CHANGELOG.md +++ b/vendor/mockery/mockery/CHANGELOG.md @@ -3,17 +3,65 @@ ## 1.3.6 (2022-09-07) * PHP 8.2 | Fix "Use of "parent" in callables is deprecated" notice #1169 +## 1.5.1 (2022-09-07) + +* [PHP 8.2] Various tests: explicitly declare properties #1170 +* [PHP 8.2] Fix "Use of "parent" in callables is deprecated" notice #1169 +* [PHP 8.1] Support intersection types #1164 +* Handle final `__toString` methods #1162 + +## 1.5.0 (2022-01-20) + +* Override default call count expectations via expects() #1146 +* Mock methods with static return types #1157 +* Mock methods with mixed return type #1156 +* Mock classes with new in initializers on PHP 8.1 #1160 +* Removes redundant PHPUnitConstraint #1158 + +## 1.4.4 (2021-09-13) + +* Fixes auto-generated return values #1144 +* Adds support for tentative types #1130 +* Fixes for PHP 8.1 Support (#1130 and #1140) +* Add method that allows defining a set of arguments the mock should yield #1133 +* Added option to configure default matchers for objects `\Mockery::getConfiguration()->setDefaultMatcher($class, $matcherClass)` #1120 + ## 1.3.5 (2021-09-13) * Fix auto-generated return values with union types #1143 * Adds support for tentative types #1130 * Fixes for PHP 8.1 Support (#1130 and #1140) +* Add method that allows defining a set of arguments the mock should yield #1133 +* Added option to configure default matchers for objects `\Mockery::getConfiguration()->setDefaultMatcher($class, $matcherClass)` #1120 + +## 1.4.3 (2021-02-24) + +* Fixes calls to fetchMock before initialisation #1113 +* Allow shouldIgnoreMissing() to behave in a recursive fashion #1097 +* Custom object formatters #766 (Needs Docs) +* Fix crash on a union type including null #1106 ## 1.3.4 (2021-02-24) * Fixes calls to fetchMock before initialisation #1113 * Fix crash on a union type including null #1106 +## 1.4.2 (2020-08-11) + +* Fix array to string conversion in ConstantsPass (#1086) +* Fixed nullable PHP 8.0 union types (#1088, #1089) +* Fixed support for PHP 8.0 parent type (#1088, #1089) +* Fixed PHP 8.0 mixed type support (#1088, #1089) +* Fixed PHP 8.0 union return types (#1088, #1089) + +## 1.4.1 (2020-07-09) + +* Allow quick definitions to use 'at least once' expectation + `\Mockery::getConfiguration()->getQuickDefinitions()->shouldBeCalledAtLeastOnce(true)` (#1056) +* Added provisional support for PHP 8.0 (#1068, #1072,#1079) +* Fix mocking methods with iterable return type without specifying a return value (#1075) + ## 1.3.3 (2020-08-11) + * Fix array to string conversion in ConstantsPass (#1086) * Fixed nullable PHP 8.0 union types (#1088) * Fixed support for PHP 8.0 parent type (#1088) @@ -21,12 +69,20 @@ * Fixed PHP 8.0 union return types (#1088) ## 1.3.2 (2020-07-09) + * Fix mocking with anonymous classes (#1039) * Fix andAnyOthers() to properly match earlier expectations (#1051) * Added provisional support for PHP 8.0 (#1068, #1072,#1079) * Fix mocking methods with iterable return type without specifying a return value (#1075) +## 1.4.0 (2020-05-19) + +* Fix mocking with anonymous classes (#1039) +* Fix andAnyOthers() to properly match earlier expectations (#1051) +* Drops support for PHP < 7.3 and PHPUnit < 8 (#1059) + ## 1.3.1 (2019-12-26) + * Revert improved exception debugging due to BC breaks (#1032) ## 1.3.0 (2019-11-24) diff --git a/vendor/mockery/mockery/README.md b/vendor/mockery/mockery/README.md index 491742d69..55771dfbb 100644 --- a/vendor/mockery/mockery/README.md +++ b/vendor/mockery/mockery/README.md @@ -1,7 +1,7 @@ Mockery ======= -[![Build Status](https://github.com/mockery/mockery/workflows/tests/badge.svg)](https://github.com/mockery/mockery/actions) +[![Build Status](https://github.com/mockery/mockery/actions/workflows/tests.yml/badge.svg)](https://github.com/mockery/mockery/actions) [![Latest Stable Version](https://poser.pugx.org/mockery/mockery/v/stable.svg)](https://packagist.org/packages/mockery/mockery) [![Total Downloads](https://poser.pugx.org/mockery/mockery/downloads.svg)](https://packagist.org/packages/mockery/mockery) @@ -33,6 +33,14 @@ to learn how to use Mockery. The current version can be seen at [docs.mockery.io](http://docs.mockery.io). +## PHPUnit Integration + +Mockery ships with some helpers if you are using PHPUnit. You can extend the +[`Mockery\Adapter\Phpunit\MockeryTestCase`](library/Mockery/Adapter/Phpunit/MockeryTestCase.php) +class instead of `PHPUnit\Framework\TestCase`, or if you are already using a +custom base class for your tests, take a look at the traits available in the +[`Mockery\Adapter\Phpunit`](library/Mockery/Adapter/Phpunit) namespace. + ## Test Doubles Test doubles (often called mocks) simulate the behaviour of real objects. They are @@ -267,7 +275,7 @@ versioning scheme. ### Alternative Runtimes -Mockery will attempt to continue support HHVM, but will not make any guarantees. +Mockery 1.3 was the last version to support HHVM 3 and PHP 5. There is no support for HHVM 4+. ## A new home for Mockery diff --git a/vendor/mockery/mockery/composer.json b/vendor/mockery/mockery/composer.json index 44ffe5131..43caba8c6 100644 --- a/vendor/mockery/mockery/composer.json +++ b/vendor/mockery/mockery/composer.json @@ -31,12 +31,15 @@ } ], "require": { - "php": ">=5.6.0", + "php": "^7.3 || ^8.0", "lib-pcre": ">=7.0", "hamcrest/hamcrest-php": "^2.0.1" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "^8.5 || ^9.3" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "autoload": { "psr-0": { @@ -53,7 +56,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } } } diff --git a/vendor/mockery/mockery/docs/mockery/configuration.rst b/vendor/mockery/mockery/docs/mockery/configuration.rst index 44cd886bc..007133674 100644 --- a/vendor/mockery/mockery/docs/mockery/configuration.rst +++ b/vendor/mockery/mockery/docs/mockery/configuration.rst @@ -5,13 +5,15 @@ Mockery Global Configuration ============================ To allow for a degree of fine-tuning, Mockery utilises a singleton -configuration object to store a small subset of core behaviours. The two +configuration object to store a small subset of core behaviours. The three currently present include: * Option to allow/disallow the mocking of methods which do not actually exist fulfilled (i.e. unused) * Setter/Getter for added a parameter map for internal PHP class methods (``Reflection`` cannot detect these automatically) +* Option to drive if quick definitions should define a stub or a mock with + an 'at least once' expectation. By default, the first behaviour is enabled. Of course, there are situations where this can lead to unintended consequences. The mocking of @@ -49,6 +51,19 @@ won't correctly add it automatically for internal classes. Note that internal cl parameter overriding is not available in PHP 8. This is because incompatible signatures have been reclassified as fatal errors. +Finally there is the possibility to change what a quick definition produces. +By default quick definitions create stubs but you can change this behaviour +by asking Mockery to use 'at least once' expectations. + +.. code-block:: php + + \Mockery::getConfiguration()->getQuickDefinitions()->shouldBeCalledAtLeastOnce(bool) + +Passing a true allows the behaviour, false disallows it. It takes effect +immediately until switched back. By doing so you can avoid the proliferating of +quick definitions that accumulate overtime in your code since the test would +fail in case the 'at least once' expectation is not fulfilled. + Disabling reflection caching ---------------------------- diff --git a/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst b/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst index 112d6f0a5..5ad58d40e 100644 --- a/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst +++ b/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst @@ -12,7 +12,20 @@ name collision (reported as a PHP fatal error). The methods reserved by Mockery are: * ``shouldReceive()`` -* ``shouldBeStrict()`` +* ``shouldNotReceive()`` +* ``allows()`` +* ``expects()`` +* ``shouldAllowMockingMethod()`` +* ``shouldIgnoreMissing()`` +* ``asUndefined()`` +* ``shouldAllowMockingProtectedMethods()`` +* ``makePartial()`` +* ``byDefault()`` +* ``shouldHaveReceived()`` +* ``shouldHaveBeenCalled()`` +* ``shouldNotHaveReceived()`` +* ``shouldNotHaveBeenCalled()`` + In addition, all mocks utilise a set of added methods and protected properties which cannot exist on the class or object being mocked. These are far less diff --git a/vendor/mockery/mockery/docs/reference/argument_validation.rst b/vendor/mockery/mockery/docs/reference/argument_validation.rst index 622501ad6..9351ce407 100644 --- a/vendor/mockery/mockery/docs/reference/argument_validation.rst +++ b/vendor/mockery/mockery/docs/reference/argument_validation.rst @@ -212,7 +212,7 @@ the ``\Mockery::pattern()``: // Hamcrest equivalent $mock->shouldReceive('foo') - with(matchesPattern('/^foo/')); + ->with(matchesPattern('/^foo/')); The ``ducktype()`` matcher is an alternative to matching by class type: diff --git a/vendor/mockery/mockery/docs/reference/expectations.rst b/vendor/mockery/mockery/docs/reference/expectations.rst index 65cf2a235..608aaef1a 100644 --- a/vendor/mockery/mockery/docs/reference/expectations.rst +++ b/vendor/mockery/mockery/docs/reference/expectations.rst @@ -448,6 +448,34 @@ This is actually identical to using ``atLeast()->times($min)->atMost()->times($m but is provided as a shorthand. It may be followed by a ``times()`` call with no parameter to preserve the APIs natural language readability. +Multiple Calls with Different Expectations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If a method is expected to get called multiple times with different arguments +and/or return values we can simply repeat the expectations. The same of course +also works if we expect multiple calls to different methods. + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + // Expectations for the 1st call + $mock->shouldReceive('name_of_method'); + ->once() + ->with('arg1') + ->andReturn($value1) + + // 2nd call to same method + ->shouldReceive('name_of_method') + ->once() + ->with('arg2') + ->andReturn($value2) + + // final call to another method + ->shouldReceive('other_method') + ->once() + ->with('other') + ->andReturn($value_other); + Expectation Declaration Utilities --------------------------------- diff --git a/vendor/mockery/mockery/docs/reference/final_methods_classes.rst b/vendor/mockery/mockery/docs/reference/final_methods_classes.rst index 3b2c443f7..dd0fa5ba6 100644 --- a/vendor/mockery/mockery/docs/reference/final_methods_classes.rst +++ b/vendor/mockery/mockery/docs/reference/final_methods_classes.rst @@ -9,9 +9,10 @@ classes or methods marked final is hard. The final keyword prevents methods so marked from being replaced in subclasses (subclassing is how mock objects can inherit the type of the class or object being mocked). -The simplest solution is to not mark classes or methods as final! +The simplest solution is to implement an interface in your final class and +typehint against / mock this. -However, in a compromise between mocking functionality and type safety, +However this may not be possible in some third party libraries. Mockery does allow creating "proxy mocks" from classes marked final, or from classes with methods marked final. This offers all the usual mock object goodness but the resulting mock will not inherit the class type of the object diff --git a/vendor/mockery/mockery/docs/reference/phpunit_integration.rst b/vendor/mockery/mockery/docs/reference/phpunit_integration.rst index 7528b5aae..669a8ca9e 100644 --- a/vendor/mockery/mockery/docs/reference/phpunit_integration.rst +++ b/vendor/mockery/mockery/docs/reference/phpunit_integration.rst @@ -114,12 +114,6 @@ Make sure Composer's or Mockery's autoloader is present in the bootstrap file or we will need to also define a "file" attribute pointing to the file of the ``TestListener`` class. -.. caution:: - - The ``TestListener`` will only work for PHPUnit 6+ versions. - - For PHPUnit versions 5 and lower, the test listener does not work. - If we are creating the test suite programmatically we may add the listener like this: diff --git a/vendor/mockery/mockery/docs/reference/spies.rst b/vendor/mockery/mockery/docs/reference/spies.rst index 77f37f3db..9a699cbf9 100644 --- a/vendor/mockery/mockery/docs/reference/spies.rst +++ b/vendor/mockery/mockery/docs/reference/spies.rst @@ -17,7 +17,7 @@ our tests more clear. Spies also allow us to follow the more familiar Arrange-Act-Assert or Given-When-Then style within our tests. With mocks, we have to follow a less familiar style, something along the lines of Arrange-Expect-Act-Assert, where -we have to tell our mocks what to expect before we act on the sut, then assert +we have to tell our mocks what to expect before we act on the SUT, then assert that those expectations where met: .. code-block:: php diff --git a/vendor/mockery/mockery/library/Mockery.php b/vendor/mockery/mockery/library/Mockery.php index e1558163c..95abd1b9d 100644 --- a/vendor/mockery/mockery/library/Mockery.php +++ b/vendor/mockery/mockery/library/Mockery.php @@ -80,24 +80,18 @@ class Mockery */ public static function builtInTypes() { - $builtInTypes = array( - 'self', + return array( 'array', - 'callable', - // Up to php 7 'bool', + 'callable', 'float', 'int', - 'string', 'iterable', + 'object', + 'self', + 'string', 'void', ); - - if (\PHP_VERSION_ID >= 70200) { - $builtInTypes[] = 'object'; - } - - return $builtInTypes; } /** @@ -404,7 +398,7 @@ class Mockery /** * Return instance of CONTAINS matcher. * - * @param array ...$args + * @param mixed $args * * @return \Mockery\Matcher\Contains */ @@ -668,10 +662,22 @@ class Mockery return array('...'); } - return array( - 'class' => get_class($object), - 'properties' => self::extractInstancePublicProperties($object, $nesting) + $defaultFormatter = function ($object, $nesting) { + return array('properties' => self::extractInstancePublicProperties($object, $nesting)); + }; + + $class = get_class($object); + + $formatter = self::getConfiguration()->getObjectFormatter($class, $defaultFormatter); + + $array = array( + 'class' => $class, + 'identity' => '#' . md5(spl_object_hash($object)) ); + + $array = array_merge($array, $formatter($object, $nesting)); + + return $array; } /** @@ -691,7 +697,11 @@ class Mockery foreach ($properties as $publicProperty) { if (!$publicProperty->isStatic()) { $name = $publicProperty->getName(); - $cleanedProperties[$name] = self::cleanupNesting($object->$name, $nesting); + try { + $cleanedProperties[$name] = self::cleanupNesting($object->$name, $nesting); + } catch (\Exception $exception) { + $cleanedProperties[$name] = $exception->getMessage(); + } } } @@ -863,28 +873,26 @@ class Mockery ) { $newMockName = 'demeter_' . md5($parent) . '_' . $method; - if (\PHP_VERSION_ID >= 70000) { - $parRef = null; - $parRefMethod = null; - $parRefMethodRetType = null; + $parRef = null; + $parRefMethod = null; + $parRefMethodRetType = null; - $parentMock = $exp->getMock(); - if ($parentMock !== null) { - $parRef = new ReflectionObject($parentMock); - } + $parentMock = $exp->getMock(); + if ($parentMock !== null) { + $parRef = new ReflectionObject($parentMock); + } - if ($parRef !== null && $parRef->hasMethod($method)) { - $parRefMethod = $parRef->getMethod($method); - $parRefMethodRetType = Reflector::getReturnType($parRefMethod, true); + if ($parRef !== null && $parRef->hasMethod($method)) { + $parRefMethod = $parRef->getMethod($method); + $parRefMethodRetType = Reflector::getReturnType($parRefMethod, true); - if ($parRefMethodRetType !== null) { - $nameBuilder = new MockNameBuilder(); - $nameBuilder->addPart('\\' . $newMockName); - $mock = self::namedMock($nameBuilder->build(), $parRefMethodRetType); - $exp->andReturn($mock); + if ($parRefMethodRetType !== null && $parRefMethodRetType !== 'mixed') { + $nameBuilder = new MockNameBuilder(); + $nameBuilder->addPart('\\' . $newMockName); + $mock = self::namedMock($nameBuilder->build(), $parRefMethodRetType); + $exp->andReturn($mock); - return $mock; - } + return $mock; } } diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV5.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV5.php deleted file mode 100644 index 38d73e02c..000000000 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV5.php +++ /dev/null @@ -1,47 +0,0 @@ -trait = new TestListenerTrait(); - } - - /** - * {@inheritdoc} - */ - public function endTest(\PHPUnit_Framework_Test $test, $time) - { - $this->trait->endTest($test, $time); - } - - /** - * {@inheritdoc} - */ - public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) - { - $this->trait->startTestSuite(); - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php deleted file mode 100644 index 815b13c1a..000000000 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php +++ /dev/null @@ -1,51 +0,0 @@ -trait = new TestListenerTrait(); - } - - /** - * {@inheritdoc} - */ - public function endTest(Test $test, $time) - { - $this->trait->endTest($test, $time); - } - - /** - * {@inheritdoc} - */ - public function startTestSuite(TestSuite $suite) - { - $this->trait->startTestSuite(); - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php deleted file mode 100644 index d590825ab..000000000 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php +++ /dev/null @@ -1,55 +0,0 @@ -trait = new TestListenerTrait(); - } - - - /** - * {@inheritdoc} - */ - public function endTest(Test $test, float $time): void - { - $this->trait->endTest($test, $time); - } - - /** - * {@inheritdoc} - */ - public function startTestSuite(TestSuite $suite): void - { - $this->trait->startTestSuite(); - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php index ec3955f3d..472f6fbcc 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php @@ -22,12 +22,6 @@ namespace Mockery\Adapter\Phpunit; use Mockery; -if (class_exists('PHPUnit_Framework_TestCase') || version_compare(\PHPUnit\Runner\Version::id(), '8.0.0', '<')) { - class_alias(MockeryPHPUnitIntegrationAssertPostConditionsForV7AndPrevious::class, MockeryPHPUnitIntegrationAssertPostConditions::class); -} else { - class_alias(MockeryPHPUnitIntegrationAssertPostConditionsForV8::class, MockeryPHPUnitIntegrationAssertPostConditions::class); -} - /** * Integrates Mockery into PHPUnit. Ensures Mockery expectations are verified * for each test and are included by the assertion counter. diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV8.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditions.php similarity index 93% rename from vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV8.php rename to vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditions.php index cd7889e40..68fc89ef5 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV8.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditions.php @@ -22,7 +22,7 @@ declare(strict_types=1); namespace Mockery\Adapter\Phpunit; -trait MockeryPHPUnitIntegrationAssertPostConditionsForV8 +trait MockeryPHPUnitIntegrationAssertPostConditions { protected function assertPostConditions(): void { diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV7AndPrevious.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV7AndPrevious.php deleted file mode 100644 index 52b7165b1..000000000 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditionsForV7AndPrevious.php +++ /dev/null @@ -1,29 +0,0 @@ -mockeryAssertPostConditions(); - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php index 13189fa5f..f18ce2cfd 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php @@ -20,11 +20,6 @@ namespace Mockery\Adapter\Phpunit; -if (class_exists('PHPUnit_Framework_TestCase') || version_compare(\PHPUnit\Runner\Version::id(), '8.0.0', '<')) { - class_alias(MockeryTestCaseSetUpForV7AndPrevious::class, MockeryTestCaseSetUp::class); -} else { - class_alias(MockeryTestCaseSetUpForV8::class, MockeryTestCaseSetUp::class); -} abstract class MockeryTestCase extends \PHPUnit\Framework\TestCase { use MockeryPHPUnitIntegration; @@ -37,22 +32,4 @@ abstract class MockeryTestCase extends \PHPUnit\Framework\TestCase protected function mockeryTestTearDown() { } - - public function expectExceptionMessageRegEx($regularExpression) - { - if (method_exists(get_parent_class(), 'expectExceptionMessageRegExp')) { - return parent::expectExceptionMessageRegExp($regularExpression); - } - - return $this->expectExceptionMessageMatches($regularExpression); - } - - public static function assertMatchesRegEx($pattern, $string, $message = '') - { - if (method_exists(get_parent_class(), 'assertMatchesRegularExpression')) { - parent::assertMatchesRegularExpression($pattern, $string, $message); - } - - self::assertRegExp($pattern, $string, $message); - } } diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV8.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUp.php similarity index 96% rename from vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV8.php rename to vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUp.php index a2544baa7..e4cc588ee 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV8.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUp.php @@ -22,7 +22,7 @@ declare(strict_types=1); namespace Mockery\Adapter\Phpunit; -trait MockeryTestCaseSetUpForV8 +trait MockeryTestCaseSetUp { protected function setUp(): void { diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV7AndPrevious.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV7AndPrevious.php deleted file mode 100644 index 75b7d347f..000000000 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCaseSetUpForV7AndPrevious.php +++ /dev/null @@ -1,36 +0,0 @@ -mockeryTestSetUp(); - } - - protected function tearDown() - { - $this->mockeryTestTearDown(); - parent::tearDown(); - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php index 180761a1f..effb8e48b 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php @@ -20,16 +20,29 @@ namespace Mockery\Adapter\Phpunit; -if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) { - class_alias('Mockery\Adapter\Phpunit\Legacy\TestListenerForV5', 'Mockery\Adapter\Phpunit\TestListener'); -} elseif (version_compare(\PHPUnit\Runner\Version::id(), '7.0.0', '<')) { - class_alias('Mockery\Adapter\Phpunit\Legacy\TestListenerForV6', 'Mockery\Adapter\Phpunit\TestListener'); -} else { - class_alias('Mockery\Adapter\Phpunit\Legacy\TestListenerForV7', 'Mockery\Adapter\Phpunit\TestListener'); -} +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestListenerDefaultImplementation; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\TestListener as PHPUnitTestListener; -if (false) { - class TestListener +class TestListener implements PHPUnitTestListener +{ + use TestListenerDefaultImplementation; + + private $trait; + + public function __construct() { + $this->trait = new TestListenerTrait(); + } + + public function endTest(Test $test, float $time): void + { + $this->trait->endTest($test, $time); + } + + public function startTestSuite(TestSuite $suite): void + { + $this->trait->startTestSuite(); } } diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListenerTrait.php similarity index 84% rename from vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php rename to vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListenerTrait.php index 72d8633c1..7b5bfe928 100644 --- a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListenerTrait.php @@ -18,15 +18,7 @@ * @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License */ -namespace Mockery\Adapter\Phpunit\Legacy; - -if (class_exists('PHPUnit_Framework_TestCase') && ! class_exists('PHPUnit\Util\Blacklist')) { - class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException'); - class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test'); - class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase'); - class_alias('PHPUnit_Util_Blacklist', 'PHPUnit\Util\Blacklist'); - class_alias('PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner'); -} +namespace Mockery\Adapter\Phpunit; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\Test; diff --git a/vendor/mockery/mockery/library/Mockery/Configuration.php b/vendor/mockery/mockery/library/Mockery/Configuration.php index 60f49a7df..bce05f3c5 100644 --- a/vendor/mockery/mockery/library/Mockery/Configuration.php +++ b/vendor/mockery/mockery/library/Mockery/Configuration.php @@ -40,6 +40,11 @@ class Configuration */ protected $_allowMockingMethodsUnnecessarily = true; + /** + * @var QuickDefinitionsConfiguration + */ + protected $_quickDefinitionsConfiguration; + /** * Parameter map for use with PHP internal classes. * @@ -57,6 +62,25 @@ class Configuration */ protected $_reflectionCacheEnabled = true; + public function __construct() + { + $this->_quickDefinitionsConfiguration = new QuickDefinitionsConfiguration(); + } + + /** + * Custom object formatters + * + * @var array + */ + protected $_objectFormatters = array(); + + /** + * Default argument matchers + * + * @var array + */ + protected $_defaultMatchers = array(); + /** * Set boolean to allow/prevent mocking of non-existent methods * @@ -78,15 +102,15 @@ class Configuration } /** - * @deprecated - * * Set boolean to allow/prevent unnecessary mocking of methods * * @param bool $flag + * + * @deprecated since 1.4.0 */ public function allowMockingMethodsUnnecessarily($flag = true) { - trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); $this->_allowMockingMethodsUnnecessarily = (bool) $flag; } @@ -95,10 +119,12 @@ class Configuration * Return flag indicating whether mocking non-existent methods allowed * * @return bool + * + * @deprecated since 1.4.0 */ public function mockingMethodsUnnecessarilyAllowed() { - trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); return $this->_allowMockingMethodsUnnecessarily; } @@ -158,6 +184,14 @@ class Configuration return $this->_constantsMap; } + /** + * Returns the quick definitions configuration + */ + public function getQuickDefinitions(): QuickDefinitionsConfiguration + { + return $this->_quickDefinitionsConfiguration; + } + /** * Disable reflection caching * @@ -191,4 +225,59 @@ class Configuration { return $this->_reflectionCacheEnabled; } + + public function setObjectFormatter($class, $formatterCallback) + { + $this->_objectFormatters[$class] = $formatterCallback; + } + + public function getObjectFormatter($class, $defaultFormatter) + { + $parentClass = $class; + do { + $classes[] = $parentClass; + $parentClass = get_parent_class($parentClass); + } while ($parentClass); + $classesAndInterfaces = array_merge($classes, class_implements($class)); + foreach ($classesAndInterfaces as $type) { + if (isset($this->_objectFormatters[$type])) { + return $this->_objectFormatters[$type]; + } + } + return $defaultFormatter; + } + + /** + * @param string $class + * @param string $matcherClass + */ + public function setDefaultMatcher($class, $matcherClass) + { + if (!is_a($matcherClass, \Mockery\Matcher\MatcherAbstract::class, true) && + !is_a($matcherClass, \Hamcrest\Matcher::class, true) && + !is_a($matcherClass, \Hamcrest_Matcher::class, true) + ) { + throw new \InvalidArgumentException( + "Matcher class must be either Hamcrest matcher or extend \Mockery\Matcher\MatcherAbstract, " . + "'$matcherClass' given." + ); + } + $this->_defaultMatchers[$class] = $matcherClass; + } + + public function getDefaultMatcher($class) + { + $parentClass = $class; + do { + $classes[] = $parentClass; + $parentClass = get_parent_class($parentClass); + } while ($parentClass); + $classesAndInterfaces = array_merge($classes, class_implements($class)); + foreach ($classesAndInterfaces as $type) { + if (isset($this->_defaultMatchers[$type])) { + return $this->_defaultMatchers[$type]; + } + } + return null; + } } diff --git a/vendor/mockery/mockery/library/Mockery/Container.php b/vendor/mockery/mockery/library/Mockery/Container.php index 2e719daf3..196dc996e 100644 --- a/vendor/mockery/mockery/library/Mockery/Container.php +++ b/vendor/mockery/mockery/library/Mockery/Container.php @@ -190,12 +190,6 @@ class Container $builder->addBlackListedMethods($blocks); - if (defined('HHVM_VERSION') - && ($class === 'Exception' || is_subclass_of($class, 'Exception'))) { - $builder->addBlackListedMethod("setTraceOptions"); - $builder->addBlackListedMethod("getTraceOptions"); - } - if (!is_null($constructorArgs)) { $builder->addBlackListedMethod("__construct"); // we need to pass through } else { @@ -225,7 +219,11 @@ class Container $mock->mockery_init($this, $config->getTargetObject(), $config->isInstanceMock()); if (!empty($quickdefs)) { - $mock->shouldReceive($quickdefs)->byDefault(); + if (\Mockery::getConfiguration()->getQuickDefinitions()->shouldBeCalledAtLeastOnce()) { + $mock->shouldReceive($quickdefs)->atLeast()->once(); + } else { + $mock->shouldReceive($quickdefs)->byDefault(); + } } if (!empty($expectationClosure)) { $expectationClosure($mock); diff --git a/vendor/mockery/mockery/library/Mockery/Expectation.php b/vendor/mockery/mockery/library/Mockery/Expectation.php index 9dfc5a176..ed87a5a67 100644 --- a/vendor/mockery/mockery/library/Mockery/Expectation.php +++ b/vendor/mockery/mockery/library/Mockery/Expectation.php @@ -194,7 +194,7 @@ class Expectation implements ExpectationInterface /** * Throws an exception if the expectation has been configured to do so * - * @throws \Exception|\Throwable + * @throws \Throwable * @return void */ private function throwAsNecessary($return) @@ -203,9 +203,7 @@ class Expectation implements ExpectationInterface return; } - $type = \PHP_VERSION_ID >= 70000 ? "\Throwable" : "\Exception"; - - if ($return instanceof $type) { + if ($return instanceof \Throwable) { throw $return; } @@ -391,6 +389,12 @@ class Expectation implements ExpectationInterface return true; } } + if (is_object($expected)) { + $matcher = \Mockery::getConfiguration()->getDefaultMatcher(get_class($expected)); + if ($matcher !== null) { + $expected = new $matcher($expected); + } + } if ($expected instanceof \Mockery\Matcher\MatcherAbstract) { return $expected->match($actual); } @@ -567,7 +571,7 @@ class Expectation implements ExpectationInterface public function andReturnArg($index) { if (!is_int($index) || $index < 0) { - throw new \InvalidArgumentException("Invalid argument index supplied. Index must be a positive integer."); + throw new \InvalidArgumentException("Invalid argument index supplied. Index must be a non-negative integer."); } $closure = function (...$args) use ($index) { if (array_key_exists($index, $args)) { @@ -666,6 +670,25 @@ class Expectation implements ExpectationInterface return $this; } + /** + * Sets up a closure that will yield each of the provided args + * + * @param mixed ...$args + * @return self + */ + public function andYield(...$args) + { + $this->_closureQueue = [ + static function () use ($args) { + foreach ($args as $arg) { + yield $arg; + } + }, + ]; + + return $this; + } + /** * Alias to andSet(). Allows the natural English construct * - set('foo', 'bar')->andReturn('bar') @@ -705,7 +728,12 @@ class Expectation implements ExpectationInterface throw new \InvalidArgumentException('The passed Times limit should be an integer value'); } $this->_countValidators[$this->_countValidatorClass] = new $this->_countValidatorClass($this, $limit); - $this->_countValidatorClass = 'Mockery\CountValidator\Exact'; + + if ('Mockery\CountValidator\Exact' !== $this->_countValidatorClass) { + $this->_countValidatorClass = 'Mockery\CountValidator\Exact'; + unset($this->_countValidators[$this->_countValidatorClass]); + } + return $this; } diff --git a/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php b/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php index 1310c1b38..efb0b70ba 100644 --- a/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php +++ b/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php @@ -213,6 +213,14 @@ class ExpectationDirector */ public function getExpectationCount() { - return count($this->getExpectations()) ?: count($this->getDefaultExpectations()); + $count = 0; + /** @var Expectation $expectations */ + $expectations = $this->getExpectations() ?: $this->getDefaultExpectations(); + foreach ($expectations as $expectation) { + if ($expectation->isCallCountConstrained()) { + $count++; + } + } + return $count; } } diff --git a/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php b/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php index 5df0e7673..f1295ad35 100644 --- a/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php +++ b/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php @@ -34,7 +34,7 @@ interface ExpectationInterface public function getMock(); /** - * @param array ...$args + * @param mixed $args * @return self */ public function andReturn(...$args); diff --git a/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php b/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php index 652eac1e9..05903e5bb 100644 --- a/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php +++ b/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php @@ -526,34 +526,6 @@ class MockConfiguration return true; }); - // In HHVM, class methods can be annotated with the built-in - // <<__Memoize>> attribute (similar to a Python decorator), - // which builds an LRU cache of method arguments and their - // return values. - // https://docs.hhvm.com/hack/attributes/special#__memoize - // - // HHVM implements this behavior by inserting a private helper - // method into the class at runtime which is named as the - // method to be memoized, suffixed by `$memoize_impl`. - // https://github.com/facebook/hhvm/blob/6aa46f1e8c2351b97d65e67b73e26f274a7c3f2e/hphp/runtime/vm/func.cpp#L364 - // - // Ordinarily, PHP does not all allow the `$` token in method - // names, but since the memoization helper is inserted at - // runtime (and not in userland), HHVM allows it. - // - // We use code generation and eval() for some types of mocks, - // so to avoid syntax errors from these memoization helpers, - // we must filter them from our list of class methods. - // - // This effectively disables the memoization behavior in HHVM, - // but that's preferable to failing catastrophically when - // attempting to mock a class using the attribute. - if (defined('HHVM_VERSION')) { - $methods = array_filter($methods, function ($method) { - return strpos($method->getName(), '$memoize_impl') === false; - }); - } - return $this->allMethods = $methods; } diff --git a/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php b/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php index 842bb861b..273b1d8b7 100644 --- a/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php +++ b/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php @@ -72,9 +72,7 @@ class MockConfigurationBuilder public function __construct() { - if (\PHP_VERSION_ID >= 70000) { - $this->blackListedMethods = array_diff($this->blackListedMethods, $this->php7SemiReservedKeywords); - } + $this->blackListedMethods = array_diff($this->blackListedMethods, $this->php7SemiReservedKeywords); } public function addTarget($target) diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php index e949a515a..1debcbb18 100644 --- a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php @@ -37,11 +37,6 @@ class ClassPass implements Pass } $className = ltrim($target->getName(), "\\"); - if (defined('HHVM_VERSION') && preg_match('/^HH\\\\/', $className)) { - // HH\ namespace is reserved for HHVM class and doesnt require - // class declaration and extension. - return $code; - } if (!class_exists($className)) { \Mockery::declareClass($className); diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php index 72967cd6a..b0b743df7 100644 --- a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php @@ -75,7 +75,8 @@ class MethodDefinitionPass implements Pass if (!$param->isVariadic()) { if (false !== $param->isDefaultValueAvailable()) { - $paramDef .= ' = ' . var_export($param->getDefaultValue(), true); + $defaultValue = $param->getDefaultValue(); + $paramDef .= ' = ' . (is_object($defaultValue) ? get_class($defaultValue) : var_export($defaultValue, true)); } elseif ($param->isOptional()) { $paramDef .= ' = null'; } @@ -156,7 +157,7 @@ BODY; $body .= "\$ret = {$invoke}(__FUNCTION__, \$argv);\n"; - if ($method->getReturnType() !== "void") { + if (! in_array($method->getReturnType(), ['never','void'], true)) { $body .= "return \$ret;\n"; } diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveBuiltinMethodsThatAreFinalPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveBuiltinMethodsThatAreFinalPass.php index 59f18cf49..7b0850ed4 100644 --- a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveBuiltinMethodsThatAreFinalPass.php +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveBuiltinMethodsThatAreFinalPass.php @@ -32,6 +32,7 @@ class RemoveBuiltinMethodsThatAreFinalPass { protected $methods = array( '__wakeup' => '/public function __wakeup\(\)\s+\{.*?\}/sm', + '__toString' => '/public function __toString\(\)\s+(:\s+string)?\s*\{.*?\}/sm', ); public function apply($code, MockConfiguration $config) diff --git a/vendor/mockery/mockery/library/Mockery/LegacyMockInterface.php b/vendor/mockery/mockery/library/Mockery/LegacyMockInterface.php index 1ce63a12a..ae0cc2a75 100644 --- a/vendor/mockery/mockery/library/Mockery/LegacyMockInterface.php +++ b/vendor/mockery/mockery/library/Mockery/LegacyMockInterface.php @@ -69,7 +69,7 @@ interface LegacyMockInterface /** * Set mock to defer unexpected methods to its parent if possible * - * @deprecated 2.0.0 Please use makePartial() instead + * @deprecated since 1.4.0. Please use makePartial() instead. * * @return Mock */ diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php b/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php deleted file mode 100644 index 11874878e..000000000 --- a/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php +++ /dev/null @@ -1,76 +0,0 @@ -constraint = $constraint; - $this->rethrow = $rethrow; - } - - /** - * @param mixed $actual - * @return bool - */ - public function match(&$actual) - { - try { - $this->constraint->evaluate($actual); - return true; - } catch (\PHPUnit_Framework_AssertionFailedError $e) { - if ($this->rethrow) { - throw $e; - } - return false; - } catch (\PHPUnit\Framework\AssertionFailedError $e) { - if ($this->rethrow) { - throw $e; - } - return false; - } - } - - /** - * - */ - public function __toString() - { - return ''; - } -} diff --git a/vendor/mockery/mockery/library/Mockery/Mock.php b/vendor/mockery/mockery/library/Mockery/Mock.php index 95bb5f399..c9000838f 100644 --- a/vendor/mockery/mockery/library/Mockery/Mock.php +++ b/vendor/mockery/mockery/library/Mockery/Mock.php @@ -52,6 +52,14 @@ class Mock implements MockInterface */ protected $_mockery_ignoreMissing = false; + /** + * Flag to indicate whether we want to set the ignoreMissing flag on + * mocks generated form this calls to this one + * + * @var bool + */ + protected $_mockery_ignoreMissingRecursive = false; + /** * Flag to indicate whether we can defer method calls missing from our * expectations @@ -308,11 +316,13 @@ class Mock implements MockInterface /** * Set mock to ignore unexpected methods and return Undefined class * @param mixed $returnValue the default return value for calls to missing functions on this mock + * @param bool $recursive Specify if returned mocks should also have shouldIgnoreMissing set * @return Mock */ - public function shouldIgnoreMissing($returnValue = null) + public function shouldIgnoreMissing($returnValue = null, $recursive = false) { $this->_mockery_ignoreMissing = true; + $this->_mockery_ignoreMissingRecursive = $recursive; $this->_mockery_defaultReturnValue = $returnValue; return $this; } @@ -657,9 +667,9 @@ class Mock implements MockInterface { $rfc = new \ReflectionClass($this); - // HHVM has a Stringish interface and PHP 8 has Stringable + // PHP 8 has Stringable interface $interfaces = array_filter($rfc->getInterfaces(), function ($i) { - return $i->getName() !== 'Stringish' && $i->getName() !== 'Stringable'; + return $i->getName() !== 'Stringable'; }); return false === $rfc->getParentClass() && 2 === count($interfaces); @@ -737,11 +747,22 @@ class Mock implements MockInterface case 'void': return null; + case 'static': + return $this; + case 'object': - return \Mockery::mock(); + $mock = \Mockery::mock(); + if ($this->_mockery_ignoreMissingRecursive) { + $mock->shouldIgnoreMissing($this->_mockery_defaultReturnValue, true); + } + return $mock; default: - return \Mockery::mock($returnType); + $mock = \Mockery::mock($returnType); + if ($this->_mockery_ignoreMissingRecursive) { + $mock->shouldIgnoreMissing($this->_mockery_defaultReturnValue, true); + } + return $mock; } } diff --git a/vendor/mockery/mockery/library/Mockery/QuickDefinitionsConfiguration.php b/vendor/mockery/mockery/library/Mockery/QuickDefinitionsConfiguration.php new file mode 100644 index 000000000..b0eea6623 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/QuickDefinitionsConfiguration.php @@ -0,0 +1,56 @@ +_quickDefinitionsApplicationMode = $newValue + ? self::QUICK_DEFINITIONS_MODE_MOCK_AT_LEAST_ONCE + : self::QUICK_DEFINITIONS_MODE_DEFAULT_EXPECTATION; + } + + return $this->_quickDefinitionsApplicationMode === self::QUICK_DEFINITIONS_MODE_MOCK_AT_LEAST_ONCE; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Reflector.php b/vendor/mockery/mockery/library/Mockery/Reflector.php index 3ec7cde12..4e8c6e1fc 100644 --- a/vendor/mockery/mockery/library/Mockery/Reflector.php +++ b/vendor/mockery/mockery/library/Mockery/Reflector.php @@ -35,13 +35,9 @@ class Reflector */ public static function isArray(\ReflectionParameter $param) { - if (\PHP_VERSION_ID < 70100) { - return $param->isArray(); - } - $type = $param->getType(); - return $type instanceof \ReflectionNamedType ? $type->getName() === 'array' : false; + return $type instanceof \ReflectionNamedType && $type->getName(); } /** @@ -54,13 +50,6 @@ class Reflector */ public static function getTypeHint(\ReflectionParameter $param, $withoutNullable = false) { - // returns false if we are running PHP 7+ - $typeHint = self::getLegacyTypeHint($param); - - if ($typeHint !== false) { - return $typeHint; - } - if (!$param->hasType()) { return null; } @@ -69,8 +58,7 @@ class Reflector $declaringClass = $param->getDeclaringClass(); $typeHint = self::typeToString($type, $declaringClass); - // PHP 7.1+ supports nullable types via a leading question mark - return (!$withoutNullable && \PHP_VERSION_ID >= 70100 && $type->allowsNull()) ? self::formatNullableType($typeHint) : $typeHint; + return (!$withoutNullable && $type->allowsNull()) ? self::formatNullableType($typeHint) : $typeHint; } /** @@ -83,11 +71,6 @@ class Reflector */ public static function getReturnType(\ReflectionMethod $method, $withoutNullable = false) { - // Strip all return types for HHVM and skip PHP 5. - if (method_exists($method, 'getReturnTypeText') || \PHP_VERSION_ID < 70000) { - return null; - } - $type = $method->getReturnType(); if (is_null($type) && method_exists($method, 'getTentativeReturnType')) { @@ -100,8 +83,7 @@ class Reflector $typeHint = self::typeToString($type, $method->getDeclaringClass()); - // PHP 7.1+ supports nullable types via a leading question mark - return (!$withoutNullable && \PHP_VERSION_ID >= 70100 && $type->allowsNull()) ? self::formatNullableType($typeHint) : $typeHint; + return (!$withoutNullable && $type->allowsNull()) ? self::formatNullableType($typeHint) : $typeHint; } /** @@ -113,11 +95,6 @@ class Reflector */ public static function getSimplestReturnType(\ReflectionMethod $method) { - // Strip all return types for HHVM and skip PHP 5. - if (method_exists($method, 'getReturnTypeText') || \PHP_VERSION_ID < 70000) { - return null; - } - $type = $method->getReturnType(); if (is_null($type) && method_exists($method, 'getTentativeReturnType')) { @@ -145,95 +122,11 @@ class Reflector return null; } - /** - * Compute the legacy type hint. - * - * We return: - * - string: the legacy type hint - * - null: if there is no legacy type hint - * - false: if we must check for PHP 7+ typing - * - * @param \ReflectionParameter $param - * - * @return string|null|false - */ - private static function getLegacyTypeHint(\ReflectionParameter $param) - { - // Handle HHVM typing - if (\method_exists($param, 'getTypehintText')) { - if ($param->isArray()) { - return 'array'; - } - - if ($param->isCallable()) { - return 'callable'; - } - - $typeHint = $param->getTypehintText(); - - // throw away HHVM scalar types - if (\in_array($typeHint, array('int', 'integer', 'float', 'string', 'bool', 'boolean'), true)) { - return null; - } - - return sprintf('\\%s', $typeHint); - } - - // Handle PHP 5 typing - if (\PHP_VERSION_ID < 70000) { - if ($param->isArray()) { - return 'array'; - } - - if ($param->isCallable()) { - return 'callable'; - } - - $typeHint = self::getLegacyClassName($param); - - return $typeHint === null ? null : sprintf('\\%s', $typeHint); - } - - return false; - } - - /** - * Compute the class name using legacy APIs, if possible. - * - * This method MUST only be called on PHP 5. - * - * @param \ReflectionParameter $param - * - * @return string|null - */ - private static function getLegacyClassName(\ReflectionParameter $param) - { - try { - $class = $param->getClass(); - - $typeHint = $class === null ? null : $class->getName(); - } catch (\ReflectionException $e) { - $typeHint = null; - } - - if ($typeHint === null) { - if (preg_match('/^Parameter #[0-9]+ \[ \<(required|optional)\> (?\S+ )?.*\$' . $param->getName() . ' .*\]$/', (string) $param, $typehintMatch)) { - if (!empty($typehintMatch['typehint']) && $typehintMatch['typehint']) { - $typeHint = $typehintMatch['typehint']; - } - } - } - - return $typeHint; - } - /** * Get the string representation of the given type. * - * This method MUST only be called on PHP 7+. - * - * @param \ReflectionType $type - * @param \ReflectionClass $declaringClass + * @param \ReflectionType $type + * @param string $declaringClass * * @return string|null */ @@ -247,8 +140,6 @@ class Reflector /** * Get the string representation of the given type. * - * This method MUST only be called on PHP 7+. - * * @param \ReflectionType $type * @param \ReflectionClass $declaringClass * @@ -256,8 +147,8 @@ class Reflector */ private static function getTypeInformation(\ReflectionType $type, \ReflectionClass $declaringClass) { - // PHP 8 union types can be recursively processed - if ($type instanceof \ReflectionUnionType) { + // PHP 8 union types and PHP 8.1 intersection types can be recursively processed + if ($type instanceof \ReflectionUnionType || $type instanceof \ReflectionIntersectionType) { $types = []; foreach ($type->getTypes() as $innterType) { @@ -273,8 +164,8 @@ class Reflector return $types; } - // PHP 7.0 doesn't have named types, but 7.1+ does - $typeHint = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type; + // $type must be an instance of \ReflectionNamedType + $typeHint = $type->getName(); // builtins can be returned as is if ($type->isBuiltin()) { @@ -318,8 +209,6 @@ class Reflector /** * Format the given type as a nullable type. * - * This method MUST only be called on PHP 7.1+. - * * @param string $typeHint * * @return string diff --git a/vendor/monolog/monolog/CHANGELOG.md b/vendor/monolog/monolog/CHANGELOG.md index 7f9db2b07..8a8c65124 100644 --- a/vendor/monolog/monolog/CHANGELOG.md +++ b/vendor/monolog/monolog/CHANGELOG.md @@ -1,3 +1,18 @@ +### 2.9.1 (2023-02-06) + + * Fixed Logger not being serializable anymore (#1792) + +### 2.9.0 (2023-02-05) + + * Deprecated FlowdockHandler & Formatter as the flowdock service was shutdown (#1748) + * Added support for enum context values in PsrLogMessageProcessor (#1773) + * Added graylog2/gelf-php 2.x support (#1747) + * Improved `BrowserConsoleHandler` logging to use more appropriate methods than just console.log in the browser (#1739) + * Fixed `WhatFailureGroupHandler` not catching errors happening inside `close()` (#1791) + * Fixed datetime field in `GoogleCloudLoggingFormatter` (#1758) + * Fixed infinite loop detection within Fibers (#1753) + * Fixed `AmqpHandler->setExtraAttributes` not working with buffering handler wrappers (#1781) + ### 2.8.0 (2022-07-24) * Deprecated `CubeHandler` and `PHPConsoleHandler` as both projects are abandoned and those should not be used anymore (#1734) diff --git a/vendor/monolog/monolog/composer.json b/vendor/monolog/monolog/composer.json index ab775ad63..b9437d6d5 100644 --- a/vendor/monolog/monolog/composer.json +++ b/vendor/monolog/monolog/composer.json @@ -21,7 +21,7 @@ "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", - "graylog2/gelf-php": "^1.4.2", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", "guzzlehttp/guzzle": "^7.4", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php index 41b56b3c0..867ae586b 100644 --- a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php @@ -15,6 +15,7 @@ namespace Monolog\Formatter; * formats the record to be used in the FlowdockHandler * * @author Dominik Liebler + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockFormatter implements FormatterInterface { diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php index a1a79372d..3b3e1e7f6 100644 --- a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +++ b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php @@ -47,6 +47,11 @@ class GelfMessageFormatter extends NormalizerFormatter */ protected $maxLength; + /** + * @var int + */ + private $gelfVersion = 2; + /** * Translates Monolog log levels to Graylog2 log priorities. * @@ -78,6 +83,10 @@ class GelfMessageFormatter extends NormalizerFormatter $this->extraPrefix = is_null($extraPrefix) ? '' : $extraPrefix; $this->contextPrefix = $contextPrefix; $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; + + if (method_exists(Message::class, 'setFacility')) { + $this->gelfVersion = 1; + } } /** @@ -113,16 +122,20 @@ class GelfMessageFormatter extends NormalizerFormatter $message->setShortMessage(Utils::substr($record['message'], 0, $this->maxLength)); } - if (isset($record['channel'])) { - $message->setFacility($record['channel']); - } - if (isset($extra['line'])) { - $message->setLine($extra['line']); - unset($extra['line']); - } - if (isset($extra['file'])) { - $message->setFile($extra['file']); - unset($extra['file']); + if ($this->gelfVersion === 1) { + if (isset($record['channel'])) { + $message->setFacility($record['channel']); + } + if (isset($extra['line'])) { + $message->setLine($extra['line']); + unset($extra['line']); + } + if (isset($extra['file'])) { + $message->setFile($extra['file']); + unset($extra['file']); + } + } else { + $message->setAdditional('facility', $record['channel']); } foreach ($extra as $key => $val) { @@ -147,11 +160,13 @@ class GelfMessageFormatter extends NormalizerFormatter $message->setAdditional($this->contextPrefix . $key, $val); } - /** @phpstan-ignore-next-line */ - if (null === $message->getFile() && isset($context['exception']['file'])) { - if (preg_match("/^(.+):([0-9]+)$/", $context['exception']['file'], $matches)) { - $message->setFile($matches[1]); - $message->setLine($matches[2]); + if ($this->gelfVersion === 1) { + /** @phpstan-ignore-next-line */ + if (null === $message->getFile() && isset($context['exception']['file'])) { + if (preg_match("/^(.+):([0-9]+)$/", $context['exception']['file'], $matches)) { + $message->setFile($matches[1]); + $message->setLine($matches[2]); + } } } diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php index 0cd287f5e..ca52ebf4e 100644 --- a/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php +++ b/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php @@ -17,6 +17,7 @@ use Monolog\LogRecord; /** * Encodes message information into JSON in a format compatible with Cloud logging. * + * @see https://cloud.google.com/logging/docs/structured-logging * @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry * * @author Luís Cobucci @@ -28,7 +29,7 @@ final class GoogleCloudLoggingFormatter extends JsonFormatter { // Re-key level for GCP logging $record['severity'] = $record['level_name']; - $record['timestamp'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED); + $record['time'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED); // Remove keys that are not used by GCP unset($record['level'], $record['level_name'], $record['datetime']); diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php index c4997482e..994872ce8 100644 --- a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +++ b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php @@ -151,13 +151,14 @@ class AmqpHandler extends AbstractProcessingHandler private function createAmqpMessage(string $data): AMQPMessage { - return new AMQPMessage( - $data, - [ - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ] - ); + $attributes = [ + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ]; + if ($this->extraAttributes) { + $attributes = array_merge($attributes, $this->extraAttributes); + } + return new AMQPMessage($data, $attributes); } /** diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php index fa383f1c2..95bbfed42 100644 --- a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +++ b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php @@ -14,6 +14,7 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; use Monolog\Utils; +use Monolog\Logger; use function count; use function headers_list; @@ -177,7 +178,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler $extra = static::dump('Extra', $record['extra']); if (empty($context) && empty($extra)) { - $script[] = static::call_array('log', static::handleStyles($record['formatted'])); + $script[] = static::call_array(static::getConsoleMethodForLevel($record['level']), static::handleStyles($record['formatted'])); } else { $script = array_merge( $script, @@ -192,6 +193,20 @@ class BrowserConsoleHandler extends AbstractProcessingHandler return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; } + private static function getConsoleMethodForLevel(int $level): string + { + return [ + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ][$level] ?? 'log'; + } + /** * @return string[] */ diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php index b837bdb66..5715d5800 100644 --- a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +++ b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php @@ -28,6 +28,7 @@ use Monolog\Formatter\FormatterInterface; * @see https://www.flowdock.com/api/push * * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockHandler extends SocketHandler { diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php index 2dd136720..b6d3d3b19 100644 --- a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +++ b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -64,4 +64,18 @@ class WhatFailureGroupHandler extends GroupHandler } } } + + /** + * {@inheritDoc} + */ + public function close(): void + { + foreach ($this->handlers as $handler) { + try { + $handler->close(); + } catch (\Throwable $e) { + // What failure? + } + } + } } diff --git a/vendor/monolog/monolog/src/Monolog/Logger.php b/vendor/monolog/monolog/src/Monolog/Logger.php index 1ab75b9e0..84a2f5510 100644 --- a/vendor/monolog/monolog/src/Monolog/Logger.php +++ b/vendor/monolog/monolog/src/Monolog/Logger.php @@ -168,6 +168,11 @@ class Logger implements LoggerInterface, ResettableInterface */ private $logDepth = 0; + /** + * @var \WeakMap<\Fiber, int>|null Keeps track of depth inside fibers to prevent infinite logging loops + */ + private $fiberLogDepth; + /** * @var bool Whether to detect infinite logging loops * @@ -189,6 +194,13 @@ class Logger implements LoggerInterface, ResettableInterface $this->setHandlers($handlers); $this->processors = $processors; $this->timezone = $timezone ?: new DateTimeZone(date_default_timezone_get() ?: 'UTC'); + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } } public function getName(): string @@ -332,12 +344,20 @@ class Logger implements LoggerInterface, ResettableInterface } if ($this->detectCycles) { - $this->logDepth += 1; + if (\PHP_VERSION_ID >= 80100 && $fiber = \Fiber::getCurrent()) { + $this->fiberLogDepth[$fiber] = $this->fiberLogDepth[$fiber] ?? 0; + $logDepth = ++$this->fiberLogDepth[$fiber]; + } else { + $logDepth = ++$this->logDepth; + } + } else { + $logDepth = 0; } - if ($this->logDepth === 3) { + + if ($logDepth === 3) { $this->warning('A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause.'); return false; - } elseif ($this->logDepth >= 5) { // log depth 4 is let through so we can log the warning above + } elseif ($logDepth >= 5) { // log depth 4 is let through, so we can log the warning above return false; } @@ -387,7 +407,11 @@ class Logger implements LoggerInterface, ResettableInterface } } finally { if ($this->detectCycles) { - $this->logDepth--; + if (isset($fiber)) { + $this->fiberLogDepth[$fiber]--; + } else { + $this->logDepth--; + } } } @@ -698,4 +722,40 @@ class Logger implements LoggerInterface, ResettableInterface ($this->exceptionHandler)($e, $record); } + + /** + * @return array + */ + public function __serialize(): array + { + return [ + 'name' => $this->name, + 'handlers' => $this->handlers, + 'processors' => $this->processors, + 'microsecondTimestamps' => $this->microsecondTimestamps, + 'timezone' => $this->timezone, + 'exceptionHandler' => $this->exceptionHandler, + 'logDepth' => $this->logDepth, + 'detectCycles' => $this->detectCycles, + ]; + } + + /** + * @param array $data + */ + public function __unserialize(array $data): void + { + foreach (['name', 'handlers', 'processors', 'microsecondTimestamps', 'timezone', 'exceptionHandler', 'logDepth', 'detectCycles'] as $property) { + if (isset($data[$property])) { + $this->$property = $data[$property]; + } + } + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } + } } diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php index 2c2a00e75..e7c12176a 100644 --- a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +++ b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -66,6 +66,8 @@ class PsrLogMessageProcessor implements ProcessorInterface } else { $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE); } + } elseif ($val instanceof \UnitEnum) { + $replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name; } elseif (is_object($val)) { $replacements[$placeholder] = '[object '.Utils::getClass($val).']'; } elseif (is_array($val)) { diff --git a/vendor/nesbot/carbon/.phpstorm.meta.php b/vendor/nesbot/carbon/.phpstorm.meta.php new file mode 100644 index 000000000..bd7c7e0e7 --- /dev/null +++ b/vendor/nesbot/carbon/.phpstorm.meta.php @@ -0,0 +1,10 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface + { + public function format(string $message, string $locale, array $parameters = []): string + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php new file mode 100644 index 000000000..cbd890d5b --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface + { + abstract protected function transformLocale(?string $locale): ?string; + + public function format($message, $locale, array $parameters = []) + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + + public function choiceFormat($message, $number, $locale, array $parameters = []) + { + return $this->formatter->choiceFormat($message, $number, $locale, $parameters); + } + } +} diff --git a/vendor/nesbot/carbon/readme.md b/vendor/nesbot/carbon/readme.md index c04a0e95d..a178c3c70 100644 --- a/vendor/nesbot/carbon/readme.md +++ b/vendor/nesbot/carbon/readme.md @@ -125,6 +125,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l + diff --git a/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php b/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php index 949e159be..8b8fe089e 100644 --- a/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php +++ b/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php @@ -11,6 +11,7 @@ namespace Carbon; +use Carbon\MessageFormatter\MessageFormatterMapper; use Closure; use ReflectionException; use ReflectionFunction; @@ -51,7 +52,7 @@ abstract class AbstractTranslator extends Translation\Translator /** * List of locales aliases. * - * @var string[] + * @var array */ protected $aliases = [ 'me' => 'sr_Latn_ME', @@ -83,7 +84,7 @@ abstract class AbstractTranslator extends Translation\Translator $this->initializing = true; $this->directories = [__DIR__.'/Lang']; $this->addLoader('array', new ArrayLoader()); - parent::__construct($locale, $formatter, $cacheDir, $debug); + parent::__construct($locale, new MessageFormatterMapper($formatter), $cacheDir, $debug); $this->initializing = false; } diff --git a/vendor/nesbot/carbon/src/Carbon/Carbon.php b/vendor/nesbot/carbon/src/Carbon/Carbon.php index e327590e2..1e285aa4a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Carbon.php +++ b/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -502,8 +502,8 @@ use DateTimeZone; * @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|false 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 + * @method static static|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new Carbon object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php * * */ diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php b/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php index 6d1194ee7..960d66c05 100644 --- a/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php +++ b/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php @@ -24,486 +24,486 @@ use DateTimeZone; * * * - * @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|float|string $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 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 $micro + * @property int $microsecond + * @property int|float|string $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 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 * - * @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|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|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|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|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|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|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|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|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|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|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|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 CarbonImmutable years(int $value) Set current instance year to the given value. - * @method CarbonImmutable year(int $value) Set current instance year to the given value. - * @method CarbonImmutable setYears(int $value) Set current instance year to the given value. - * @method CarbonImmutable setYear(int $value) Set current instance year to the given value. - * @method CarbonImmutable months(int $value) Set current instance month to the given value. - * @method CarbonImmutable month(int $value) Set current instance month to the given value. - * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value. - * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value. - * @method CarbonImmutable days(int $value) Set current instance day to the given value. - * @method CarbonImmutable day(int $value) Set current instance day to the given value. - * @method CarbonImmutable setDays(int $value) Set current instance day to the given value. - * @method CarbonImmutable setDay(int $value) Set current instance day to the given value. - * @method CarbonImmutable hours(int $value) Set current instance hour to the given value. - * @method CarbonImmutable hour(int $value) Set current instance hour to the given value. - * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value. - * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value. - * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value. - * @method CarbonImmutable minute(int $value) Set current instance minute to the given value. - * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value. - * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value. - * @method CarbonImmutable seconds(int $value) Set current instance second to the given value. - * @method CarbonImmutable second(int $value) Set current instance second to the given value. - * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value. - * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value. - * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addYear() Add one year to the instance (using date interval). - * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subYear() Sub one year to the instance (using date interval). - * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMonth() Add one month to the instance (using date interval). - * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval). - * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addDay() Add one day to the instance (using date interval). - * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subDay() Sub one day to the instance (using date interval). - * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addHour() Add one hour to the instance (using date interval). - * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval). - * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval). - * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval). - * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addSecond() Add one second to the instance (using date interval). - * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval). - * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval). - * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval). - * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval). - * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval). - * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval). - * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval). - * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval). - * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval). - * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval). - * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval). - * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addCentury() Add one century to the instance (using date interval). - * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval). - * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval). - * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval). - * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval). - * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval). - * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addWeek() Add one week to the instance (using date interval). - * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval). - * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval). - * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval). - * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp). - * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp). - * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp). - * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp). - * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp). - * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp). - * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp). - * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp). - * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp). - * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp). - * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp). - * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp). - * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp). - * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp). - * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp). - * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable 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 CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision. - * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision. - * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision. - * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision. - * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision. - * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision. - * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision. - * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision. - * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision. - * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision. - * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision. - * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision. - * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision. - * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision. - * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision. - * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision. - * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision. - * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. - * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. - * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. - * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision. - * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision. - * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision. - * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. - * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. - * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. - * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. - * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. - * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision. - * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision. - * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision. - * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. - * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision. - * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision. - * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. - * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. - * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. - * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. - * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. - * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. - * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. - * @method CarbonImmutable 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 CarbonImmutable|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format. - * @method static CarbonImmutable __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * @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|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|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|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|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|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|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|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|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|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|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|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 CarbonImmutable years(int $value) Set current instance year to the given value. + * @method CarbonImmutable year(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYears(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYear(int $value) Set current instance year to the given value. + * @method CarbonImmutable months(int $value) Set current instance month to the given value. + * @method CarbonImmutable month(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value. + * @method CarbonImmutable days(int $value) Set current instance day to the given value. + * @method CarbonImmutable day(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDays(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDay(int $value) Set current instance day to the given value. + * @method CarbonImmutable hours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable hour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable minute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable seconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable second(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value. + * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addYear() Add one year to the instance (using date interval). + * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subYear() Sub one year to the instance (using date interval). + * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMonth() Add one month to the instance (using date interval). + * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval). + * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDay() Add one day to the instance (using date interval). + * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDay() Sub one day to the instance (using date interval). + * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addHour() Add one hour to the instance (using date interval). + * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval). + * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval). + * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval). + * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addSecond() Add one second to the instance (using date interval). + * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval). + * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval). + * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval). + * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addCentury() Add one century to the instance (using date interval). + * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval). + * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval). + * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval). + * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval). + * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval). + * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeek() Add one week to the instance (using date interval). + * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval). + * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval). + * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval). + * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp). + * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp). + * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp). + * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp). + * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp). + * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp). + * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp). + * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp). + * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp). + * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp). + * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp). + * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable 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 CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method CarbonImmutable 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 static|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php * * */ diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php index c3db85043..4b6ce76c5 100644 --- a/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php @@ -702,6 +702,15 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public function __isset($name); + /** + * Returns the values to dump on serialize() called on. + * + * Only used by PHP >= 7.4. + * + * @return array + */ + public function __serialize(): array; + /** * Set a part of the Carbon object * @@ -727,6 +736,8 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable /** * Returns the list of properties to dump on serialize() called on. * + * Only used by PHP < 7.4. + * * @return array */ public function __sleep(); @@ -736,13 +747,22 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @example * ``` - * echo Carbon::now(); // Carbon instances can be casted to string + * echo Carbon::now(); // Carbon instances can be cast to string * ``` * * @return string */ public function __toString(); + /** + * Set locale if specified on unserialize() called. + * + * Only used by PHP >= 7.4. + * + * @return void + */ + public function __unserialize(array $data): void; + /** * Add given units or interval to the current instance. * @@ -988,7 +1008,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string $modifier * - * @return static + * @return static|false */ public function change($modifier); @@ -1277,7 +1297,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @return CarbonInterval */ - public function diffAsCarbonInterval($date = null, $absolute = true); + public function diffAsCarbonInterval($date = null, $absolute = true, array $skip = []); /** * Get the difference by the given interval using a filter closure. @@ -2117,6 +2137,18 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public static function getDays(); + /** + * Return the number of days since the start of the week (using the current locale or the first parameter + * if explicitly given). + * + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return int + */ + public function getDaysFromStartOfWeek(?int $weekStartsAt = null): int; + /** * Get the fallback locale. * @@ -3383,7 +3415,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function next($modifier = null); @@ -3529,7 +3561,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function previous($modifier = null); @@ -3774,6 +3806,19 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public function setDateTimeFrom($date = null); + /** + * Set the day (keeping the current time) to the start of the week + the number of days passed as the first + * parameter. First day of week is driven by the locale unless explicitly set with the second parameter. + * + * @param int $numberOfDays number of days to add after the start of the current week + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return static + */ + public function setDaysFromStartOfWeek(int $numberOfDays, ?int $weekStartsAt = null); + /** * Set the fallback locale. * @@ -3861,7 +3906,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNow($testNow = null); @@ -3882,7 +3927,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNowAndTimezone($testNow = null, $tz = null); @@ -3943,11 +3988,11 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. * - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * * @param string|Closure|null $format * @@ -4538,6 +4583,18 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public function toFormattedDateString(); + /** + * Format the instance with the day, and a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDayDateString(); + * ``` + * + * @return string + */ + public function toFormattedDayDateString(): string; + /** * 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). @@ -5058,8 +5115,8 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance - * @param Closure|null $callback + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + * @param Closure|null $callback * * @return mixed */ diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php index 566b4f940..796f9cdcd 100644 --- a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -48,7 +48,7 @@ use Throwable; * @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 int $milliseconds Total milliseconds of the current interval. * @property int $microExcludeMilli Remaining microseconds without the milliseconds. * @property int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). * @property int $daysExcludeWeeks alias of dayzExcludeWeeks @@ -298,7 +298,12 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ public static function getCascadeFactors() { - return static::$cascadeFactors ?: [ + return static::$cascadeFactors ?: static::getDefaultCascadeFactors(); + } + + protected static function getDefaultCascadeFactors(): array + { + return [ 'milliseconds' => [Carbon::MICROSECONDS_PER_MILLISECOND, 'microseconds'], 'seconds' => [Carbon::MILLISECONDS_PER_SECOND, 'milliseconds'], 'minutes' => [Carbon::SECONDS_PER_MINUTE, 'seconds'], @@ -1883,7 +1888,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Invert the interval. * - * @param bool|int $inverted if a parameter is passed, the passed value casted as 1 or 0 is used + * @param bool|int $inverted if a parameter is passed, the passed value cast as 1 or 0 is used * as the new value of the ->invert property. * * @return $this @@ -2720,6 +2725,15 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ public function roundUnit($unit, $precision = 1, $function = 'round') { + if (static::getCascadeFactors() !== static::getDefaultCascadeFactors()) { + $value = $function($this->total($unit) / $precision) * $precision; + $inverted = $value < 0; + + return $this->copyProperties(self::fromString( + number_format(abs($value), 12, '.', '').' '.$unit + )->invert($inverted)->cascade()); + } + $base = CarbonImmutable::parse('2000-01-01 00:00:00', 'UTC') ->roundUnit($unit, $precision, $function); $next = $base->add($this); diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php index 36f04bf58..01679142e 100644 --- a/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -255,6 +255,13 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ protected $dateInterval; + /** + * True once __construct is finished. + * + * @var bool + */ + protected $constructed = false; + /** * Whether current date interval was set by default. * @@ -695,6 +702,8 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable if ($this->options === null) { $this->setOptions(0); } + + $this->constructed = true; } /** @@ -707,6 +716,17 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return clone $this; } + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this; + } + /** * Get the getter for a property allowing both `DatePeriod` snakeCase and camelCase names. * @@ -798,7 +818,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param string $dateClass * - * @return $this + * @return static */ public function setDateClass(string $dateClass) { @@ -806,15 +826,16 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new NotACarbonClassException($dateClass); } - $this->dateClass = $dateClass; + $self = $this->copyIfImmutable(); + $self->dateClass = $dateClass; if (is_a($dateClass, Carbon::class, true)) { - $this->toggleOptions(static::IMMUTABLE, false); + $self->options = $self->options & ~static::IMMUTABLE; } elseif (is_a($dateClass, CarbonImmutable::class, true)) { - $this->toggleOptions(static::IMMUTABLE, true); + $self->options = $self->options | static::IMMUTABLE; } - return $this; + return $self; } /** @@ -834,7 +855,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidIntervalException * - * @return $this + * @return static */ public function setDateInterval($interval) { @@ -846,25 +867,24 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new InvalidIntervalException('Empty interval is not accepted.'); } - $this->dateInterval = $interval; + $self = $this->copyIfImmutable(); + $self->dateInterval = $interval; - $this->isDefaultInterval = false; + $self->isDefaultInterval = false; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** * Invert the period date interval. * - * @return $this + * @return static */ public function invertDateInterval() { - $interval = $this->dateInterval->invert(); - - return $this->setDateInterval($interval); + return $this->setDateInterval($this->dateInterval->invert()); } /** @@ -873,14 +893,11 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param DateTime|DateTimeInterface|string $start * @param DateTime|DateTimeInterface|string|null $end * - * @return $this + * @return static */ public function setDates($start, $end) { - $this->setStartDate($start); - $this->setEndDate($end); - - return $this; + return $this->setStartDate($start)->setEndDate($end); } /** @@ -890,7 +907,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidArgumentException * - * @return $this + * @return static */ public function setOptions($options) { @@ -898,11 +915,12 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new InvalidPeriodParameterException('Invalid options.'); } - $this->options = $options ?: 0; + $self = $this->copyIfImmutable(); + $self->options = $options ?: 0; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -923,7 +941,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws \InvalidArgumentException * - * @return $this + * @return static */ public function toggleOptions($options, $state = null) { @@ -943,7 +961,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param bool $state * - * @return $this + * @return static */ public function excludeStartDate($state = true) { @@ -955,7 +973,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param bool $state * - * @return $this + * @return static */ public function excludeEndDate($state = true) { @@ -1099,17 +1117,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param callable $callback * @param string $name * - * @return $this + * @return static */ public function addFilter($callback, $name = null) { - $tuple = $this->createFilterTuple(\func_get_args()); + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); - $this->filters[] = $tuple; + $self->filters[] = $tuple; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1120,17 +1139,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param callable $callback * @param string $name * - * @return $this + * @return static */ public function prependFilter($callback, $name = null) { - $tuple = $this->createFilterTuple(\func_get_args()); + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); - array_unshift($this->filters, $tuple); + array_unshift($self->filters, $tuple); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1138,24 +1158,25 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param callable|string $filter * - * @return $this + * @return static */ public function removeFilter($filter) { + $self = $this->copyIfImmutable(); $key = \is_callable($filter) ? 0 : 1; - $this->filters = array_values(array_filter( + $self->filters = array_values(array_filter( $this->filters, function ($tuple) use ($key, $filter) { return $tuple[$key] !== $filter; } )); - $this->updateInternalState(); + $self->updateInternalState(); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1193,39 +1214,41 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param array $filters * - * @return $this + * @return static */ public function setFilters(array $filters) { - $this->filters = $filters; + $self = $this->copyIfImmutable(); + $self->filters = $filters; - $this->updateInternalState(); + $self->updateInternalState(); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** * Reset filters stack. * - * @return $this + * @return static */ public function resetFilters() { - $this->filters = []; + $self = $this->copyIfImmutable(); + $self->filters = []; - if ($this->endDate !== null) { - $this->filters[] = [static::END_DATE_FILTER, null]; + if ($self->endDate !== null) { + $self->filters[] = [static::END_DATE_FILTER, null]; } - if ($this->recurrences !== null) { - $this->filters[] = [static::RECURRENCES_FILTER, null]; + if ($self->recurrences !== null) { + $self->filters[] = [static::RECURRENCES_FILTER, null]; } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1235,7 +1258,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidArgumentException * - * @return $this + * @return static */ public function setRecurrences($recurrences) { @@ -1247,15 +1270,17 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $this->removeFilter(static::RECURRENCES_FILTER); } - $this->recurrences = $recurrences === INF ? INF : (int) $recurrences; + /** @var self $self */ + $self = $this->copyIfImmutable(); + $self->recurrences = $recurrences === INF ? INF : (int) $recurrences; - if (!$this->hasFilter(static::RECURRENCES_FILTER)) { - return $this->addFilter(static::RECURRENCES_FILTER); + if (!$self->hasFilter(static::RECURRENCES_FILTER)) { + return $self->addFilter(static::RECURRENCES_FILTER); } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1266,7 +1291,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidPeriodDateException * - * @return $this + * @return static */ public function setStartDate($date, $inclusive = null) { @@ -1274,13 +1299,14 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new InvalidPeriodDateException('Invalid start date.'); } - $this->startDate = $date; + $self = $this->copyIfImmutable(); + $self->startDate = $date; if ($inclusive !== null) { - $this->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + $self = $self->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); } - return $this; + return $self; } /** @@ -1291,7 +1317,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws \InvalidArgumentException * - * @return $this + * @return static */ public function setEndDate($date, $inclusive = null) { @@ -1303,19 +1329,20 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $this->removeFilter(static::END_DATE_FILTER); } - $this->endDate = $date; + $self = $this->copyIfImmutable(); + $self->endDate = $date; if ($inclusive !== null) { - $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + $self = $self->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); } - if (!$this->hasFilter(static::END_DATE_FILTER)) { - return $this->addFilter(static::END_DATE_FILTER); + if (!$self->hasFilter(static::END_DATE_FILTER)) { + return $self->addFilter(static::END_DATE_FILTER); } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1800,18 +1827,19 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function setTimezone($timezone) { - $this->tzName = $timezone; - $this->timezone = $timezone; + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; - if ($this->startDate) { - $this->setStartDate($this->startDate->setTimezone($timezone)); + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->setTimezone($timezone)); } - if ($this->endDate) { - $this->setEndDate($this->endDate->setTimezone($timezone)); + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->setTimezone($timezone)); } - return $this; + return $self; } /** @@ -1823,18 +1851,19 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function shiftTimezone($timezone) { - $this->tzName = $timezone; - $this->timezone = $timezone; + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; - if ($this->startDate) { - $this->setStartDate($this->startDate->shiftTimezone($timezone)); + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->shiftTimezone($timezone)); } - if ($this->endDate) { - $this->setEndDate($this->endDate->shiftTimezone($timezone)); + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->shiftTimezone($timezone)); } - return $this; + return $self; } /** @@ -2213,19 +2242,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param float|int|string|\DateInterval|null $precision * @param string $function * - * @return $this + * @return static */ public function roundUnit($unit, $precision = 1, $function = 'round') { - $this->setStartDate($this->getStartDate()->roundUnit($unit, $precision, $function)); + $self = $this->copyIfImmutable(); + $self = $self->setStartDate($self->getStartDate()->roundUnit($unit, $precision, $function)); - if ($this->endDate) { - $this->setEndDate($this->getEndDate()->roundUnit($unit, $precision, $function)); + if ($self->endDate) { + $self = $self->setEndDate($self->getEndDate()->roundUnit($unit, $precision, $function)); } - $this->setDateInterval($this->getDateInterval()->roundUnit($unit, $precision, $function)); - - return $this; + return $self->setDateInterval($self->getDateInterval()->roundUnit($unit, $precision, $function)); } /** @@ -2234,7 +2262,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param string $unit * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function floorUnit($unit, $precision = 1) { @@ -2247,7 +2275,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param string $unit * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function ceilUnit($unit, $precision = 1) { @@ -2260,7 +2288,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param float|int|string|\DateInterval|null $precision * @param string $function * - * @return $this + * @return static */ public function round($precision = null, $function = 'round') { @@ -2275,7 +2303,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function floor($precision = null) { @@ -2287,7 +2315,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function ceil($precision = null) { @@ -2476,9 +2504,9 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable protected function handleChangedParameters() { if (($this->getOptions() & static::IMMUTABLE) && $this->dateClass === Carbon::class) { - $this->setDateClass(CarbonImmutable::class); + $this->dateClass = CarbonImmutable::class; } elseif (!($this->getOptions() & static::IMMUTABLE) && $this->dateClass === CarbonImmutable::class) { - $this->setDateClass(Carbon::class); + $this->dateClass = Carbon::class; } $this->validationResult = null; diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php new file mode 100644 index 000000000..cda0733f5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +class CarbonPeriodImmutable extends CarbonPeriod +{ + /** + * Date class of iteration items. + * + * @var string + */ + protected $dateClass = CarbonImmutable::class; + + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this->constructed ? clone $this : $this; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Factory.php b/vendor/nesbot/carbon/src/Carbon/Factory.php index f8c72890c..a4a496c89 100644 --- a/vendor/nesbot/carbon/src/Carbon/Factory.php +++ b/vendor/nesbot/carbon/src/Carbon/Factory.php @@ -177,10 +177,10 @@ use ReflectionMethod; * parameter of null. * /!\ Use this method for unit tests only. * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. * @method Carbon setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use UTF-8 language packages on every machine. diff --git a/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php b/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php index 596ee8064..67088f21c 100644 --- a/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php +++ b/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php @@ -175,10 +175,10 @@ use Closure; * parameter of null. * /!\ Use this method for unit tests only. * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. * @method CarbonImmutable setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use UTF-8 language packages on every machine. diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php index 75fe47f6d..35a22b1d2 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php index 362009e29..35180965a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php index 362009e29..35180965a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php index 0ac09958e..2d4200845 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php index 0ac09958e..2d4200845 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php index e6f0531d4..b3fb1cfec 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php @@ -16,6 +16,7 @@ * - JD Isaacks * - Atef Ben Ali (atefBB) * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri */ $months = [ 'يناير', @@ -90,4 +91,5 @@ return [ ], 'meridiem' => ['ص', 'م'], 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php index 55bb10c33..2792745c6 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php index 362009e29..35180965a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php index e790b99e6..503c60d2e 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php @@ -9,5 +9,10 @@ * file that was distributed with this source code. */ +/* + * Authors: + * - Abdullah-Alhariri + */ return array_replace_recursive(require __DIR__.'/ar.php', [ + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php index 362009e29..35180965a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php index 10aaa2ede..550b0c73a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php @@ -15,6 +15,7 @@ * - JD Isaacks * - Atef Ben Ali (atefBB) * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri */ $months = [ 'يناير', @@ -89,4 +90,5 @@ return [ ], 'meridiem' => ['ص', 'م'], 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php index 362009e29..35180965a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php index 0ac09958e..2d4200845 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php index 5dc29388e..169fe88a9 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -23,4 +24,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/be.php b/vendor/nesbot/carbon/src/Carbon/Lang/be.php index 51b4d0cc1..ee736365a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/be.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/be.php @@ -9,13 +9,12 @@ * file that was distributed with this source code. */ -// @codeCoverageIgnoreStart - use Carbon\CarbonInterface; use Symfony\Component\Translation\PluralizationRules; -if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); }, 'be'); } diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php index 861acd2a0..1c16421ad 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php @@ -9,5 +9,15 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'ca'); + }, 'ca_ES_Valencia'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/ca.php', [ ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php index 89693e674..c9411d69d 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/oc.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -17,7 +17,7 @@ use Symfony\Component\Translation\PluralizationRules; if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { + PluralizationRules::set(static function ($number) { return $number == 1 ? 0 : 1; }, 'oc'); } diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php index f0196c0d6..b72053549 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -62,7 +62,7 @@ return [ }, 'after' => ':time po', 'before' => ':time przed', - 'diff_now' => 'przed chwilą', + 'diff_now' => 'teraz', 'diff_today' => 'Dziś', 'diff_today_regexp' => 'Dziś(?:\\s+o)?', 'diff_yesterday' => 'wczoraj', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php index e4aa5a1c7..e03b50675 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sh.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -13,7 +13,7 @@ use Symfony\Component\Translation\PluralizationRules; if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { + PluralizationRules::set(static function ($number) { return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); }, 'sh'); } diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php index c09df19cf..8becbc576 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -24,28 +24,28 @@ use Carbon\CarbonInterface; return [ - 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', + 'year' => ':count година|:count године|:count година', 'y' => ':count г.', - 'month' => '{1}:count месец|{2,3,4}:count месеца|[0,Inf[:count месеци', + 'month' => ':count месец|:count месеца|:count месеци', 'm' => ':count м.', - 'week' => '{1}:count недеља|{2,3,4}:count недеље|[0,Inf[:count недеља', + 'week' => ':count недеља|:count недеље|:count недеља', 'w' => ':count нед.', - 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', + 'day' => ':count дан|:count дана|:count дана', 'd' => ':count д.', - 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', + 'hour' => ':count сат|:count сата|:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51}:count минут|[0,Inf[:count минута', + 'minute' => ':count минут|:count минута|: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 секунде|[0,Inf[:count секунди', + 'second' => ':count секунд|:count секунде|: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 године|[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 недеља', + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', + 'week_from_now' => ':count недељу|:count недеље|:count недеља', + 'week_ago' => ':count недељу|:count недеље|:count недеља', 'diff_now' => 'управо сада', 'diff_today' => 'данас', 'diff_today_regexp' => 'данас(?:\\s+у)?', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php index 0fb63d769..4b29a45c7 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_BA'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Cyrl.php', [ 'formats' => [ 'LT' => 'HH:mm', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php index d13229abc..28d22fd2c 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -16,32 +16,41 @@ */ use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_ME'); +} +// @codeCoverageIgnoreEnd return [ - 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', + 'year' => ':count година|:count године|:count година', 'y' => ':count г.', - 'month' => '{1}:count мјесец|{2,3,4}:count мјесеца|[0,Inf[:count мјесеци', + 'month' => ':count мјесец|:count мјесеца|:count мјесеци', 'm' => ':count мј.', - 'week' => '{1}:count недјеља|{2,3,4}:count недјеље|[0,Inf[:count недјеља', + 'week' => ':count недјеља|:count недјеље|:count недјеља', 'w' => ':count нед.', - 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', + 'day' => ':count дан|:count дана|:count дана', 'd' => ':count д.', - 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', + 'hour' => ':count сат|:count сата|:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51}:count минут|[0,Inf[:count минута', + 'minute' => ':count минут|:count минута|: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 секунде|[0,Inf[:count секунди', + 'second' => ':count секунд|:count секунде|: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 године|[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 година', + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', - 'week_from_now' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', - 'week_ago' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', + 'week_from_now' => ':count недјељу|:count недјеље|:count недјеља', + 'week_ago' => ':count недјељу|:count недјеље|:count недјеља', 'diff_now' => 'управо сада', 'diff_today' => 'данас', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php index 492baf0cb..d6e29b86b 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_XK'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Cyrl_BA.php', [ 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php index 897c674a5..95b2770db 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_BA'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Latn.php', [ 'formats' => [ 'LT' => 'HH:mm', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php index e2133ef1a..5b8f2d062 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -16,6 +16,15 @@ */ use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_ME'); +} +// @codeCoverageIgnoreEnd return array_replace_recursive(require __DIR__.'/sr.php', [ 'month' => ':count mjesec|:count mjeseca|:count mjeseci', @@ -27,6 +36,7 @@ return array_replace_recursive(require __DIR__.'/sr.php', [ 'before' => ':time prije', 'week_from_now' => ':count nedjelju|:count nedjelje|:count nedjelja', 'week_ago' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'second_ago' => ':count sekund|:count sekunde|:count sekundi', 'diff_tomorrow' => 'sjutra', 'calendar' => [ 'nextDay' => '[sjutra u] LT', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php index d0b9d10bb..5278e2e5a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_XK'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Latn_BA.php', [ 'weekdays' => ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], ]); diff --git a/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php b/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php new file mode 100644 index 000000000..a230b0631 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use ReflectionMethod; +use Symfony\Component\Translation\Formatter\MessageFormatter; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +$transMethod = new ReflectionMethod(MessageFormatterInterface::class, 'format'); + +require $transMethod->getParameters()[0]->hasType() + ? __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php' + : __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php'; + +final class MessageFormatterMapper extends LazyMessageFormatter +{ + /** + * Wrapped formatter. + * + * @var MessageFormatterInterface + */ + protected $formatter; + + public function __construct(?MessageFormatterInterface $formatter = null) + { + $this->formatter = $formatter ?? new MessageFormatter(); + } + + protected function transformLocale(?string $locale): ?string + { + return $locale ? preg_replace('/[_@][A-Za-z][a-z]{2,}/', '', $locale) : $locale; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php b/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php index d4c2d8c8e..f6261d882 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php @@ -563,12 +563,17 @@ trait Comparison } /** - * Determines if the instance is a long year + * Determines if the instance is a long year (using calendar year). + * + * ⚠️ This method completely ignores month and day to use the numeric year number, + * it's not correct if the exact date matters. For instance as `2019-12-30` is already + * in the first week of the 2020 year, if you want to know from this date if ISO week + * year 2020 is a long year, use `isLongIsoYear` instead. * * @example * ``` - * Carbon::parse('2015-01-01')->isLongYear(); // true - * Carbon::parse('2016-01-01')->isLongYear(); // false + * Carbon::create(2015)->isLongYear(); // true + * Carbon::create(2016)->isLongYear(); // false * ``` * * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates @@ -580,6 +585,27 @@ trait Comparison return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; } + /** + * Determines if the instance is a long year (using ISO 8601 year). + * + * @example + * ``` + * Carbon::parse('2015-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-03')->isLongIsoYear(); // false + * Carbon::parse('2019-12-29')->isLongIsoYear(); // false + * Carbon::parse('2019-12-30')->isLongIsoYear(); // true + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongIsoYear() + { + return static::create($this->isoWeekYear, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + /** * Compares the formatted values of the two dates. * @@ -996,12 +1022,12 @@ trait Comparison return $current->startOfMinute()->eq($other); } - if (preg_match('/\d(h|am|pm)$/', $tester)) { + if (preg_match('/\d(?:h|am|pm)$/', $tester)) { return $current->startOfHour()->eq($other); } if (preg_match( - '/^(january|february|march|april|may|june|july|august|september|october|november|december)\s+\d+$/i', + '/^(?:january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+\d+)?$/i', $tester )) { return $current->startOfMonth()->eq($other->startOfMonth()); diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php b/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php index 05598d579..fff8a600a 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php @@ -16,6 +16,7 @@ use Carbon\CarbonImmutable; use Carbon\CarbonInterface; use Carbon\CarbonInterval; use Carbon\CarbonPeriod; +use Carbon\CarbonPeriodImmutable; use Carbon\Exceptions\UnitException; use Closure; use DateTime; @@ -605,16 +606,18 @@ trait Converter $interval = CarbonInterval::make("$interval ".static::pluralUnit($unit)); } - $period = (new CarbonPeriod())->setDateClass(static::class)->setStartDate($this); + $period = ($this->isMutable() ? new CarbonPeriod() : new CarbonPeriodImmutable()) + ->setDateClass(static::class) + ->setStartDate($this); if ($interval) { - $period->setDateInterval($interval); + $period = $period->setDateInterval($interval); } if (\is_int($end) || (\is_string($end) && ctype_digit($end))) { - $period->setRecurrences($end); + $period = $period->setRecurrences($end); } elseif ($end) { - $period->setEndDate($end); + $period = $period->setEndDate($end); } return $period; diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php b/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php index be2c0f7c2..d73dad54d 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php @@ -354,13 +354,13 @@ trait Creator * If $hour is not null then the default values for $minute and $second * will be 0. * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param DateTimeZone|string|null $tz + * @param DateTimeInterface|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 InvalidFormatException * @@ -862,6 +862,19 @@ trait Creator */ public static function createFromLocaleFormat($format, $locale, $time, $tz = null) { + $format = preg_replace_callback( + '/(?:\\\\[a-zA-Z]|[bfkqCEJKQRV]){2,}/', + static function (array $match) use ($locale): string { + $word = str_replace('\\', '', $match[0]); + $translatedWord = static::translateTimeString($word, $locale, 'en'); + + return $word === $translatedWord + ? $match[0] + : preg_replace('/[a-zA-Z]/', '\\\\$0', $translatedWord); + }, + $format + ); + return static::rawCreateFromFormat($format, static::translateTimeString($time, $locale, 'en'), $tz); } diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php b/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php index 4f1fceca2..a9868ebf8 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php @@ -844,7 +844,7 @@ trait Difference $parts = min(7, max(1, (int) $parts)); $skip = \is_array($syntax) ? ($syntax['skip'] ?? []) : []; - return $this->diffAsCarbonInterval($other, false, $skip) + return $this->diffAsCarbonInterval($other, false, (array) $skip) ->setLocalTranslator($this->getLocalTranslator()) ->forHumans($syntax, (bool) $short, $parts, $options ?? $this->localHumanDiffOptions ?? static::getHumanDiffOptions()); } diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php b/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php index 88b251df4..595c287b3 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php @@ -151,22 +151,12 @@ trait Mixin protected static function bindMacroContext($context, callable $callable) { static::$macroContextStack[] = $context; - $exception = null; - $result = null; try { - $result = $callable(); - } catch (Throwable $throwable) { - $exception = $throwable; + return $callable(); + } finally { + array_pop(static::$macroContextStack); } - - array_pop(static::$macroContextStack); - - if ($exception) { - throw $exception; - } - - return $result; } /** diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php b/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php index 164dbbd10..39343d8fa 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php @@ -75,7 +75,7 @@ trait Modifiers * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function next($modifier = null) { @@ -157,7 +157,7 @@ trait Modifiers * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function previous($modifier = null) { @@ -451,7 +451,7 @@ trait Modifiers * * @param string $modifier * - * @return static + * @return static|false */ public function change($modifier) { diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Options.php b/vendor/nesbot/carbon/src/Carbon/Traits/Options.php index 0ddee8dd6..9bb3071f5 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Options.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Options.php @@ -441,7 +441,7 @@ trait Options return $var; }); - foreach (['dumpProperties', 'constructedObjectId'] as $property) { + foreach (['dumpProperties', 'constructedObjectId', 'constructed'] as $property) { if (isset($infos[$property])) { unset($infos[$property]); } diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php b/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php index 9e86bd3e9..53fead69e 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php @@ -120,6 +120,8 @@ trait Serialization /** * Returns the list of properties to dump on serialize() called on. * + * Only used by PHP < 7.4. + * * @return array */ public function __sleep() @@ -134,8 +136,16 @@ trait Serialization return $properties; } + /** + * Returns the values to dump on serialize() called on. + * + * Only used by PHP >= 7.4. + * + * @return array + */ public function __serialize(): array { + // @codeCoverageIgnoreStart if (isset($this->timezone_type)) { return [ 'date' => $this->date ?? null, @@ -143,6 +153,7 @@ trait Serialization 'timezone' => $this->timezone ?? null, ]; } + // @codeCoverageIgnoreEnd $timezone = $this->getTimezone(); $export = [ @@ -170,6 +181,8 @@ trait Serialization /** * Set locale if specified on unserialize() called. * + * Only used by PHP < 7.4. + * * @return void */ #[ReturnTypeWillChange] @@ -201,6 +214,13 @@ trait Serialization $this->cleanupDumpProperties(); } + /** + * Set locale if specified on unserialize() called. + * + * Only used by PHP >= 7.4. + * + * @return void + */ public function __unserialize(array $data): void { // @codeCoverageIgnoreStart @@ -269,6 +289,7 @@ trait Serialization */ public function cleanupDumpProperties() { + // @codeCoverageIgnoreStart if (PHP_VERSION < 8.2) { foreach ($this->dumpProperties as $property) { if (isset($this->$property)) { @@ -276,6 +297,7 @@ trait Serialization } } } + // @codeCoverageIgnoreEnd return $this; } diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php b/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php index 38cb24064..a81164f99 100644 --- a/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php +++ b/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php @@ -38,16 +38,16 @@ trait ToStringFormat } /** - * @param string|Closure|null $format - * - * @return void - * * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and * use other method or custom format passed to format() method if you need to dump another string * format. * * Set the default format used when type juggling a Carbon instance to a string. + * + * @param string|Closure|null $format + * + * @return void */ public static function setToStringFormat($format) { diff --git a/vendor/nikic/php-parser/grammar/php5.y b/vendor/nikic/php-parser/grammar/php5.y index a62e9a310..2920deadd 100644 --- a/vendor/nikic/php-parser/grammar/php5.y +++ b/vendor/nikic/php-parser/grammar/php5.y @@ -264,8 +264,13 @@ optional_ellipsis: | T_ELLIPSIS { $$ = true; } ; +identifier_maybe_readonly: + identifier { $$ = $1; } + | T_READONLY { $$ = Node\Identifier[$1]; } +; + function_declaration_statement: - T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' + T_FUNCTION optional_ref identifier_maybe_readonly '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $9]]; } ; @@ -721,8 +726,13 @@ lexical_var: optional_ref plain_variable { $$ = Expr\ClosureUse[$2, $1]; } ; +name_readonly: + T_READONLY { $$ = Name[$1]; } +; + function_call: name argument_list { $$ = Expr\FuncCall[$1, $2]; } + | name_readonly argument_list { $$ = Expr\FuncCall[$1, $2]; } | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier_ex argument_list { $$ = Expr\StaticCall[$1, $3, $4]; } | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' argument_list diff --git a/vendor/nikic/php-parser/grammar/php7.y b/vendor/nikic/php-parser/grammar/php7.y index 5d5fff214..1f9b4bdd2 100644 --- a/vendor/nikic/php-parser/grammar/php7.y +++ b/vendor/nikic/php-parser/grammar/php7.y @@ -350,15 +350,23 @@ block_or_error: | error { $$ = []; } ; +identifier_maybe_readonly: + identifier_not_reserved { $$ = $1; } + | T_READONLY { $$ = Node\Identifier[$1]; } +; + function_declaration_statement: - T_FUNCTION optional_ref identifier_not_reserved '(' parameter_list ')' optional_return_type block_or_error + T_FUNCTION optional_ref identifier_maybe_readonly '(' parameter_list ')' optional_return_type block_or_error { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $8, 'attrGroups' => []]]; } - | attributes T_FUNCTION optional_ref identifier_not_reserved '(' parameter_list ')' optional_return_type block_or_error + | attributes T_FUNCTION optional_ref identifier_maybe_readonly '(' parameter_list ')' optional_return_type block_or_error { $$ = Stmt\Function_[$4, ['byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9, 'attrGroups' => $1]]; } ; class_declaration_statement: - optional_attributes class_entry_type identifier_not_reserved extends_from implements_list '{' class_statement_list '}' + class_entry_type identifier_not_reserved extends_from implements_list '{' class_statement_list '}' + { $$ = Stmt\Class_[$2, ['type' => $1, 'extends' => $3, 'implements' => $4, 'stmts' => $6, 'attrGroups' => []]]; + $this->checkClass($$, #2); } + | attributes class_entry_type identifier_not_reserved extends_from implements_list '{' class_statement_list '}' { $$ = Stmt\Class_[$3, ['type' => $2, 'extends' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]]; $this->checkClass($$, #3); } | optional_attributes T_INTERFACE identifier_not_reserved interface_extends_list '{' class_statement_list '}' @@ -962,8 +970,13 @@ lexical_var: optional_ref plain_variable { $$ = Expr\ClosureUse[$2, $1]; } ; +name_readonly: + T_READONLY { $$ = Name[$1]; } +; + function_call: name argument_list { $$ = Expr\FuncCall[$1, $2]; } + | name_readonly argument_list { $$ = Expr\FuncCall[$1, $2]; } | callable_expr argument_list { $$ = Expr\FuncCall[$1, $2]; } | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM member_name argument_list { $$ = Expr\StaticCall[$1, $3, $4]; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php index 02fa83e62..accc5166b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php @@ -78,8 +78,8 @@ class EnumCase implements PhpParser\Builder return new Stmt\EnumCase( $this->name, $this->value, - $this->attributes, - $this->attributeGroups + $this->attributeGroups, + $this->attributes ); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php index 5c56e026b..b0929f3cc 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php @@ -14,6 +14,7 @@ use PhpParser\Lexer\TokenEmulator\FnTokenEmulator; use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator; use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator; use PhpParser\Lexer\TokenEmulator\NumericLiteralSeparatorEmulator; +use PhpParser\Lexer\TokenEmulator\ReadonlyFunctionTokenEmulator; use PhpParser\Lexer\TokenEmulator\ReadonlyTokenEmulator; use PhpParser\Lexer\TokenEmulator\ReverseEmulator; use PhpParser\Lexer\TokenEmulator\TokenEmulator; @@ -24,6 +25,7 @@ class Emulative extends Lexer const PHP_7_4 = '7.4dev'; const PHP_8_0 = '8.0dev'; const PHP_8_1 = '8.1dev'; + const PHP_8_2 = '8.2dev'; /** @var mixed[] Patches used to reverse changes introduced in the code */ private $patches = []; @@ -41,7 +43,7 @@ class Emulative extends Lexer */ public function __construct(array $options = []) { - $this->targetPhpVersion = $options['phpVersion'] ?? Emulative::PHP_8_1; + $this->targetPhpVersion = $options['phpVersion'] ?? Emulative::PHP_8_2; unset($options['phpVersion']); parent::__construct($options); @@ -57,6 +59,7 @@ class Emulative extends Lexer new EnumTokenEmulator(), new ReadonlyTokenEmulator(), new ExplicitOctalEmulator(), + new ReadonlyFunctionTokenEmulator(), ]; // Collect emulators that are relevant for the PHP version we're running diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php new file mode 100644 index 000000000..e671458c9 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php @@ -0,0 +1,31 @@ +name) : $use->name; // Type is determined either by individual element or whole use declaration diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php index d9c8fe049..351db9ed0 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php @@ -18,8 +18,8 @@ use PhpParser\Node\Stmt; class Php5 extends \PhpParser\ParserAbstract { protected $tokenToSymbolMapSize = 396; - protected $actionTableSize = 1093; - protected $gotoTableSize = 643; + protected $actionTableSize = 1099; + protected $gotoTableSize = 640; protected $invalidSymbol = 168; protected $errorSymbol = 1; @@ -27,7 +27,7 @@ class Php5 extends \PhpParser\ParserAbstract protected $unexpectedTokenRule = 32767; protected $YY2TBLSTATE = 415; - protected $numNonLeafStates = 662; + protected $numNonLeafStates = 663; protected $symbolToName = array( "EOF", @@ -152,6 +152,7 @@ class Php5 extends \PhpParser\ParserAbstract "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", + "T_READONLY", "T_VAR", "T_UNSET", "T_ISSET", @@ -194,7 +195,6 @@ class Php5 extends \PhpParser\ParserAbstract "'`'", "']'", "'\"'", - "T_READONLY", "T_ENUM", "T_NULLSAFE_OBJECT_OPERATOR", "T_ATTRIBUTE" @@ -204,16 +204,16 @@ class Php5 extends \PhpParser\ParserAbstract 0, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 56, 163, 168, 160, 55, 168, 168, - 158, 159, 53, 50, 8, 51, 52, 54, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, 31, 155, + 168, 168, 168, 56, 164, 168, 161, 55, 168, 168, + 159, 160, 53, 50, 8, 51, 52, 54, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 31, 156, 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, - 168, 70, 168, 162, 36, 168, 161, 168, 168, 168, + 168, 70, 168, 163, 36, 168, 162, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 156, 35, 157, 58, 168, 168, 168, + 168, 168, 168, 157, 35, 158, 58, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, @@ -236,124 +236,124 @@ class Php5 extends \PhpParser\ParserAbstract 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 164, - 122, 123, 124, 125, 126, 127, 128, 129, 165, 130, - 131, 132, 166, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 167 + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 165, 131, + 132, 133, 166, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 167 ); protected $action = array( - 699, 669, 670, 671, 672, 673, 286, 674, 675, 676, - 712, 713, 223, 224, 225, 226, 227, 228, 229, 230, + 700, 670, 671, 672, 673, 674, 286, 675, 676, 677, + 713, 714, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,-32766,-32766,-32766,-32766,-32766, -32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, 245, 246, - 242, 243, 244,-32766,-32766, 677,-32766, 750,-32766,-32766, - -32766,-32766,-32766,-32766,-32766, 1224, 245, 246, 1225, 678, - 679, 680, 681, 682, 683, 684,-32766, 48, 746,-32766, - -32766,-32766,-32766,-32766,-32766, 685, 686, 687, 688, 689, - 690, 691, 692, 693, 694, 695, 715, 738, 716, 717, - 718, 719, 707, 708, 709, 737, 710, 711, 696, 697, - 698, 700, 701, 702, 740, 741, 742, 743, 744, 745, - 703, 704, 705, 706, 736, 727, 725, 726, 722, 723, - 751, 714, 720, 721, 728, 729, 731, 730, 732, 733, - 55, 56, 425, 57, 58, 724, 735, 734, 1073, 59, - 60, -224, 61,-32766,-32766,-32766,-32766,-32766,-32766,-32766, - -32766,-32766,-32766, 121,-32767,-32767,-32767,-32767, 29, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 1043, 766, 1071, 767, 580, 62, 63,-32766, - -32766,-32766,-32766, 64, 516, 65, 294, 295, 66, 67, - 68, 69, 70, 71, 72, 73, 822, 25, 302, 74, - 418, 981, 983, 1043, 1181, 1095, 1096, 1073, 748, 754, - 1075, 1074, 1076, 469,-32766,-32766,-32766, 337, 823, 54, - -32767,-32767,-32767,-32767, 98, 99, 100, 101, 102, 220, - 221, 222, 78, 361, 1107,-32766, 341,-32766,-32766,-32766, - -32766,-32766, 1107, 492, 949, 950, 951, 948, 947, 946, - 207, 477, 478, 949, 950, 951, 948, 947, 946, 1043, - 479, 480, 52, 1101, 1102, 1103, 1104, 1098, 1099, 319, - 872, 668, 667, 27, -511, 1105, 1100,-32766, 130, 1075, - 1074, 1076, 345, 668, 667, 41, 126, 341, 334, 369, - 336, 426, -128, -128, -128, 896, 897, 468, 220, 221, - 222, 811, 1195, 619, 40, 21, 427, -128, 470, -128, - 471, -128, 472, -128, 802, 428, -4, 823, 54, 207, - 33, 34, 429, 360, 317, 28, 35, 473,-32766,-32766, - -32766, 211, 356, 357, 474, 475,-32766,-32766,-32766, 754, - 476, 49, 313, 794, 843, 430, 431, 289, 125,-32766, - 813,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767, - -32767,-32767,-32767,-32766,-32766,-32766, 769, 103, 104, 105, - 327, 307, 825, 633, -128, 1075, 1074, 1076, 221, 222, - 927, 748, 1146, 106,-32766, 129,-32766,-32766,-32766,-32766, - 426, 823, 54, 902, 873, 302, 468, 75, 207, 359, - 811, 668, 667, 40, 21, 427, 754, 470, 754, 471, - 423, 472, 1043, 127, 428, 435, 1043, 341, 1043, 33, - 34, 429, 360, 1181, 415, 35, 473, 122, 10, 315, - 128, 356, 357, 474, 475,-32766,-32766,-32766, 768, 476, - 668, 667, 758, 843, 430, 431, 754, 1043, 1147,-32766, - -32766,-32766, 754, 419, 342, 1215,-32766, 131,-32766,-32766, - -32766, 341, 363, 346, 426, 823, 54, 100, 101, 102, - 468, 825, 633, -4, 811, 442, 903, 40, 21, 427, - 754, 470, 435, 471, 341, 472, 341, 766, 428, 767, - -209, -209, -209, 33, 34, 429, 360, 479, 1196, 35, - 473, 345,-32766,-32766,-32766, 356, 357, 474, 475, 220, - 221, 222, 421, 476, 32, 297, 794, 843, 430, 431, - 754, 754, 435,-32766, 341,-32766,-32766, 9, 300, 51, - 207, 249, 324, 753, 120, 220, 221, 222, 426, 30, - 247, 941, 422, 424, 468, 825, 633, -209, 811, 1043, - 1061, 40, 21, 427, 129, 470, 207, 471, 341, 472, - 804, 20, 428, 124, -208, -208, -208, 33, 34, 429, - 360, 479, 212, 35, 473, 923, -259, 823, 54, 356, - 357, 474, 475,-32766,-32766,-32766, 1043, 476, 213, 806, - 794, 843, 430, 431,-32766,-32766, 435, 435, 341, 341, - 443, 79, 80, 81,-32766, 668, 667, 636, 344, 808, - 668, 667, 239, 240, 241, 123, 214, 538, 250, 825, - 633, -208, 36, 251, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 252, 307, - 426, 220, 221, 222, 823, 54, 468,-32766, 222, 765, - 811, 106, 134, 40, 21, 427, 571, 470, 207, 471, - 445, 472, 207,-32766, 428, 896, 897, 207, 307, 33, - 34, 429, 245, 246, 637, 35, 473, 452, 22, 809, - 922, 356, 357, 457, 588, 135, 374, 595, 596, 476, - -228, 759, 639, 938, 653, 926, 661, -86, 823, 54, - 314, 644, 647, 821, 133, 836, 43, 106, 603, 44, - 45, 46, 47, 748, 50, 53, 132, 426, 302,-32766, - 520, 825, 633, 468, -84, 607, 577, 811, 641, 362, - 40, 21, 427, -278, 470, 754, 471, 954, 472, 441, - 627, 428, 823, 54, 574, 844, 33, 34, 429, 11, - 615, 845, 35, 473, 444, 461, 285, -511, 356, 357, - 592, -419, 593, 1106, 1153, -410, 476, 368, 838, 38, - 658, 426, 645, 795, 1052, 0, 325, 468, 0,-32766, - 0, 811, 0, 0, 40, 21, 427, 0, 470, 0, - 471, 0, 472, 0, 322, 428, 823, 54, 825, 633, - 33, 34, 429, 0, 326, 0, 35, 473, 323, 0, - 316, 318, 356, 357, -512, 426, 0, 753, 531, 0, - 476, 468, 6, 0, 0, 811, 650, 7, 40, 21, - 427, 12, 470, 14, 471, 373, 472, -420, 562, 428, - 823, 54, 78, -225, 33, 34, 429, 39, 656, 657, - 35, 473, 859, 633, 764, 812, 356, 357, 820, 799, - 814, 875, 866, 867, 476, 797, 860, 857, 855, 426, - 933, 934, 931, 819, 803, 468, 805, 807, 810, 811, - 930, 762, 40, 21, 427, 763, 470, 932, 471, 335, - 472, 358, 634, 428, 638, 640, 825, 633, 33, 34, - 429, 642, 643, 646, 35, 473, 648, 649, 651, 652, - 356, 357, 635, 426, 1221, 1223, 761, 842, 476, 468, - 248, 760, 841, 811, 1222, 840, 40, 21, 427, 1057, - 470, 830, 471, 1045, 472, 839, 1046, 428, 828, 215, - 216, 939, 33, 34, 429, 217, 864, 218, 35, 473, - 825, 633, 24, 865, 356, 357, 456, 1220, 1189, 209, - 1187, 1172, 476, 1185, 215, 216, 1086, 1095, 1096, 914, - 217, 1193, 218, 1183, -224, 1097, 26, 31, 37, 42, - 76, 77, 210, 288, 209, 292, 293, 308, 309, 310, - 311, 339, 1095, 1096, 825, 633, 355, 291, 416, 1152, - 1097, 16, 17, 18, 393, 453, 460, 462, 466, 552, - 624, 1048, 1051, 904, 1111, 1047, 1023, 563, 1022, 1088, - 0, 0, -429, 558, 1041, 1101, 1102, 1103, 1104, 1098, - 1099, 398, 1054, 1053, 1056, 1055, 1070, 1105, 1100, 1186, - 1171, 1167, 1184, 1085, 1218, 1112, 1166, 219, 558, 599, - 1101, 1102, 1103, 1104, 1098, 1099, 398, 0, 0, 0, - 0, 0, 1105, 1100, 0, 0, 0, 0, 0, 0, - 0, 0, 219 + 242, 243, 244,-32766,-32766, 678,-32766,-32766,-32766,-32766, + -32766,-32766,-32766,-32766,-32766, 1229, 245, 246, 1230, 679, + 680, 681, 682, 683, 684, 685, 899, 900, 747,-32766, + -32766,-32766,-32766,-32766,-32766, 686, 687, 688, 689, 690, + 691, 692, 693, 694, 695, 696, 716, 739, 717, 718, + 719, 720, 708, 709, 710, 738, 711, 712, 697, 698, + 699, 701, 702, 703, 741, 742, 743, 744, 745, 746, + 875, 704, 705, 706, 707, 737, 728, 726, 727, 723, + 724, 1046, 715, 721, 722, 729, 730, 732, 731, 733, + 734, 55, 56, 425, 57, 58, 725, 736, 735, 755, + 59, 60, -226, 61,-32766,-32766,-32766,-32766,-32766,-32766, + -32766,-32766,-32766,-32766, 337,-32767,-32767,-32767,-32767, 29, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 620,-32766,-32766,-32766,-32766, 62, 63, + 1046,-32766,-32766,-32766, 64, 419, 65, 294, 295, 66, + 67, 68, 69, 70, 71, 72, 73, 823, 25, 302, + 74, 418, 984, 986, 669, 668, 1100, 1101, 1078, 755, + 755, 767, 1220, 768, 470,-32766,-32766,-32766, 341, 749, + 824, 54,-32767,-32767,-32767,-32767, 98, 99, 100, 101, + 102, 220, 221, 222, 362, 876,-32766, 27,-32766,-32766, + -32766,-32766,-32766, 1046, 493, 126, 1080, 1079, 1081, 370, + 1068, 930, 207, 478, 479, 952, 953, 954, 951, 950, + 949, 128, 480, 481, 803, 1106, 1107, 1108, 1109, 1103, + 1104, 319, 32, 297, 10, 211, -515, 1110, 1105, 669, + 668, 1080, 1079, 1081, 220, 221, 222, 41, 364, 341, + 334, 421, 336, 426, -128, -128, -128, 313, 1046, 469, + -4, 824, 54, 812, 770, 207, 40, 21, 427, -128, + 471, -128, 472, -128, 473, -128, 1046, 428, 220, 221, + 222,-32766, 33, 34, 429, 361, 327, 52, 35, 474, + -32766,-32766,-32766, 342, 357, 358, 475, 476, 48, 207, + 249, 669, 668, 477, 443, 300, 795, 846, 430, 431, + 28,-32766, 814,-32766,-32766,-32766,-32766,-32766,-32766,-32766, + -32767,-32767,-32767,-32767,-32767, 952, 953, 954, 951, 950, + 949, 422, 755, 424, 426, 826, 634, -128,-32766,-32766, + 469, 824, 54, 288, 812, 1151, 755, 40, 21, 427, + 317, 471, 345, 472, 129, 473, 9, 1186, 428, 769, + 360, 324, 905, 33, 34, 429, 361, 1046, 415, 35, + 474, 944, 1068, 315, 125, 357, 358, 475, 476,-32766, + -32766,-32766, 926, 302, 477, 121, 1068, 759, 846, 430, + 431, 669, 668, 423, 755, 1152, 809, 1046, 480, 766, + -32766, 805,-32766,-32766,-32766,-32766, -261, 127, 347, 436, + 841, 341, 1078, 1200, 426, 446, 826, 634, -4, 807, + 469, 824, 54, 436, 812, 341, 755, 40, 21, 427, + 444, 471, 130, 472, 1068, 473, 346, 767, 428, 768, + -211, -211, -211, 33, 34, 429, 361, 308, 1076, 35, + 474,-32766,-32766,-32766, 1046, 357, 358, 475, 476,-32766, + -32766,-32766, 906, 120, 477, 539, 1068, 795, 846, 430, + 431, 436,-32766, 341,-32766,-32766,-32766, 1046, 480, 810, + -32766, 925,-32766,-32766, 754, 1080, 1079, 1081, 49,-32766, + -32766,-32766, 749, 751, 426, 1201, 826, 634, -211, 30, + 469, 669, 668, 436, 812, 341, 75, 40, 21, 427, + -32766, 471, 1064, 472, 124, 473, 669, 668, 428, 212, + -210, -210, -210, 33, 34, 429, 361, 51, 1186, 35, + 474, 755,-32766,-32766,-32766, 357, 358, 475, 476, 213, + 824, 54, 221, 222, 477, 20, 581, 795, 846, 430, + 431, 220, 221, 222, 755, 222, 247, 78, 79, 80, + 81, 341, 207, 517, 103, 104, 105, 752, 307, 131, + 637, 1068, 207, 341, 207, 122, 826, 634, -210, 36, + 106, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 1112, 307, 346, 436, 214, + 341, 824, 54, 426, 123, 250, 129, 134, 106, 469, + -32766, 572, 1112, 812, 245, 246, 40, 21, 427, 251, + 471, 252, 472, 341, 473, 453, 22, 428, 207, 899, + 900, 638, 33, 34, 429, 824, 54, -86, 35, 474, + 220, 221, 222, 314, 357, 358, 100, 101, 102, 239, + 240, 241, 645, 477, -230, 458, 589, 135, 374, 596, + 597, 207, 760, 640, 648, 642, 941, 654, 929, 662, + 822, 133, 307, 837, 426,-32766, 106, 749, 43, 44, + 469, 45, 442, 46, 812, 826, 634, 40, 21, 427, + 47, 471, 50, 472, 53, 473, 132, 608, 428, 302, + 604, -280,-32766, 33, 34, 429, 824, 54, 426, 35, + 474, 755, 957, -84, 469, 357, 358, 521, 812, 628, + 363, 40, 21, 427, 477, 471, 575, 472, -515, 473, + 847, 616, 428, -423,-32766, 11, 646, 33, 34, 429, + 824, 54, 445, 35, 474, 462, 285, 578, 1111, 357, + 358, 593, 369, 848, 594, 290, 826, 634, 477, 0, + 0, 532, 0, 0, 325, 0, 0, 0, 0, 0, + 651, 0, 0, 0, 322, 326, 0, 0, 0, 426, + 0, 0, 0, 0, 323, 469, 316, 318, -516, 812, + 862, 634, 40, 21, 427, 0, 471, 0, 472, 0, + 473, 1158, 0, 428, 0, -414, 6, 7, 33, 34, + 429, 824, 54, 426, 35, 474, 12, 14, 373, 469, + 357, 358, -424, 812, 563, 754, 40, 21, 427, 477, + 471, 248, 472, 839, 473, 38, 39, 428, 657, 658, + 765, 813, 33, 34, 429, 821, 800, 815, 35, 474, + 215, 216, 878, 869, 357, 358, 217, 870, 218, 798, + 863, 826, 634, 477, 860, 858, 936, 937, 934, 820, + 209, 804, 806, 808, 811, 933, 763, 764, 1100, 1101, + 935, 659, 78, 335, 426, 359, 1102, 635, 639, 641, + 469, 643, 644, 647, 812, 826, 634, 40, 21, 427, + 649, 471, 650, 472, 652, 473, 653, 636, 428, 796, + 1226, 1228, 762, 33, 34, 429, 215, 216, 845, 35, + 474, 761, 217, 844, 218, 357, 358, 1227, 843, 1060, + 831, 1048, 842, 1049, 477, 559, 209, 1106, 1107, 1108, + 1109, 1103, 1104, 398, 1100, 1101, 829, 942, 867, 1110, + 1105, 868, 1102, 457, 1225, 1194, 1192, 1177, 1157, 219, + 1190, 1091, 917, 1198, 1188, 0, 826, 634, 24, -433, + 26, 31, 37, 42, 76, 77, 210, 287, 292, 293, + 308, 309, 310, 311, 339, 356, 416, 0, -227, -226, + 16, 17, 18, 393, 454, 461, 463, 467, 553, 625, + 1051, 559, 1054, 1106, 1107, 1108, 1109, 1103, 1104, 398, + 907, 1116, 1050, 1026, 564, 1110, 1105, 1025, 1093, 1055, + 0, 1044, 0, 1057, 1056, 219, 1059, 1058, 1075, 0, + 1191, 1176, 1172, 1189, 1090, 1223, 1117, 1171, 600 ); protected $actionCheck = array( @@ -362,360 +362,359 @@ class Php5 extends \PhpParser\ParserAbstract 41, 42, 0, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 9, 10, 11, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 69, 70, - 53, 54, 55, 9, 10, 57, 30, 80, 32, 33, + 53, 54, 55, 9, 10, 57, 30, 116, 32, 33, 34, 35, 36, 37, 38, 80, 69, 70, 83, 71, - 72, 73, 74, 75, 76, 77, 9, 70, 80, 33, + 72, 73, 74, 75, 76, 77, 135, 136, 80, 33, 34, 35, 36, 37, 38, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 153, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 3, 4, 5, 6, 7, 147, 148, 149, 80, 12, - 13, 159, 15, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 156, 44, 45, 46, 47, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 13, 106, 116, 108, 85, 50, 51, 33, - 34, 35, 36, 56, 85, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 1, 70, 71, 72, - 73, 59, 60, 13, 82, 78, 79, 80, 80, 82, - 152, 153, 154, 86, 9, 10, 11, 8, 1, 2, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 9, - 10, 11, 156, 106, 143, 30, 160, 32, 33, 34, - 35, 36, 143, 116, 116, 117, 118, 119, 120, 121, - 30, 124, 125, 116, 117, 118, 119, 120, 121, 13, - 133, 134, 70, 136, 137, 138, 139, 140, 141, 142, - 31, 37, 38, 8, 132, 148, 149, 116, 156, 152, - 153, 154, 160, 37, 38, 158, 8, 160, 161, 8, - 163, 74, 75, 76, 77, 134, 135, 80, 9, 10, - 11, 84, 1, 80, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 155, 98, 0, 1, 2, 30, - 103, 104, 105, 106, 132, 8, 109, 110, 9, 10, - 11, 8, 115, 116, 117, 118, 9, 10, 11, 82, - 123, 70, 8, 126, 127, 128, 129, 8, 156, 30, - 155, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 9, 10, 11, 157, 53, 54, 55, - 8, 57, 155, 156, 157, 152, 153, 154, 10, 11, - 157, 80, 162, 69, 30, 151, 32, 33, 34, 35, - 74, 1, 2, 159, 155, 71, 80, 151, 30, 8, - 84, 37, 38, 87, 88, 89, 82, 91, 82, 93, - 8, 95, 13, 156, 98, 158, 13, 160, 13, 103, - 104, 105, 106, 82, 108, 109, 110, 156, 8, 113, - 31, 115, 116, 117, 118, 9, 10, 11, 157, 123, - 37, 38, 126, 127, 128, 129, 82, 13, 159, 33, - 34, 35, 82, 127, 8, 85, 30, 156, 32, 33, - 34, 160, 8, 147, 74, 1, 2, 50, 51, 52, - 80, 155, 156, 157, 84, 31, 159, 87, 88, 89, - 82, 91, 158, 93, 160, 95, 160, 106, 98, 108, - 100, 101, 102, 103, 104, 105, 106, 133, 159, 109, - 110, 160, 9, 10, 11, 115, 116, 117, 118, 9, - 10, 11, 8, 123, 144, 145, 126, 127, 128, 129, - 82, 82, 158, 30, 160, 32, 33, 108, 8, 70, - 30, 31, 113, 152, 16, 9, 10, 11, 74, 14, - 14, 122, 8, 8, 80, 155, 156, 157, 84, 13, - 159, 87, 88, 89, 151, 91, 30, 93, 160, 95, - 155, 159, 98, 14, 100, 101, 102, 103, 104, 105, - 106, 133, 16, 109, 110, 155, 157, 1, 2, 115, - 116, 117, 118, 9, 10, 11, 13, 123, 16, 155, - 126, 127, 128, 129, 33, 34, 158, 158, 160, 160, - 156, 9, 10, 11, 30, 37, 38, 31, 70, 155, - 37, 38, 50, 51, 52, 156, 16, 81, 16, 155, - 156, 157, 30, 16, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 16, 57, - 74, 9, 10, 11, 1, 2, 80, 116, 11, 155, - 84, 69, 156, 87, 88, 89, 160, 91, 30, 93, - 132, 95, 30, 33, 98, 134, 135, 30, 57, 103, - 104, 105, 69, 70, 31, 109, 110, 75, 76, 155, - 155, 115, 116, 75, 76, 101, 102, 111, 112, 123, - 159, 155, 156, 155, 156, 155, 156, 31, 1, 2, - 31, 31, 31, 31, 31, 38, 70, 69, 77, 70, - 70, 70, 70, 80, 70, 70, 70, 74, 71, 85, - 85, 155, 156, 80, 97, 96, 100, 84, 31, 106, - 87, 88, 89, 82, 91, 82, 93, 82, 95, 89, - 92, 98, 1, 2, 90, 127, 103, 104, 105, 97, - 94, 127, 109, 110, 97, 97, 97, 132, 115, 116, - 100, 146, 113, 143, 143, 146, 123, 106, 151, 155, - 157, 74, 31, 157, 162, -1, 114, 80, -1, 116, - -1, 84, -1, -1, 87, 88, 89, -1, 91, -1, - 93, -1, 95, -1, 130, 98, 1, 2, 155, 156, - 103, 104, 105, -1, 130, -1, 109, 110, 131, -1, - 132, 132, 115, 116, 132, 74, -1, 152, 150, -1, - 123, 80, 146, -1, -1, 84, 31, 146, 87, 88, - 89, 146, 91, 146, 93, 146, 95, 146, 150, 98, - 1, 2, 156, 159, 103, 104, 105, 155, 155, 155, - 109, 110, 155, 156, 155, 155, 115, 116, 155, 155, - 155, 155, 155, 155, 123, 155, 155, 155, 155, 74, - 155, 155, 155, 155, 155, 80, 155, 155, 155, 84, - 155, 155, 87, 88, 89, 155, 91, 155, 93, 156, - 95, 156, 156, 98, 156, 156, 155, 156, 103, 104, - 105, 156, 156, 156, 109, 110, 156, 156, 156, 156, - 115, 116, 156, 74, 157, 157, 157, 157, 123, 80, - 31, 157, 157, 84, 157, 157, 87, 88, 89, 157, - 91, 157, 93, 157, 95, 157, 157, 98, 157, 50, - 51, 157, 103, 104, 105, 56, 157, 58, 109, 110, - 155, 156, 158, 157, 115, 116, 157, 157, 157, 70, - 157, 157, 123, 157, 50, 51, 157, 78, 79, 157, - 56, 157, 58, 157, 159, 86, 158, 158, 158, 158, - 158, 158, 158, 158, 70, 158, 158, 158, 158, 158, - 158, 158, 78, 79, 155, 156, 158, 160, 158, 163, - 86, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 31, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 13, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 3, 4, 5, 6, 7, 148, 149, 150, 82, + 12, 13, 160, 15, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 8, 44, 45, 46, 47, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 80, 33, 34, 35, 36, 50, 51, + 13, 9, 10, 11, 56, 128, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 1, 70, 71, + 72, 73, 59, 60, 37, 38, 78, 79, 80, 82, + 82, 106, 85, 108, 86, 9, 10, 11, 161, 80, + 1, 2, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 9, 10, 11, 106, 156, 30, 8, 32, 33, + 34, 35, 36, 13, 116, 8, 153, 154, 155, 8, + 122, 158, 30, 125, 126, 116, 117, 118, 119, 120, + 121, 31, 134, 135, 156, 137, 138, 139, 140, 141, + 142, 143, 145, 146, 8, 8, 133, 149, 150, 37, + 38, 153, 154, 155, 9, 10, 11, 159, 8, 161, + 162, 8, 164, 74, 75, 76, 77, 8, 13, 80, + 0, 1, 2, 84, 158, 30, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 13, 98, 9, 10, + 11, 9, 103, 104, 105, 106, 8, 70, 109, 110, + 9, 10, 11, 8, 115, 116, 117, 118, 70, 30, + 31, 37, 38, 124, 31, 8, 127, 128, 129, 130, + 8, 30, 156, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 116, 117, 118, 119, 120, + 121, 8, 82, 8, 74, 156, 157, 158, 33, 34, + 80, 1, 2, 8, 84, 163, 82, 87, 88, 89, + 133, 91, 70, 93, 152, 95, 108, 82, 98, 158, + 8, 113, 160, 103, 104, 105, 106, 13, 108, 109, + 110, 123, 122, 113, 157, 115, 116, 117, 118, 9, + 10, 11, 156, 71, 124, 157, 122, 127, 128, 129, + 130, 37, 38, 8, 82, 160, 156, 13, 134, 156, + 30, 156, 32, 33, 34, 35, 158, 157, 148, 159, + 122, 161, 80, 1, 74, 133, 156, 157, 158, 156, + 80, 1, 2, 159, 84, 161, 82, 87, 88, 89, + 157, 91, 157, 93, 122, 95, 161, 106, 98, 108, + 100, 101, 102, 103, 104, 105, 106, 159, 116, 109, + 110, 9, 10, 11, 13, 115, 116, 117, 118, 9, + 10, 11, 160, 16, 124, 81, 122, 127, 128, 129, + 130, 159, 30, 161, 32, 33, 34, 13, 134, 156, + 30, 156, 32, 33, 153, 153, 154, 155, 70, 9, + 10, 11, 80, 80, 74, 160, 156, 157, 158, 14, + 80, 37, 38, 159, 84, 161, 152, 87, 88, 89, + 30, 91, 160, 93, 14, 95, 37, 38, 98, 16, + 100, 101, 102, 103, 104, 105, 106, 70, 82, 109, + 110, 82, 33, 34, 35, 115, 116, 117, 118, 16, + 1, 2, 10, 11, 124, 160, 85, 127, 128, 129, + 130, 9, 10, 11, 82, 11, 14, 157, 9, 10, + 11, 161, 30, 85, 53, 54, 55, 154, 57, 157, + 31, 122, 30, 161, 30, 157, 156, 157, 158, 30, + 69, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 144, 57, 161, 159, 16, + 161, 1, 2, 74, 157, 16, 152, 157, 69, 80, + 116, 161, 144, 84, 69, 70, 87, 88, 89, 16, + 91, 16, 93, 161, 95, 75, 76, 98, 30, 135, + 136, 31, 103, 104, 105, 1, 2, 31, 109, 110, + 9, 10, 11, 31, 115, 116, 50, 51, 52, 50, + 51, 52, 31, 124, 160, 75, 76, 101, 102, 111, + 112, 30, 156, 157, 31, 31, 156, 157, 156, 157, + 31, 31, 57, 38, 74, 33, 69, 80, 70, 70, + 80, 70, 89, 70, 84, 156, 157, 87, 88, 89, + 70, 91, 70, 93, 70, 95, 70, 96, 98, 71, + 77, 82, 85, 103, 104, 105, 1, 2, 74, 109, + 110, 82, 82, 97, 80, 115, 116, 85, 84, 92, + 106, 87, 88, 89, 124, 91, 90, 93, 133, 95, + 128, 94, 98, 147, 116, 97, 31, 103, 104, 105, + 1, 2, 97, 109, 110, 97, 97, 100, 144, 115, + 116, 100, 106, 128, 113, 161, 156, 157, 124, -1, + -1, 151, -1, -1, 114, -1, -1, -1, -1, -1, + 31, -1, -1, -1, 131, 131, -1, -1, -1, 74, + -1, -1, -1, -1, 132, 80, 133, 133, 133, 84, + 156, 157, 87, 88, 89, -1, 91, -1, 93, -1, + 95, 144, -1, 98, -1, 147, 147, 147, 103, 104, + 105, 1, 2, 74, 109, 110, 147, 147, 147, 80, + 115, 116, 147, 84, 151, 153, 87, 88, 89, 124, + 91, 31, 93, 152, 95, 156, 156, 98, 156, 156, + 156, 156, 103, 104, 105, 156, 156, 156, 109, 110, + 50, 51, 156, 156, 115, 116, 56, 156, 58, 156, + 156, 156, 157, 124, 156, 156, 156, 156, 156, 156, + 70, 156, 156, 156, 156, 156, 156, 156, 78, 79, + 156, 158, 157, 157, 74, 157, 86, 157, 157, 157, + 80, 157, 157, 157, 84, 156, 157, 87, 88, 89, + 157, 91, 157, 93, 157, 95, 157, 157, 98, 158, + 158, 158, 158, 103, 104, 105, 50, 51, 158, 109, + 110, 158, 56, 158, 58, 115, 116, 158, 158, 158, + 158, 158, 158, 158, 124, 135, 70, 137, 138, 139, + 140, 141, 142, 143, 78, 79, 158, 158, 158, 149, + 150, 158, 86, 158, 158, 158, 158, 158, 164, 159, + 158, 158, 158, 158, 158, -1, 156, 157, 159, 162, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - -1, -1, 161, 134, 161, 136, 137, 138, 139, 140, - 141, 142, 162, 162, 162, 162, 162, 148, 149, 162, - 162, 162, 162, 162, 162, 162, 162, 158, 134, 162, - 136, 137, 138, 139, 140, 141, 142, -1, -1, -1, - -1, -1, 148, 149, -1, -1, -1, -1, -1, -1, - -1, -1, 158 + 159, 159, 159, 159, 159, 159, 159, -1, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 135, 160, 137, 138, 139, 140, 141, 142, 143, + 160, 160, 160, 160, 160, 149, 150, 160, 160, 163, + -1, 162, -1, 163, 163, 159, 163, 163, 163, -1, + 163, 163, 163, 163, 163, 163, 163, 163, 163 ); protected $actionBase = array( - 0, 227, 326, 400, 474, 233, 132, 132, 752, -2, - -2, 138, -2, -2, -2, 663, 761, 815, 761, 586, - 717, 859, 859, 859, 244, 256, 256, 256, 413, 583, - 583, 880, 546, 169, 415, 444, 409, 200, 200, 200, - 200, 137, 137, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 249, 205, 738, 559, - 535, 739, 741, 742, 876, 679, 877, 820, 821, 693, - 823, 824, 826, 829, 832, 819, 834, 907, 836, 602, - 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, - 602, 67, 536, 299, 510, 230, 44, 652, 652, 652, - 652, 652, 652, 652, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 378, 584, 584, 584, 657, 909, 648, 934, - 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, - 934, 934, 934, 503, -21, -21, 436, 650, 364, 571, - 215, 426, 156, 26, 26, 329, 329, 329, 329, 329, - 46, 46, 5, 5, 5, 5, 152, 186, 186, 186, - 186, 120, 120, 120, 120, 374, 374, 429, 448, 448, - 334, 267, 449, 449, 449, 449, 449, 449, 449, 449, - 449, 449, 336, 427, 427, 572, 572, 408, 551, 551, - 551, 551, 671, 171, 171, 391, 311, 311, 311, 109, - 641, 856, 68, 68, 68, 68, 68, 68, 324, 324, - 324, -3, -3, -3, 655, 77, 380, 77, 380, 683, - 685, 86, 685, 654, -15, 516, 776, 281, 646, 809, - 680, 816, 560, 711, 202, 578, 857, 643, -23, 578, - 578, 578, 578, 857, 622, 628, 596, -23, 578, -23, - 639, 454, 849, 351, 249, 558, 469, 631, 743, 514, - 688, 746, 464, 544, 548, 556, 7, 412, 708, 750, - 878, 879, 349, 702, 631, 631, 631, 327, 101, 7, - -8, 623, 623, 623, 623, 219, 623, 623, 623, 623, - 291, 430, 545, 401, 745, 653, 653, 675, 839, 814, - 814, 653, 673, 653, 675, 841, 841, 841, 841, 653, - 653, 653, 653, 814, 814, 667, 814, 275, 684, 694, - 694, 841, 713, 714, 653, 653, 697, 814, 814, 814, - 697, 687, 841, 669, 637, 333, 814, 841, 689, 673, - 689, 653, 669, 689, 673, 673, 689, 22, 686, 656, - 840, 842, 860, 756, 638, 644, 847, 848, 843, 845, - 838, 692, 719, 720, 528, 659, 660, 661, 662, 696, - 664, 698, 643, 658, 658, 658, 645, 701, 645, 658, - 658, 658, 658, 658, 658, 658, 658, 632, 635, 709, - 699, 670, 723, 566, 582, 758, 640, 636, 872, 865, - 881, 883, 849, 870, 645, 890, 634, 288, 610, 850, - 633, 753, 645, 851, 645, 759, 645, 873, 777, 666, - 778, 779, 658, 874, 891, 892, 893, 894, 897, 898, - 899, 900, 665, 901, 724, 674, 866, 344, 844, 639, - 705, 677, 755, 725, 780, 372, 902, 784, 645, 645, - 765, 706, 645, 766, 726, 712, 862, 727, 867, 903, - 640, 678, 868, 645, 681, 785, 904, 372, 690, 651, - 704, 649, 728, 858, 875, 853, 767, 612, 617, 787, - 788, 792, 691, 730, 863, 864, 835, 731, 770, 642, - 771, 676, 794, 772, 852, 732, 796, 798, 871, 647, - 707, 682, 672, 668, 773, 799, 869, 733, 735, 736, - 801, 737, 804, 0, 0, 0, 0, 0, 0, 0, + 0, 229, 310, 390, 470, 103, 325, 325, 784, -2, + -2, 149, -2, -2, -2, 660, 765, 799, 765, 589, + 694, 870, 870, 870, 252, 404, 404, 404, 514, 177, + 177, 918, 434, 118, 295, 313, 240, 491, 491, 491, + 491, 138, 138, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 491, 89, 206, 773, 550, + 535, 775, 776, 777, 912, 709, 913, 856, 857, 700, + 858, 859, 862, 863, 864, 855, 865, 935, 866, 599, + 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, + 599, 322, 592, 285, 319, 232, 44, 691, 691, 691, + 691, 691, 691, 691, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, + 182, 182, 582, 530, 530, 530, 594, 860, 658, 926, + 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, + 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, + 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, + 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, + 926, 926, 926, 500, -21, -21, 492, 702, 420, 355, + 216, 549, 151, 26, 26, 331, 331, 331, 331, 331, + 46, 46, 5, 5, 5, 5, 153, 188, 188, 188, + 188, 121, 121, 121, 121, 314, 314, 394, 394, 362, + 300, 298, 499, 499, 499, 499, 499, 499, 499, 499, + 499, 499, 67, 656, 656, 659, 659, 522, 554, 554, + 554, 554, 679, -59, -59, 381, 462, 462, 462, 528, + 717, 854, 382, 382, 382, 382, 382, 382, 561, 561, + 561, -3, -3, -3, 692, 115, 137, 115, 137, 678, + 732, 450, 732, 338, 677, -15, 510, 810, 468, 707, + 850, 711, 853, 572, 735, 267, 529, 654, 674, 463, + 529, 529, 529, 529, 654, 610, 640, 608, 463, 529, + 463, 718, 323, 496, 89, 570, 507, 675, 778, 293, + 670, 780, 290, 373, 332, 566, 278, 435, 733, 781, + 914, 917, 385, 715, 675, 675, 675, 352, 511, 278, + -8, 605, 605, 605, 605, 156, 605, 605, 605, 605, + 251, 276, 375, 402, 779, 657, 657, 690, 872, 869, + 869, 657, 689, 657, 690, 874, 874, 874, 874, 657, + 657, 657, 657, 869, 869, 869, 688, 869, 239, 703, + 704, 704, 874, 742, 743, 657, 657, 712, 869, 869, + 869, 712, 695, 874, 701, 741, 277, 869, 874, 672, + 689, 672, 657, 701, 672, 689, 689, 672, 22, 666, + 668, 873, 875, 887, 790, 662, 685, 879, 880, 876, + 878, 871, 699, 744, 745, 497, 669, 671, 673, 680, + 719, 682, 713, 674, 667, 667, 667, 655, 720, 655, + 667, 667, 667, 667, 667, 667, 667, 667, 916, 646, + 731, 714, 653, 749, 553, 573, 791, 664, 811, 900, + 893, 867, 919, 881, 898, 655, 920, 739, 247, 643, + 882, 783, 786, 655, 883, 655, 792, 655, 902, 812, + 686, 813, 814, 667, 910, 921, 923, 924, 925, 927, + 928, 929, 930, 684, 931, 750, 696, 894, 299, 877, + 718, 729, 705, 788, 751, 820, 328, 932, 823, 655, + 655, 794, 785, 655, 795, 756, 740, 890, 757, 895, + 933, 664, 708, 896, 655, 706, 825, 934, 328, 681, + 683, 888, 661, 761, 886, 911, 885, 796, 649, 663, + 829, 830, 831, 693, 763, 891, 892, 889, 764, 803, + 665, 805, 697, 832, 807, 884, 768, 833, 834, 899, + 676, 730, 710, 698, 687, 809, 835, 897, 769, 770, + 771, 848, 772, 849, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 137, 137, 137, 137, -2, -2, -2, - -2, 0, 0, -2, 0, 0, 0, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 0, 0, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 602, 602, - 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, - 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, - 602, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 602, -21, -21, -21, -21, 602, -21, - -21, -21, -21, -21, -21, -21, 602, 602, 602, 602, - 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, - 602, 602, 602, 602, -21, 602, 602, 602, -21, 68, - -21, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 602, 0, 0, 602, -21, - 602, -21, 602, -21, -21, 602, 602, 602, 602, 602, - 602, 602, -21, -21, -21, -21, -21, -21, 0, 324, - 324, 324, 324, -21, -21, -21, -21, 68, 68, 147, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 324, 324, -3, -3, 68, - 68, 68, 68, 68, 147, 68, 68, -23, 673, 673, - 673, 380, 380, 380, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 380, -23, 0, -23, - 0, 68, -23, 673, -23, 380, 673, 673, -23, 814, - 604, 604, 604, 604, 372, 7, 0, 0, 673, 673, - 0, 0, 0, 0, 0, 673, 0, 0, 0, 0, - 0, 0, 814, 0, 653, 0, 0, 0, 0, 658, - 288, 0, 677, 456, 0, 0, 0, 0, 0, 0, - 677, 456, 530, 530, 0, 665, 658, 658, 658, 0, + 0, 0, 0, 0, 138, 138, 138, 138, -2, -2, + -2, -2, 0, 0, -2, 0, 0, 0, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 0, 0, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 599, + 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, + 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, + 599, 599, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 599, -21, -21, -21, -21, 599, + -21, -21, -21, -21, -21, -21, -21, 599, 599, 599, + 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, + 599, 599, 599, 599, 599, -21, 599, 599, 599, -21, + 382, -21, 382, 382, 382, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 599, 0, 0, 599, + -21, 599, -21, 599, -21, -21, 599, 599, 599, 599, + 599, 599, 599, -21, -21, -21, -21, -21, -21, 0, + 561, 561, 561, 561, -21, -21, -21, -21, 382, 382, + 382, 382, 382, 382, 259, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 561, 561, -3, -3, + 382, 382, 382, 382, 382, 259, 382, 382, 463, 689, + 689, 689, 137, 137, 137, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 137, 463, 0, + 463, 0, 382, 463, 689, 463, 657, 137, 689, 689, + 463, 869, 616, 616, 616, 616, 328, 278, 0, 0, + 689, 689, 0, 0, 0, 0, 0, 689, 0, 0, + 0, 0, 0, 0, 869, 0, 0, 0, 0, 0, + 667, 247, 0, 705, 335, 0, 0, 0, 0, 0, + 0, 705, 335, 347, 347, 0, 684, 667, 667, 667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 372 + 0, 0, 0, 0, 0, 0, 0, 328 ); protected $actionDefault = array( 3,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 540, 540, 495,32767,32767, - 32767,32767,32767,32767,32767,32767,32767, 297, 297, 297, - 32767,32767,32767, 528, 528, 528, 528, 528, 528, 528, - 528, 528, 528, 528,32767,32767,32767,32767,32767,32767, - 381,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 544, 544, 499,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 299, 299, 299, + 32767,32767,32767, 532, 532, 532, 532, 532, 532, 532, + 532, 532, 532, 532,32767,32767,32767,32767,32767,32767, + 383,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 387, - 545,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 362, - 363, 365, 366, 296, 548, 529, 245, 388, 544, 295, - 247, 325, 499,32767,32767,32767, 327, 122, 256, 201, - 498, 125, 294, 232, 380, 382, 326, 301, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 300, 454, 359, 358, 357, 456,32767, 455, 492, - 492, 495,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 389, + 549,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 364, + 365, 367, 368, 298, 552, 533, 247, 390, 548, 297, + 249, 327, 503,32767,32767,32767, 329, 122, 258, 203, + 502, 125, 296, 234, 382, 384, 328, 303, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 302, 458, 361, 360, 359, 460,32767, 459, 496, + 496, 499,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 323, 483, 482, 324, 452, 328, 453, - 331, 457, 460, 329, 330, 347, 348, 345, 346, 349, - 458, 459, 476, 477, 474, 475, 299, 350, 351, 352, - 353, 478, 479, 480, 481,32767,32767, 280, 539, 539, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 338, 339, 467, 468,32767, 236, 236, - 236, 236, 281, 236,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767, 333, 334, - 332, 462, 463, 461, 428,32767,32767,32767, 430,32767, - 32767,32767,32767,32767,32767,32767,32767, 500,32767,32767, - 32767,32767,32767, 513, 417, 171,32767, 409,32767, 171, - 171, 171, 171,32767, 220, 222, 167,32767, 171,32767, - 486,32767,32767,32767,32767,32767, 518, 343,32767,32767, - 116,32767,32767,32767, 555,32767, 513,32767, 116,32767, - 32767,32767,32767, 356, 335, 336, 337,32767,32767, 517, - 511, 470, 471, 472, 473,32767, 464, 465, 466, 469, - 32767,32767,32767,32767,32767,32767,32767,32767, 425, 431, - 431,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 516, 515,32767, 410, 494, 186, 184, - 184,32767, 206, 206,32767,32767, 188, 487, 506,32767, - 188, 173,32767, 398, 175, 494,32767,32767, 238,32767, - 238,32767, 398, 238,32767,32767, 238,32767, 411, 435, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 377, 378, 489, 502,32767, - 503,32767, 409, 341, 342, 344, 320,32767, 322, 367, - 368, 369, 370, 371, 372, 373, 375,32767, 415,32767, - 418,32767,32767,32767, 255,32767, 553,32767,32767, 304, - 553,32767,32767,32767, 547,32767,32767, 298,32767,32767, - 32767,32767, 251,32767, 169,32767, 537,32767, 554,32767, - 511,32767, 340,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 512,32767,32767,32767,32767, 227,32767, 448, - 32767, 116,32767,32767,32767, 187,32767,32767, 302, 246, - 32767,32767, 546,32767,32767,32767,32767,32767,32767,32767, - 32767, 114,32767, 170,32767,32767,32767, 189,32767,32767, - 511,32767,32767,32767,32767,32767,32767,32767, 293,32767, - 32767,32767,32767,32767,32767,32767, 511,32767,32767, 231, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 411, - 32767, 274,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 127, 127, 3, 127, 127, 258, 3, - 258, 127, 258, 258, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 214, 217, 206, 206, 164, 127, - 127, 266 + 32767,32767,32767, 325, 487, 486, 326, 456, 330, 457, + 333, 461, 464, 331, 332, 349, 350, 347, 348, 351, + 462, 463, 480, 481, 478, 479, 301, 352, 353, 354, + 355, 482, 483, 484, 485,32767,32767, 543, 543,32767, + 32767, 282,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 340, 341, 471, 472,32767, 238, 238, + 238, 238, 283, 238,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 335, 336, + 334, 466, 467, 465, 432,32767,32767,32767, 434,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 504,32767, + 32767,32767,32767,32767, 517, 421, 171,32767, 413,32767, + 171, 171, 171, 171,32767, 222, 224, 167,32767, 171, + 32767, 490,32767,32767,32767,32767, 522, 345,32767,32767, + 116,32767,32767,32767, 559,32767, 517,32767, 116,32767, + 32767,32767,32767, 358, 337, 338, 339,32767,32767, 521, + 515, 474, 475, 476, 477,32767, 468, 469, 470, 473, + 32767,32767,32767,32767,32767,32767,32767,32767, 429, 435, + 435,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 520, 519,32767, 414, 498, 188, + 186, 186,32767, 208, 208,32767,32767, 190, 491, 510, + 32767, 190, 173,32767, 400, 175, 498,32767,32767, 240, + 32767, 240,32767, 400, 240,32767,32767, 240,32767, 415, + 439,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 379, 380, 493, 506, + 32767, 507,32767, 413, 343, 344, 346, 322,32767, 324, + 369, 370, 371, 372, 373, 374, 375, 377,32767, 419, + 32767, 422,32767,32767,32767, 257,32767, 557,32767,32767, + 306, 557,32767,32767,32767, 551,32767,32767, 300,32767, + 32767,32767,32767, 253,32767, 169,32767, 541,32767, 558, + 32767, 515,32767, 342,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 516,32767,32767,32767,32767, 229,32767, + 452,32767, 116,32767,32767,32767, 189,32767,32767, 304, + 248,32767,32767, 550,32767,32767,32767,32767,32767,32767, + 32767,32767, 114,32767, 170,32767,32767,32767, 191,32767, + 32767, 515,32767,32767,32767,32767,32767,32767,32767, 295, + 32767,32767,32767,32767,32767,32767,32767, 515,32767,32767, + 233,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 415,32767, 276,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 127, 127, 3, 127, 127, 260, + 3, 260, 127, 260, 260, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 216, 219, 208, 208, 164, + 127, 127, 268 ); protected $goto = array( 166, 140, 140, 140, 166, 187, 168, 144, 147, 141, 142, 143, 149, 163, 163, 163, 163, 144, 144, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, - 138, 159, 160, 161, 162, 184, 139, 185, 493, 494, - 377, 495, 499, 500, 501, 502, 503, 504, 505, 506, - 967, 164, 145, 146, 148, 171, 176, 186, 203, 253, + 138, 159, 160, 161, 162, 184, 139, 185, 494, 495, + 377, 496, 500, 501, 502, 503, 504, 505, 506, 507, + 970, 164, 145, 146, 148, 171, 176, 186, 203, 253, 256, 258, 260, 263, 264, 265, 266, 267, 268, 269, 277, 278, 279, 280, 303, 304, 328, 329, 330, 394, - 395, 396, 542, 188, 189, 190, 191, 192, 193, 194, + 395, 396, 543, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 150, 151, 152, 167, 153, 169, 154, 204, 170, 155, 156, 157, 205, - 158, 136, 620, 560, 756, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 1108, - 628, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, - 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, - 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, - 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, - 1108, 1108, 1108, 1108, 1108, 757, 888, 888, 508, 1200, - 1200, 400, 606, 508, 536, 536, 568, 532, 534, 534, - 496, 498, 524, 540, 569, 572, 583, 590, 852, 852, - 852, 852, 847, 853, 174, 585, 519, 600, 601, 177, + 158, 136, 621, 561, 757, 561, 561, 561, 561, 561, + 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, + 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, + 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, + 561, 561, 561, 561, 561, 561, 561, 561, 561, 1113, + 629, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, + 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, + 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, + 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, + 1113, 1113, 1113, 1113, 1113, 758, 520, 531, 509, 656, + 556, 1183, 750, 509, 592, 786, 1183, 888, 612, 613, + 884, 617, 618, 624, 626, 631, 633, 817, 855, 855, + 855, 855, 850, 856, 174, 891, 891, 1205, 1205, 177, 178, 179, 401, 402, 403, 404, 173, 202, 206, 208, 257, 259, 261, 262, 270, 271, 272, 273, 274, 275, 281, 282, 283, 284, 305, 306, 331, 332, 333, 406, 407, 408, 409, 175, 180, 254, 255, 181, 182, 183, - 497, 497, 785, 497, 497, 497, 497, 497, 497, 497, - 497, 497, 497, 497, 497, 497, 497, 509, 578, 582, - 626, 749, 509, 544, 545, 546, 547, 548, 549, 550, - 551, 553, 586, 338, 559, 321, 559, 559, 559, 559, - 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - 530, 349, 655, 555, 587, 352, 414, 591, 575, 604, - 885, 611, 612, 881, 616, 617, 623, 625, 630, 632, - 298, 296, 296, 296, 298, 290, 299, 944, 610, 816, - 1170, 613, 436, 436, 375, 436, 436, 436, 436, 436, - 436, 436, 436, 436, 436, 436, 436, 436, 436, 1072, - 1084, 1083, 945, 1065, 1072, 895, 895, 895, 895, 1178, - 895, 895, 1212, 1212, 1178, 388, 858, 561, 755, 1072, - 1072, 1072, 1072, 1072, 1072, 3, 4, 384, 384, 384, - 1212, 874, 856, 854, 856, 654, 465, 511, 883, 878, - 1089, 541, 384, 537, 384, 567, 384, 1026, 19, 15, - 371, 384, 1226, 510, 1204, 1192, 1192, 1192, 510, 906, - 372, 522, 533, 554, 912, 514, 1068, 1069, 13, 1065, - 378, 912, 1158, 594, 23, 965, 386, 386, 386, 602, - 1066, 1169, 1066, 937, 447, 449, 631, 752, 1177, 1067, - 1109, 614, 935, 1177, 605, 1197, 391, 1211, 1211, 543, - 892, 386, 1194, 1194, 1194, 399, 518, 1016, 901, 389, - 771, 529, 752, 340, 752, 1211, 518, 518, 385, 781, - 1214, 770, 772, 1063, 910, 774, 1058, 1176, 659, 953, - 514, 782, 862, 915, 450, 573, 1155, 0, 463, 0, + 498, 498, 498, 498, 498, 498, 861, 498, 498, 498, + 498, 498, 498, 498, 498, 498, 498, 510, 586, 538, + 601, 602, 510, 545, 546, 547, 548, 549, 550, 551, + 552, 554, 587, 1209, 560, 350, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 400, 607, 537, 537, 569, 533, 909, 535, 535, 497, + 499, 525, 541, 570, 573, 584, 591, 298, 296, 296, + 296, 298, 289, 299, 611, 378, 511, 614, 595, 947, + 375, 511, 437, 437, 437, 437, 437, 437, 1163, 437, + 437, 437, 437, 437, 437, 437, 437, 437, 437, 1077, + 948, 338, 1175, 321, 1077, 898, 898, 898, 898, 606, + 898, 898, 1217, 1217, 1202, 753, 576, 605, 756, 1077, + 1077, 1077, 1077, 1077, 1077, 1069, 384, 384, 384, 391, + 1217, 877, 859, 857, 859, 655, 466, 512, 886, 881, + 753, 384, 753, 384, 968, 384, 895, 385, 588, 353, + 414, 384, 1231, 1019, 542, 1197, 1197, 1197, 568, 1094, + 386, 386, 386, 904, 915, 515, 1029, 19, 15, 372, + 389, 915, 940, 448, 450, 632, 340, 1216, 1216, 1114, + 615, 938, 840, 555, 775, 386, 913, 1070, 1073, 1074, + 399, 1069, 1182, 660, 23, 1216, 773, 1182, 544, 603, + 1066, 1219, 1071, 1174, 1071, 519, 1199, 1199, 1199, 1089, + 1088, 1072, 343, 523, 534, 519, 519, 772, 351, 352, + 13, 579, 583, 627, 1061, 388, 782, 562, 771, 515, + 783, 1181, 3, 4, 918, 956, 865, 451, 574, 1160, + 464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 514, 529, 0, 0, 0, 0, + 514, 0, 529, 0, 0, 0, 0, 610, 513, 516, + 439, 440, 1067, 619, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 780, 1224, 0, 0, 0, 0, + 0, 524, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 513, 528, 0, 0, 0, 0, - 513, 0, 528, 0, 350, 351, 0, 609, 512, 515, - 438, 439, 1064, 618, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 779, 1219, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 777, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 301, 301 + 0, 0, 0, 0, 0, 0, 0, 0, 301, 301 ); protected $gotoCheck = array( @@ -730,96 +729,95 @@ class Php5 extends \PhpParser\ParserAbstract 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 57, 68, 15, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 126, - 9, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 16, 76, 76, 68, 76, - 76, 51, 51, 68, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 68, 68, - 68, 68, 68, 68, 27, 66, 101, 66, 66, 27, + 43, 43, 57, 69, 15, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 128, + 9, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 16, 102, 32, 69, 32, + 32, 120, 6, 69, 32, 29, 120, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 50, 69, 69, + 69, 69, 69, 69, 27, 77, 77, 77, 77, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 117, 117, 29, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 61, 61, - 61, 6, 117, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 125, 57, 125, 57, 57, 57, 57, + 119, 119, 119, 119, 119, 119, 33, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 67, 110, + 67, 67, 119, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 142, 57, 72, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 32, 71, 32, 32, 69, 69, 69, 32, 40, 40, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 5, 5, 5, 5, 5, 5, 5, 97, 62, 50, - 81, 62, 57, 57, 62, 57, 57, 57, 57, 57, + 51, 51, 51, 51, 51, 51, 84, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 5, 5, 5, + 5, 5, 5, 5, 63, 46, 124, 63, 129, 98, + 63, 124, 57, 57, 57, 57, 57, 57, 133, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 124, 124, 97, 81, 57, 57, 57, 57, 57, 118, - 57, 57, 142, 142, 118, 12, 33, 12, 14, 57, - 57, 57, 57, 57, 57, 30, 30, 13, 13, 13, - 142, 14, 14, 14, 14, 14, 57, 14, 14, 14, - 34, 2, 13, 109, 13, 2, 13, 34, 34, 34, - 34, 13, 13, 122, 140, 9, 9, 9, 122, 83, - 58, 58, 58, 34, 13, 13, 81, 81, 58, 81, - 46, 13, 131, 127, 34, 101, 123, 123, 123, 34, - 81, 81, 81, 8, 8, 8, 8, 11, 119, 81, - 8, 8, 8, 119, 49, 138, 48, 141, 141, 47, - 78, 123, 119, 119, 119, 123, 47, 102, 80, 17, - 23, 9, 11, 18, 11, 141, 47, 47, 11, 23, - 141, 23, 24, 115, 84, 25, 113, 119, 73, 99, - 13, 26, 70, 85, 64, 65, 130, -1, 108, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 98, 127, 82, 127, 57, 57, 57, 57, 57, 49, + 57, 57, 144, 144, 140, 11, 40, 40, 14, 57, + 57, 57, 57, 57, 57, 82, 13, 13, 13, 48, + 144, 14, 14, 14, 14, 14, 57, 14, 14, 14, + 11, 13, 11, 13, 102, 13, 79, 11, 70, 70, + 70, 13, 13, 103, 2, 9, 9, 9, 2, 34, + 125, 125, 125, 81, 13, 13, 34, 34, 34, 34, + 17, 13, 8, 8, 8, 8, 18, 143, 143, 8, + 8, 8, 9, 34, 25, 125, 85, 82, 82, 82, + 125, 82, 121, 74, 34, 143, 24, 121, 47, 34, + 116, 143, 82, 82, 82, 47, 121, 121, 121, 126, + 126, 82, 58, 58, 58, 47, 47, 23, 72, 72, + 58, 62, 62, 62, 114, 12, 23, 12, 23, 13, + 26, 121, 30, 30, 86, 100, 71, 65, 66, 132, + 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 9, -1, -1, -1, -1, - 9, -1, 9, -1, 71, 71, -1, 13, 9, 9, + 9, -1, 9, -1, -1, -1, -1, 13, 9, 9, 9, 9, 13, 13, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 9, 9, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 9, 9, -1, -1, -1, -1, + -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 5, 5 + -1, -1, -1, -1, -1, -1, -1, -1, 5, 5 ); protected $gotoBase = array( - 0, 0, -184, 0, 0, 356, 290, 0, 488, 149, - 0, 182, 85, 118, 426, 112, 203, 179, 208, 0, - 0, 0, 0, 162, 190, 198, 120, 27, 0, 272, - -224, 0, -274, 406, 32, 0, 0, 0, 0, 0, - 330, 0, 0, -24, 0, 0, 440, 485, 213, 218, - 371, -74, 0, 0, 0, 0, 0, 107, 110, 0, - 0, -11, -72, 0, 104, 95, -405, 0, -94, 41, - 119, -82, 0, 164, 0, 0, -79, 0, 197, 0, - 204, 43, 0, 441, 171, 121, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 100, 0, 115, - 0, 195, 210, 0, 0, 0, 0, 0, 86, 427, - 259, 0, 0, 116, 0, 174, 0, -5, 117, 196, - 0, 0, 161, 170, 93, -21, -48, 273, 0, 0, - 91, 271, 0, 0, 0, 0, 0, 0, 216, 0, - 437, 187, 102, 0, 0 + 0, 0, -172, 0, 0, 353, 201, 0, 477, 149, + 0, 110, 195, 117, 426, 112, 203, 140, 171, 0, + 0, 0, 0, 168, 164, 157, 119, 27, 0, 205, + -118, 0, -428, 266, 51, 0, 0, 0, 0, 0, + 388, 0, 0, -24, 0, 0, 345, 484, 146, 133, + 209, 75, 0, 0, 0, 0, 0, 107, 161, 0, + 0, 0, 222, -77, 0, 106, 97, -343, 0, -94, + 135, 123, -129, 0, 129, 0, 0, -50, 0, 143, + 0, 159, 64, 0, 338, 132, 122, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 98, 0, + 121, 0, 165, 156, 0, 0, 0, 0, 0, 87, + 273, 259, 0, 0, 114, 0, 150, 0, 0, -5, + -91, 200, 0, 0, 84, 154, 202, 77, -48, 178, + 0, 0, 93, 187, 0, 0, 0, 0, 0, 0, + 136, 0, 286, 167, 102, 0, 0 ); protected $gotoDefault = array( - -32768, 467, 663, 2, 664, 834, 739, 747, 597, 481, - 629, 581, 380, 1188, 791, 792, 793, 381, 367, 482, - 379, 410, 405, 780, 773, 775, 783, 172, 411, 786, - 1, 788, 517, 824, 1017, 364, 796, 365, 589, 798, - 526, 800, 801, 137, 382, 383, 527, 483, 390, 576, - 815, 276, 387, 817, 366, 818, 827, 370, 464, 454, - 459, 556, 608, 432, 446, 570, 564, 535, 1081, 565, - 861, 348, 869, 660, 877, 880, 484, 557, 891, 451, - 899, 1094, 397, 905, 911, 916, 287, 919, 417, 412, - 584, 924, 925, 5, 929, 621, 622, 8, 312, 952, - 598, 966, 420, 1036, 1038, 485, 486, 521, 458, 507, - 525, 487, 1059, 440, 413, 1062, 488, 489, 433, 434, - 1078, 354, 1163, 353, 448, 320, 1150, 579, 1113, 455, - 1203, 1159, 347, 490, 491, 376, 1182, 392, 1198, 437, - 1205, 1213, 343, 539, 566 + -32768, 468, 664, 2, 665, 835, 740, 748, 598, 482, + 630, 582, 380, 1193, 792, 793, 794, 381, 368, 483, + 379, 410, 405, 781, 774, 776, 784, 172, 411, 787, + 1, 789, 518, 825, 1020, 365, 797, 366, 590, 799, + 527, 801, 802, 137, 382, 383, 528, 484, 390, 577, + 816, 276, 387, 818, 367, 819, 828, 371, 465, 455, + 460, 530, 557, 609, 432, 447, 571, 565, 536, 1086, + 566, 864, 349, 872, 661, 880, 883, 485, 558, 894, + 452, 902, 1099, 397, 908, 914, 919, 291, 922, 417, + 412, 585, 927, 928, 5, 932, 622, 623, 8, 312, + 955, 599, 969, 420, 1039, 1041, 486, 487, 522, 459, + 508, 526, 488, 1062, 441, 413, 1065, 433, 489, 490, + 434, 435, 1083, 355, 1168, 354, 449, 320, 1155, 580, + 1118, 456, 1208, 1164, 348, 491, 492, 376, 1187, 392, + 1203, 438, 1210, 1218, 344, 540, 567 ); protected $ruleToNonTerminal = array( @@ -840,19 +838,20 @@ class Php5 extends \PhpParser\ParserAbstract 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 14, 14, 54, 54, 56, 55, 55, 48, - 48, 58, 58, 59, 59, 60, 60, 15, 16, 16, - 16, 63, 63, 63, 64, 64, 67, 67, 65, 65, - 69, 69, 41, 41, 50, 50, 53, 53, 53, 52, - 52, 70, 42, 42, 42, 42, 71, 71, 72, 72, - 73, 73, 39, 39, 35, 35, 74, 37, 37, 75, - 36, 36, 38, 38, 49, 49, 49, 61, 61, 77, - 77, 78, 78, 80, 80, 80, 79, 79, 62, 62, - 81, 81, 81, 82, 82, 83, 83, 83, 44, 44, - 84, 84, 84, 45, 45, 85, 85, 86, 86, 66, - 87, 87, 87, 87, 92, 92, 93, 93, 94, 94, - 94, 94, 94, 95, 96, 96, 91, 91, 88, 88, - 90, 90, 98, 98, 97, 97, 97, 97, 97, 97, - 89, 89, 100, 99, 99, 46, 46, 40, 40, 43, + 48, 58, 58, 59, 59, 60, 60, 61, 61, 15, + 16, 16, 16, 64, 64, 64, 65, 65, 68, 68, + 66, 66, 70, 70, 41, 41, 50, 50, 53, 53, + 53, 52, 52, 71, 42, 42, 42, 42, 72, 72, + 73, 73, 74, 74, 39, 39, 35, 35, 75, 37, + 37, 76, 36, 36, 38, 38, 49, 49, 49, 62, + 62, 78, 78, 79, 79, 81, 81, 81, 80, 80, + 63, 63, 82, 82, 82, 83, 83, 84, 84, 84, + 44, 44, 85, 85, 85, 45, 45, 86, 86, 87, + 87, 67, 88, 88, 88, 88, 93, 93, 94, 94, + 95, 95, 95, 95, 95, 96, 97, 97, 92, 92, + 89, 89, 91, 91, 99, 99, 98, 98, 98, 98, + 98, 98, 90, 90, 101, 100, 100, 46, 46, 40, + 40, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, @@ -860,26 +859,25 @@ class Php5 extends \PhpParser\ParserAbstract 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 34, 34, 47, 47, 105, - 105, 106, 106, 106, 106, 112, 101, 101, 108, 108, - 114, 114, 115, 116, 116, 116, 116, 116, 116, 68, - 68, 57, 57, 57, 57, 102, 102, 120, 120, 117, - 117, 121, 121, 121, 121, 103, 103, 103, 107, 107, - 107, 113, 113, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 27, 27, 27, 27, - 27, 27, 128, 128, 128, 128, 128, 128, 128, 128, + 43, 43, 43, 43, 43, 43, 43, 34, 34, 47, + 47, 106, 106, 107, 107, 107, 107, 113, 102, 102, + 109, 109, 115, 115, 116, 117, 118, 118, 118, 118, + 118, 118, 118, 69, 69, 57, 57, 57, 57, 103, + 103, 122, 122, 119, 119, 123, 123, 123, 123, 104, + 104, 104, 108, 108, 108, 114, 114, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 111, 111, 104, 104, - 104, 104, 127, 127, 130, 130, 129, 129, 131, 131, - 51, 51, 51, 51, 133, 133, 132, 132, 132, 132, - 132, 134, 134, 119, 119, 122, 122, 118, 118, 136, - 135, 135, 135, 135, 123, 123, 123, 123, 110, 110, - 124, 124, 124, 124, 76, 137, 137, 138, 138, 138, - 109, 109, 139, 139, 140, 140, 140, 140, 140, 125, - 125, 125, 125, 142, 143, 141, 141, 141, 141, 141, - 141, 141, 144, 144, 144 + 27, 27, 27, 27, 27, 27, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 112, 112, 105, 105, 105, 105, 129, 129, 132, 132, + 131, 131, 133, 133, 51, 51, 51, 51, 135, 135, + 134, 134, 134, 134, 134, 136, 136, 121, 121, 124, + 124, 120, 120, 138, 137, 137, 137, 137, 125, 125, + 125, 125, 111, 111, 126, 126, 126, 126, 77, 139, + 139, 140, 140, 140, 110, 110, 141, 141, 142, 142, + 142, 142, 142, 127, 127, 127, 127, 144, 145, 143, + 143, 143, 143, 143, 143, 143, 146, 146, 146 ); protected $ruleToLength = array( @@ -900,46 +898,46 @@ class Php5 extends \PhpParser\ParserAbstract 2, 3, 2, 3, 2, 3, 3, 3, 3, 1, 2, 2, 5, 7, 9, 5, 6, 3, 3, 2, 2, 1, 1, 1, 0, 2, 8, 0, 4, 1, - 3, 0, 1, 0, 1, 0, 1, 10, 7, 6, - 5, 1, 2, 2, 0, 2, 0, 2, 0, 2, - 1, 3, 1, 4, 1, 4, 1, 1, 4, 1, - 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, - 1, 1, 1, 4, 0, 2, 3, 0, 2, 4, - 0, 2, 0, 3, 1, 2, 1, 1, 0, 1, - 3, 4, 6, 1, 1, 1, 0, 1, 0, 2, - 2, 3, 3, 1, 3, 1, 2, 2, 3, 1, - 1, 2, 4, 3, 1, 1, 3, 2, 0, 1, - 3, 3, 9, 3, 1, 3, 0, 2, 4, 5, - 4, 4, 4, 3, 1, 1, 1, 3, 1, 1, - 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 3, 3, 1, 0, 1, 1, - 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 0, 1, 0, 1, 0, 1, 1, 1, 10, + 7, 6, 5, 1, 2, 2, 0, 2, 0, 2, + 0, 2, 1, 3, 1, 4, 1, 4, 1, 1, + 4, 1, 3, 3, 3, 4, 4, 5, 0, 2, + 4, 3, 1, 1, 1, 4, 0, 2, 3, 0, + 2, 4, 0, 2, 0, 3, 1, 2, 1, 1, + 0, 1, 3, 4, 6, 1, 1, 1, 0, 1, + 0, 2, 2, 3, 3, 1, 3, 1, 2, 2, + 3, 1, 1, 2, 4, 3, 1, 1, 3, 2, + 0, 1, 3, 3, 9, 3, 1, 3, 0, 2, + 4, 5, 4, 4, 4, 3, 1, 1, 1, 3, + 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 1, 3, 3, 1, 0, + 1, 1, 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 5, 4, 3, - 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, - 2, 1, 2, 10, 11, 3, 3, 2, 4, 4, - 3, 4, 4, 4, 4, 7, 3, 2, 0, 4, - 1, 3, 2, 2, 4, 6, 2, 2, 4, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 4, 4, 0, 2, 1, 0, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 2, 1, 3, 1, 4, - 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 5, 4, 4, 3, 1, 3, 1, 1, - 3, 3, 0, 2, 0, 1, 3, 1, 3, 1, - 1, 1, 1, 1, 6, 4, 3, 4, 2, 4, - 4, 1, 3, 1, 2, 1, 1, 4, 1, 1, - 3, 6, 4, 4, 4, 4, 1, 4, 0, 1, - 1, 3, 1, 1, 4, 3, 1, 1, 1, 0, - 0, 2, 3, 1, 3, 1, 4, 2, 2, 2, - 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, - 6, 3, 1, 1, 1 + 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 3, 5, + 4, 3, 4, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, + 1, 3, 2, 1, 2, 10, 11, 3, 3, 2, + 4, 4, 3, 4, 4, 4, 4, 7, 3, 2, + 0, 4, 1, 3, 2, 1, 2, 2, 4, 6, + 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 4, 4, 0, + 2, 1, 0, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, + 1, 3, 1, 4, 3, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, + 1, 3, 1, 1, 3, 3, 0, 2, 0, 1, + 3, 1, 3, 1, 1, 1, 1, 1, 6, 4, + 3, 4, 2, 4, 4, 1, 3, 1, 2, 1, + 1, 4, 1, 1, 3, 6, 4, 4, 4, 4, + 1, 4, 0, 1, 1, 3, 1, 1, 4, 3, + 1, 1, 1, 0, 0, 2, 3, 1, 3, 1, + 4, 2, 2, 2, 2, 1, 2, 1, 1, 1, + 4, 3, 3, 3, 6, 3, 1, 1, 1 ); protected function initReduceCallbacks() { @@ -1492,36 +1490,36 @@ class Php5 extends \PhpParser\ParserAbstract $this->semValue = true; }, 177 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(10-3)], ['byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-5)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 178 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 179 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(10-3)], ['byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-5)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 180 => function ($stackPos) { $this->semValue = new Stmt\Class_($this->semStack[$stackPos-(7-2)], ['type' => $this->semStack[$stackPos-(7-1)], 'extends' => $this->semStack[$stackPos-(7-3)], 'implements' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); $this->checkClass($this->semValue, $stackPos-(7-2)); }, - 179 => function ($stackPos) { + 181 => function ($stackPos) { $this->semValue = new Stmt\Interface_($this->semStack[$stackPos-(6-2)], ['extends' => $this->semStack[$stackPos-(6-3)], 'stmts' => $this->semStack[$stackPos-(6-5)]], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkInterface($this->semValue, $stackPos-(6-2)); }, - 180 => function ($stackPos) { + 182 => function ($stackPos) { $this->semValue = new Stmt\Trait_($this->semStack[$stackPos-(5-2)], ['stmts' => $this->semStack[$stackPos-(5-4)]], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, - 181 => function ($stackPos) { + 183 => function ($stackPos) { $this->semValue = 0; }, - 182 => function ($stackPos) { + 184 => function ($stackPos) { $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; }, - 183 => function ($stackPos) { + 185 => function ($stackPos) { $this->semValue = Stmt\Class_::MODIFIER_FINAL; }, - 184 => function ($stackPos) { - $this->semValue = null; - }, - 185 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, 186 => function ($stackPos) { - $this->semValue = array(); + $this->semValue = null; }, 187 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-2)]; @@ -1533,16 +1531,16 @@ class Php5 extends \PhpParser\ParserAbstract $this->semValue = $this->semStack[$stackPos-(2-2)]; }, 190 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semValue = array(); }, 191 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, 192 => function ($stackPos) { - $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 193 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 194 => function ($stackPos) { $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); @@ -1554,679 +1552,679 @@ class Php5 extends \PhpParser\ParserAbstract $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); }, 197 => function ($stackPos) { - $this->semValue = null; + $this->semValue = $this->semStack[$stackPos-(4-2)]; }, 198 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 199 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 200 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 201 => function ($stackPos) { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 202 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; - }, - 203 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-3)]; - }, - 204 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 205 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(5-3)]; - }, - 206 => function ($stackPos) { - $this->semValue = array(); - }, - 207 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 208 => function ($stackPos) { - $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 209 => function ($stackPos) { - $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 210 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 211 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 212 => function ($stackPos) { $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); }, - 213 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 214 => function ($stackPos) { - $this->semValue = array(); - }, - 215 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 216 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(3-2)], is_array($this->semStack[$stackPos-(3-3)]) ? $this->semStack[$stackPos-(3-3)] : array($this->semStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 217 => function ($stackPos) { - $this->semValue = array(); - }, - 218 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 219 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 220 => function ($stackPos) { + 199 => function ($stackPos) { $this->semValue = null; }, + 200 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 201 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 202 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 203 => function ($stackPos) { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 204 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 205 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 206 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 207 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(5-3)]; + }, + 208 => function ($stackPos) { + $this->semValue = array(); + }, + 209 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 210 => function ($stackPos) { + $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 211 => function ($stackPos) { + $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 212 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 213 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 214 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 215 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 216 => function ($stackPos) { + $this->semValue = array(); + }, + 217 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 218 => function ($stackPos) { + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(3-2)], is_array($this->semStack[$stackPos-(3-3)]) ? $this->semStack[$stackPos-(3-3)] : array($this->semStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 219 => function ($stackPos) { + $this->semValue = array(); + }, + 220 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, 221 => function ($stackPos) { - $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 222 => function ($stackPos) { $this->semValue = null; }, 223 => function ($stackPos) { - $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 224 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + $this->semValue = null; }, 225 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(2-2)], true); + $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 226 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)], false); }, 227 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = array($this->semStack[$stackPos-(2-2)], true); }, 228 => function ($stackPos) { - $this->semValue = array(); + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); }, 229 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 230 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = array(); }, 231 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos-(4-4)], null, $this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue); + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 232 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-3)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue); + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 233 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Node\Param($this->semStack[$stackPos-(4-4)], null, $this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue); }, 234 => function ($stackPos) { - $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Node\Param($this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-3)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue); }, 235 => function ($stackPos) { - $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 236 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 237 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 238 => function ($stackPos) { $this->semValue = null; }, 239 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 240 => function ($stackPos) { - $this->semValue = array(); - }, - 241 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; - }, - 242 => function ($stackPos) { - $this->semValue = array(new Node\Arg($this->semStack[$stackPos-(3-2)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes)); - }, - 243 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 244 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 245 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 246 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 247 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 248 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 249 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 250 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 251 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + 240 => function ($stackPos) { + $this->semValue = null; }, - 252 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + 241 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, - 253 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 254 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 255 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 256 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 257 => function ($stackPos) { - if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } - }, - 258 => function ($stackPos) { + 242 => function ($stackPos) { $this->semValue = array(); }, + 243 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 244 => function ($stackPos) { + $this->semValue = array(new Node\Arg($this->semStack[$stackPos-(3-2)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes)); + }, + 245 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 246 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 247 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 248 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 249 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 250 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 251 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 252 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 253 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 254 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 255 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 256 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 257 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 258 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, 259 => function ($stackPos) { + if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } + }, + 260 => function ($stackPos) { + $this->semValue = array(); + }, + 261 => function ($stackPos) { $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 260 => function ($stackPos) { + 262 => function ($stackPos) { $this->semValue = new Stmt\Property($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $stackPos-(3-1)); }, - 261 => function ($stackPos) { + 263 => function ($stackPos) { $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos-(3-2)], 0, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 262 => function ($stackPos) { + 264 => function ($stackPos) { $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos-(9-4)], ['type' => $this->semStack[$stackPos-(9-1)], 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-6)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); $this->checkClassMethod($this->semValue, $stackPos-(9-1)); }, - 263 => function ($stackPos) { - $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 264 => function ($stackPos) { - $this->semValue = array(); - }, 265 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 266 => function ($stackPos) { $this->semValue = array(); }, 267 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 268 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 269 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); - }, - 270 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 271 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 272 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 273 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); - }, - 274 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 275 => function ($stackPos) { - $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); - }, - 276 => function ($stackPos) { - $this->semValue = null; - }, - 277 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; - }, - 278 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 279 => function ($stackPos) { - $this->semValue = 0; - }, - 280 => function ($stackPos) { - $this->semValue = 0; - }, - 281 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 282 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 283 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; - }, - 284 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - }, - 285 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - }, - 286 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - }, - 287 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - }, - 288 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, - 289 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, - 290 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 291 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 292 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 293 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 294 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 295 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 296 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 297 => function ($stackPos) { $this->semValue = array(); }, - 298 => function ($stackPos) { + 269 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 270 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 271 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 272 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 273 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 274 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 275 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 276 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 299 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + 277 => function ($stackPos) { + $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); }, - 300 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + 278 => function ($stackPos) { + $this->semValue = null; }, - 301 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 302 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 303 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 304 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 305 => function ($stackPos) { - $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 306 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 307 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 308 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 309 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 310 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 311 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 312 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 313 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 314 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 315 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 316 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 317 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 318 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 319 => function ($stackPos) { - $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 320 => function ($stackPos) { - $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 321 => function ($stackPos) { - $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 322 => function ($stackPos) { - $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 323 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 324 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 325 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 326 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 327 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 328 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 329 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 330 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 331 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 332 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 333 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 334 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 335 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 336 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 337 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 338 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 339 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 340 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 341 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 342 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 343 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 344 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 345 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 346 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 347 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 348 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 349 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 350 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 351 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 352 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 353 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 354 => function ($stackPos) { - $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 355 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 356 => function ($stackPos) { + 279 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, + 280 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 281 => function ($stackPos) { + $this->semValue = 0; + }, + 282 => function ($stackPos) { + $this->semValue = 0; + }, + 283 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 284 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 285 => function ($stackPos) { + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + }, + 286 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + }, + 287 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + }, + 288 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + }, + 289 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_STATIC; + }, + 290 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 291 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 292 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 293 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 294 => function ($stackPos) { + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 295 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 296 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 297 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 298 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 299 => function ($stackPos) { + $this->semValue = array(); + }, + 300 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 301 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 302 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 303 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 304 => function ($stackPos) { + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 305 => function ($stackPos) { + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 306 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 307 => function ($stackPos) { + $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 308 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 309 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 310 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 311 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 312 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 313 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 314 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 315 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 316 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 317 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 318 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 319 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 320 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 321 => function ($stackPos) { + $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 322 => function ($stackPos) { + $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 323 => function ($stackPos) { + $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 324 => function ($stackPos) { + $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 325 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 326 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 327 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 328 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 329 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 330 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 331 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 332 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 333 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 334 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 335 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 336 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 337 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 338 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 339 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 340 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 341 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 342 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 343 => function ($stackPos) { + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 344 => function ($stackPos) { + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 345 => function ($stackPos) { + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 346 => function ($stackPos) { + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 347 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 348 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 349 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 350 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 351 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 352 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 353 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 354 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 355 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 356 => function ($stackPos) { + $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, 357 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 358 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 359 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, 360 => function ($stackPos) { - $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 361 => function ($stackPos) { - $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 362 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 363 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 364 => function ($stackPos) { - $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 365 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 366 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 367 => function ($stackPos) { - $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 368 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 369 => function ($stackPos) { + $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 370 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos-(2-1)]); $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos-(2-2)], $attrs); }, - 369 => function ($stackPos) { + 371 => function ($stackPos) { $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 370 => function ($stackPos) { + 372 => function ($stackPos) { $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 371 => function ($stackPos) { + 373 => function ($stackPos) { $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 372 => function ($stackPos) { + 374 => function ($stackPos) { $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 373 => function ($stackPos) { + 375 => function ($stackPos) { $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 374 => function ($stackPos) { + 376 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strtolower($this->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; $this->semValue = new Expr\Exit_($this->semStack[$stackPos-(2-2)], $attrs); }, - 375 => function ($stackPos) { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 376 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, 377 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 378 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 379 => function ($stackPos) { - $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 380 => function ($stackPos) { - $this->semValue = new Expr\Print_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 381 => function ($stackPos) { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 382 => function ($stackPos) { - $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Print_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 383 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-4)], 'uses' => $this->semStack[$stackPos-(10-6)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 384 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(11-3)], 'params' => $this->semStack[$stackPos-(11-5)], 'uses' => $this->semStack[$stackPos-(11-7)], 'returnType' => $this->semStack[$stackPos-(11-8)], 'stmts' => $this->semStack[$stackPos-(11-10)]], $this->startAttributeStack[$stackPos-(11-1)] + $this->endAttributes); + $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 385 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-4)], 'uses' => $this->semStack[$stackPos-(10-6)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); }, 386 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(11-3)], 'params' => $this->semStack[$stackPos-(11-5)], 'uses' => $this->semStack[$stackPos-(11-7)], 'returnType' => $this->semStack[$stackPos-(11-8)], 'stmts' => $this->semStack[$stackPos-(11-10)]], $this->startAttributeStack[$stackPos-(11-1)] + $this->endAttributes); }, 387 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(2-2)], null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 388 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 389 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(2-2)], null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 390 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 391 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $attrs); }, - 390 => function ($stackPos) { + 392 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $attrs); }, - 391 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 392 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch(Scalar\String_::fromString($this->semStack[$stackPos-(4-1)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes), $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, 393 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 394 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch(Scalar\String_::fromString($this->semStack[$stackPos-(4-1)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes), $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 395 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 396 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 397 => function ($stackPos) { $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$stackPos-(7-3)], 'implements' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes), $this->semStack[$stackPos-(7-2)]); $this->checkClass($this->semValue[0], -1); }, - 396 => function ($stackPos) { + 398 => function ($stackPos) { $this->semValue = new Expr\New_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 397 => function ($stackPos) { + 399 => function ($stackPos) { list($class, $ctorArgs) = $this->semStack[$stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 398 => function ($stackPos) { + 400 => function ($stackPos) { $this->semValue = array(); }, - 399 => function ($stackPos) { + 401 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-3)]; }, - 400 => function ($stackPos) { + 402 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 401 => function ($stackPos) { + 403 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, - 402 => function ($stackPos) { + 404 => function ($stackPos) { $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos-(2-2)], $this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 403 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 404 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, 405 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 406 => function ($stackPos) { - $this->semValue = $this->fixupPhp5StaticPropCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 407 => function ($stackPos) { $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 408 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 409 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, 410 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->fixupPhp5StaticPropCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 411 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 412 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 413 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 414 => function ($stackPos) { - $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 415 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 416 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 417 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 418 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 419 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; @@ -2235,436 +2233,448 @@ class Php5 extends \PhpParser\ParserAbstract $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 421 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 422 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 423 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 424 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 425 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 426 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 427 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 428 => function ($stackPos) { - $this->semValue = array(); - }, - 429 => function ($stackPos) { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`', false), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); - }, - 430 => function ($stackPos) { - foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 431 => function ($stackPos) { - $this->semValue = array(); - }, - 432 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 433 => function ($stackPos) { - $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, true); - }, - 434 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 435 => function ($stackPos) { - $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, false); - }, - 436 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 437 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 438 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 439 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 440 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 441 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 442 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 443 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 444 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], false); - }, - 445 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], false); - }, - 446 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 447 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 448 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 449 => function ($stackPos) { - $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 450 => function ($stackPos) { - $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 451 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 452 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 453 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 454 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 455 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 456 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 457 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 458 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 459 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 460 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 461 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 462 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 463 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 464 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 465 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 466 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 467 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 468 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 469 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 470 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 471 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 472 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 473 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 474 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 475 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 476 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 477 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 478 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 479 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 480 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 481 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 482 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); - }, - 483 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 484 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 485 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + 428 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 486 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + 429 => function ($stackPos) { + $this->semValue = null; }, - 487 => function ($stackPos) { + 430 => function ($stackPos) { + $this->semValue = null; + }, + 431 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 432 => function ($stackPos) { + $this->semValue = array(); + }, + 433 => function ($stackPos) { + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`', false), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); + }, + 434 => function ($stackPos) { + foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 435 => function ($stackPos) { + $this->semValue = array(); + }, + 436 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 437 => function ($stackPos) { + $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, true); + }, + 438 => function ($stackPos) { + $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 439 => function ($stackPos) { + $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, false); + }, + 440 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 441 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 442 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 443 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 444 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 445 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 446 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 447 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 448 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], false); + }, + 449 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], false); + }, + 450 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 451 => function ($stackPos) { $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 488 => function ($stackPos) { + 452 => function ($stackPos) { + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 453 => function ($stackPos) { + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 454 => function ($stackPos) { + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 455 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, + 456 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 457 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 458 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 459 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 460 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 461 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 462 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 463 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 464 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 465 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 466 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 467 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 468 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 469 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 470 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 471 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 472 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 473 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 474 => function ($stackPos) { + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 475 => function ($stackPos) { + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 476 => function ($stackPos) { + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 477 => function ($stackPos) { + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 478 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 479 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 480 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 481 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 482 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 483 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 484 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 485 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 486 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 487 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 488 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, 489 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 490 => function ($stackPos) { + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 491 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 492 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 493 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 494 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); }, - 491 => function ($stackPos) { + 495 => function ($stackPos) { $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); }, - 492 => function ($stackPos) { + 496 => function ($stackPos) { $this->semValue = array(); }, - 493 => function ($stackPos) { + 497 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-1)]; }, - 494 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 495 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 496 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 497 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, 498 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos]; }, 499 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos]; }, 500 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 501 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 502 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 503 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 504 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 505 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 506 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 507 => function ($stackPos) { - $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 508 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, 509 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 510 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 511 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 512 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 513 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 514 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 515 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 516 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 517 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 518 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 519 => function ($stackPos) { - $var = substr($this->semStack[$stackPos-(1-1)], 1); $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 520 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 521 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 522 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 523 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $var = substr($this->semStack[$stackPos-(1-1)], 1); $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; }, 524 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 525 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, 526 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 527 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 528 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 529 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 530 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 531 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 532 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 533 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; - }, - 534 => function ($stackPos) { - $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 535 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 536 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 537 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 538 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 539 => function ($stackPos) { $this->semValue = null; }, - 540 => function ($stackPos) { - $this->semValue = array(); - }, - 541 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 542 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 543 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 544 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 545 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 546 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 547 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 548 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 549 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 550 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 551 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 552 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); - }, - 553 => function ($stackPos) { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 554 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 555 => function ($stackPos) { + 533 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 556 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + 534 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 557 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 558 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 559 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 560 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); - }, - 561 => function ($stackPos) { + 535 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, + 536 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 537 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + }, + 538 => function ($stackPos) { + $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 539 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 540 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 541 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 542 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 543 => function ($stackPos) { + $this->semValue = null; + }, + 544 => function ($stackPos) { + $this->semValue = array(); + }, + 545 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 546 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 547 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 548 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 549 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 550 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 551 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 552 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 553 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 554 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 555 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 556 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); + }, + 557 => function ($stackPos) { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 558 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 559 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 560 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 561 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, 562 => function ($stackPos) { - $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 563 => function ($stackPos) { - $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 564 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 565 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 566 => function ($stackPos) { + $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 567 => function ($stackPos) { + $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 568 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, ]; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php index 91eefac8a..48deff23b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php @@ -18,8 +18,8 @@ use PhpParser\Node\Stmt; class Php7 extends \PhpParser\ParserAbstract { protected $tokenToSymbolMapSize = 396; - protected $actionTableSize = 1217; - protected $gotoTableSize = 604; + protected $actionTableSize = 1223; + protected $gotoTableSize = 626; protected $invalidSymbol = 168; protected $errorSymbol = 1; @@ -27,7 +27,7 @@ class Php7 extends \PhpParser\ParserAbstract protected $unexpectedTokenRule = 32767; protected $YY2TBLSTATE = 429; - protected $numNonLeafStates = 717; + protected $numNonLeafStates = 726; protected $symbolToName = array( "EOF", @@ -244,330 +244,333 @@ class Php7 extends \PhpParser\ParserAbstract ); protected $action = array( - 132, 133, 134, 570, 135, 136, 0, 729, 730, 731, - 137, 37, 929, 450, 451, 452,-32766,-32766,-32766,-32767, - -32767,-32767,-32767, 101, 102, 103, 104, 105, 1085, 1086, - 1087, 1084, 1083, 1082, 1088, 723, 722,-32766, 1275,-32766, + 132, 133, 134, 575, 135, 136, 0, 738, 739, 740, + 137, 37, 850, 825, 851, 476,-32766,-32766,-32766,-32767, + -32767,-32767,-32767, 101, 102, 103, 104, 105, 1097, 1098, + 1099, 1096, 1095, 1094, 1100, 732, 731,-32766, 1289,-32766, -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, - -32767, 373, 374, 918, 2, 732,-32766,-32766,-32766, 1001, - 472, 417, 150,-32766,-32766,-32766, 375, 374, 12, 267, - 138, 399, 736, 737, 738, 739, 417,-32766, 423,-32766, - -32766,-32766,-32766,-32766,-32766, 740, 741, 742, 743, 744, - 745, 746, 747, 748, 749, 750, 770, 571, 771, 772, - 773, 774, 762, 763, 339, 340, 765, 766, 751, 752, - 753, 755, 756, 757, 349, 797, 798, 799, 800, 801, - 802, 758, 759, 572, 573, 791, 782, 780, 781, 794, - 777, 778, 323, 423, 574, 575, 776, 576, 577, 578, - 579, 580, 581, -324, -585, 810, 34, 805, 779, 582, - 583, -585, 139,-32766,-32766,-32766, 132, 133, 134, 570, - 135, 136, 1034, 729, 730, 731, 137, 37,-32766,-32766, - -32766, 544, 814, 126,-32766, 1310,-32766,-32766,-32766,-32766, - -32766,-32766,-32766, 1085, 1086, 1087, 1084, 1083, 1082, 1088, - 473, 723, 722,-32766,-32766,-32766, 458, 459, 81,-32766, - -32766,-32766, -193, -192, 322, 898, 240, 599, 1210, 1209, - 1211, 732, 816, 703,-32766, 1063,-32766,-32766,-32766,-32766, - -32766, 811,-32766,-32766,-32766, 267, 138, 399, 736, 737, - 738, 739, 1247, 1295, 423, 694, 1320, 35, 249, 1321, - 1294, 740, 741, 742, 743, 744, 745, 746, 747, 748, - 749, 750, 770, 571, 771, 772, 773, 774, 762, 763, - 339, 340, 765, 766, 751, 752, 753, 755, 756, 757, - 349, 797, 798, 799, 800, 801, 802, 758, 759, 572, - 573, 791, 782, 780, 781, 794, 777, 778, 888, 593, - 574, 575, 776, 576, 577, 578, 579, 580, 581, -324, - 82, 83, 84, -585, 779, 582, 583, -585, 148, 754, - 724, 725, 726, 727, 728, -582, 729, 730, 731, 767, - 768, 36, -582, 85, 86, 87, 88, 89, 90, 91, + -32767, 1022, 377, 376, 2, 741,-32766,-32766,-32766,-32766, + -32766, 822, 417,-32766,-32766,-32766,-32766,-32766,-32766, 267, + 138, 399, 745, 746, 747, 748, 287,-32766, 423,-32766, + -32766,-32766,-32766,-32766,-32766, 749, 750, 751, 752, 753, + 754, 755, 756, 757, 758, 759, 779, 576, 780, 781, + 782, 783, 771, 772, 340, 341, 774, 775, 760, 761, + 762, 764, 765, 766, 351, 806, 807, 808, 809, 810, + 577, 767, 768, 578, 579, 800, 791, 789, 790, 803, + 786, 787, -327, 423, 580, 581, 785, 582, 583, 584, + 585, 586, 587, 605, -590, 477, -86, 814, 788, 588, + 589, -590, 139,-32766,-32766,-32766, 132, 133, 134, 575, + 135, 136, 1046, 738, 739, 740, 137, 37, 323, 1013, + 823, 824, 1334, 1324,-32766, 1335,-32766,-32766,-32766,-32766, + -32766,-32766,-32766, 1097, 1098, 1099, 1096, 1095, 1094, 1100, + -587, 732, 731,-32766,-32766,-32766, 12, -587, 81,-32766, + -32766,-32766, 945, 946, 322, 927, 34, 947, 1224, 1223, + 1225, 741, -86, 942,-32766, 1075,-32766,-32766,-32766,-32766, + -32766, 239,-32766,-32766,-32766, 267, 138, 399, 745, 746, + 747, 748, 461, 462, 423, 35, 247, 103, 104, 105, + 128, 749, 750, 751, 752, 753, 754, 755, 756, 757, + 758, 759, 779, 576, 780, 781, 782, 783, 771, 772, + 340, 341, 774, 775, 760, 761, 762, 764, 765, 766, + 351, 806, 807, 808, 809, 810, 577, 767, 768, 578, + 579, 800, 791, 789, 790, 803, 786, 787, -327, 144, + 580, 581, 785, 582, 583, 584, 585, 586, 587, 1222, + 82, 83, 84, -590, 788, 588, 589, -590, 148, 763, + 733, 734, 735, 736, 737, 1309, 738, 739, 740, 776, + 777, 36, 1308, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, -362, 271, -362, - -32766,-32766,-32766, 106, 107, 108, -268, 271, -193, -192, - 109, 933, 934, 900, 732, 689, 935, 14, 288, 109, - 815,-32766, 1061,-32766,-32766, 964, -86, 288, 733, 734, - 735, 736, 737, 738, 739, 239, 384, 803, 11, 1077, - -539,-32766,-32766,-32766, 740, 741, 742, 743, 744, 745, - 746, 747, 748, 749, 750, 770, 793, 771, 772, 773, - 774, 762, 763, 764, 792, 765, 766, 751, 752, 753, - 755, 756, 757, 796, 797, 798, 799, 800, 801, 802, - 758, 759, 760, 761, 791, 782, 780, 781, 794, 777, - 778, 128, -86, 769, 775, 776, 783, 784, 786, 785, - 787, 788, -576, 144, -539, -539, -576, 779, 790, 789, - 49, 50, 51, 503, 52, 53, 997, 996, 995, 998, - 54, 55, -111, 56, -582, 1033, 1010, -111, -582, -111, - 1291, -539,-32766,-32766, 302, 1010, 1010, -111, -111, -111, - -111, -111, -111, -111, -111, 1208, 841, 898, 842, 253, - 807, 287, 306, 965, 284, 898, 723, 722, 57, 58, - 287, 287, 1007, -536, 59, 308, 60, 246, 247, 61, - 62, 63, 64, 65, 66, 67, 68, 695, 27, 269, - 69, 439, 504, -338, 1010, 696, 1241, 1242, 505, 898, - 814, 640, 25, 898, 1239, 41, 24, 506, 320, 507, - 1235, 508, 1009, 509, 149, 402, 510, 511, 841, 805, - 842, 43, 44, 440, 370, 369, 898, 45, 512, 698, - 1210, 1209, 1211, 361, 335, 1215, 809, -536, -536, 336, - 888, 691, 513, 514, 515, 1215, 1007, 1062, 888, 715, - 1007, 337, -536, 363, 516, 517, 705, 1229, 1230, 1231, - 1232, 1226, 1227, 294, -536, -16, -542, 813, 1010, 1233, - 1228, 367, 1010, 1210, 1209, 1211, 295, -153, -153, -153, - 382, 70, 888, 318, 319, 322, 888, 659, 660, -535, - 1206, 814, -153, 279, -153, 435, -153, 279, -153, 436, - 141, 103, 104, 105, 632, 633, 322, 437, 368, 888, - -32766,-32766, 371, 372, 438, 900, 814, 689, 820, -111, - -111, 376, 377, 950, -111, 689, 814, -88, 151, 874, - -111, -111, -111, -111, 31, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 723, 722, - 1206, 153, 154, -535, -535, 155, 898, 900, 157, 689, - 1206, 900, -111, 689, -153, 32, 123, 898, -535, 124, - 140,-32766, -537, 129, 130, 143, 322, 1122, 1124, 158, - -535,-32766, -541, -534, 900,-32766, 689, 159, -534, 723, - 722, 1208, 295, 160, 161, -79, -75, 74,-32766,-32766, - -32766, 322,-32766, -73,-32766, -298,-32766, 74, -294,-32766, - -72, 322, -71, -70,-32766,-32766,-32766, -69, -68, -67, - -32766,-32766, 27, -66, -47, 1215,-32766, 414, -18, 147, - 275, 270, 281, 704, 814,-32766, -537, -537, 1239, 888, - 707, 897, 146, 276, 48, -4, 898, -534, -534, 282, - 888, -537, -534, -534, 283, -246, -246, -246, 329, 285, - 271, 368, -534, -537, 286, 73, 289, -534, 1206, 47, - 723, 722, -111, -111, -534, 290, 109, -111, 914, -534, - 550, 669, 874, -111, -111, -111, -111, 145, 516, 517, - -32766, 1229, 1230, 1231, 1232, 1226, 1227, 814, 805, 1322, - 662, 300, 1092, 1233, 1228, 682, 814,-32766, 298, 299, - 546, 641, 647, 1208, 900, 72, 689, -246, 319, 322, - -32766,-32766,-32766, 366,-32766, 900,-32766, 689,-32766, 888, - 646,-32766, 13, 296, 297, 127,-32766,-32766,-32766, 455, - 1206, -51,-32766,-32766, 483, 630, 663, 556,-32766, 414, - 303, 368, -111, 430, 434, 39, 930,-32766, 293, 0, - 125,-32766, -111, -111, 301, 0, 0, -111, 1010, 307, - 0, 0, 833, -111, -111, -111, -111, 0,-32766, 131, - 0, 0, 295, 0,-32766, 1246, 0, 74, 0, 1248, - 1208, 322, 0, -500, 0, 9, 0,-32766,-32766,-32766, - -490,-32766, 7,-32766, 900,-32766, 689, -4,-32766, 16, - 365, 597, 813,-32766,-32766,-32766, 916, 295, 709,-32766, - -32766, 1240,-32766, 40, 712,-32766, 414, 713, 1208, 879, - 898, 974, 951, 958,-32766,-32766,-32766,-32766, 948,-32766, - 959,-32766, 877,-32766, 946, 1066,-32766, 1069, 1070, 1067, - 1068,-32766,-32766,-32766,-32766, 1074, 33,-32766,-32766, 1236, - 1208, 825, 1261,-32766, 414, 1279, 1313,-32766,-32766,-32766, - 317,-32766,-32766,-32766, 635,-32766, 364, 690,-32766, 693, - 697, 699, 478,-32766,-32766,-32766,-32766, 700, 701,-32766, - -32766, 702, 1208, 562, 706,-32766, 414, 692, -570,-32766, - -32766,-32766, 875,-32766,-32766,-32766, 1317,-32766, 1319, 836, - -32766, 835, 844, 888, 923,-32766,-32766,-32766, 966, 843, - 1318,-32766,-32766, 922, 924, 921, 1194,-32766, 414, -245, - -245, -245, 907, 917, 905, 368,-32766, 956, 957, 1316, - 1273, 1262, 0, 1280, 1286, 1289, -111, -111, -568, 27, - -542, -111, -541, -540, 1, 28, 874, -111, -111, -111, - -111, 814, 29,-32766, 38, 1239, 42, 46, 71, 1208, - 75, 76, 77, 78, 79, 0,-32766,-32766,-32766, 80, - -32766, 142,-32766, 152,-32766, 156, 245,-32766, 900, 324, - 689, -245,-32766,-32766,-32766, 1206, 350, 351,-32766,-32766, - 352, 353, 354, 355,-32766, 414, 356, 357, 358, 359, - 360, 362, 431,-32766, -271, -269, 517, -268, 1229, 1230, - 1231, 1232, 1226, 1227, 18, 19, 20, 21, 23, 401, - 1233, 1228, 474, 475, 482, 485, 486, 487, 488, 492, - 493, 494, 72, -504, 501, 319, 322, 676, 1219, 1162, - 1237, 1036, 1035, 0, 1016, 1198, 1012, -273, -103, 17, - 22, 26, 292, 400, 590, 594, 621, 681, 1166, 1214, - 1163, 1292, 0, 1179, 0, 0, 322 + 102, 103, 104, 105, 106, 107, 108, 288, 271, -587, + -193, 375, 376, -587, 976,-32766, 1021, 453, 454, 455, + 109, 417, 945, 946, 741, 712, 819, 947,-32766,-32766, + -32766, -271, 1073, 941, 1224, 1223, 1225, 288, 742, 743, + 744, 745, 746, 747, 748, -192, -365, 812, -365,-32766, + 599,-32766,-32766, 549, 749, 750, 751, 752, 753, 754, + 755, 756, 757, 758, 759, 779, 802, 780, 781, 782, + 783, 771, 772, 773, 801, 774, 775, 760, 761, 762, + 764, 765, 766, 805, 806, 807, 808, 809, 810, 811, + 767, 768, 769, 770, 800, 791, 789, 790, 803, 786, + 787, 251, 820, 778, 784, 785, 792, 793, 795, 794, + 796, 797, 732, 731, 1261, 1022, 1019, 788, 799, 798, + 49, 50, 51, 507, 52, 53, 1009, 1008, 1007, 1010, + 54, 55, -111, 56, 816, 1045, 14, -111, 1022, -111, + 287, 1305, 977, 306, 302, 1022, 238, -111, -111, -111, + -111, -111, -111, -111, -111, 106, 107, 108, 1089, 271, + -32766,-32766,-32766, 280, 284, 126, -193, 929, 57, 58, + 287, 109, 1019, -541, 59, 308, 60, 244, 245, 61, + 62, 63, 64, 65, 66, 67, 68, 1229, 27, 269, + 69, 439, 508, -341, 1022, 929, 1255, 1256, 509, 907, + 823, -192, 150, 907, 1253, 41, 24, 510, 352, 511, + 818, 512, 386, 513, 11, 699, 514, 515, 648, 25, + 814, 43, 44, 440, 372, 371, 907, 45, 516, 702, + 1220, 667, 668, 363, 334, -540, 357, -541, -541, 320, + 1215, 1249, 518, 519, 520, -581, 1074, 335, 724, -581, + 1019,-32766, -541, 336, 521, 522, 703, 1243, 1244, 1245, + 1246, 1240, 1241, 294, -541, 850, -547, 851, 823, 1247, + 1242, 365, 1022, 1224, 1223, 1225, 295, -153, -153, -153, + 369, 70, 897, 318, 319, 322, 897, 384, 149, 402, + 373, 374, -153, 435, -153, 436, -153, 280, -153, -540, + -540, 141, 1220, 378, 379, 639, 640, 322, 370, 897, + 907, 437, 438, 829, -540, -88, 151, 732, 731, 945, + 946, 153, 823,-32766, 517, -51, -540, 154, -546, 883, + 941, -111, -111, -111, 31, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 155, 74, + 27, 157, 32, 322, -85, 123, 124, 909, 129, 697, + 130, 909, 823, 697, -153, 143, 1253, 158,-32766, -544, + 1229, -542, 159, 160, 1222, 161, -79, 1134, 1136, -75, + 285,-32766,-32766,-32766, 909,-32766, 697,-32766, -539,-32766, + -301, -73,-32766, 897, -72, -71, 1220,-32766,-32766,-32766, + -16, 140, 1215,-32766,-32766, 732, 731, 322, -70,-32766, + 414, -69, -4, 907, -68, -67, 521, 522,-32766, 1243, + 1244, 1245, 1246, 1240, 1241, -66, -47, -18, 147, 270, + 281, 1247, 1242, -544, -544, -542, -542, 732, 731, 713, + 716, 906,-32766, 72, 146, 907, 319, 322, 1222, -297, + -542, 823, -539, -539, 276,-32766,-32766,-32766, 277,-32766, + -544,-32766, -542,-32766, 282, 283,-32766, -539, 909, 328, + 697,-32766,-32766,-32766,-32766, 704, 286,-32766,-32766, -539, + 1222, 923, 289,-32766, 414, 1220, 290,-32766,-32766,-32766, + 271,-32766,-32766,-32766, 47,-32766, 897, -111,-32766, 677, + 109, 814, 145,-32766,-32766,-32766,-32766, 823, 131,-32766, + -32766, 1336,-32766, 654, 670,-32766, 414, 1104, 370, 637, + 430, 551, 73, 13,-32766, 293, 555, 295, 897, 945, + 946, 649, 74, 434, 517, 458, 322, 487, 690, 842, + 941, -111, -111, -111, 301, 1022, 561, 655, 671, 1260, + 300,-32766, -539,-32766, 907, 603, 303, 1222, 296, 297, + 39, 1262, 9, 40,-32766,-32766,-32766, 0,-32766, 907, + -32766, 909,-32766, 697, -4,-32766, 0, 1229, 907, 0, + -32766,-32766,-32766,-32766, 307, 125,-32766,-32766, 0, 1222, + 907, 0,-32766, 414, 0, 0,-32766,-32766,-32766, 707, + -32766,-32766,-32766, 962,-32766, 697, -505,-32766, 714, -495, + 7, 482,-32766,-32766,-32766,-32766, -539, -539,-32766,-32766, + 16, 1222, 567, 367,-32766, 414, 925, 295,-32766,-32766, + -32766, -539,-32766,-32766,-32766, 822,-32766, 897, 721,-32766, + 722, -575, 888, -539,-32766,-32766,-32766, 986, 963, 970, + -32766,-32766, 897, -249, -249, -249,-32766, 414, 823, 370, + 960, 897, 971, 886, 958,-32766, 1078, 1081, 718, 1082, + 945, 946, 1079, 897, 1080, 517, 1086, 33, 1250, 834, + 883, 941, -111, -111, -111, 27, 1275, 1293, 1327, -248, + -248, -248, 1220, 642, 884, 370, 317, 823, 366, 698, + 701, 1253, 1331, 705, -111, 706, 945, 946, 708, 709, + 710, 517, 909,-32766, 697, -249, 883, 941, -111, -111, + -111, 711, 715, 700, -509, 1333, 845, 909, 48, 697, + -573, 1220, 844, 853, 295, 935, 909, 1215, 697, 74, + 978, 852, 1332, 322, 934, 932, 933, 936, 909, 1206, + 697, -248, 522, 916, 1243, 1244, 1245, 1246, 1240, 1241, + 926, 914, 968, 969, 1330, 1287, 1247, 1242, 1276, 1294, + -32766, 1300, 1303, 1191, -547, -546, 1222, -545, 72, -489, + 1, 319, 322,-32766,-32766,-32766, 28,-32766, 29,-32766, + 38,-32766, 298, 299,-32766, 42, 46, 71, 75,-32766, + -32766,-32766, 76, 77, 78,-32766,-32766, 368, 79, 80, + 142,-32766, 414, 152, 156, 243, 324, 352, 353, 127, + -32766, -274, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 364, 431, 0, -272, -271, 18, 19, 20, 21, + 23, 401, 478, 479, 486, 489, 490, 491, 492, 496, + 497, 498, 505, 684, 1233, 1174, 1251, 1048, 1047, 1028, + 0, 1210, 1024, -276, -103, 17, 22, 26, 292, 400, + 596, 600, 628, 689, 1178, 1228, 1175, 1306, 0, 0, + 1254, 0, 322 ); protected $actionCheck = array( 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, - 12, 13, 128, 129, 130, 131, 9, 10, 11, 44, + 12, 13, 106, 1, 108, 31, 9, 10, 11, 44, 45, 46, 47, 48, 49, 50, 51, 52, 116, 117, 118, 119, 120, 121, 122, 37, 38, 30, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 106, 107, 1, 8, 57, 9, 10, 11, 1, - 31, 116, 14, 9, 10, 11, 106, 107, 8, 71, - 72, 73, 74, 75, 76, 77, 116, 30, 80, 32, + 43, 138, 106, 107, 8, 57, 9, 10, 11, 9, + 10, 155, 116, 9, 10, 11, 9, 10, 11, 71, + 72, 73, 74, 75, 76, 77, 163, 30, 80, 32, 33, 34, 35, 36, 30, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 70, 80, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 8, 1, 80, 8, 80, 150, 151, + 132, 133, 8, 80, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 51, 1, 161, 31, 80, 150, 151, 152, 8, 154, 9, 10, 11, 2, 3, 4, 5, - 6, 7, 164, 9, 10, 11, 12, 13, 9, 10, - 11, 85, 82, 14, 30, 85, 32, 33, 34, 35, + 6, 7, 164, 9, 10, 11, 12, 13, 70, 1, + 82, 159, 80, 85, 30, 83, 32, 33, 34, 35, 36, 37, 38, 116, 117, 118, 119, 120, 121, 122, - 161, 37, 38, 9, 10, 11, 134, 135, 161, 9, - 10, 11, 8, 8, 167, 1, 14, 51, 155, 156, - 157, 57, 1, 161, 30, 162, 32, 33, 34, 35, - 30, 156, 32, 33, 34, 71, 72, 73, 74, 75, - 76, 77, 146, 1, 80, 31, 80, 147, 148, 83, + 1, 37, 38, 9, 10, 11, 8, 8, 161, 9, + 10, 11, 117, 118, 167, 1, 8, 122, 155, 156, + 157, 57, 97, 128, 30, 162, 32, 33, 34, 35, + 30, 14, 32, 33, 34, 71, 72, 73, 74, 75, + 76, 77, 134, 135, 80, 147, 148, 50, 51, 52, 8, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 84, 1, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 164, + 126, 127, 128, 129, 130, 131, 132, 133, 164, 8, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 80, 9, 10, 11, 160, 150, 151, 152, 164, 154, 2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 30, 8, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 106, 57, 108, - 9, 10, 11, 53, 54, 55, 164, 57, 164, 164, - 69, 117, 118, 159, 57, 161, 122, 101, 30, 69, - 159, 30, 1, 32, 33, 31, 31, 30, 71, 72, - 73, 74, 75, 76, 77, 97, 106, 80, 108, 123, - 70, 9, 10, 11, 87, 88, 89, 90, 91, 92, + 49, 50, 51, 52, 53, 54, 55, 30, 57, 160, + 8, 106, 107, 164, 31, 9, 137, 129, 130, 131, + 69, 116, 117, 118, 57, 161, 80, 122, 9, 10, + 11, 164, 1, 128, 155, 156, 157, 30, 71, 72, + 73, 74, 75, 76, 77, 8, 106, 80, 108, 30, + 1, 32, 33, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 8, 97, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 160, 8, 134, 135, 164, 150, 151, 152, + 133, 8, 156, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 37, 38, 146, 138, 116, 150, 151, 152, 2, 3, 4, 5, 6, 7, 119, 120, 121, 122, - 12, 13, 101, 15, 160, 1, 138, 106, 164, 108, - 1, 161, 9, 10, 113, 138, 138, 116, 117, 118, - 119, 120, 121, 122, 123, 80, 106, 1, 108, 8, - 80, 163, 8, 159, 30, 1, 37, 38, 50, 51, - 163, 163, 116, 70, 56, 8, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 31, 70, 71, - 72, 73, 74, 162, 138, 31, 78, 79, 80, 1, - 82, 75, 76, 1, 86, 87, 88, 89, 8, 91, - 1, 93, 137, 95, 101, 102, 98, 99, 106, 80, - 108, 103, 104, 105, 106, 107, 1, 109, 110, 31, - 155, 156, 157, 115, 116, 1, 156, 134, 135, 8, - 84, 161, 124, 125, 126, 1, 116, 159, 84, 161, - 116, 8, 149, 8, 136, 137, 31, 139, 140, 141, - 142, 143, 144, 145, 161, 31, 163, 155, 138, 151, + 12, 13, 101, 15, 80, 1, 101, 106, 138, 108, + 163, 1, 159, 8, 113, 138, 97, 116, 117, 118, + 119, 120, 121, 122, 123, 53, 54, 55, 123, 57, + 9, 10, 11, 163, 30, 14, 164, 122, 50, 51, + 163, 69, 116, 70, 56, 8, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 1, 70, 71, + 72, 73, 74, 162, 138, 122, 78, 79, 80, 1, + 82, 164, 14, 1, 86, 87, 88, 89, 163, 91, + 156, 93, 106, 95, 108, 161, 98, 99, 75, 76, + 80, 103, 104, 105, 106, 107, 1, 109, 110, 31, + 116, 75, 76, 115, 116, 70, 163, 134, 135, 8, + 122, 1, 124, 125, 126, 160, 159, 8, 161, 164, + 116, 137, 149, 8, 136, 137, 31, 139, 140, 141, + 142, 143, 144, 145, 161, 106, 163, 108, 82, 151, 152, 8, 138, 155, 156, 157, 158, 75, 76, 77, - 8, 163, 84, 165, 166, 167, 84, 75, 76, 70, - 116, 82, 90, 163, 92, 8, 94, 163, 96, 8, - 161, 50, 51, 52, 111, 112, 167, 8, 106, 84, - 9, 137, 106, 107, 8, 159, 82, 161, 8, 117, - 118, 106, 107, 159, 122, 161, 82, 31, 14, 127, + 8, 163, 84, 165, 166, 167, 84, 8, 101, 102, + 106, 107, 90, 8, 92, 8, 94, 163, 96, 134, + 135, 161, 116, 106, 107, 111, 112, 167, 106, 84, + 1, 8, 8, 8, 149, 31, 14, 37, 38, 117, + 118, 14, 82, 137, 122, 31, 161, 14, 163, 127, 128, 129, 130, 131, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 37, 38, - 116, 14, 14, 134, 135, 14, 1, 159, 14, 161, - 116, 159, 128, 161, 162, 14, 16, 1, 149, 16, - 161, 137, 70, 16, 16, 16, 167, 59, 60, 16, - 161, 137, 163, 70, 159, 74, 161, 16, 70, 37, - 38, 80, 158, 16, 16, 31, 31, 163, 87, 88, - 89, 167, 91, 31, 93, 35, 95, 163, 35, 98, - 31, 167, 31, 31, 103, 104, 105, 31, 31, 31, - 109, 110, 70, 31, 31, 1, 115, 116, 31, 31, - 35, 31, 31, 31, 82, 124, 134, 135, 86, 84, - 31, 31, 31, 35, 70, 0, 1, 134, 135, 35, - 84, 149, 134, 135, 35, 100, 101, 102, 35, 37, - 57, 106, 149, 161, 37, 154, 37, 149, 116, 70, - 37, 38, 117, 118, 161, 37, 69, 122, 38, 161, - 89, 77, 127, 128, 129, 130, 131, 70, 136, 137, - 85, 139, 140, 141, 142, 143, 144, 82, 80, 83, - 94, 132, 82, 151, 152, 92, 82, 74, 134, 135, - 85, 90, 100, 80, 159, 163, 161, 162, 166, 167, - 87, 88, 89, 149, 91, 159, 93, 161, 95, 84, - 96, 98, 97, 134, 135, 161, 103, 104, 105, 97, - 116, 31, 109, 110, 97, 113, 100, 153, 115, 116, - 114, 106, 128, 108, 128, 159, 128, 124, 113, -1, - 161, 137, 117, 118, 133, -1, -1, 122, 138, 132, - -1, -1, 127, 128, 129, 130, 131, -1, 137, 31, - -1, -1, 158, -1, 74, 146, -1, 163, -1, 146, - 80, 167, -1, 149, -1, 150, -1, 87, 88, 89, - 149, 91, 149, 93, 159, 95, 161, 162, 98, 149, - 149, 153, 155, 103, 104, 105, 154, 158, 162, 109, - 110, 166, 74, 159, 159, 115, 116, 159, 80, 159, - 1, 159, 159, 159, 124, 87, 88, 89, 159, 91, - 159, 93, 159, 95, 159, 159, 98, 159, 159, 159, - 159, 103, 104, 105, 74, 159, 161, 109, 110, 160, - 80, 160, 160, 115, 116, 160, 160, 87, 88, 89, - 161, 91, 124, 93, 160, 95, 161, 161, 98, 161, - 161, 161, 102, 103, 104, 105, 74, 161, 161, 109, - 110, 161, 80, 81, 161, 115, 116, 161, 163, 87, - 88, 89, 162, 91, 124, 93, 162, 95, 162, 162, - 98, 162, 162, 84, 162, 103, 104, 105, 162, 162, - 162, 109, 110, 162, 162, 162, 162, 115, 116, 100, - 101, 102, 162, 162, 162, 106, 124, 162, 162, 162, - 162, 162, -1, 162, 162, 162, 117, 118, 163, 70, - 163, 122, 163, 163, 163, 163, 127, 128, 129, 130, - 131, 82, 163, 74, 163, 86, 163, 163, 163, 80, - 163, 163, 163, 163, 163, -1, 87, 88, 89, 163, - 91, 163, 93, 163, 95, 163, 163, 98, 159, 163, - 161, 162, 103, 104, 105, 116, 163, 163, 109, 110, - 163, 163, 163, 163, 115, 116, 163, 163, 163, 163, - 163, 163, 163, 124, 164, 164, 137, 164, 139, 140, - 141, 142, 143, 144, 164, 164, 164, 164, 164, 164, - 151, 152, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 163, 165, 164, 166, 167, 164, 164, 164, - 164, 164, 164, -1, 164, 164, 164, 164, 164, 164, + 22, 23, 24, 25, 26, 27, 28, 29, 14, 163, + 70, 14, 14, 167, 31, 16, 16, 159, 16, 161, + 16, 159, 82, 161, 162, 16, 86, 16, 74, 70, + 1, 70, 16, 16, 80, 16, 31, 59, 60, 31, + 37, 87, 88, 89, 159, 91, 161, 93, 70, 95, + 35, 31, 98, 84, 31, 31, 116, 103, 104, 105, + 31, 161, 122, 109, 110, 37, 38, 167, 31, 115, + 116, 31, 0, 1, 31, 31, 136, 137, 124, 139, + 140, 141, 142, 143, 144, 31, 31, 31, 31, 31, + 31, 151, 152, 134, 135, 134, 135, 37, 38, 31, + 31, 31, 74, 163, 31, 1, 166, 167, 80, 35, + 149, 82, 134, 135, 35, 87, 88, 89, 35, 91, + 161, 93, 161, 95, 35, 35, 98, 149, 159, 35, + 161, 103, 104, 105, 74, 31, 37, 109, 110, 161, + 80, 38, 37, 115, 116, 116, 37, 87, 88, 89, + 57, 91, 124, 93, 70, 95, 84, 128, 98, 77, + 69, 80, 70, 103, 104, 105, 137, 82, 31, 109, + 110, 83, 85, 96, 94, 115, 116, 82, 106, 113, + 108, 85, 154, 97, 124, 113, 89, 158, 84, 117, + 118, 90, 163, 128, 122, 97, 167, 97, 92, 127, + 128, 129, 130, 131, 133, 138, 153, 100, 100, 146, + 132, 74, 70, 137, 1, 153, 114, 80, 134, 135, + 159, 146, 150, 159, 87, 88, 89, -1, 91, 1, + 93, 159, 95, 161, 162, 98, -1, 1, 1, -1, + 103, 104, 105, 74, 132, 161, 109, 110, -1, 80, + 1, -1, 115, 116, -1, -1, 87, 88, 89, 31, + 91, 124, 93, 159, 95, 161, 149, 98, 31, 149, + 149, 102, 103, 104, 105, 74, 134, 135, 109, 110, + 149, 80, 81, 149, 115, 116, 154, 158, 87, 88, + 89, 149, 91, 124, 93, 155, 95, 84, 159, 98, + 159, 163, 159, 161, 103, 104, 105, 159, 159, 159, + 109, 110, 84, 100, 101, 102, 115, 116, 82, 106, + 159, 84, 159, 159, 159, 124, 159, 159, 162, 159, + 117, 118, 159, 84, 159, 122, 159, 161, 160, 160, + 127, 128, 129, 130, 131, 70, 160, 160, 160, 100, + 101, 102, 116, 160, 162, 106, 161, 82, 161, 161, + 161, 86, 162, 161, 128, 161, 117, 118, 161, 161, + 161, 122, 159, 137, 161, 162, 127, 128, 129, 130, + 131, 161, 161, 161, 165, 162, 162, 159, 70, 161, + 163, 116, 162, 162, 158, 162, 159, 122, 161, 163, + 162, 162, 162, 167, 162, 162, 162, 162, 159, 162, + 161, 162, 137, 162, 139, 140, 141, 142, 143, 144, + 162, 162, 162, 162, 162, 162, 151, 152, 162, 162, + 74, 162, 162, 165, 163, 163, 80, 163, 163, 163, + 163, 166, 167, 87, 88, 89, 163, 91, 163, 93, + 163, 95, 134, 135, 98, 163, 163, 163, 163, 103, + 104, 105, 163, 163, 163, 109, 110, 149, 163, 163, + 163, 115, 116, 163, 163, 163, 163, 163, 163, 161, + 124, 164, 163, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, -1, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, -1, 165, -1, -1, 167 + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + -1, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, -1, -1, + 166, -1, 167 ); protected $actionBase = array( - 0, -2, 154, 542, 785, 695, 969, 549, 53, 420, - 831, 307, 307, 67, 307, 307, 307, 496, 538, 538, - 565, 538, 204, 504, 706, 706, 706, 651, 651, 651, - 651, 773, 773, 920, 920, 952, 888, 850, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, - 1029, 1029, 211, 344, 288, 691, 1038, 1044, 1040, 1045, - 1036, 1035, 1039, 1041, 1046, 917, 918, 751, 919, 921, - 922, 923, 1042, 854, 1037, 1043, 291, 291, 291, 291, + 0, -2, 154, 542, 752, 893, 929, 580, 53, 394, + 855, 307, 307, 67, 307, 307, 307, 565, 908, 908, + 917, 908, 538, 784, 649, 649, 649, 708, 708, 708, + 708, 740, 740, 849, 849, 881, 817, 634, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, + 1036, 1036, 12, 323, 389, 678, 1044, 1050, 1046, 1051, + 1042, 1041, 1045, 1047, 1052, 942, 943, 753, 946, 947, + 949, 950, 1048, 873, 1043, 1049, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, - 291, 291, 641, 159, 473, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 54, 54, 54, 341, 692, - 692, 190, 184, 658, 47, 1019, 1019, 1019, 1019, 1019, - 1019, 1019, 1019, 1019, 1019, 144, 144, 7, 7, 7, - 7, 7, 371, -25, -25, -25, -25, 574, 347, 764, - 474, 584, 266, 241, 338, 470, 470, 591, 591, 396, - -116, 396, 348, 348, 396, 396, 396, 770, 770, 770, - 770, 443, 559, 452, 86, 514, 479, 479, 479, 479, - 514, 514, 514, 514, 783, 795, 514, 514, 514, 642, - 653, 653, 714, 300, 300, 300, 653, 390, 765, 90, - 390, 90, 37, 156, 781, -55, -40, 292, 768, 781, - 320, 739, 314, 143, 797, 546, 797, 1034, 745, 733, - 705, 836, 876, 1047, 752, 915, 786, 916, 62, 704, - 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, - 1033, 1049, 469, 1034, 65, 1049, 1049, 1049, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 533, 65, - 466, 552, 65, 763, 469, 211, 791, 211, 211, 211, - 211, 973, 211, 211, 211, 211, 211, 211, 980, 737, - 29, 211, 344, 52, 52, 428, 58, 52, 52, 52, - 52, 211, 211, 211, 546, 743, 734, 555, 798, 195, - 743, 743, 743, 345, 135, 192, 194, 710, 713, 280, - 758, 758, 760, 931, 931, 758, 755, 758, 760, 944, - 758, 931, 799, 433, 627, 571, 603, 631, 931, 494, - 758, 758, 758, 758, 639, 758, 491, 445, 758, 758, - 709, 741, 777, 46, 931, 931, 931, 777, 585, 771, - 771, 771, 805, 808, 772, 740, 540, 507, 650, 138, - 780, 740, 740, 758, 612, 772, 740, 772, 740, 802, - 740, 740, 740, 772, 740, 755, 583, 740, 703, 646, - 60, 740, 6, 945, 947, 636, 948, 941, 949, 989, - 950, 951, 856, 963, 943, 956, 939, 932, 750, 690, - 693, 793, 784, 930, 747, 747, 747, 927, 747, 747, - 747, 747, 747, 747, 747, 747, 690, 839, 801, 766, - 731, 974, 697, 698, 779, 880, 1018, 1048, 973, 1024, - 958, 736, 699, 1004, 977, 796, 849, 978, 979, 1005, - 1025, 1026, 884, 757, 886, 887, 841, 983, 858, 747, - 945, 951, 943, 956, 939, 932, 732, 728, 726, 727, - 722, 721, 712, 719, 738, 1027, 925, 875, 842, 980, - 929, 690, 845, 1000, 835, 1008, 1009, 855, 782, 756, - 846, 889, 984, 985, 986, 859, 1028, 804, 1001, 990, - 1010, 787, 890, 1011, 1012, 1013, 1014, 892, 860, 866, - 867, 810, 761, 991, 774, 896, 48, 754, 759, 778, - 988, 654, 966, 870, 897, 898, 1015, 1016, 1017, 901, - 960, 812, 1002, 746, 1003, 993, 813, 814, 677, 769, - 1030, 735, 748, 767, 678, 681, 902, 903, 904, 962, - 742, 744, 819, 821, 1031, 762, 1032, 910, 684, 823, - 711, 911, 1023, 717, 718, 753, 873, 800, 776, 775, - 987, 749, 825, 912, 826, 828, 829, 1020, 830, 0, + 291, 291, 346, 491, 50, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 54, 54, 54, 620, 620, + 359, 190, 184, 955, 955, 955, 955, 955, 955, 955, + 955, 955, 955, 658, 47, 144, 144, 7, 7, 7, + 7, 7, 371, -25, -25, -25, -25, 709, 347, 916, + 474, 526, 375, 280, 317, 245, 340, 340, 187, 187, + 396, 396, -87, -87, 396, 396, 396, 747, 747, 747, + 747, 443, 505, -94, 308, 454, 480, 480, 480, 480, + 454, 454, 454, 454, 755, 1054, 454, 454, 454, 641, + 822, 822, 998, 442, 442, 442, 822, 499, 776, 88, + 499, 88, 37, 92, 756, 85, -54, 425, 756, 639, + 764, 189, 143, 820, 524, 820, 1040, 385, 767, 413, + 735, 688, 857, 902, 1053, 787, 940, 788, 941, 228, + 98, 685, 1039, 1039, 1039, 1039, 1039, 1039, 1039, 1039, + 1039, 1039, 1039, 1055, 415, 1040, 286, 1055, 1055, 1055, + 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, + 534, 286, 483, 496, 286, 774, 415, 12, 800, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 736, + -16, 12, 323, 204, 204, 427, 168, 204, 204, 204, + 204, 12, 12, 12, 524, 773, 733, 537, 742, 377, + 773, 773, 773, 115, 124, 207, 342, 695, 754, 446, + 761, 761, 775, 957, 957, 761, 765, 761, 775, 973, + 761, 761, 957, 957, 809, 232, 625, 579, 612, 627, + 957, 475, 761, 761, 761, 761, 792, 643, 761, 433, + 281, 761, 761, 792, 758, 739, 46, 751, 957, 957, + 957, 792, 603, 751, 751, 751, 819, 821, 746, 738, + 571, 507, 645, 198, 783, 738, 738, 761, 619, 746, + 738, 746, 738, 812, 738, 738, 738, 746, 738, 765, + 585, 738, 691, 644, 188, 738, 6, 974, 975, 624, + 979, 967, 980, 1009, 981, 985, 878, 956, 992, 972, + 986, 965, 963, 750, 679, 680, 801, 797, 954, 771, + 771, 771, 951, 771, 771, 771, 771, 771, 771, 771, + 771, 679, 858, 814, 745, 777, 995, 682, 684, 743, + 872, 899, 948, 994, 1030, 987, 741, 689, 1016, 999, + 846, 875, 1000, 1001, 1017, 1031, 1032, 880, 772, 903, + 904, 859, 1003, 879, 771, 974, 985, 663, 972, 986, + 965, 963, 734, 724, 720, 723, 717, 704, 700, 703, + 737, 1033, 907, 818, 866, 1002, 952, 679, 867, 1012, + 856, 1018, 1019, 877, 778, 768, 868, 910, 1004, 1005, + 1006, 882, 1034, 884, 744, 1013, 997, 1020, 780, 911, + 1021, 1022, 1023, 1024, 887, 913, 888, 889, 823, 781, + 1010, 757, 918, 528, 769, 770, 789, 1008, 642, 993, + 900, 919, 920, 1025, 1026, 1027, 922, 923, 990, 828, + 1014, 760, 1015, 1011, 829, 830, 647, 785, 1035, 759, + 763, 779, 653, 674, 924, 925, 927, 991, 748, 762, + 841, 843, 1037, 683, 1038, 931, 677, 844, 696, 938, + 1029, 697, 699, 786, 901, 811, 782, 766, 1007, 749, + 845, 939, 847, 848, 850, 1028, 853, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 458, 458, - 458, 458, 458, 458, 307, 307, 307, 307, 0, 0, - 307, 0, 0, 0, 458, 458, 458, 458, 458, 458, + 0, 0, 0, 0, 0, 0, 0, 458, 458, 458, + 458, 458, 458, 307, 307, 307, 307, 0, 0, 307, + 0, 0, 0, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, @@ -581,43 +584,43 @@ class Php7 extends \PhpParser\ParserAbstract 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, - 458, 458, 458, 458, 458, 458, 458, 458, 458, 291, + 458, 458, 458, 458, 458, 458, 458, 458, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, - 291, 291, 291, 0, 0, 0, 0, 0, 0, 0, + 291, 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 291, + 0, 0, 0, 0, 0, 0, 0, 0, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, - 291, 291, 291, 291, 291, 291, 415, 415, 291, 291, - 0, 291, 415, 415, 415, 415, 415, 415, 415, 415, - 415, 415, 291, 291, 291, 291, 291, 291, 291, 799, - 300, 300, 300, 300, 415, 415, 415, 415, 415, -88, - -88, 415, 415, 415, 300, 300, 415, 244, 415, 415, - 415, 415, 415, 415, 415, 415, 415, 415, 0, 0, - 65, 90, 415, 755, 755, 755, 755, 415, 415, 415, - 415, 90, 90, 415, 415, 415, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 90, 0, 65, 0, 755, - 755, 415, 799, 799, 232, 244, 415, 0, 0, 0, - 0, 65, 755, 65, 469, 90, 469, 469, 52, 211, - 232, 453, 453, 453, 453, 0, 546, 799, 799, 799, - 799, 799, 799, 799, 799, 799, 799, 799, 755, 0, - 799, 0, 755, 755, 755, 0, 0, 0, 0, 0, + 291, 291, 291, 291, 219, 219, 291, 291, 291, 219, + 219, 219, 219, 219, 219, 219, 219, 219, 219, 0, + 291, 291, 291, 291, 291, 291, 291, 291, 809, 442, + 442, 442, 442, 219, 219, 219, 219, 219, -88, -88, + 219, 809, 219, 219, 442, 442, 219, 219, 219, 219, + 219, 219, 219, 219, 219, 219, 219, 0, 0, 286, + 88, 219, 765, 765, 765, 765, 219, 219, 219, 219, + 88, 88, 219, 219, 219, 0, 0, 0, 0, 0, + 0, 0, 0, 286, 88, 0, 286, 0, 765, 765, + 219, 0, 809, 314, 219, 0, 0, 0, 0, 286, + 765, 286, 415, 761, 88, 761, 415, 415, 204, 12, + 314, 527, 527, 527, 527, 0, 0, 524, 809, 809, + 809, 809, 809, 809, 809, 809, 809, 809, 809, 765, + 0, 809, 0, 765, 765, 765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 755, 0, 0, 931, 0, 0, 0, 0, 758, 0, - 0, 0, 0, 0, 0, 758, 944, 0, 0, 0, - 0, 0, 0, 755, 0, 0, 0, 0, 0, 0, - 0, 0, 747, 782, 0, 782, 0, 747, 747, 747, - 0, 0, 0, 0, 769, 762 + 0, 765, 0, 0, 957, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 973, 0, 0, 0, 0, + 0, 0, 765, 0, 0, 0, 0, 0, 0, 0, + 0, 771, 778, 0, 778, 0, 771, 771, 771, 0, + 0, 0, 0, 785, 683 ); protected $actionDefault = array( 3,32767, 103,32767,32767,32767,32767,32767,32767,32767, 32767,32767, 101,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767, 588, 588, 588, - 588,32767,32767, 250, 103,32767,32767, 464, 382, 382, - 382,32767,32767, 532, 532, 532, 532, 532, 532,32767, - 32767,32767,32767,32767,32767, 464,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 593, 593, 593, + 593,32767,32767, 253, 103,32767,32767, 467, 385, 385, + 385,32767,32767, 537, 537, 537, 537, 537, 537,32767, + 32767,32767,32767,32767,32767, 467,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, @@ -625,135 +628,138 @@ class Php7 extends \PhpParser\ParserAbstract 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767, 101,32767, - 32767,32767, 37, 7, 8, 10, 11, 50, 17, 320, + 32767,32767, 37, 7, 8, 10, 11, 50, 17, 323, 32767,32767,32767,32767, 103,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 581,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 586,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767, 468, 447, 448, 450, - 451, 381, 533, 587, 323, 584, 380, 146, 335, 325, - 238, 326, 254, 469, 255, 470, 473, 474, 211, 283, - 377, 150, 411, 465, 413, 463, 467, 412, 387, 392, - 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 385, 386, 466, 444, 443, 442, 409,32767, - 32767, 410, 414, 384, 417,32767,32767,32767,32767,32767, - 32767,32767,32767, 103,32767, 415, 416, 433, 434, 431, - 432, 435,32767, 436, 437, 438, 439,32767, 312,32767, - 32767,32767, 361, 359, 312,32767,32767, 424, 425,32767, + 32767,32767,32767,32767,32767,32767, 471, 450, 451, 453, + 454, 384, 538, 592, 326, 589, 383, 146, 338, 328, + 241, 329, 257, 472, 258, 473, 476, 477, 214, 286, + 380, 150, 414, 468, 416, 466, 470, 415, 390, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 388, 389, 469, 447, 446, 445,32767,32767, + 412, 413, 417,32767,32767,32767,32767,32767,32767,32767, + 32767, 103,32767, 387, 420, 418, 419, 436, 437, 434, + 435, 438,32767, 439, 440, 441, 442,32767, 315,32767, + 32767,32767, 364, 362, 315, 112,32767,32767, 427, 428, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 526, 441,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767, 103,32767, 101, 528, - 406, 408, 496, 419, 420, 418, 388,32767, 503,32767, - 103, 505,32767,32767,32767, 112,32767,32767,32767,32767, - 527,32767, 534, 534,32767, 489, 101, 194,32767, 194, - 194,32767,32767,32767,32767,32767,32767,32767, 595, 489, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111,32767, 194, 111,32767,32767,32767, 101, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 189,32767, - 264, 266, 103, 549, 194,32767, 508,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 501, + 32767, 531, 444,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 103,32767, 101, 533, + 409, 411, 501, 422, 423, 421, 391,32767, 508,32767, + 103, 510,32767,32767,32767,32767,32767,32767,32767, 532, + 32767, 539, 539,32767, 494, 101, 194,32767,32767,32767, + 194, 194,32767,32767,32767,32767,32767,32767,32767,32767, + 600, 494, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111,32767, 194, 111,32767,32767,32767, 101, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 189,32767, 267, 269, 103, 554, 194,32767, 513,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 506, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767, 489, 429, 139,32767, 139, 534, - 421, 422, 423, 491, 534, 534, 534, 308, 285,32767, - 32767,32767,32767, 506, 506, 101, 101, 101, 101, 501, - 32767,32767, 112, 100, 100, 100, 100, 100, 104, 102, - 32767,32767,32767,32767, 100,32767, 102, 102,32767,32767, - 221, 208, 219, 102,32767, 553, 554, 219, 102, 223, - 223, 223, 243, 243, 480, 314, 102, 100, 102, 102, - 196, 314, 314,32767, 102, 480, 314, 480, 314, 198, - 314, 314, 314, 480, 314,32767, 102, 314, 210, 100, - 100, 314,32767,32767,32767, 491,32767,32767,32767,32767, + 32767,32767,32767,32767, 494, 432, 139,32767, 139, 539, + 424, 425, 426, 496, 539, 539, 539, 311, 288,32767, + 32767,32767,32767, 511, 511, 101, 101, 101, 101, 506, + 32767,32767,32767,32767, 112, 100, 100, 100, 100, 100, + 104, 102,32767,32767,32767,32767, 222, 100,32767, 102, + 102,32767,32767, 222, 224, 211, 102, 226,32767, 558, + 559, 222, 102, 226, 226, 226, 246, 246, 483, 317, + 102, 100, 102, 102, 196, 317, 317,32767, 102, 483, + 317, 483, 317, 198, 317, 317, 317, 483, 317,32767, + 102, 317, 213, 100, 100, 317,32767,32767,32767, 496, + 32767,32767,32767,32767,32767,32767,32767, 221,32767,32767, + 32767,32767,32767,32767,32767, 526,32767, 543, 556, 430, + 431, 433, 541, 455, 456, 457, 458, 459, 460, 461, + 463, 588,32767, 500,32767,32767,32767,32767, 337, 598, + 32767, 598,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 599,32767, 539, + 32767,32767,32767,32767, 429, 9, 76, 489, 43, 44, + 52, 58, 517, 518, 519, 520, 514, 515, 521, 516, + 32767,32767, 522, 564,32767,32767, 540, 591,32767,32767, + 32767,32767,32767,32767, 139,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 526,32767, 137,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 521,32767, 538, 551, 427, 428, 430, 536, 452, 453, - 454, 455, 456, 457, 458, 460, 583,32767, 495,32767, - 32767,32767,32767, 334, 593,32767, 593,32767,32767,32767, + 539,32767,32767,32767,32767, 313, 310,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 594,32767, 534,32767,32767,32767,32767, 426, - 9, 76, 43, 44, 52, 58, 512, 513, 514, 515, - 509, 510, 516, 511,32767,32767, 517, 559,32767,32767, - 535, 586,32767,32767,32767,32767,32767,32767, 139,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 521, - 32767, 137,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 534,32767,32767,32767,32767, 310, 307, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 534,32767,32767,32767,32767, - 32767, 287,32767, 304,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 282,32767,32767, 376,32767,32767,32767,32767, 355,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 152, - 152, 3, 3, 337, 152, 152, 152, 337, 152, 337, - 337, 337, 152, 152, 152, 152, 152, 152, 276, 184, - 258, 261, 243, 243, 152, 347, 152 + 32767,32767,32767, 539,32767,32767,32767,32767,32767, 290, + 32767, 307,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 285,32767, + 32767, 379,32767,32767,32767,32767, 358,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 152, 152, 3, + 3, 340, 152, 152, 152, 340, 340, 152, 340, 340, + 340, 152, 152, 152, 152, 152, 152, 279, 184, 261, + 264, 246, 246, 152, 350, 152 ); protected $goto = array( - 194, 194, 677, 466, 1281, 1282, 345, 428, 325, 325, - 325, 325, 536, 536, 536, 536, 665, 591, 926, 1039, - 685, 1003, 1019, 1020, 1080, 1081, 165, 165, 165, 165, + 194, 194, 685, 425, 653, 346, 614, 650, 419, 310, + 311, 331, 569, 316, 424, 332, 426, 630, 1200, 930, + 693, 1051, 1201, 1204, 931, 1205, 165, 165, 165, 165, 218, 195, 191, 191, 175, 177, 213, 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, 192, 186, 187, - 188, 189, 190, 215, 213, 216, 524, 525, 415, 526, - 528, 529, 530, 531, 532, 533, 534, 535, 1108, 166, + 188, 189, 190, 215, 213, 216, 529, 530, 415, 531, + 533, 534, 535, 536, 537, 538, 539, 540, 1120, 166, 167, 168, 193, 169, 170, 171, 164, 172, 173, 174, - 176, 212, 214, 217, 235, 238, 241, 242, 244, 255, + 176, 212, 214, 217, 235, 240, 241, 242, 254, 255, 256, 257, 258, 259, 260, 261, 263, 264, 265, 266, - 277, 278, 313, 314, 315, 420, 421, 422, 569, 219, + 278, 279, 313, 314, 315, 420, 421, 422, 574, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 178, 234, 179, 196, 197, 198, - 236, 186, 187, 188, 189, 190, 215, 1108, 199, 180, + 236, 186, 187, 188, 189, 190, 215, 1120, 199, 180, 181, 182, 200, 196, 183, 237, 201, 199, 163, 202, 203, 184, 204, 205, 206, 185, 207, 208, 209, 210, - 211, 834, 587, 425, 645, 548, 541, 830, 831, 419, - 310, 311, 332, 564, 316, 424, 333, 426, 623, 832, - 973, 947, 947, 945, 947, 710, 808, 540, 982, 977, - 827, 827, 607, 642, 391, 541, 548, 557, 558, 398, - 567, 589, 603, 604, 839, 865, 887, 882, 883, 896, - 15, 840, 884, 837, 885, 886, 838, 457, 457, 639, - 890, 656, 657, 658, 987, 987, 457, 609, 609, 806, - 1060, 1056, 1057, 1238, 1238, 1238, 1238, 1238, 1238, 1238, - 1238, 1238, 1238, 1256, 1256, 346, 347, 812, 949, 1256, - 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1014, - 1013, 1207, 1008, 1207, 1008, 1207, 561, 442, 1008, 1008, - 1008, 343, 442, 1008, 442, 1008, 1008, 1008, 1008, 1008, - 1008, 1008, 1008, 1008, 1008, 251, 251, 1296, 812, 1207, - 812, 1307, 1307, 970, 1207, 1207, 1207, 1207, 1017, 1018, - 1207, 1207, 1207, 1288, 1288, 1288, 1288, 827, 1307, 321, - 305, 248, 248, 248, 248, 250, 252, 387, 903, 1254, - 1254, 619, 620, 904, 1203, 1254, 1254, 1254, 1254, 1254, - 1254, 1254, 1254, 1254, 1254, 527, 527, 280, 280, 280, - 280, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 941, 405, 684, 560, 442, 442, 442, 442, 442, - 442, 442, 442, 442, 442, 442, 348, 644, 442, 389, - 393, 549, 588, 592, 847, 1157, 348, 348, 538, 1204, - 538, 891, 538, 892, 432, 418, 822, 598, 666, 859, - 348, 348, 846, 348, 5, 1323, 6, 824, 554, 1283, - 1284, 650, 1205, 1264, 1265, 602, 448, 543, 565, 601, - 348, 943, 943, 943, 943, 334, 932, 448, 937, 944, - 403, 404, 1278, 852, 1278, 654, 1278, 655, 397, 407, - 408, 409, 1200, 668, 849, 1045, 410, 542, 552, 992, - 341, 490, 542, 491, 552, 714, 467, 390, 861, 497, - 1049, 1290, 1290, 1290, 1290, 1267, 954, 568, 460, 461, - 462, 1091, 857, 471, 0, 1314, 1315, 555, 0, 0, - 0, 711, 622, 624, 0, 643, 0, 1274, 670, 667, - 671, 984, 675, 683, 980, 0, 0, 0, 0, 0, - 855, 596, 610, 613, 614, 615, 616, 636, 637, 638, - 687, 860, 848, 1044, 1048, 908, 1096, 0, 543, 0, - 0, 952, 606, 1306, 1306, 0, 1047, 989, 0, 0, - 1276, 1276, 1047, 254, 254, 851, 0, 648, 968, 427, - 1306, 0, 0, 845, 942, 427, 0, 0, 0, 0, - 0, 0, 0, 1015, 1015, 1199, 0, 1309, 649, 1026, - 1022, 1023, 0, 0, 0, 0, 1089, 864, 0, 0, - 0, 586, 1073, 0, 688, 674, 674, 1202, 498, 680, - 1071, 1188, 919, 0, 0, 1189, 1192, 920, 1193, 0, + 211, 275, 275, 275, 275, 843, 593, 646, 647, 560, + 664, 665, 666, 720, 629, 631, 840, 418, 651, 604, + 841, 350, 675, 679, 996, 683, 691, 992, 616, 616, + 817, 350, 350, 1252, 1252, 1252, 1252, 1252, 1252, 1252, + 1252, 1252, 1252, 1092, 1093, 350, 350, 874, 350, 848, + 1337, 896, 891, 892, 905, 849, 893, 846, 894, 895, + 847, 548, 900, 899, 901, 350, 391, 394, 554, 594, + 598, 1270, 1270, 1072, 1068, 1069, 1270, 1270, 1270, 1270, + 1270, 1270, 1270, 1270, 1270, 1270, 1268, 1268, 815, 347, + 348, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, + 1268, 1221, 1020, 1221, 1020, 1221, 836, 5, 1020, 6, + 1020, 1020, 1281, 961, 1020, 1020, 1020, 1020, 1020, 1020, + 1020, 1020, 1020, 1020, 1020, 349, 349, 349, 349, 1221, + 460, 460, 566, 678, 1221, 1221, 1221, 1221, 344, 460, + 1221, 1221, 1221, 1302, 1302, 1302, 1302, 602, 617, 620, + 621, 622, 623, 643, 644, 645, 695, 836, 912, 553, + 546, 1310, 913, 548, 532, 532, 821, 856, 982, 532, + 532, 532, 532, 532, 532, 532, 532, 532, 532, 543, + 473, 543, 868, 543, 928, 855, 928, 389, 475, 337, + 546, 553, 562, 563, 339, 572, 595, 609, 610, 1320, + 1320, 249, 249, 1026, 1025, 15, 821, 450, 821, 494, + 565, 495, 955, 955, 955, 955, 1320, 501, 450, 949, + 956, 839, 652, 1321, 1321, 1169, 1214, 246, 246, 246, + 246, 248, 250, 1323, 985, 959, 959, 957, 959, 719, + 1321, 545, 994, 989, 470, 1295, 1296, 953, 405, 692, + 917, 1108, 432, 541, 541, 541, 541, 612, 597, 452, + 444, 1029, 1030, 1001, 658, 444, 1292, 444, 1292, 674, + 1292, 860, 833, 656, 980, 836, 861, 547, 557, 854, + 321, 305, 547, 333, 557, 1297, 1298, 392, 456, 570, + 607, 1211, 944, 398, 858, 1304, 1304, 1304, 1304, 463, + 573, 464, 465, 608, 1004, 866, 403, 404, 1328, 1329, + 1057, 662, 1212, 663, 471, 407, 408, 409, 723, 676, + 870, 1288, 410, 624, 626, 627, 342, 427, 1216, 869, + 857, 1056, 1060, 427, 864, 1061, 1103, 966, 0, 0, + 964, 1027, 1027, 0, 0, 0, 657, 1038, 1034, 1035, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 0, 1059, 444, 954, 0, 1290, 1290, 1059, 592, + 1085, 0, 696, 682, 682, 0, 502, 688, 1083, 0, + 0, 0, 1217, 1218, 272, 428, 1101, 873, 0, 544, + 831, 544, 0, 0, 0, 673, 938, 0, 0, 1015, + 1031, 1032, 0, 0, 0, 0, 0, 0, 1219, 1278, + 1279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 272, 0, 0, 0, - 0, 539, 0, 539 + 0, 0, 0, 0, 0, 0, 0, 0, 252, 252, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 999, 999 ); protected $gotoCheck = array( - 42, 42, 72, 172, 172, 172, 95, 87, 23, 23, - 23, 23, 105, 105, 105, 105, 87, 105, 87, 125, - 9, 87, 87, 87, 142, 142, 42, 42, 42, 42, + 42, 42, 72, 65, 65, 96, 55, 55, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 78, 78, + 9, 126, 78, 78, 78, 78, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, @@ -767,95 +773,97 @@ class Php7 extends \PhpParser\ParserAbstract 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 15, 128, 65, 65, 75, 75, 25, 26, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 27, - 25, 25, 25, 25, 25, 25, 7, 25, 25, 25, - 22, 22, 55, 55, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 15, 45, 15, 15, 15, 15, - 75, 15, 15, 15, 15, 15, 15, 147, 147, 84, - 15, 84, 84, 84, 105, 105, 147, 106, 106, 6, - 15, 15, 15, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 166, 166, 95, 95, 12, 49, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 116, - 116, 72, 72, 72, 72, 72, 168, 23, 72, 72, - 72, 175, 23, 72, 23, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 5, 5, 177, 12, 72, - 12, 179, 179, 101, 72, 72, 72, 72, 117, 117, - 72, 72, 72, 9, 9, 9, 9, 22, 179, 165, - 165, 5, 5, 5, 5, 5, 5, 61, 72, 167, - 167, 83, 83, 72, 20, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 169, 169, 24, 24, 24, - 24, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 91, 91, 91, 102, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 14, 63, 23, 58, - 58, 58, 58, 58, 35, 149, 14, 14, 19, 20, - 19, 64, 19, 64, 111, 13, 20, 13, 114, 35, - 14, 14, 35, 14, 46, 14, 46, 18, 9, 174, - 174, 118, 20, 20, 20, 9, 19, 14, 2, 2, - 14, 19, 19, 19, 19, 29, 90, 19, 19, 19, - 80, 80, 128, 39, 128, 80, 128, 80, 28, 80, - 80, 80, 158, 80, 37, 127, 80, 9, 9, 108, - 80, 153, 9, 153, 9, 97, 155, 9, 41, 153, - 130, 128, 128, 128, 128, 14, 94, 9, 9, 9, - 9, 145, 9, 82, -1, 9, 9, 48, -1, -1, - -1, 48, 48, 48, -1, 48, -1, 128, 14, 48, - 48, 48, 48, 48, 48, -1, -1, -1, -1, -1, - 9, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 16, 16, 16, 16, 17, 17, -1, 14, -1, - -1, 16, 17, 178, 178, -1, 128, 17, -1, -1, - 128, 128, 128, 5, 5, 17, -1, 17, 17, 115, - 178, -1, -1, 17, 16, 115, -1, -1, -1, -1, - -1, -1, -1, 115, 115, 17, -1, 178, 115, 115, - 115, 115, -1, -1, -1, -1, 16, 16, -1, -1, - -1, 8, 8, -1, 8, 8, 8, 14, 8, 8, - 8, 78, 78, -1, -1, 78, 78, 78, 78, -1, + 42, 23, 23, 23, 23, 15, 129, 85, 85, 48, + 85, 85, 85, 48, 48, 48, 26, 13, 48, 13, + 27, 14, 48, 48, 48, 48, 48, 48, 107, 107, + 7, 14, 14, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 143, 143, 14, 14, 45, 14, 15, + 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 14, 64, 15, 64, 14, 58, 58, 58, 58, + 58, 168, 168, 15, 15, 15, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 169, 169, 6, 96, + 96, 169, 169, 169, 169, 169, 169, 169, 169, 169, + 169, 72, 72, 72, 72, 72, 22, 46, 72, 46, + 72, 72, 14, 49, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 24, 24, 24, 24, 72, + 148, 148, 170, 14, 72, 72, 72, 72, 177, 148, + 72, 72, 72, 9, 9, 9, 9, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 22, 72, 75, + 75, 179, 72, 14, 171, 171, 12, 35, 102, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 19, + 83, 19, 35, 19, 9, 35, 9, 61, 83, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 180, + 180, 5, 5, 117, 117, 75, 12, 19, 12, 154, + 103, 154, 19, 19, 19, 19, 180, 154, 19, 19, + 19, 25, 63, 181, 181, 150, 14, 5, 5, 5, + 5, 5, 5, 180, 25, 25, 25, 25, 25, 25, + 181, 25, 25, 25, 174, 174, 174, 92, 92, 92, + 17, 17, 112, 106, 106, 106, 106, 17, 106, 82, + 23, 118, 118, 17, 119, 23, 129, 23, 129, 115, + 129, 17, 18, 17, 17, 22, 39, 9, 9, 17, + 167, 167, 9, 29, 9, 176, 176, 9, 9, 2, + 2, 17, 91, 28, 37, 129, 129, 129, 129, 9, + 9, 9, 9, 79, 109, 9, 81, 81, 9, 9, + 128, 81, 159, 81, 156, 81, 81, 81, 98, 81, + 41, 129, 81, 84, 84, 84, 81, 116, 20, 16, + 16, 16, 16, 116, 9, 131, 146, 95, -1, -1, + 16, 116, 116, -1, -1, -1, 116, 116, 116, 116, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, -1, 129, 23, 16, -1, 129, 129, 129, 8, + 8, -1, 8, 8, 8, -1, 8, 8, 8, -1, + -1, -1, 20, 20, 24, 88, 16, 16, -1, 24, + 20, 24, -1, -1, -1, 88, 88, -1, -1, 88, + 88, 88, -1, -1, -1, -1, -1, -1, 20, 20, + 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, - -1, 24, -1, 24 + -1, -1, -1, -1, -1, -1, -1, -1, 5, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 106, 106 ); protected $gotoBase = array( - 0, 0, -283, 0, 0, 284, 216, 177, 554, 7, - 0, 0, -46, 51, 72, -181, 57, 49, 91, 111, - -62, 0, -135, 5, 334, 163, 164, 175, 94, 122, - 0, 0, 0, 0, 0, 10, 0, 98, 0, 103, - 0, 13, -1, 0, 0, 193, -320, 0, -223, 225, - 0, 0, 0, 0, 0, 153, 0, 0, 325, 0, - 0, 276, 0, 127, 362, -76, 0, 0, 0, 0, - 0, 0, -6, 0, 0, -174, 0, 0, 168, 140, - -61, 0, -4, -149, -478, 0, 0, -263, 0, 0, - 88, 50, 0, 0, 19, -467, 0, 43, 0, 0, - 0, 259, 312, 0, 0, -15, -12, 0, 76, 0, - 0, 110, 0, 0, 109, 261, -16, 16, 114, 0, - 0, 0, 0, 0, 0, 17, 0, 68, 155, 0, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -248, 0, 0, 23, 0, 184, 0, 104, - 0, 0, 0, -44, 0, 12, 0, 0, 70, 0, - 0, 0, 0, 0, 0, -9, 4, 80, 238, 96, - 0, 0, -294, 0, 34, 242, 0, 257, 209, -13, - 0, 0 + 0, 0, -250, 0, 0, 360, 235, 181, 522, 7, + 0, 0, 33, -156, -113, -178, 43, -49, 126, 72, + 100, 0, -9, 158, 282, 377, 172, 176, 120, 150, + 0, 0, 0, 0, 0, -39, 0, 119, 0, 116, + 0, 45, -1, 0, 0, 195, -456, 0, -529, 250, + 0, 0, 0, 0, 0, -33, 0, 0, 182, 0, + 0, 306, 0, 143, 203, -235, 0, 0, 0, 0, + 0, 0, -6, 0, 0, -21, 0, 0, -385, 124, + -46, -19, 144, -123, 10, -538, 0, 0, 275, 0, + 0, 127, 106, 0, 0, 60, -472, 0, 76, 0, + 0, 0, 294, 328, 0, 0, 386, -50, 0, 99, + 0, 0, 138, 0, 0, 149, 219, 87, 139, 137, + 0, 0, 0, 0, 0, 0, 19, 0, 101, 159, + 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -69, 0, 0, 58, 0, 257, 0, + 114, 0, 0, 0, -120, 0, 40, 0, 0, 108, + 0, 0, 0, 0, 0, 0, 0, 122, -7, 8, + 264, 86, 0, 0, 107, 0, 78, 269, 0, 291, + 55, 79, 0, 0 ); protected $gotoDefault = array( - -32768, 502, 718, 4, 719, 912, 795, 804, 584, 518, - 686, 342, 611, 416, 1272, 889, 1095, 566, 823, 1216, - 1224, 449, 826, 326, 708, 871, 872, 873, 394, 379, - 385, 392, 634, 612, 484, 858, 445, 850, 476, 853, - 444, 862, 162, 413, 500, 866, 3, 868, 545, 899, - 380, 876, 381, 661, 878, 551, 880, 881, 388, 395, - 396, 1100, 559, 608, 893, 243, 553, 894, 378, 895, - 902, 383, 386, 672, 456, 495, 489, 406, 1075, 595, - 631, 453, 470, 618, 617, 605, 469, 1011, 411, 328, - 931, 939, 477, 454, 953, 344, 961, 716, 1107, 625, - 479, 969, 626, 976, 979, 519, 520, 468, 991, 268, - 994, 480, 1032, 651, 1005, 1006, 652, 627, 1028, 628, - 653, 629, 1030, 463, 585, 1038, 446, 1046, 1260, 447, - 1050, 262, 1053, 274, 412, 429, 1058, 1059, 8, 1065, - 678, 679, 10, 273, 499, 1090, 673, 443, 1106, 433, - 1176, 1178, 547, 481, 1196, 1195, 664, 496, 1201, 1263, - 441, 521, 464, 312, 522, 304, 330, 309, 537, 291, - 331, 523, 465, 1269, 1277, 327, 30, 1297, 1308, 338, - 563, 600 + -32768, 506, 727, 4, 728, 921, 804, 813, 590, 523, + 694, 343, 618, 416, 1286, 898, 1107, 571, 832, 1230, + 1238, 451, 835, 326, 717, 880, 881, 882, 395, 381, + 387, 393, 641, 619, 488, 867, 447, 859, 480, 862, + 446, 871, 162, 413, 504, 875, 3, 877, 550, 908, + 382, 885, 383, 669, 887, 556, 889, 890, 390, 396, + 397, 1112, 564, 615, 902, 253, 558, 903, 380, 904, + 911, 385, 388, 680, 459, 499, 493, 406, 1087, 559, + 601, 638, 441, 467, 613, 625, 611, 474, 1023, 411, + 325, 943, 951, 481, 457, 965, 345, 973, 725, 1119, + 632, 483, 981, 633, 988, 991, 524, 525, 472, 1003, + 268, 1006, 484, 1044, 659, 1017, 1018, 660, 634, 1040, + 635, 661, 636, 1042, 466, 591, 1050, 448, 1058, 1274, + 449, 1062, 262, 1065, 274, 412, 429, 1070, 1071, 8, + 1077, 686, 687, 10, 273, 503, 1102, 681, 445, 1118, + 433, 1188, 1190, 552, 485, 1208, 1207, 672, 500, 1213, + 442, 1277, 443, 526, 468, 312, 527, 304, 329, 309, + 542, 291, 330, 528, 469, 1283, 1291, 327, 30, 1311, + 1322, 338, 568, 606 ); protected $ruleToNonTerminal = array( @@ -879,25 +887,25 @@ class Php7 extends \PhpParser\ParserAbstract 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 25, 25, 68, 68, 71, 71, 70, 69, 69, 62, 74, 74, 75, 75, 76, 76, 77, 77, - 78, 78, 26, 26, 27, 27, 27, 27, 86, 86, - 88, 88, 81, 81, 89, 89, 90, 90, 90, 82, - 82, 85, 85, 83, 83, 91, 92, 92, 56, 56, - 64, 64, 67, 67, 67, 66, 93, 93, 94, 57, - 57, 57, 57, 95, 95, 96, 96, 97, 97, 98, - 99, 99, 100, 100, 101, 101, 54, 54, 50, 50, - 103, 52, 52, 104, 51, 51, 53, 53, 63, 63, - 63, 63, 79, 79, 107, 107, 109, 109, 110, 110, - 110, 110, 108, 108, 108, 112, 112, 112, 112, 87, - 87, 115, 115, 115, 116, 116, 113, 113, 117, 117, - 119, 119, 120, 120, 114, 121, 121, 118, 122, 122, - 122, 122, 111, 111, 80, 80, 80, 20, 20, 20, - 124, 123, 123, 125, 125, 125, 125, 59, 126, 126, - 127, 60, 129, 129, 130, 130, 131, 131, 84, 132, - 132, 132, 132, 132, 132, 137, 137, 138, 138, 139, - 139, 139, 139, 139, 140, 141, 141, 136, 136, 133, - 133, 135, 135, 143, 143, 142, 142, 142, 142, 142, - 142, 142, 134, 144, 144, 146, 145, 145, 61, 102, - 147, 147, 55, 55, 42, 42, 42, 42, 42, 42, + 78, 78, 79, 79, 26, 26, 27, 27, 27, 27, + 27, 87, 87, 89, 89, 82, 82, 90, 90, 91, + 91, 91, 83, 83, 86, 86, 84, 84, 92, 93, + 93, 56, 56, 64, 64, 67, 67, 67, 66, 94, + 94, 95, 57, 57, 57, 57, 96, 96, 97, 97, + 98, 98, 99, 100, 100, 101, 101, 102, 102, 54, + 54, 50, 50, 104, 52, 52, 105, 51, 51, 53, + 53, 63, 63, 63, 63, 80, 80, 108, 108, 110, + 110, 111, 111, 111, 111, 109, 109, 109, 113, 113, + 113, 113, 88, 88, 116, 116, 116, 117, 117, 114, + 114, 118, 118, 120, 120, 121, 121, 115, 122, 122, + 119, 123, 123, 123, 123, 112, 112, 81, 81, 81, + 20, 20, 20, 125, 124, 124, 126, 126, 126, 126, + 59, 127, 127, 128, 60, 130, 130, 131, 131, 132, + 132, 85, 133, 133, 133, 133, 133, 133, 138, 138, + 139, 139, 140, 140, 140, 140, 140, 141, 142, 142, + 137, 137, 134, 134, 136, 136, 144, 144, 143, 143, + 143, 143, 143, 143, 143, 135, 145, 145, 147, 146, + 146, 61, 103, 148, 148, 55, 55, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, @@ -906,20 +914,21 @@ class Php7 extends \PhpParser\ParserAbstract 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 154, 148, 148, - 153, 153, 156, 157, 157, 158, 159, 159, 159, 19, - 19, 72, 72, 72, 72, 149, 149, 149, 149, 161, - 161, 150, 150, 152, 152, 152, 155, 155, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 167, 167, 106, - 169, 169, 169, 169, 151, 151, 151, 151, 151, 151, - 151, 151, 58, 58, 164, 164, 164, 164, 170, 170, - 160, 160, 160, 171, 171, 171, 171, 171, 171, 73, - 73, 65, 65, 65, 65, 128, 128, 128, 128, 174, - 173, 163, 163, 163, 163, 163, 163, 163, 162, 162, - 162, 172, 172, 172, 172, 105, 168, 176, 176, 175, - 175, 177, 177, 177, 177, 177, 177, 177, 177, 165, - 165, 165, 165, 179, 180, 178, 178, 178, 178, 178, - 178, 178, 178, 181, 181, 181, 181 + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 155, 149, 149, 154, 154, 157, 158, 158, 159, 160, + 161, 161, 161, 161, 19, 19, 72, 72, 72, 72, + 150, 150, 150, 150, 163, 163, 151, 151, 153, 153, + 153, 156, 156, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 169, 169, 107, 171, 171, 171, 171, 152, + 152, 152, 152, 152, 152, 152, 152, 58, 58, 166, + 166, 166, 166, 172, 172, 162, 162, 162, 173, 173, + 173, 173, 173, 173, 73, 73, 65, 65, 65, 65, + 129, 129, 129, 129, 176, 175, 165, 165, 165, 165, + 165, 165, 165, 164, 164, 164, 174, 174, 174, 174, + 106, 170, 178, 178, 177, 177, 179, 179, 179, 179, + 179, 179, 179, 179, 167, 167, 167, 167, 181, 182, + 180, 180, 180, 180, 180, 180, 180, 180, 183, 183, + 183, 183 ); protected $ruleToLength = array( @@ -943,47 +952,48 @@ class Php7 extends \PhpParser\ParserAbstract 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, 2, 1, 1, 1, 0, 2, 1, 3, 8, 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, 1, - 3, 1, 8, 9, 8, 7, 6, 8, 0, 2, - 0, 2, 1, 2, 1, 2, 1, 1, 1, 0, - 2, 0, 2, 0, 2, 2, 1, 3, 1, 4, - 1, 4, 1, 1, 4, 2, 1, 3, 3, 3, - 4, 4, 5, 0, 2, 4, 3, 1, 1, 7, - 0, 2, 1, 3, 3, 4, 1, 4, 0, 2, - 5, 0, 2, 6, 0, 2, 0, 3, 1, 2, - 1, 1, 2, 0, 1, 3, 0, 2, 1, 1, - 1, 1, 6, 8, 6, 1, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, - 3, 3, 3, 3, 1, 3, 3, 1, 1, 2, - 1, 1, 0, 1, 0, 2, 2, 2, 4, 3, - 1, 1, 3, 1, 2, 2, 3, 2, 3, 1, - 1, 2, 3, 1, 1, 3, 2, 0, 1, 5, - 5, 10, 3, 5, 1, 1, 3, 0, 2, 4, - 5, 4, 4, 4, 3, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 3, 1, 1, 3, 2, 2, - 3, 1, 0, 1, 1, 3, 3, 3, 4, 1, - 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, + 3, 1, 1, 1, 8, 9, 7, 8, 7, 6, + 8, 0, 2, 0, 2, 1, 2, 1, 2, 1, + 1, 1, 0, 2, 0, 2, 0, 2, 2, 1, + 3, 1, 4, 1, 4, 1, 1, 4, 2, 1, + 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, + 1, 1, 7, 0, 2, 1, 3, 3, 4, 1, + 4, 0, 2, 5, 0, 2, 6, 0, 2, 0, + 3, 1, 2, 1, 1, 2, 0, 1, 3, 0, + 2, 1, 1, 1, 1, 6, 8, 6, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, + 1, 1, 2, 1, 1, 0, 1, 0, 2, 2, + 2, 4, 3, 1, 1, 3, 1, 2, 2, 3, + 2, 3, 1, 1, 2, 3, 1, 1, 3, 2, + 0, 1, 5, 5, 10, 3, 5, 1, 1, 3, + 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, + 1, 1, 1, 1, 0, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, + 3, 2, 2, 3, 1, 0, 1, 1, 3, 3, + 3, 4, 1, 1, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, + 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 5, 4, 3, 4, 4, 2, 2, 4, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 3, 2, 1, 2, 4, 2, 2, 8, - 9, 8, 9, 9, 10, 9, 10, 8, 3, 2, - 0, 4, 2, 1, 3, 2, 2, 2, 4, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, - 1, 0, 3, 0, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, - 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, - 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, - 1, 3, 1, 1, 4, 4, 1, 4, 4, 0, - 1, 1, 1, 3, 3, 1, 4, 2, 2, 1, - 3, 1, 4, 4, 3, 3, 3, 3, 1, 3, - 1, 1, 3, 1, 1, 4, 1, 1, 1, 3, - 1, 1, 2, 1, 3, 4, 3, 2, 0, 2, - 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, - 3, 6, 3, 1, 1, 2, 1 + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 5, 4, 3, 4, 4, + 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 3, 2, 1, 2, 4, + 2, 2, 8, 9, 8, 9, 9, 10, 9, 10, + 8, 3, 2, 0, 4, 2, 1, 3, 2, 1, + 2, 2, 2, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 1, 1, 0, 3, 0, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 3, 4, 1, 1, 3, 1, + 1, 1, 1, 1, 3, 2, 3, 0, 1, 1, + 3, 1, 1, 1, 1, 1, 3, 1, 1, 4, + 4, 1, 4, 4, 0, 1, 1, 1, 3, 3, + 1, 4, 2, 2, 1, 3, 1, 4, 4, 3, + 3, 3, 3, 1, 3, 1, 1, 3, 1, 1, + 4, 1, 1, 1, 3, 1, 1, 2, 1, 3, + 4, 3, 2, 0, 2, 2, 1, 2, 1, 1, + 1, 4, 3, 3, 3, 3, 6, 3, 1, 1, + 2, 1 ); protected function initReduceCallbacks() { @@ -1620,184 +1630,185 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = []; }, 202 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(8-3)], ['byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-5)], 'returnType' => $this->semStack[$stackPos-(8-7)], 'stmts' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 203 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(9-4)], ['byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-6)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 204 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(8-3)], ['byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-5)], 'returnType' => $this->semStack[$stackPos-(8-7)], 'stmts' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 205 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(9-4)], ['byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-6)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 206 => function ($stackPos) { + $this->semValue = new Stmt\Class_($this->semStack[$stackPos-(7-2)], ['type' => $this->semStack[$stackPos-(7-1)], 'extends' => $this->semStack[$stackPos-(7-3)], 'implements' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + $this->checkClass($this->semValue, $stackPos-(7-2)); + }, + 207 => function ($stackPos) { $this->semValue = new Stmt\Class_($this->semStack[$stackPos-(8-3)], ['type' => $this->semStack[$stackPos-(8-2)], 'extends' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); $this->checkClass($this->semValue, $stackPos-(8-3)); }, - 205 => function ($stackPos) { + 208 => function ($stackPos) { $this->semValue = new Stmt\Interface_($this->semStack[$stackPos-(7-3)], ['extends' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)], 'attrGroups' => $this->semStack[$stackPos-(7-1)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); $this->checkInterface($this->semValue, $stackPos-(7-3)); }, - 206 => function ($stackPos) { + 209 => function ($stackPos) { $this->semValue = new Stmt\Trait_($this->semStack[$stackPos-(6-3)], ['stmts' => $this->semStack[$stackPos-(6-5)], 'attrGroups' => $this->semStack[$stackPos-(6-1)]], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, - 207 => function ($stackPos) { + 210 => function ($stackPos) { $this->semValue = new Stmt\Enum_($this->semStack[$stackPos-(8-3)], ['scalarType' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); $this->checkEnum($this->semValue, $stackPos-(8-3)); }, - 208 => function ($stackPos) { - $this->semValue = null; - }, - 209 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 210 => function ($stackPos) { - $this->semValue = null; - }, 211 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; + $this->semValue = null; }, 212 => function ($stackPos) { - $this->semValue = 0; + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, 213 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = null; }, 214 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, 215 => function ($stackPos) { - $this->checkClassModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + $this->semValue = 0; }, 216 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, - 217 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, - 218 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; - }, - 219 => function ($stackPos) { - $this->semValue = null; - }, - 220 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 221 => function ($stackPos) { - $this->semValue = array(); - }, - 222 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 223 => function ($stackPos) { - $this->semValue = array(); - }, - 224 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 225 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-1)]; }, + 217 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 218 => function ($stackPos) { + $this->checkClassModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + }, + 219 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 220 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 221 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_READONLY; + }, + 222 => function ($stackPos) { + $this->semValue = null; + }, + 223 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 224 => function ($stackPos) { + $this->semValue = array(); + }, + 225 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, 226 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semValue = array(); }, 227 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, 228 => function ($stackPos) { - $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 229 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 230 => function ($stackPos) { - $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 231 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 232 => function ($stackPos) { $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); }, + 232 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, 233 => function ($stackPos) { - $this->semValue = null; + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); }, 234 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-2)]; }, 235 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 236 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 237 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 238 => function ($stackPos) { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 239 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; - }, - 240 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-3)]; - }, - 241 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 242 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(5-3)]; - }, - 243 => function ($stackPos) { - $this->semValue = array(); - }, - 244 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 245 => function ($stackPos) { - $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 246 => function ($stackPos) { - $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 247 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 248 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 249 => function ($stackPos) { - $this->semValue = new Expr\Match_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); - }, - 250 => function ($stackPos) { - $this->semValue = []; - }, - 251 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 252 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 253 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 254 => function ($stackPos) { - $this->semValue = new Node\MatchArm($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 255 => function ($stackPos) { - $this->semValue = new Node\MatchArm(null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 256 => function ($stackPos) { $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); }, - 257 => function ($stackPos) { + 236 => function ($stackPos) { + $this->semValue = null; + }, + 237 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-2)]; }, - 258 => function ($stackPos) { + 238 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 239 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 240 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 241 => function ($stackPos) { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 242 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 243 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 244 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 245 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(5-3)]; + }, + 246 => function ($stackPos) { $this->semValue = array(); }, - 259 => function ($stackPos) { + 247 => function ($stackPos) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, + 248 => function ($stackPos) { + $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 249 => function ($stackPos) { + $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 250 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 251 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 252 => function ($stackPos) { + $this->semValue = new Expr\Match_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 253 => function ($stackPos) { + $this->semValue = []; + }, + 254 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 255 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 256 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 257 => function ($stackPos) { + $this->semValue = new Node\MatchArm($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 258 => function ($stackPos) { + $this->semValue = new Node\MatchArm(null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 259 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, 260 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(5-3)], is_array($this->semStack[$stackPos-(5-5)]) ? $this->semStack[$stackPos-(5-5)] : array($this->semStack[$stackPos-(5-5)]), $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(4-2)]; }, 261 => function ($stackPos) { $this->semValue = array(); @@ -1806,132 +1817,132 @@ class Php7 extends \PhpParser\ParserAbstract $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 263 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(5-3)], is_array($this->semStack[$stackPos-(5-5)]) ? $this->semStack[$stackPos-(5-5)] : array($this->semStack[$stackPos-(5-5)]), $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, 264 => function ($stackPos) { - $this->semValue = null; + $this->semValue = array(); }, 265 => function ($stackPos) { - $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 266 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, 267 => function ($stackPos) { - $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = null; }, 268 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 269 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(2-2)], true); + $this->semValue = null; }, 270 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 271 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)], false); }, 272 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = array($this->semStack[$stackPos-(2-2)], true); }, 273 => function ($stackPos) { - $this->semValue = array(); + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); }, 274 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); }, 275 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 276 => function ($stackPos) { - $this->semValue = 0; + $this->semValue = array(); }, 277 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 278 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 279 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + $this->semValue = 0; }, 280 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, 281 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; }, 282 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + }, + 283 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + }, + 284 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_READONLY; + }, + 285 => function ($stackPos) { $this->semValue = new Node\Param($this->semStack[$stackPos-(6-6)], null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); $this->checkParam($this->semValue); }, - 283 => function ($stackPos) { + 286 => function ($stackPos) { $this->semValue = new Node\Param($this->semStack[$stackPos-(8-6)], $this->semStack[$stackPos-(8-8)], $this->semStack[$stackPos-(8-3)], $this->semStack[$stackPos-(8-4)], $this->semStack[$stackPos-(8-5)], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes, $this->semStack[$stackPos-(8-2)], $this->semStack[$stackPos-(8-1)]); $this->checkParam($this->semValue); }, - 284 => function ($stackPos) { - $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes), null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); - }, - 285 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 286 => function ($stackPos) { - $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, 287 => function ($stackPos) { - $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes), null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); }, 288 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 289 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 290 => function ($stackPos) { - $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 291 => function ($stackPos) { - $this->semValue = $this->handleBuiltinTypes($this->semStack[$stackPos-(1-1)]); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 292 => function ($stackPos) { - $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 293 => function ($stackPos) { - $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 294 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->handleBuiltinTypes($this->semStack[$stackPos-(1-1)]); }, 295 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 296 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 297 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 298 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 299 => function ($stackPos) { + 298 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 300 => function ($stackPos) { + 299 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, + 300 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, 301 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 302 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 303 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, 304 => function ($stackPos) { - $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 305 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); @@ -1943,706 +1954,706 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 308 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, 309 => function ($stackPos) { - $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 310 => function ($stackPos) { - $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 311 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 312 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 313 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 314 => function ($stackPos) { - $this->semValue = null; - }, - 315 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-2)]; - }, - 316 => function ($stackPos) { - $this->semValue = null; - }, - 317 => function ($stackPos) { - $this->semValue = array(); - }, - 318 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-2)]; - }, - 319 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(3-2)]); - }, - 320 => function ($stackPos) { - $this->semValue = new Node\VariadicPlaceholder($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 321 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 322 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 323 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 324 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 325 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 326 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos-(3-3)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->semStack[$stackPos-(3-1)]); - }, - 327 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 328 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 329 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 330 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 331 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; + 315 => function ($stackPos) { + $this->semValue = null; }, - 332 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + 316 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 333 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + 317 => function ($stackPos) { + $this->semValue = null; }, - 334 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + 318 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; }, - 335 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + 319 => function ($stackPos) { + $this->semValue = null; }, - 336 => function ($stackPos) { - if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } - }, - 337 => function ($stackPos) { + 320 => function ($stackPos) { $this->semValue = array(); }, + 321 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 322 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-2)]); + }, + 323 => function ($stackPos) { + $this->semValue = new Node\VariadicPlaceholder($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 324 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 325 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 326 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 327 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 328 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 329 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(3-3)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->semStack[$stackPos-(3-1)]); + }, + 330 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 331 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 332 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 333 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 334 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 335 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 336 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 337 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, 338 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 339 => function ($stackPos) { + if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } + }, + 340 => function ($stackPos) { + $this->semValue = array(); + }, + 341 => function ($stackPos) { $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 339 => function ($stackPos) { + 342 => function ($stackPos) { $this->semValue = new Stmt\Property($this->semStack[$stackPos-(5-2)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes, $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-1)]); $this->checkProperty($this->semValue, $stackPos-(5-2)); }, - 340 => function ($stackPos) { + 343 => function ($stackPos) { $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos-(5-4)], $this->semStack[$stackPos-(5-2)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes, $this->semStack[$stackPos-(5-1)]); $this->checkClassConst($this->semValue, $stackPos-(5-2)); }, - 341 => function ($stackPos) { + 344 => function ($stackPos) { $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos-(10-5)], ['type' => $this->semStack[$stackPos-(10-2)], 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-7)], 'returnType' => $this->semStack[$stackPos-(10-9)], 'stmts' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); $this->checkClassMethod($this->semValue, $stackPos-(10-2)); }, - 342 => function ($stackPos) { + 345 => function ($stackPos) { $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 343 => function ($stackPos) { + 346 => function ($stackPos) { $this->semValue = new Stmt\EnumCase($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->semStack[$stackPos-(5-1)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, - 344 => function ($stackPos) { + 347 => function ($stackPos) { $this->semValue = null; /* will be skipped */ }, - 345 => function ($stackPos) { - $this->semValue = array(); - }, - 346 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; - }, - 347 => function ($stackPos) { - $this->semValue = array(); - }, 348 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = array(); }, 349 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 350 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + $this->semValue = array(); }, 351 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 352 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 353 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, 354 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 355 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 356 => function ($stackPos) { - $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 357 => function ($stackPos) { - $this->semValue = null; + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, 358 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 359 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); }, 360 => function ($stackPos) { - $this->semValue = 0; + $this->semValue = null; }, 361 => function ($stackPos) { - $this->semValue = 0; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 362 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 363 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = 0; }, 364 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + $this->semValue = 0; }, 365 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 366 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 367 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, 368 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; }, 369 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; }, 370 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; }, 371 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; + $this->semValue = Stmt\Class_::MODIFIER_STATIC; }, 372 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; }, 373 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semValue = Stmt\Class_::MODIFIER_FINAL; }, 374 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = Stmt\Class_::MODIFIER_READONLY; }, 375 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 376 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 377 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 378 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 379 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 380 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 381 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, + 377 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 378 => function ($stackPos) { + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 379 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 380 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 381 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, 382 => function ($stackPos) { - $this->semValue = array(); + $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 383 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 384 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 385 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = array(); }, 386 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 387 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 388 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 389 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 390 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 391 => function ($stackPos) { - $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 392 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 393 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 394 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 395 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 396 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 397 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 398 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 399 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 400 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 401 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 402 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 403 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 404 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 405 => function ($stackPos) { - $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 406 => function ($stackPos) { - $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 407 => function ($stackPos) { - $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 408 => function ($stackPos) { - $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 409 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 410 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 411 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 412 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 413 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 414 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 415 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 416 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 417 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 418 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 419 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 420 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 421 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 422 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 423 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 424 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 425 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 426 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 427 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 428 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 429 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 430 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 431 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 432 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 433 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 434 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 435 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 436 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 437 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 438 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 439 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 440 => function ($stackPos) { - $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 441 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 442 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 443 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 444 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 445 => function ($stackPos) { - $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); }, 446 => function ($stackPos) { - $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 447 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 448 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 449 => function ($stackPos) { - $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 450 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 451 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 452 => function ($stackPos) { - $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 453 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 454 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 455 => function ($stackPos) { + $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 456 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos-(2-1)]); $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos-(2-2)], $attrs); }, - 454 => function ($stackPos) { + 457 => function ($stackPos) { $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 455 => function ($stackPos) { + 458 => function ($stackPos) { $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 456 => function ($stackPos) { + 459 => function ($stackPos) { $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 457 => function ($stackPos) { + 460 => function ($stackPos) { $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 458 => function ($stackPos) { + 461 => function ($stackPos) { $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 459 => function ($stackPos) { + 462 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strtolower($this->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; $this->semValue = new Expr\Exit_($this->semStack[$stackPos-(2-2)], $attrs); }, - 460 => function ($stackPos) { + 463 => function ($stackPos) { $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 461 => function ($stackPos) { + 464 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 462 => function ($stackPos) { + 465 => function ($stackPos) { $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 463 => function ($stackPos) { + 466 => function ($stackPos) { $this->semValue = new Expr\Print_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 464 => function ($stackPos) { + 467 => function ($stackPos) { $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 465 => function ($stackPos) { + 468 => function ($stackPos) { $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(2-2)], null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 466 => function ($stackPos) { + 469 => function ($stackPos) { $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 467 => function ($stackPos) { + 470 => function ($stackPos) { $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 468 => function ($stackPos) { + 471 => function ($stackPos) { $this->semValue = new Expr\Throw_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 469 => function ($stackPos) { + 472 => function ($stackPos) { $this->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-4)], 'returnType' => $this->semStack[$stackPos-(8-6)], 'expr' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); }, - 470 => function ($stackPos) { + 473 => function ($stackPos) { $this->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'returnType' => $this->semStack[$stackPos-(9-7)], 'expr' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); }, - 471 => function ($stackPos) { + 474 => function ($stackPos) { $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-4)], 'uses' => $this->semStack[$stackPos-(8-6)], 'returnType' => $this->semStack[$stackPos-(8-7)], 'stmts' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); }, - 472 => function ($stackPos) { + 475 => function ($stackPos) { $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'uses' => $this->semStack[$stackPos-(9-7)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); }, - 473 => function ($stackPos) { + 476 => function ($stackPos) { $this->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'returnType' => $this->semStack[$stackPos-(9-7)], 'expr' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); }, - 474 => function ($stackPos) { + 477 => function ($stackPos) { $this->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-6)], 'returnType' => $this->semStack[$stackPos-(10-8)], 'expr' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); }, - 475 => function ($stackPos) { + 478 => function ($stackPos) { $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'uses' => $this->semStack[$stackPos-(9-7)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); }, - 476 => function ($stackPos) { + 479 => function ($stackPos) { $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-6)], 'uses' => $this->semStack[$stackPos-(10-8)], 'returnType' => $this->semStack[$stackPos-(10-9)], 'stmts' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); }, - 477 => function ($stackPos) { + 480 => function ($stackPos) { $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes), $this->semStack[$stackPos-(8-3)]); $this->checkClass($this->semValue[0], -1); }, - 478 => function ($stackPos) { + 481 => function ($stackPos) { $this->semValue = new Expr\New_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 479 => function ($stackPos) { + 482 => function ($stackPos) { list($class, $ctorArgs) = $this->semStack[$stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 480 => function ($stackPos) { + 483 => function ($stackPos) { $this->semValue = array(); }, - 481 => function ($stackPos) { + 484 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-3)]; }, - 482 => function ($stackPos) { + 485 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-1)]; }, - 483 => function ($stackPos) { + 486 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 484 => function ($stackPos) { + 487 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, - 485 => function ($stackPos) { - $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos-(2-2)], $this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 486 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 487 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, 488 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos-(2-2)], $this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 489 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 490 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 491 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 492 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 493 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 494 => function ($stackPos) { - $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 495 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 496 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 497 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 498 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 499 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 500 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 501 => function ($stackPos) { - $this->semValue = null; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 502 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 503 => function ($stackPos) { - $this->semValue = array(); + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, 504 => function ($stackPos) { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); - }, - 505 => function ($stackPos) { - foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 506 => function ($stackPos) { - $this->semValue = array(); - }, - 507 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, + 505 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 506 => function ($stackPos) { + $this->semValue = null; + }, + 507 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, 508 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = array(); }, 509 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); }, 510 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 511 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = array(); }, 512 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 513 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 514 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 515 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 516 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 517 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 518 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], new Expr\Error($this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->errorState = 2; + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 519 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 520 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 521 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 522 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 523 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], new Expr\Error($this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->errorState = 2; + }, + 524 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $attrs); }, - 520 => function ($stackPos) { + 525 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $attrs); }, - 521 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 522 => function ($stackPos) { - $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 523 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); - }, - 524 => function ($stackPos) { - $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 525 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, 526 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 527 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 528 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); }, 529 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); + $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 530 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], true); + $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 531 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 532 => function ($stackPos) { - $this->semValue = null; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 533 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 534 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); }, 535 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], true); }, 536 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); }, 537 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = null; }, 538 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; @@ -2651,10 +2662,10 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 540 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 541 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 542 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; @@ -2663,192 +2674,207 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 544 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 545 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 546 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 547 => function ($stackPos) { - $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 548 => function ($stackPos) { - $this->semValue = new Expr\NullsafeMethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 549 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 550 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 551 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 552 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 553 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\NullsafeMethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 554 => function ($stackPos) { - $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = null; }, 555 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 556 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 557 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 558 => function ($stackPos) { - $this->semValue = new Expr\Variable(new Expr\Error($this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; - }, - 559 => function ($stackPos) { - $var = $this->semStack[$stackPos-(1-1)]->name; $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; - }, - 560 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 561 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 562 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 563 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 564 => function ($stackPos) { $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 565 => function ($stackPos) { + 559 => function ($stackPos) { $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 566 => function ($stackPos) { + 560 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 561 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 562 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 563 => function ($stackPos) { + $this->semValue = new Expr\Variable(new Expr\Error($this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; + }, + 564 => function ($stackPos) { + $var = $this->semStack[$stackPos-(1-1)]->name; $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; + }, + 565 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, + 566 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, 567 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 568 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 569 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 570 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 571 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 572 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 573 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 574 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; - }, - 575 => function ($stackPos) { - $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 576 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) array_pop($this->semValue); - }, - 577 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 578 => function ($stackPos) { - /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ - }, - 579 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; - }, - 580 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 581 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 582 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 583 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 584 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 585 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 586 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 587 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 588 => function ($stackPos) { - $this->semValue = null; - }, - 589 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 590 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 591 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); - }, - 592 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); - }, - 593 => function ($stackPos) { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 594 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 595 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 596 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 597 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 598 => function ($stackPos) { - $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 599 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 600 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 601 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); - }, - 602 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, + 575 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 576 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 577 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 578 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 579 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + }, + 580 => function ($stackPos) { + $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 581 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) array_pop($this->semValue); + }, + 582 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 583 => function ($stackPos) { + /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ + }, + 584 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 585 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 586 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 587 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 588 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 589 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 590 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 591 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 592 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 593 => function ($stackPos) { + $this->semValue = null; + }, + 594 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 595 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 596 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 597 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); + }, + 598 => function ($stackPos) { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 599 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 600 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 601 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 602 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, 603 => function ($stackPos) { - $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 604 => function ($stackPos) { - $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 605 => function ($stackPos) { - $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 606 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 607 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 608 => function ($stackPos) { + $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 609 => function ($stackPos) { + $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 610 => function ($stackPos) { + $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 611 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, ]; diff --git a/vendor/october/rain/.github/workflows/tests.yml b/vendor/october/rain/.github/workflows/tests.yml index 9c0cfb5ed..c6b1b921c 100644 --- a/vendor/october/rain/.github/workflows/tests.yml +++ b/vendor/october/rain/.github/workflows/tests.yml @@ -14,13 +14,13 @@ jobs: max-parallel: 6 matrix: operatingSystem: [ubuntu-latest, windows-latest] - phpVersion: ['7.2', '7.3', '7.4'] + phpVersion: ['7.2', '7.3', '7.4', '8.0'] fail-fast: false runs-on: ${{ matrix.operatingSystem }} name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }} env: extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml - key: october-rain-cache-v1 + key: october-rain-cache-v1.1.2 steps: - name: Checkout changes uses: actions/checkout@v2 @@ -39,18 +39,18 @@ jobs: path: ${{ steps.extcache.outputs.dir }} key: ${{ steps.extcache.outputs.key }} restore-keys: ${{ steps.extcache.outputs.key }} - + - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.phpVersion }} - tools: composer:v1 + tools: composer:v2 extensions: ${{ env.extensions }} - name: Setup dependency cache id: composercache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - + - name: Cache dependencies uses: actions/cache@v2 with: @@ -59,7 +59,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies - run: composer install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-scripts - name: Setup problem matchers for PHPUnit if: matrix.phpVersion == '7.4' diff --git a/vendor/october/rain/LICENSE b/vendor/october/rain/LICENSE new file mode 100644 index 000000000..9b8517372 --- /dev/null +++ b/vendor/october/rain/LICENSE @@ -0,0 +1 @@ +Copyright (c) 2013-2021 Alexey Bobkov, Samuel Georges, October CMS diff --git a/vendor/october/rain/build/rain-split-1.0.sh b/vendor/october/rain/build/rain-split-1.0.sh index 2be0cd8ed..9412a69e2 100644 --- a/vendor/october/rain/build/rain-split-1.0.sh +++ b/vendor/october/rain/build/rain-split-1.0.sh @@ -6,9 +6,9 @@ mkdir -p october pushd october ./../git-subsplit.sh init git@github.com:octobercms/october.git ./../git-subsplit.sh update -./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.470" modules/backend:git@github.com:octoberrain/backend.git -./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.470" modules/cms:git@github.com:octoberrain/cms.git -./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.470" modules/system:git@github.com:octoberrain/system.git -./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.470" themes/demo:git@github.com:octoberrain/demo-theme.git -./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.470" plugins/october/demo:git@github.com:octoberrain/demo-plugin.git +./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.475" modules/backend:git@github.com:octoberrain/backend.git +./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.475" modules/cms:git@github.com:octoberrain/cms.git +./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.475" modules/system:git@github.com:octoberrain/system.git +./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.475" themes/demo:git@github.com:octoberrain/demo-theme.git +./../git-subsplit.sh publish --heads="1.0" --tags="v1.0.475" plugins/october/demo:git@github.com:octoberrain/demo-plugin.git popd diff --git a/vendor/october/rain/build/rain-split-stable.sh b/vendor/october/rain/build/rain-split-stable.sh index 43289a0bd..48ae76164 100644 --- a/vendor/october/rain/build/rain-split-stable.sh +++ b/vendor/october/rain/build/rain-split-stable.sh @@ -6,9 +6,9 @@ mkdir -p october pushd october ./../git-subsplit.sh init git@github.com:octobercms/october.git ./../git-subsplit.sh update -./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.1" modules/backend:git@github.com:octoberrain/backend.git -./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.1" modules/cms:git@github.com:octoberrain/cms.git -./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.1" modules/system:git@github.com:octoberrain/system.git -./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.1" themes/demo:git@github.com:octoberrain/demo-theme.git -./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.1" plugins/october/demo:git@github.com:octoberrain/demo-plugin.git +./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.11" modules/backend:git@github.com:octoberrain/backend.git +./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.11" modules/cms:git@github.com:octoberrain/cms.git +./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.11" modules/system:git@github.com:octoberrain/system.git +./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.11" themes/demo:git@github.com:octoberrain/demo-theme.git +./../git-subsplit.sh publish --heads="1.1" --tags="v1.1.11" plugins/october/demo:git@github.com:octoberrain/demo-plugin.git popd diff --git a/vendor/october/rain/composer.json b/vendor/october/rain/composer.json index edeeabbf8..19a53337a 100644 --- a/vendor/october/rain/composer.json +++ b/vendor/october/rain/composer.json @@ -14,16 +14,10 @@ "name": "Samuel Georges", "email": "daftspunky@gmail.com", "role": "Co-founder" - }, - { - "name": "Luke Towers", - "email": "octobercms@luketowers.ca", - "homepage": "https://luketowers.ca", - "role": "Maintainer" } ], "require": { - "php": ">=7.2", + "php": ">=7.2.9", "ext-ctype": "*", "ext-curl": "*", "ext-dom": "*", @@ -38,7 +32,7 @@ "doctrine/dbal": "^2.6", "erusev/parsedown-extra": "~0.7", "linkorb/jsmin-php": "~1.0", - "wikimedia/less.php": "~2.0", + "wikimedia/less.php": "~3.0", "scssphp/scssphp": "~1.0", "symfony/yaml": "^3.4", "twig/twig": "~2.0", @@ -48,7 +42,7 @@ "laravel/tinker": "~2.0" }, "require-dev": { - "phpunit/phpunit": "^8.4|^9.3.3", + "phpunit/phpunit": "^8.5.12|^9.3.3", "mockery/mockery": "~1.3.3|^1.4.2", "illuminate/database": "^6.0", "illuminate/encryption": "^6.0", @@ -66,8 +60,8 @@ "illuminate/cache": "^6.0", "squizlabs/php_codesniffer": "3.*", "php-parallel-lint/php-parallel-lint": "^1.0", - "meyfa/phpunit-assert-gd": "^2.0.0", - "dms/phpunit-arraysubset-asserts": "^0.1.0" + "meyfa/phpunit-assert-gd": "^2.0.0|^3.0.0", + "dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1" }, "suggest": { "ext-pdo_dblib": "Required to use MS SQL Server databases", diff --git a/vendor/october/rain/src/Argon/ArgonServiceProvider.php b/vendor/october/rain/src/Argon/ArgonServiceProvider.php index 74b18ea30..cb897c24c 100644 --- a/vendor/october/rain/src/Argon/ArgonServiceProvider.php +++ b/vendor/october/rain/src/Argon/ArgonServiceProvider.php @@ -30,8 +30,12 @@ class ArgonServiceProvider extends ServiceProvider */ protected function setArgonLocale($locale) { - Argon::setFallbackLocale($this->getFallbackLocale($locale)); Argon::setLocale($locale); + + $fallbackLocale = $this->getFallbackLocale($locale); + if ($locale !== $fallbackLocale) { + Argon::setFallbackLocale($fallbackLocale); + } } /** diff --git a/vendor/october/rain/src/Auth/Manager.php b/vendor/october/rain/src/Auth/Manager.php index 1bb65baf6..479045ef6 100644 --- a/vendor/october/rain/src/Auth/Manager.php +++ b/vendor/october/rain/src/Auth/Manager.php @@ -241,7 +241,7 @@ class Manager implements \Illuminate\Contracts\Auth\StatefulGuard foreach ($hashedCredentials as $credential => $value) { if (!$user->checkHashValue($credential, $value)) { // Incorrect password - if ($credential == 'password') { + if ($credential === 'password') { throw new AuthException(sprintf( 'A user was found to match all plain text credentials however hashed credential "%s" did not match.', $credential @@ -686,7 +686,7 @@ class Manager implements \Illuminate\Contracts\Auth\StatefulGuard $this->user = null; - Session::flush(); + Session::invalidate(); Cookie::queue(Cookie::forget($this->sessionKey)); } diff --git a/vendor/october/rain/src/Auth/Models/Role.php b/vendor/october/rain/src/Auth/Models/Role.php index a90b2ac71..92c95ce9c 100644 --- a/vendor/october/rain/src/Auth/Models/Role.php +++ b/vendor/october/rain/src/Auth/Models/Role.php @@ -84,7 +84,7 @@ class Role extends Model // We will make sure that the merged permission does not // exactly match our permission, but starts with it. - if ($checkPermission != $rolePermission && starts_with($rolePermission, $checkPermission) && $value == 1) { + if ($checkPermission != $rolePermission && starts_with($rolePermission, $checkPermission) && (int) $value === 1) { $matched = true; break; } @@ -102,7 +102,7 @@ class Role extends Model // We will make sure that the merged permission does not // exactly match our permission, but ends with it. - if ($checkPermission != $rolePermission && ends_with($rolePermission, $checkPermission) && $value == 1) { + if ($checkPermission != $rolePermission && ends_with($rolePermission, $checkPermission) && (int) $value === 1) { $matched = true; break; } @@ -121,14 +121,14 @@ class Role extends Model // We will make sure that the merged permission does not // exactly match our permission, but starts with it. - if ($checkGroupPermission != $permission && starts_with($permission, $checkGroupPermission) && $value == 1) { + if ($checkGroupPermission != $permission && starts_with($permission, $checkGroupPermission) && (int) $value === 1) { $matched = true; break; } } // Otherwise, we'll fallback to standard permissions checking where // we match that permissions explicitly exist. - elseif ($permission == $rolePermission && $rolePermissions[$permission] == 1) { + elseif ($permission === $rolePermission && (int) $rolePermissions[$permission] === 1) { $matched = true; break; } diff --git a/vendor/october/rain/src/Auth/Models/Throttle.php b/vendor/october/rain/src/Auth/Models/Throttle.php index fbaf14b2e..ba01a8645 100644 --- a/vendor/october/rain/src/Auth/Models/Throttle.php +++ b/vendor/october/rain/src/Auth/Models/Throttle.php @@ -99,7 +99,7 @@ class Throttle extends Model // anything either as clearing login attempts // makes us unsuspended. We need to manually // call unsuspend() in order to unsuspend. - if ($this->getLoginAttempts() == 0 or $this->is_suspended) { + if ($this->getLoginAttempts() === 0 or $this->is_suspended) { return; } diff --git a/vendor/october/rain/src/Auth/Models/User.php b/vendor/october/rain/src/Auth/Models/User.php index db289f569..bd524c60f 100644 --- a/vendor/october/rain/src/Auth/Models/User.php +++ b/vendor/october/rain/src/Auth/Models/User.php @@ -190,7 +190,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable return false; } - return $persistCode == $this->persist_code; + return $persistCode === $this->persist_code; } // @@ -278,7 +278,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable return false; } - return ($this->reset_password_code == $resetCode); + return ($this->reset_password_code === $resetCode); } /** @@ -386,7 +386,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable public function inGroup($group) { foreach ($this->getGroups() as $_group) { - if ($_group->getKey() == $group->getKey()) { + if ($_group->getKey() === $group->getKey()) { return true; } } @@ -481,7 +481,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable // We will make sure that the merged permission does not // exactly match our permission, but starts with it. - if ($checkPermission != $mergedPermission && starts_with($mergedPermission, $checkPermission) && $value == 1) { + if ($checkPermission != $mergedPermission && starts_with($mergedPermission, $checkPermission) && (int) $value === 1) { $matched = true; break; } @@ -496,7 +496,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable // We will make sure that the merged permission does not // exactly match our permission, but ends with it. - if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && $value == 1) { + if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && (int) $value === 1) { $matched = true; break; } @@ -515,7 +515,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable // We will make sure that the merged permission does not // exactly match our permission, but starts with it. - if ($checkMergedPermission != $permission && starts_with($permission, $checkMergedPermission) && $value == 1) { + if ($checkMergedPermission != $permission && starts_with($permission, $checkMergedPermission) && (int) $value === 1) { $matched = true; break; } @@ -523,7 +523,7 @@ class User extends Model implements \Illuminate\Contracts\Auth\Authenticatable // Otherwise, we'll fallback to standard permissions checking where // we match that permissions explicitly exist. - elseif ($permission == $mergedPermission && $mergedPermissions[$permission] == 1) { + elseif ($permission === $mergedPermission && (int) $mergedPermissions[$permission] === 1) { $matched = true; break; } diff --git a/vendor/october/rain/src/Database/Attach/File.php b/vendor/october/rain/src/Database/Attach/File.php index 10e8aa88b..b727d3c18 100644 --- a/vendor/october/rain/src/Database/Attach/File.php +++ b/vendor/october/rain/src/Database/Attach/File.php @@ -29,7 +29,7 @@ class File extends Model * Relations */ public $morphTo = [ - 'attachment' => [] + 'attachment' => [], ]; /** @@ -122,14 +122,14 @@ class File extends Model /** * Creates a file object from a file on the disk. */ - public function fromFile($filePath) + public function fromFile($filePath, $filename = null) { if ($filePath === null) { return; } $file = new FileObj($filePath); - $this->file_name = $file->getFilename(); + $this->file_name = empty($filename) ? $file->getFilename() : $filename; $this->file_size = $file->getSize(); $this->content_type = $file->getMimeType(); $this->disk_name = $this->getDiskName(); @@ -153,10 +153,11 @@ class File extends Model return; } - $tempPath = temp_path($filename); + $tempName = str_replace('.', '', uniqid('', true)) . '.tmp'; + $tempPath = temp_path($tempName); FileHelper::put($tempPath, $data); - $file = $this->fromFile($tempPath); + $file = $this->fromFile($tempPath, basename($filename)); FileHelper::delete($tempPath); return $file; diff --git a/vendor/october/rain/src/Database/Behaviors/Sortable.php b/vendor/october/rain/src/Database/Behaviors/Sortable.php index 3d1002cd0..92b9bd91e 100644 --- a/vendor/october/rain/src/Database/Behaviors/Sortable.php +++ b/vendor/october/rain/src/Database/Behaviors/Sortable.php @@ -89,6 +89,13 @@ class Sortable extends ExtensionBase */ public function getSortOrderColumn() { - return defined($this->model.'::SORT_ORDER') ? $this->model::SORT_ORDER : 'sort_order'; + if (defined(get_class($this->model).'::SORT_ORDER')) { + $column = $this->model::SORT_ORDER; + } else if (isset($this->model->sort_order_column)) { + $column = $this->model->sort_order_column; + } else { + $column = 'sort_order'; + } + return $column; } } diff --git a/vendor/october/rain/src/Database/Builder.php b/vendor/october/rain/src/Database/Builder.php index b3f4ce99b..73d9571d6 100644 --- a/vendor/october/rain/src/Database/Builder.php +++ b/vendor/october/rain/src/Database/Builder.php @@ -14,6 +14,8 @@ use October\Rain\Support\Facades\DbDongle; */ class Builder extends BuilderModel { + use \October\Rain\Database\Concerns\QueriesRelationships; + /** * Get an array with the values of a given column. * diff --git a/vendor/october/rain/src/Database/Concerns/GuardsAttributes.php b/vendor/october/rain/src/Database/Concerns/GuardsAttributes.php index b785a4123..3deef601a 100644 --- a/vendor/october/rain/src/Database/Concerns/GuardsAttributes.php +++ b/vendor/october/rain/src/Database/Concerns/GuardsAttributes.php @@ -17,10 +17,17 @@ trait GuardsAttributes public function isGuarded($key) { $guarded = $this->getGuarded(); + // Nothing's guarded so just return early - if (empty($guarded) || $guarded === ['*']) { + if (empty($guarded)) { return false; } + + // Everything's guarded, return early + if ($guarded === ['*']) { + return true; + } + // Normalize the variables for comparison $key = trim(strtolower($key)); $guarded = array_map(function ($column) { diff --git a/vendor/october/rain/src/Database/Concerns/HasRelationships.php b/vendor/october/rain/src/Database/Concerns/HasRelationships.php index e7b34cab0..7aab78712 100644 --- a/vendor/october/rain/src/Database/Concerns/HasRelationships.php +++ b/vendor/october/rain/src/Database/Concerns/HasRelationships.php @@ -157,7 +157,36 @@ trait HasRelationships public function getRelationDefinition($name) { if (($type = $this->getRelationType($name)) !== null) { - return (array) $this->{$type}[$name] + $this->getRelationDefaults($type); + return (array) $this->getRelationTypeDefinition($type, $name) + $this->getRelationDefaults($type); + } + } + + /** + * Returns all defined relations of given type. + * @param string $type Relation type + * @return array|string|null + */ + public function getRelationTypeDefinitions($type) + { + if (in_array($type, static::$relationTypes)) { + return $this->{$type}; + } + + return []; + } + + /** + * Returns the given relation definition. + * @param string $type Relation type + * @param string $name Relation name + * @return array + */ + public function getRelationTypeDefinition($type, $name) + { + $definitions = $this->getRelationTypeDefinitions($type); + + if (isset($definitions[$name])) { + return $definitions[$name]; } } @@ -170,7 +199,7 @@ trait HasRelationships $result = []; foreach (static::$relationTypes as $type) { - $result[$type] = $this->{$type}; + $result[$type] = $this->getRelationTypeDefinitions($type); /* * Apply default values for the relation type @@ -193,7 +222,7 @@ trait HasRelationships public function getRelationType($name) { foreach (static::$relationTypes as $type) { - if (isset($this->{$type}[$name])) { + if ($this->getRelationTypeDefinition($type, $name) !== null) { return $type; } } @@ -706,7 +735,7 @@ trait HasRelationships $localKey = $localKey ?: $this->getKeyName(); - return new AttachOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $isPublic, $localKey, $relationName); + return new AttachOne($instance->newQuery(), $this, $table . '.' . $type, $table . '.' . $id, $isPublic, $localKey, $relationName); } /** @@ -728,7 +757,7 @@ trait HasRelationships $localKey = $localKey ?: $this->getKeyName(); - return new AttachMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $isPublic, $localKey, $relationName); + return new AttachMany($instance->newQuery(), $this, $table . '.' . $type, $table . '.' . $id, $isPublic, $localKey, $relationName); } /** diff --git a/vendor/october/rain/src/Database/Concerns/QueriesRelationships.php b/vendor/october/rain/src/Database/Concerns/QueriesRelationships.php new file mode 100644 index 000000000..fcb6324a4 --- /dev/null +++ b/vendor/october/rain/src/Database/Concerns/QueriesRelationships.php @@ -0,0 +1,68 @@ +query->columns)) { + $this->query->select([$this->query->from.'.*']); + } + + $relations = is_array($relations) ? $relations : func_get_args(); + + foreach ($this->parseWithRelations($relations) as $name => $constraints) { + // First we will determine if the name has been aliased using an "as" clause on the name + // and if it has we will extract the actual relationship name and the desired name of + // the resulting column. This allows multiple counts on the same relationship name. + $segments = explode(' ', $name); + + unset($alias); + + if (count($segments) === 3 && Str::lower($segments[1]) === 'as') { + list($name, $alias) = [$segments[0], $segments[2]]; + } + + $relation = $this->getRelationWithoutConstraints($name); + + // Here we will get the relationship count query and prepare to add it to the main query + // as a sub-select. First, we'll get the "has" query and use that to get the relation + // count query. We will normalize the relation name then append _count as the name. + $query = $relation->getRelationExistenceCountQuery( + $relation->getRelated()->newQuery(), + $this + ); + + $query->callScope($constraints); + + $query = $query->mergeConstraintsFrom($relation->getQuery())->toBase(); + + // This part will clear all the sorting from the query avoiding errors in mysql with strict_mode enabled. + // See https://github.com/octobercms/october/issues/5134 for context on the bug report. + $query->orders = null; + $query->setBindings([], 'order'); + + // 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, $column); + } + + return $this; + } +} diff --git a/vendor/october/rain/src/Database/Migrations/2021_01_19_000001_Db_Add_Pivot_Data_To_Deferred_Bindings.php b/vendor/october/rain/src/Database/Migrations/2021_01_19_000001_Db_Add_Pivot_Data_To_Deferred_Bindings.php new file mode 100644 index 000000000..81242ccaa --- /dev/null +++ b/vendor/october/rain/src/Database/Migrations/2021_01_19_000001_Db_Add_Pivot_Data_To_Deferred_Bindings.php @@ -0,0 +1,22 @@ +mediumText('pivot_data')->nullable()->after('slave_id'); + }); + } + + public function down() + { + Schema::table('deferred_bindings', function (Blueprint $table) { + $table->dropColumn('pivot_data'); + }); + } +} diff --git a/vendor/october/rain/src/Database/Models/DeferredBinding.php b/vendor/october/rain/src/Database/Models/DeferredBinding.php index 4ca2f8516..84646297b 100644 --- a/vendor/october/rain/src/Database/Models/DeferredBinding.php +++ b/vendor/october/rain/src/Database/Models/DeferredBinding.php @@ -13,11 +13,23 @@ use Exception; */ class DeferredBinding extends Model { + use \October\Rain\Database\Traits\Nullable; + /** * @var string The database table used by the model. */ public $table = 'deferred_bindings'; + /** + * @var array List of attribute names which are json encoded and decoded from the database. + */ + protected $jsonable = ['pivot_data']; + + /** + * @var array List of attribute names which should be set to null when empty. + */ + protected $nullable = ['pivot_data']; + /** * Prevents duplicates and conflicting binds. */ diff --git a/vendor/october/rain/src/Database/Relations/AttachMany.php b/vendor/october/rain/src/Database/Relations/AttachMany.php index ad2ac7151..d45af8f88 100644 --- a/vendor/october/rain/src/Database/Relations/AttachMany.php +++ b/vendor/october/rain/src/Database/Relations/AttachMany.php @@ -12,7 +12,14 @@ class AttachMany extends MorphManyBase /** * Create a new has many relationship instance. - * @return void + * @param Builder $query + * @param Model $parent + * @param $type + * @param $id + * @param $isPublic + * @param $localKey + * @param null|string $relationName + * @param null|string $keyType */ public function __construct(Builder $query, Model $parent, $type, $id, $isPublic, $localKey, $relationName = null) { diff --git a/vendor/october/rain/src/Database/Relations/AttachOne.php b/vendor/october/rain/src/Database/Relations/AttachOne.php index 789a2b8a6..2e350f5a0 100644 --- a/vendor/october/rain/src/Database/Relations/AttachOne.php +++ b/vendor/october/rain/src/Database/Relations/AttachOne.php @@ -12,7 +12,14 @@ class AttachOne extends MorphOneBase /** * Create a new has many relationship instance. - * @return void + * @param Builder $query + * @param Model $parent + * @param $type + * @param $id + * @param $isPublic + * @param $localKey + * @param null|string $relationName + * @param null|string $keyType */ public function __construct(Builder $query, Model $parent, $type, $id, $isPublic, $localKey, $relationName = null) { diff --git a/vendor/october/rain/src/Database/Relations/BelongsToMany.php b/vendor/october/rain/src/Database/Relations/BelongsToMany.php index df154b48c..b2f8bd4d7 100644 --- a/vendor/october/rain/src/Database/Relations/BelongsToMany.php +++ b/vendor/october/rain/src/Database/Relations/BelongsToMany.php @@ -88,6 +88,18 @@ class BelongsToMany extends BelongsToManyBase return $model; } + /** + * Override sync() method of BelongToMany relation in order to flush the query cache. + * @param array $ids + * @param bool $detaching + * @return array + */ + public function sync($ids, $detaching = true) + { + parent::sync($ids, $detaching); + $this->flushDuplicateCache(); + } + /** * Create a new instance of this related model with deferred binding support. */ @@ -164,7 +176,7 @@ class BelongsToMany extends BelongsToManyBase { $attachedIdList = $this->parseIds($ids); if (empty($attachedIdList)) { - $attachedIdList = $this->allRelatedIds()->all(); + $attachedIdList = $this->newPivotQuery()->lists($this->relatedPivotKey); } /** @@ -185,8 +197,8 @@ class BelongsToMany extends BelongsToManyBase return; } - /* - * See Illuminate\Database\Eloquent\Relations\Concerns\InteractsWithPivotTable + /** + * @see Illuminate\Database\Eloquent\Relations\Concerns\InteractsWithPivotTable */ parent::detach($attachedIdList, $touch); @@ -219,7 +231,7 @@ class BelongsToMany extends BelongsToManyBase $this->parent->reloadRelations($this->relationName); } else { - $this->parent->bindDeferred($this->relationName, $model, $sessionKey); + $this->parent->bindDeferred($this->relationName, $model, $sessionKey, $pivotData); } } @@ -409,14 +421,4 @@ class BelongsToMany extends BelongsToManyBase traceLog('Method BelongsToMany::getRelatedIds has been deprecated, use BelongsToMany::allRelatedIds instead.'); return $this->allRelatedIds($sessionKey)->all(); } - - /** - * Get the pivot models that are currently attached (taking conditions & scopes into account). - * - * @return \Illuminate\Support\Collection - */ - protected function getCurrentlyAttachedPivots() - { - return $this->getQuery()->get(); - } } diff --git a/vendor/october/rain/src/Database/Relations/DeferOneOrMany.php b/vendor/october/rain/src/Database/Relations/DeferOneOrMany.php index ab06cea89..6d721b9ad 100644 --- a/vendor/october/rain/src/Database/Relations/DeferOneOrMany.php +++ b/vendor/october/rain/src/Database/Relations/DeferOneOrMany.php @@ -27,7 +27,20 @@ trait DeferOneOrMany $newQuery->where(function ($query) use ($sessionKey) { if ($this->parent->exists) { - if ($this instanceof BelongsToManyBase) { + if ($this instanceof MorphToMany) { + /* + * Custom query for MorphToMany since a "join" cannot be used + */ + $query->whereExists(function ($query) { + $query + ->select($this->parent->getConnection()->raw(1)) + ->from($this->table) + ->where($this->getOtherKey(), DbDongle::raw(DbDongle::getTablePrefix().$this->related->getQualifiedKeyName())) + ->where($this->getForeignKey(), $this->parent->getKey()) + ->where($this->getMorphType(), $this->getMorphClass()); + }); + } + elseif ($this instanceof BelongsToManyBase) { /* * Custom query for BelongsToManyBase since a "join" cannot be used */ diff --git a/vendor/october/rain/src/Database/Relations/DefinedConstraints.php b/vendor/october/rain/src/Database/Relations/DefinedConstraints.php index cd73adc4a..d37ab3932 100644 --- a/vendor/october/rain/src/Database/Relations/DefinedConstraints.php +++ b/vendor/october/rain/src/Database/Relations/DefinedConstraints.php @@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany as BelongsToManyBase; */ trait DefinedConstraints { - /** * Set the defined constraints on the relation query. * diff --git a/vendor/october/rain/src/Database/Traits/DeferredBinding.php b/vendor/october/rain/src/Database/Traits/DeferredBinding.php index 92db3d38e..8ba678b02 100644 --- a/vendor/october/rain/src/Database/Traits/DeferredBinding.php +++ b/vendor/october/rain/src/Database/Traits/DeferredBinding.php @@ -27,7 +27,7 @@ trait DeferredBinding /** * Bind a deferred relationship to the supplied record. */ - public function bindDeferred($relation, $record, $sessionKey) + public function bindDeferred($relation, $record, $sessionKey, $pivotData = []) { $binding = new DeferredBindingModel; $binding->setConnection($this->getConnectionName()); @@ -35,6 +35,7 @@ trait DeferredBinding $binding->master_field = $relation; $binding->slave_type = get_class($record); $binding->slave_id = $record->getKey(); + $binding->pivot_data = $pivotData; $binding->session_key = $sessionKey; $binding->is_bind = true; $binding->save(); @@ -146,7 +147,11 @@ trait DeferredBinding $relationObj = $this->$relationName(); if ($binding->is_bind) { - $relationObj->add($slaveModel); + if (in_array($relationType, ['belongsToMany', 'morphToMany', 'morphedByMany'])) { + $relationObj->add($slaveModel, null, (array) $binding->pivot_data); + } else { + $relationObj->add($slaveModel); + } } else { $relationObj->remove($slaveModel); diff --git a/vendor/october/rain/src/Database/Updater.php b/vendor/october/rain/src/Database/Updater.php index e94452062..b4bfb4308 100644 --- a/vendor/october/rain/src/Database/Updater.php +++ b/vendor/october/rain/src/Database/Updater.php @@ -30,14 +30,12 @@ class Updater Eloquent::unguard(); - Db::transaction(function () use ($object) { - if ($object instanceof Updates\Migration) { - $object->up(); - } - elseif ($object instanceof Updates\Seeder) { - $object->run(); - } - }); + if ($object instanceof Updates\Migration) { + $object->up(); + } + elseif ($object instanceof Updates\Seeder) { + $object->run(); + } Eloquent::reguard(); @@ -59,11 +57,9 @@ class Updater Eloquent::unguard(); - Db::transaction(function () use ($object) { - if ($object instanceof Updates\Migration) { - $object->down(); - } - }); + if ($object instanceof Updates\Migration) { + $object->down(); + } Eloquent::reguard(); diff --git a/vendor/october/rain/src/Extension/ExtendableTrait.php b/vendor/october/rain/src/Extension/ExtendableTrait.php index 11cf5d0d6..666240667 100644 --- a/vendor/october/rain/src/Extension/ExtendableTrait.php +++ b/vendor/october/rain/src/Extension/ExtendableTrait.php @@ -410,8 +410,8 @@ trait ExtendableTrait $extension = $this->extensionData['methods'][$name]; $extensionObject = $this->extensionData['extensions'][$extension]; - if (method_exists($extension, $name) && is_callable([$extension, $name])) { - return call_user_func_array([$extensionObject, $name], $params); + if (method_exists($extension, $name)) { + return call_user_func_array([$extensionObject, $name], array_values($params)); } } @@ -419,7 +419,7 @@ trait ExtendableTrait $dynamicCallable = $this->extensionData['dynamicMethods'][$name]; if (is_callable($dynamicCallable)) { - return call_user_func_array($dynamicCallable, $params); + return call_user_func_array($dynamicCallable, array_values($params)); } } diff --git a/vendor/october/rain/src/Filesystem/Definitions.php b/vendor/october/rain/src/Filesystem/Definitions.php index 931e3552e..31174b8d0 100644 --- a/vendor/october/rain/src/Filesystem/Definitions.php +++ b/vendor/october/rain/src/Filesystem/Definitions.php @@ -118,7 +118,6 @@ class Definitions 'pdf', 'swf', 'txt', - 'xml', 'ods', 'xls', 'xlsx', @@ -138,7 +137,6 @@ class Definitions 'webm', 'mkv', 'rar', - 'xml', 'zip' ]; } @@ -168,8 +166,7 @@ class Definitions 'md', 'less', 'sass', - 'scss', - 'xml' + 'scss' ]; } diff --git a/vendor/october/rain/src/Foundation/Application.php b/vendor/october/rain/src/Foundation/Application.php index fa8238b27..4f150e5ee 100644 --- a/vendor/october/rain/src/Foundation/Application.php +++ b/vendor/october/rain/src/Foundation/Application.php @@ -386,21 +386,19 @@ class Application extends ApplicationBase public function registerConfiguredProviders($isRetry = false) { $providers = Collection::make($this->config['app.providers']) - ->partition(function ($provider) { - return Str::startsWith($provider, 'Illuminate\\'); - }); + ->partition(function ($provider) { + return Str::startsWith($provider, 'Illuminate\\'); + }); if (Config::get('app.loadDiscoveredPackages', false)) { $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); } - $filesystem = new Filesystem; - $repository = new ProviderRepository($this, $filesystem, $this->getCachedServicesPath()); - try { + $repository = new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath()); $repository->load($providers->collapse()->toArray()); - } catch (Throwable $e) { - // If provider loading fails, we'll try it without the cached packages first, before failing completely + } + catch (Throwable $e) { if ($isRetry) { throw $e; } @@ -417,18 +415,15 @@ class Application extends ApplicationBase */ protected function clearPackageCache() { - $filesystem = new Filesystem; - $filesystem->delete([ + (new Filesystem)->delete([ $this->getCachedPackagesPath(), $this->getCachedServicesPath(), $this->getCachedClassesPath(), ]); - // Reset package manifest - $this->make(PackageManifest::class)->manifest = null; + $this->make(PackageManifest::class)->manifest = []; } - // // Core aliases // diff --git a/vendor/october/rain/src/Foundation/Exception/Handler.php b/vendor/october/rain/src/Foundation/Exception/Handler.php index f174f8b71..55a4bfb82 100644 --- a/vendor/october/rain/src/Foundation/Exception/Handler.php +++ b/vendor/october/rain/src/Foundation/Exception/Handler.php @@ -2,13 +2,15 @@ use Log; use Event; +use Closure; use Response; +use Exception; +use Throwable; +use ReflectionClass; +use ReflectionFunction; +use October\Rain\Exception\AjaxException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use October\Rain\Exception\AjaxException; -use ReflectionFunction; -use Exception; -use Closure; class Handler extends ExceptionHandler { @@ -42,6 +44,10 @@ class Handler extends ExceptionHandler */ public function report(Exception $exception) { + if (!class_exists('Event')) { + return; + } + /** * @event exception.beforeReport * Fires before the exception has been reported @@ -217,6 +223,12 @@ class Handler extends ExceptionHandler { $parameters = $reflection->getParameters(); $expected = $parameters[0]; - return !$expected->getClass() || $expected->getClass()->isInstance($exception); + + try { + return (new ReflectionClass($expected->getType()->getName())) + ->isInstance($exception); + } catch (Throwable $t) { + return false; + } } } diff --git a/vendor/october/rain/src/Foundation/Http/Kernel.php b/vendor/october/rain/src/Foundation/Http/Kernel.php index 229d11aef..f6af6189e 100644 --- a/vendor/october/rain/src/Foundation/Http/Kernel.php +++ b/vendor/october/rain/src/Foundation/Http/Kernel.php @@ -10,13 +10,13 @@ class Kernel extends HttpKernel * @var array */ protected $bootstrappers = [ - '\October\Rain\Foundation\Bootstrap\RegisterClassLoader', - '\October\Rain\Foundation\Bootstrap\LoadEnvironmentVariables', - '\October\Rain\Foundation\Bootstrap\LoadConfiguration', - '\October\Rain\Foundation\Bootstrap\LoadTranslation', + \October\Rain\Foundation\Bootstrap\RegisterClassLoader::class, + \October\Rain\Foundation\Bootstrap\LoadEnvironmentVariables::class, + \October\Rain\Foundation\Bootstrap\LoadConfiguration::class, + \October\Rain\Foundation\Bootstrap\LoadTranslation::class, \Illuminate\Foundation\Bootstrap\HandleExceptions::class, \Illuminate\Foundation\Bootstrap\RegisterFacades::class, - '\October\Rain\Foundation\Bootstrap\RegisterOctober', + \October\Rain\Foundation\Bootstrap\RegisterOctober::class, \Illuminate\Foundation\Bootstrap\RegisterProviders::class, \Illuminate\Foundation\Bootstrap\BootProviders::class, ]; @@ -27,7 +27,8 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ - '\October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode', + \October\Rain\Foundation\Http\Middleware\CheckForTrustedHost::class, + \October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode::class, ]; /** diff --git a/vendor/october/rain/src/Foundation/Http/Middleware/CheckForTrustedHost.php b/vendor/october/rain/src/Foundation/Http/Middleware/CheckForTrustedHost.php new file mode 100644 index 000000000..64775cf64 --- /dev/null +++ b/vendor/october/rain/src/Foundation/Http/Middleware/CheckForTrustedHost.php @@ -0,0 +1,82 @@ + [ + * 'example.com', // Matches just example.com + * 'www.example.com', // Matches just www.example.com + * '^(.+\.)?example\.com$', // Matches example.com and all subdomains + * 'https://example.com', // Matches just example.com + * ], + * + * or as a boolean - if true, it will trust the `app.url` host and all subdomains, if false it + * will disable the feature entirely. + * + * Hosts can be defined as regex patterns for complex matching. + * + * @return array + */ + public function hosts() + { + return self::processTrustedHosts(Config::get('app.trustedHosts', [])); + } + + /** + * Processes the trusted hosts into an array of patterns the match for host header checks. + * + * @param array|bool $hosts + * @return array + */ + public static function processTrustedHosts($hosts) + { + if ($hosts === true) { + $url = Config::get('app.url', null); + + // If no app URL is set, then disable trusted hosts. + if (is_null($url)) { + return []; + } + + // Allow both the domain and the `www` subdomain for app.url + // regardless of the presence of www in the app.url value + $host = parse_url($url, PHP_URL_HOST); + if (preg_match('/^www\.(.*?)$/i', $host, $matches)) { + $host = '^(www\.)?' . preg_quote($matches[1]) . '$'; + } else { + $host = '^(www\.)?' . preg_quote($host) . '$'; + } + + $hosts = [$host]; + } elseif ($hosts === false) { + return []; + } + + $hosts = array_map(function ($host) { + // If a URL is provided, extract the host + if (filter_var($host, FILTER_VALIDATE_URL)) { + $host = parse_url($host, PHP_URL_HOST); + } + + // Prepare IP address & plain hostname values to be processed by the regex filter + if ( + filter_var($host, FILTER_VALIDATE_IP) + || filter_var($host, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) + ) { + return '^' . preg_quote($host) . '$'; + } + + // Allow everything else through as is + return $host; + }, $hosts); + + return $hosts; + } +} diff --git a/vendor/october/rain/src/Foundation/Maker.php b/vendor/october/rain/src/Foundation/Maker.php index 628c1ca83..f915f47e9 100644 --- a/vendor/october/rain/src/Foundation/Maker.php +++ b/vendor/october/rain/src/Foundation/Maker.php @@ -119,8 +119,9 @@ class Maker { $dependencies = []; + /** @var ReflectionParameter $parameter */ foreach ($parameters as $parameter) { - $dependency = $parameter->getClass(); + $dependency = $parameter->getType(); if (array_key_exists($parameter->name, $primitives)) { $dependencies[] = $primitives[$parameter->name]; @@ -145,7 +146,7 @@ class Maker protected function resolveClass(ReflectionParameter $parameter) { try { - return $this->getFromContainer($parameter->getClass()->name); + return $this->getFromContainer($parameter->getType()->getName()); } catch (BindingResolutionException $e) { if ($parameter->isOptional()) { diff --git a/vendor/october/rain/src/Halcyon/MemoryRepository.php b/vendor/october/rain/src/Halcyon/MemoryRepository.php index 733e4107e..ba2dbf9ce 100644 --- a/vendor/october/rain/src/Halcyon/MemoryRepository.php +++ b/vendor/october/rain/src/Halcyon/MemoryRepository.php @@ -57,7 +57,8 @@ class MemoryRepository extends Repository } $this->putInMemoryCache($key, $value); - parent::put($key, $value, $seconds); + + return parent::put($key, $value, $seconds); } /** diff --git a/vendor/october/rain/src/Halcyon/Model.php b/vendor/october/rain/src/Halcyon/Model.php index da2079bbe..2eef73133 100644 --- a/vendor/october/rain/src/Halcyon/Model.php +++ b/vendor/october/rain/src/Halcyon/Model.php @@ -80,11 +80,11 @@ class Model extends Extendable implements ArrayAccess, Arrayable, Jsonable, Json protected $wrapCode = true; /** - * @var int The maximum allowed path nesting level. The default value is 2, + * @var int The maximum allowed path nesting level. The default value is 5, * meaning that files can only exist in the root directory, or in a * subdirectory. Set to null if any level is allowed. */ - protected $maxNesting = 2; + protected $maxNesting = 5; /** * @var boolean Indicated whether the object was loaded from the cache. diff --git a/vendor/october/rain/src/Halcyon/Processors/SectionParser.php b/vendor/october/rain/src/Halcyon/Processors/SectionParser.php index c07ac4239..ab1c9f53b 100644 --- a/vendor/october/rain/src/Halcyon/Processors/SectionParser.php +++ b/vendor/october/rain/src/Halcyon/Processors/SectionParser.php @@ -72,7 +72,8 @@ class SectionParser } } - $content[] = $markup; + $sections = preg_split('/^'.preg_quote(self::SECTION_SEPARATOR).'\s*$/m', $markup, -1); + $content[] = end($sections); $content = trim(implode(PHP_EOL.self::SECTION_SEPARATOR.PHP_EOL, $content)); diff --git a/vendor/october/rain/src/Http/Middleware/TrustHosts.php b/vendor/october/rain/src/Http/Middleware/TrustHosts.php new file mode 100644 index 000000000..70381843b --- /dev/null +++ b/vendor/october/rain/src/Http/Middleware/TrustHosts.php @@ -0,0 +1,71 @@ +app = $app; + } + + /** + * Get the host patterns that should be trusted. + * + * @return array + */ + abstract public function hosts(); + + /** + * Handle the incoming request. + * + * @param \Illuminate\Http\Request $request + * @param callable $next + * @return \Illuminate\Http\Response + */ + public function handle(Request $request, $next) + { + if ($this->shouldSpecifyTrustedHosts()) { + Request::setTrustedHosts(array_filter($this->hosts())); + } + + return $next($request); + } + + /** + * Determine if the application should specify trusted hosts. + * + * @return bool + */ + protected function shouldSpecifyTrustedHosts() + { + return $this->app['config']->get('app.env') !== 'local' + && $this->app->runningUnitTests() === false; + } + + /** + * Get a regular expression matching the application URL and all of its subdomains. + * + * @return string|null + */ + protected function allSubdomainsOfApplicationUrl() + { + if ($host = parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) { + return '^(.+\.)?'.preg_quote($host).'$'; + } + } +} diff --git a/vendor/october/rain/src/Mail/Mailer.php b/vendor/october/rain/src/Mail/Mailer.php index 191fdab15..ac85e6783 100644 --- a/vendor/october/rain/src/Mail/Mailer.php +++ b/vendor/october/rain/src/Mail/Mailer.php @@ -387,13 +387,13 @@ class Mailer extends MailerBase * * Example usage (stops the content adding process): * - * Event::listen('mailer.beforeAddContent', function ((\October\Rain\Mail\Mailer) $mailerInstance, (\Illuminate\Mail\Message) $message, (string) $view, (string) $plain, (string) $raw, (array) $data) { + * Event::listen('mailer.beforeAddContent', function ((\October\Rain\Mail\Mailer) $mailerInstance, (\Illuminate\Mail\Message) $message, (string) $view, (array) $data, (string) $raw, (string) $plain) { * return false; * }); * * Or * - * $mailerInstance->bindEvent('mailer.beforeAddContent', function ((\Illuminate\Mail\Message) $message, (string) $view, (string) $plain, (string) $raw, (array) $data) { + * $mailerInstance->bindEvent('mailer.beforeAddContent', function ((\Illuminate\Mail\Message) $message, (string) $view, (array) $data, (string) $raw, (string) $plain) { * return false; * }); * diff --git a/vendor/october/rain/src/Network/Http.php b/vendor/october/rain/src/Network/Http.php index 631f3d54d..7c8d21937 100644 --- a/vendor/october/rain/src/Network/Http.php +++ b/vendor/october/rain/src/Network/Http.php @@ -280,7 +280,7 @@ class Http if (in_array($this->method, [self::METHOD_POST, self::METHOD_PATCH, self::METHOD_PUT])) { curl_setopt($curl, CURLOPT_POSTFIELDS, $this->getRequestData()); } - elseif ($this->method == self::METHOD_GET) { + elseif (in_array($this->method, [self::METHOD_GET, self::METHOD_DELETE])) { curl_setopt($curl, CURLOPT_URL, $this->url . '?' . $this->getRequestData()); } } diff --git a/vendor/october/rain/src/Parse/Syntax/FieldParser.php b/vendor/october/rain/src/Parse/Syntax/FieldParser.php index 5cdb69085..ec7db7293 100644 --- a/vendor/october/rain/src/Parse/Syntax/FieldParser.php +++ b/vendor/october/rain/src/Parse/Syntax/FieldParser.php @@ -1,6 +1,6 @@ $tagString) { $tagName = $tagNames[$key]; $params = $this->processParams($paramStrings[$key], $tagName); @@ -265,6 +271,10 @@ class FieldParser $params['options'] = $this->processOptionsToArray($params['options']); } + if (in_array($tagName, $availableColors) && isset($params['availableColors'])) { + $params['availableColors'] = $this->processOptionsToArray($params['availableColors']); + } + // Convert trigger property to array if (isset($params['trigger'])) { $params['trigger'] = $this->processOptionsToArray($params['trigger']); @@ -398,7 +408,7 @@ class FieldParser * \Path\To\Class::method -> \Path\To\Class::method(): array * * @param string $optionsString - * @throws Exception + * @throws ApplicationException if an invalid array is returned when using the callback method. * @return array */ protected function processOptionsToArray($optionsString) @@ -431,7 +441,7 @@ class FieldParser if (strlen($key)) { if (!preg_match('/^[0-9a-z-_]+$/i', $key)) { - throw new Exception(sprintf( + throw new ApplicationException(sprintf( 'Invalid drop-down option key: %s. Option keys can contain only digits, Latin letters and characters _ and -', $key )); diff --git a/vendor/october/rain/src/Scaffold/Console/controller/config_form.stub b/vendor/october/rain/src/Scaffold/Console/controller/config_form.stub index 04dc5a97b..f5b0f4fe5 100644 --- a/vendor/october/rain/src/Scaffold/Console/controller/config_form.stub +++ b/vendor/october/rain/src/Scaffold/Console/controller/config_form.stub @@ -16,16 +16,16 @@ defaultRedirect: {{lower_author}}/{{lower_plugin}}/{{lower_name}} # Create page create: - title: Create {{title_singular_name}} + title: backend::lang.form.create_title redirect: {{lower_author}}/{{lower_plugin}}/{{lower_name}}/update/:id redirectClose: {{lower_author}}/{{lower_plugin}}/{{lower_name}} # Update page update: - title: Edit {{title_singular_name}} + title: backend::lang.form.update_title redirect: {{lower_author}}/{{lower_plugin}}/{{lower_name}} redirectClose: {{lower_author}}/{{lower_plugin}}/{{lower_name}} # Preview page preview: - title: Preview {{title_singular_name}} + title: backend::lang.form.preview_title diff --git a/vendor/october/rain/src/Support/Facades/Event.php b/vendor/october/rain/src/Support/Facades/Event.php new file mode 100755 index 000000000..6da93ca57 --- /dev/null +++ b/vendor/october/rain/src/Support/Facades/Event.php @@ -0,0 +1,28 @@ +mailables)->filter(function ($mailable) use ($type) { + return $mailable->view === $type; + }); + } + + /** + * Get all of the queued mailables for a given type. + * + * @param string $type + * @return \Illuminate\Support\Collection + */ + protected function queuedMailablesOf($type) + { + return collect($this->queuedMailables)->filter(function ($mailable) use ($type) { + return $mailable->view === $type; + }); + } + + /** + * Send a new message using a view. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return void + */ + public function send($view, $data = [], $callback = null) + { + if (!$view instanceof Mailable) { + $view = $this->buildMailable($view, $data, $callback); + } + + parent::send($view, $data = [], $callback = null); + } + + /** + * Queue a new e-mail message for sending. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @param string|null $queue + * @return mixed + */ + public function queue($view, $data = null, $callback = null, $queue = null) + { + if (!$view instanceof Mailable) { + $view = $this->buildMailable($view, $data, $callback, true); + } + + return parent::queue($view, $data = null, $callback = null, $queue = null); + } + + /** + * Create a Mailable object from a view file. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @param bool $queued + * @return \October\Rain\Mail\Mailable + */ + public function buildMailable($view, $data, $callback, $queued = false) + { + $mailable = new Mailable; + + if ($queued) { + $mailable->view($view)->withSerializedData($data); + } else { + $mailable->view($view, $data); + } + + if ($callback !== null) { + call_user_func($callback, $mailable); + } + return $mailable; + } +} diff --git a/vendor/october/rain/src/Support/helpers.php b/vendor/october/rain/src/Support/helpers.php index ef6ab4f41..3597653c2 100644 --- a/vendor/october/rain/src/Support/helpers.php +++ b/vendor/october/rain/src/Support/helpers.php @@ -42,8 +42,12 @@ if (!function_exists('post')) { */ function post($name = null, $default = null) { + if (Request::getRealMethod() !== 'POST') { + return $default; + } + if ($name === null) { - return Request::post(); + return Request::all(); } /* @@ -53,7 +57,7 @@ if (!function_exists('post')) { $name = implode('.', October\Rain\Html\Helper::nameToArray($name)); } - return array_get(Request::post(), $name, $default); + return array_get(Request::all(), $name, $default); } } diff --git a/vendor/october/rain/tests/Database/Concerns/HasRelationshipsTest.php b/vendor/october/rain/tests/Database/Concerns/HasRelationshipsTest.php new file mode 100644 index 000000000..b20553391 --- /dev/null +++ b/vendor/october/rain/tests/Database/Concerns/HasRelationshipsTest.php @@ -0,0 +1,76 @@ +assertEquals([], $model->getRelationTypeDefinitions('belongsToMany')); + $this->assertEquals([ + 'relatedModel' => 'TestModelNoRelation', + 'anotherRelatedModel' => [ + 'TestModelNoRelation', + 'order' => 'name desc', + ], + ], $model->getRelationTypeDefinitions('belongsTo')); + } + + public function testDynamicGetRelationTypeDefinitions() + { + TestModelBelongsTo::extend(function ($model) { + $model->belongsTo['dynamicRelatedModel'] = 'TestModelNoRelation'; + }); + $model = new TestModelBelongsTo(); + $this->assertEquals([ + 'relatedModel' => 'TestModelNoRelation', + 'anotherRelatedModel' => [ + 'TestModelNoRelation', + 'order' => 'name desc', + ], + 'dynamicRelatedModel' => 'TestModelNoRelation' + ], $model->getRelationTypeDefinitions('belongsTo')); + } + + public function testGetRelationTypeDefinition() + { + $model = new TestModelBelongsTo(); + $this->assertEquals(null, $model->getRelationTypeDefinition('belongsTo', 'nonExistantRelation')); + $this->assertEquals('TestModelNoRelation', $model->getRelationTypeDefinition('belongsTo', 'relatedModel')); + $this->assertEquals(['TestModelNoRelation', 'order' => 'name desc'], $model->getRelationTypeDefinition('belongsTo', 'anotherRelatedModel')); + $this->assertEquals(null, $model->getRelationTypeDefinition('belongsToMany', 'nonExistantRelation')); + $this->assertEquals(null, $model->getRelationTypeDefinition('belongsToMany', 'relatedModel')); + } + + public function testDynamicGetRelationTypeDefinition() + { + TestModelBelongsTo::extend(function ($model) { + $model->belongsTo['dynamicRelatedModel'] = 'TestModelNoRelation'; + }); + $model = new TestModelBelongsTo(); + $this->assertEquals('TestModelNoRelation', $model->getRelationTypeDefinition('belongsTo', 'dynamicRelatedModel')); + } +} + +/* + * Class with belongsTo relation + */ +class TestModelBelongsTo extends Model +{ + public $belongsTo = [ + 'relatedModel' => 'TestModelNoRelation', + 'anotherRelatedModel' => [ + 'TestModelNoRelation', + 'order' => 'name desc', + ] + ]; +} + +/* + * Class with no belongsTo relation + */ +class TestModelNoRelation extends Model +{ + +} diff --git a/vendor/october/rain/tests/Database/EloquentWithCountTest.php b/vendor/october/rain/tests/Database/EloquentWithCountTest.php new file mode 100644 index 000000000..b310ce278 --- /dev/null +++ b/vendor/october/rain/tests/Database/EloquentWithCountTest.php @@ -0,0 +1,138 @@ +createTable(); + } + + public function testItBasic() + { + $one = Model1::create(); + $two = $one->twos()->Create(); + $two->threes()->Create(); + + $results = Model1::query()->select(['id'])->withCount([ + 'twos' => static function ($query) { + $query->where('id', '>=', 1); + }, + ]); + + $this->assertEquals([ + ['id' => 1, 'twos_count' => 1], + ], $results->get()->toArray()); + } + + public function testGlobalScopes() + { + $one = Model1::create(); + $one->fours()->create(); + + $result = Model1::query()->withCount('fours')->first(); + $this->assertEquals(0, $result->fours_count); + } + + public function testSortingScopes() + { + $one = Model1::create(); + $one->twos()->create(); + + $result = Model1::query()->withCount('twos')->toSql(); + + $this->assertSame( + 'select "one".*, (select count(*) from "two" where "one"."id" = "two"."one_id") as "twos_count" from "one"', + $result + ); + } + + protected function createTable(): void + { + $this->db->schema()->create('one', static function ($table) { + $table->increments('id'); + $table->timestamps(); + }); + + $this->db->schema()->create('two', static function ($table) { + $table->increments('id'); + $table->integer('one_id'); + $table->timestamps(); + }); + + $this->db->schema()->create('three', static function ($table) { + $table->increments('id'); + $table->integer('two_id'); + $table->timestamps(); + }); + + $this->db->schema()->create('four', static function ($table) { + $table->increments('id'); + $table->integer('one_id'); + }); + } +} + +class Model1 extends \October\Rain\Database\Model +{ + protected $table = 'one'; + public $timestamps = false; + protected $guarded = ['id']; + + public $hasMany = [ + 'twos' => [Model2::class, 'key' => 'one_id'], + 'fours' => [Model4::class, 'key' => 'one_id'], + ]; +} + +class Model2 extends \October\Rain\Database\Model +{ + public $table = 'two'; + public $timestamps = false; + protected $guarded = ['id']; + + public $hasMany = [ + 'threes' => [Model3::class, 'key' => 'two_id'] + ]; + + protected static function boot() + { + parent::boot(); + + static::addGlobalScope('app', static function ($builder) { + $builder->latest(); + }); + } +} + +class Model3 extends \October\Rain\Database\Model +{ + public $table = 'three'; + public $timestamps = false; + protected $guarded = ['id']; + + protected static function boot() + { + parent::boot(); + + static::addGlobalScope('app', static function ($builder) { + $builder->where('idz', '>', 0); + }); + } +} + +class Model4 extends \October\Rain\Database\Model +{ + public $table = 'four'; + public $timestamps = false; + protected $guarded = ['id']; + + protected static function boot() + { + parent::boot(); + + static::addGlobalScope('app', static function ($builder) { + $builder->where('id', '>', 1); + }); + } +} diff --git a/vendor/october/rain/tests/Database/QueryBuilderTest.php b/vendor/october/rain/tests/Database/QueryBuilderTest.php index 2361e7cf7..d507b3f0c 100644 --- a/vendor/october/rain/tests/Database/QueryBuilderTest.php +++ b/vendor/october/rain/tests/Database/QueryBuilderTest.php @@ -180,8 +180,12 @@ class QueryBuilderTest extends TestCase $this->assertEquals(2, $result); } - protected function getConnection() + protected function getConnection($connection = null) { + if ($connection) { + return parent::getConnection($connection); + } + $connection = $this->getMockBuilder(ConnectionInterface::class) ->disableOriginalConstructor() ->disableOriginalClone() diff --git a/vendor/october/rain/tests/Database/RelationsTest.php b/vendor/october/rain/tests/Database/RelationsTest.php deleted file mode 100644 index 4311cf4e6..000000000 --- a/vendor/october/rain/tests/Database/RelationsTest.php +++ /dev/null @@ -1,200 +0,0 @@ -createTables(); - $this->seedTables(); - } - - public function createTables() - { - $this->db->schema()->create('posts', function ($table) { - $table->increments('id'); - $table->string('title')->default(''); - $table->timestamps(); - }); - - $this->db->schema()->create('terms', function ($table) { - $table->increments('id'); - $table->string('type'); - $table->string('name'); - $table->timestamps(); - }); - - $this->db->schema()->create('posts_terms', function ($table) { - $table->increments('id'); - $table->unsignedInteger('post_id'); - $table->unsignedInteger('term_id'); - }); - } - - public function seedTables() - { - $post = Post::create([ - 'title' => 'A Post', - ]); - - Term::create(['type' => 'category', 'name' => 'category tag #1']); - Term::create(['type' => 'category', 'name' => 'category tag #2']); - - $post->tags()->create(['type' => 'tag', 'name' => 'A Tag']); - $post->tags()->create(['type' => 'tag', 'name' => 'Second Tag']); - - $post->categories()->create(['type' => 'category', 'name' => 'A Category']); - $post->categories()->create(['type' => 'category', 'name' => 'Second Category']); - } - - public function testTablesExist() - { - $this->assertTrue($this->db->schema()->hasTable('posts')); - $this->assertTrue($this->db->schema()->hasTable('terms')); - $this->assertTrue($this->db->schema()->hasTable('posts_terms')); - } - - public function testTablesProperlySeeded() - { - $this->assertEquals(1, Post::count()); - $this->assertEquals(6, Term::count()); - $this->assertEquals(2, Term::where('type', 'tag')->count()); - $this->assertEquals(4, Term::where('type', 'category')->count()); - } - - public function testBelongsToManyCount() - { - $post = Post::first(); - $this->assertEquals(2, $post->tags->count()); - $this->assertEquals(2, $post->categories->count()); - } - - public function testBelongsToManySyncAll() - { - $post = Post::first(); - - $catid = $post->categories()->first()->id; - $tagid = $post->tags()->first()->id; - - Post::flushDuplicateCache(); - - $post->categories()->sync([$catid]); - - $this->assertEquals(1, $post->categories->count()); - $this->assertEquals($catid, $post->categories()->first()->id); - - $post->tags()->sync([$tagid]); - - $this->assertEquals(1, $post->tags->count()); - $this->assertEquals($tagid, $post->tags()->first()->id); - } - - public function testBelongsToManySyncTags() - { - $post = Post::first(); - - $id = $post->tags()->first()->id; - - Post::flushDuplicateCache(); - - $post->categories()->detach(); - $this->assertEquals(0, $post->categories()->count()); - - $post->tags()->sync([$id]); - - $this->assertEquals(1, $post->tags->count()); - $this->assertEquals($id, $post->tags()->first()->id); - } - - public function testBelongsToManySyncCategories() - { - $post = Post::first(); - - $id = $post->categories()->first()->id; - - Post::flushDuplicateCache(); - - $post->categories()->sync([$id]); - - $this->assertEquals(1, $post->categories()->count()); - $this->assertEquals($id, $post->categories()->first()->id); - - $post->tags()->detach(); - $this->assertEquals(0, $post->tags->count()); - } - - public function testBelongsToManyDetach() - { - $post = Post::first(); - - $post->categories()->detach(); - $this->assertEquals(0, $post->categories()->count()); - - $post->tags()->detach(); - $this->assertEquals(0, $post->tags()->count()); - } - - public function testBelongsToManySyncMultipleCategories() - { - $post = Post::first(); - - $category_ids = Term::where('type', 'category')->lists('id'); - $this->assertEquals(4, count($category_ids)); - - $post->categories()->sync($category_ids); - $this->assertEquals(4, $post->categories()->count()); - } - - public function testBelongsToManyDetachOneCategory() - { - $post = Post::first(); - - $id = $post->categories()->get()->last()->id; - Post::flushDuplicateCache(); - - $post->categories()->detach([$id]); - $this->assertEquals(1, $post->categories()->count()); - } -} - -class Post extends \October\Rain\Database\Model -{ - public $table = 'posts'; - - public $fillable = ['title']; - - public $belongsToMany = [ - 'tags' => [ - Term::class, - 'table' => 'posts_terms', - 'key' => 'post_id', - 'otherKey' => 'term_id', - 'conditions' => 'type = "tag"' - ], - 'categories' => [ - Term::class, - 'table' => 'posts_terms', - 'key' => 'post_id', - 'otherKey' => 'term_id', - 'conditions' => 'type = "category"' - ], - ]; -} - -class Term extends \October\Rain\Database\Model -{ - public $table = 'terms'; - - public $fillable = ['type', 'name']; - - public $belongsToMany = [ - 'posts' => [ - 'Post', - 'table' => 'posts_terms', - 'key' => 'term_id', - 'otherKey' => 'post_id', - 'conditions' => 'type = "post"' - ], - ]; -} diff --git a/vendor/october/rain/tests/Foundation/Http/Middleware/CheckForTrustedHostTest.php b/vendor/october/rain/tests/Foundation/Http/Middleware/CheckForTrustedHostTest.php new file mode 100644 index 000000000..811941971 --- /dev/null +++ b/vendor/october/rain/tests/Foundation/Http/Middleware/CheckForTrustedHostTest.php @@ -0,0 +1,217 @@ + 'octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://octobercms.com', $url); + } + + public function testTrustedHostWwwSubdomain() + { + $trustedHosts = ['www.octobercms.com']; + $headers = ['HOST' => 'www.octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://www.octobercms.com', $url); + } + + public function testTrustedHostWwwSubdomainFailure() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['octobercms.com']; + $headers = ['HOST' => 'www.octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $urlGenerator->to('/'); + } + + public function testTrustedHostWwwRegex() + { + $trustedHosts = ['^(www\.)?octobercms\.com$']; + $headers = ['HOST' => 'octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://octobercms.com', $url); + + $headers = ['HOST' => 'www.octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://www.octobercms.com', $url); + } + + public function testTrustedIpHost() + { + $trustedHosts = ['127.0.0.1']; + $headers = ['HOST' => '127.0.0.1']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://127.0.0.1', $url); + } + + public function testNoTrustedHostsSet() + { + $trustedHosts = false; + $headers = ['HOST' => 'malicious.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://malicious.com', $url); + } + + public function testThrowExceptionForUntrustedHosts() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['octobercms.com']; + $headers = ['HOST' => 'malicious.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers); + $urlGenerator->to('/'); + } + + public function testThrowExceptionForUntrustedServerName() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['octobercms.com']; + $headers = []; + $servers = ['SERVER_NAME' => 'malicious.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $urlGenerator->to('/'); + } + + public function testThrowExceptionForUntrustedServerAddr() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['octobercms.com']; + $headers = []; + $servers = ['SERVER_ADDR' => 'malicious.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $urlGenerator->to('/'); + } + + public function testRegexTrustedHost() + { + $trustedHosts = ['^[a-z0-9]+\.octobercms\.com$']; + $headers = ['HOST' => 'test123.octobercms.com']; + $servers = []; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://test123.octobercms.com', $url); + + $headers = ['HOST' => 'test456.octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://test456.octobercms.com', $url); + } + + public function testRegexFailTrustedHost() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['^[a-z0-9]+\.octobercms\.com$']; + $headers = ['HOST' => 'test.123.octobercms.com']; + $servers = []; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $urlGenerator->to('/'); + } + + public function testArrayTrustedHost() + { + $trustedHosts = ['test1.octobercms.com', 'test2.octobercms.com']; + $headers = ['HOST' => 'test1.octobercms.com']; + $servers = []; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://test1.octobercms.com', $url); + + $headers = ['HOST' => 'test2.octobercms.com']; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $url = $urlGenerator->to('/'); + + $this->assertEquals('http://test2.octobercms.com', $url); + } + + public function testArrayFailTrustedHost() + { + $this->expectException(SuspiciousOperationException::class); + + $trustedHosts = ['test1.octobercms.com', 'test2.octobercms.com']; + $headers = ['HOST' => 'test3.octobercms.com']; + $servers = []; + $urlGenerator = $this->createUrlGenerator($trustedHosts, $headers, $servers); + $urlGenerator->to('/'); + } + + protected function createUrlGenerator($trustedHosts = [], $headers = [], $servers = []) + { + $middleware = $this->getMockBuilder(CheckForTrustedHost::class) + ->disableOriginalConstructor() + ->setMethods(['hosts', 'shouldSpecifyTrustedHosts']) + ->getMock(); + + $middleware->expects($this->any()) + ->method('hosts') + ->willReturn(CheckForTrustedHost::processTrustedHosts($trustedHosts)); + + $middleware->expects($this->any()) + ->method('shouldSpecifyTrustedHosts') + ->willReturn(true); + + $request = new Request; + + foreach ($headers as $key => $val) { + $request->headers->set($key, $val); + } + + foreach ($servers as $key => $val) { + $request->server->set($key, $val); + } + + $middleware->handle($request, function () { + }); + + $routes = new RouteCollection; + $routes->add(new Route('GET', 'foo', [ + 'uses' => 'FooController@index', + 'as' => 'foo_index', + ])); + + return new UrlGenerator($routes, $request); + } +} diff --git a/vendor/october/rain/tests/Parse/SyntaxFieldParserTest.php b/vendor/october/rain/tests/Parse/SyntaxFieldParserTest.php index 20bfecc10..38f7430d2 100644 --- a/vendor/october/rain/tests/Parse/SyntaxFieldParserTest.php +++ b/vendor/october/rain/tests/Parse/SyntaxFieldParserTest.php @@ -160,6 +160,23 @@ class SyntaxFieldParserTest extends TestCase ], $fields['radio']['options']); } + public function testParseColorPicker() + { + $content = ''; + $content .= '{colorpicker name="field1" label="Field 1" availableColors="#ffffff|#000000" allowEmpty="false"}{/colorpicker}'.PHP_EOL; + $content .= '{variable type="colorpicker" name="field2" label="Field 2" allowEmpty="true"}{/variable}'; + + $result = FieldParser::parse($content); + $fields = $result->getFields(); + + $this->assertArrayNotHasKey('availableColors', $fields['field2']); + $this->assertCount(2, $fields['field1']['availableColors']); + $this->assertEquals(['#ffffff', '#000000'], $fields['field1']['availableColors']); + + $this->assertFalse($fields['field1']['allowEmpty']); + $this->assertTrue($fields['field2']['allowEmpty']); + } + public function testParseRepeater() { $content = ''; diff --git a/vendor/october/rain/tests/Support/EventFakeTest.php b/vendor/october/rain/tests/Support/EventFakeTest.php new file mode 100644 index 000000000..40ff0d219 --- /dev/null +++ b/vendor/october/rain/tests/Support/EventFakeTest.php @@ -0,0 +1,20 @@ +faker = new EventFake(new Dispatcher); + } + + public function testFire() + { + $event = 'event.fake.test'; + + $this->faker->fire($event); + $this->faker->assertDispatched($event); + } +} diff --git a/vendor/october/rain/tests/Support/HelpersTest.php b/vendor/october/rain/tests/Support/HelpersTest.php index 9179a7150..e7107c253 100644 --- a/vendor/october/rain/tests/Support/HelpersTest.php +++ b/vendor/october/rain/tests/Support/HelpersTest.php @@ -27,6 +27,10 @@ class HelpersTest extends TestCase public function testConfigPath() { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestIncomplete('Need to fix Windows testing here'); + } + $this->assertEquals($this->app['path.config'], config_path()); } diff --git a/vendor/october/rain/tests/Support/MailFakeTest.php b/vendor/october/rain/tests/Support/MailFakeTest.php new file mode 100644 index 000000000..3bf8585a2 --- /dev/null +++ b/vendor/october/rain/tests/Support/MailFakeTest.php @@ -0,0 +1,60 @@ +andreturn('en/US'); + + // Mock Mail facade + if (!class_exists('Mail')) { + class_alias('\October\Rain\Support\Facades\Mail', 'Mail'); + } + Mail::swap(new MailFake()); + + $this->view = 'mail-test-view'; + $this->recipient = 'fake@localhost'; + $this->subject = 'MailFake test'; + } + + public function testSend() + { + Mail::send($this->view, [], function ($mailer) { + $mailer->to($this->recipient); + $mailer->subject($this->subject); + }); + Mail::assertSent($this->view, 1); + + Mail::assertSent($this->view, function ($mailer) { + return $mailer->hasTo($this->recipient); + }); + + Mail::assertSent($this->view, function ($mailer) { + return $mailer->subject === $this->subject; + }); + } + + public function testQueue() + { + Mail::queue($this->view, [], function ($mailer) { + $mailer->to($this->recipient); + $mailer->subject($this->subject); + }); + + Mail::assertQueued($this->view, 1); + + Mail::assertQueued($this->view, function ($mailer) { + return $mailer->hasTo($this->recipient); + }); + + Mail::assertQueued($this->view, function ($mailer) { + return $mailer->subject === $this->subject; + }); + } +} diff --git a/vendor/october/rain/tests/TestCase.php b/vendor/october/rain/tests/TestCase.php index be6b875b3..8cf6767cd 100644 --- a/vendor/october/rain/tests/TestCase.php +++ b/vendor/october/rain/tests/TestCase.php @@ -1,5 +1,7 @@ setAccessible(true); return $method->invokeArgs($object, $params); } + + /** + * Stub for `assertFileNotExists` to allow compatibility with both PHPUnit 8 and 9. + * + * @param string $filename + * @param string $message + * @return void + */ + public static function assertFileNotExists(string $filename, string $message = ''): void + { + if (method_exists(Assert::class, 'assertFileDoesNotExist')) { + Assert::assertFileDoesNotExist($filename, $message); + return; + } + + Assert::assertFileNotExists($filename, $message); + } } diff --git a/vendor/october/rain/tests/fixtures/halcyon/models/Page.php b/vendor/october/rain/tests/fixtures/halcyon/models/Page.php index 655a8b325..2e2a8a62a 100644 --- a/vendor/october/rain/tests/fixtures/halcyon/models/Page.php +++ b/vendor/october/rain/tests/fixtures/halcyon/models/Page.php @@ -4,6 +4,10 @@ use October\Rain\Halcyon\Model; class HalcyonTestPage extends Model { + /** + * @var int maxNesting + */ + protected $maxNesting = 2; /** * The attributes that are mass assignable. diff --git a/vendor/php-http/client-common/.php-cs-fixer.dist.php b/vendor/php-http/client-common/.php-cs-fixer.dist.php new file mode 100644 index 000000000..92bc74842 --- /dev/null +++ b/vendor/php-http/client-common/.php-cs-fixer.dist.php @@ -0,0 +1,18 @@ +in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ->name('*.php') +; + +$config = new PhpCsFixer\Config(); + +return $config + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + 'single_line_throw' => false, + ]) + ->setFinder($finder) +; diff --git a/vendor/php-http/client-common/.php_cs.dist b/vendor/php-http/client-common/.php_cs.dist new file mode 100644 index 000000000..24e9bb9e2 --- /dev/null +++ b/vendor/php-http/client-common/.php_cs.dist @@ -0,0 +1,24 @@ +in('src') + ->in('spec') +; +return PhpCsFixer\Config::create() + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'no_empty_phpdoc' => true, + 'phpdoc_to_comment' => false, + 'single_line_throw' => false, + ]) + ->setFinder($finder); diff --git a/vendor/php-http/client-common/CHANGELOG.md b/vendor/php-http/client-common/CHANGELOG.md new file mode 100644 index 000000000..e795fcefb --- /dev/null +++ b/vendor/php-http/client-common/CHANGELOG.md @@ -0,0 +1,290 @@ +# Change Log + +## 2.6.0 - 2022-09-29 + +- [RedirectPlugin] Redirection of non GET/HEAD requests with a body now removes the body on follow-up requests, if the + HTTP method changes. To do this, the plugin needs to find a PSR-7 stream implementation. If none is found, you can + explicitly pass a PSR-17 StreamFactoryInterface in the `stream_factory` option. + To keep sending the body in all cases, set the `stream_factory` option to null explicitly. + +## 2.5.1 - 2022-09-29 + +### Fixed + +- [RedirectPlugin] Fixed handling of redirection to different domain with default port +- [RedirectPlugin] Fixed false positive circular detection in RedirectPlugin in cases when target location does not contain path + +## 2.5.0 - 2021-11-26 + +### Added + +- Support for Symfony 6 +- Support for PHP 8.1 + +### Changed + +- Dropped support for Symfony 2 and 3 - please keep using version 2.4.0 of this library if you can't update Symfony. + +## 2.4.0 - 2021-07-05 + +### Added + +- `strict` option to `RedirectPlugin` to allow preserving the request method on redirections with status 300, 301 and 302. + +## 2.3.0 - 2020-07-21 + +### Fixed + +- HttpMethodsClient with PSR RequestFactory +- Bug in the cookie plugin with empty cookies +- Bug when parsing null-valued date headers + +### Changed + +- Deprecation when constructing a HttpMethodsClient with PSR RequestFactory but without a StreamFactory + +## 2.2.1 - 2020-07-13 + +### Fixed + +- Support for PHP 8 +- Plugin callable phpdoc + +## 2.2.0 - 2020-07-02 + +### Added + +- Plugin client builder for making a `PluginClient` +- Support for the PSR-17 request factory in `HttpMethodsClient` + +### Changed + +- Restored support for `symfony/options-resolver: ^2.6` +- Consistent implementation of union type checking + +### Fixed + +- Memory leak when using the `PluginClient` with plugins + +## 2.1.0 - 2019-11-18 + +### Added + +- Support Symfony 5 + +## 2.0.0 - 2019-02-03 + +### Changed + +- HttpClientRouter now throws a HttpClientNoMatchException instead of a RequestException if it can not find a client for the request. +- RetryPlugin will only retry exceptions when there is no response, or a response in the 5xx HTTP code range. +- RetryPlugin also retries when no exception is thrown if the responses has HTTP code in the 5xx range. + The callbacks for exception handling have been renamed and callbacks for response handling have been added. +- Abstract method `HttpClientPool::chooseHttpClient()` has now an explicit return type (`Http\Client\Common\HttpClientPoolItem`) +- Interface method `Plugin::handleRequest(...)` has now an explicit return type (`Http\Promise\Promise`) +- Made classes final that are not intended to be extended. +- Added interfaces for BatchClient, HttpClientRouter and HttpMethodsClient. + (These interfaces use the `Interface` suffix to avoid name collisions.) +- Added an interface for HttpClientPool and moved the abstract class to the HttpClientPool sub namespace. +- AddPathPlugin: Do not add the prefix if the URL already has the same prefix. +- All exceptions in `Http\Client\Common\Exception` are final. + +### Removed + +- Deprecated option `debug_plugins` has been removed from `PluginClient` +- Deprecated options `decider` and `delay` have been removed from `RetryPlugin`, use `exception_decider` and `exception_delay` instead. + +## 1.11.0 - 2021-07-11 + +### Changed + +- Backported from version 2: AddPathPlugin: Do not add the prefix if the URL already has the same prefix. + +## 1.10.0 - 2019-11-18 + +### Added + +- Support for Symfony 5 + +## 1.9.1 - 2019-02-02 + +### Added + +- Updated type hints in doc blocks. + +## 1.9.0 - 2019-01-03 + +### Added + +- Support for PSR-18 clients +- Added traits `VersionBridgePlugin` and `VersionBridgeClient` to help plugins and clients to support both + 1.x and 2.x version of `php-http/client-common` and `php-http/httplug`. + +### Changed + +- RetryPlugin: Renamed the configuration options for the exception retry callback from `decider` to `exception_decider` + and `delay` to `exception_delay`. The old names still work but are deprecated. + +## 1.8.2 - 2018-12-14 + +### Changed + +- When multiple cookies exist, a single header with all cookies is sent as per RFC 6265 Section 5.4 +- AddPathPlugin will now trim of ending slashes in paths + +## 1.8.1 - 2018-10-09 + +### Fixed + +- Reverted change to RetryPlugin so it again waits when retrying to avoid "can only throw objects" error. + +## 1.8.0 - 2018-09-21 + +### Added + + - Add an option on ErrorPlugin to only throw exception on response with 5XX status code. + +### Changed + +- AddPathPlugin no longer add prefix multiple times if a request is restarted - it now only adds the prefix if that request chain has not yet passed through the AddPathPlugin +- RetryPlugin no longer wait for retried requests and use a deferred promise instead + +### Fixed + +- Decoder plugin will now remove header when there is no more encoding, instead of setting to an empty array + +## 1.7.0 - 2017-11-30 + +### Added + +- Symfony 4 support + +### Changed + +- Strict comparison in DecoderPlugin + +## 1.6.0 - 2017-10-16 + +### Added + +- Add HttpClientPool client to leverage load balancing and fallback mechanism [see the documentation](http://docs.php-http.org/en/latest/components/client-common.html) for more details. +- `PluginClientFactory` to create `PluginClient` instances. +- Added new option 'delay' for `RetryPlugin`. +- Added new option 'decider' for `RetryPlugin`. +- Supports more cookie date formats in the Cookie Plugin + +### Changed + +- The `RetryPlugin` does now wait between retries. To disable/change this feature you must write something like: + +```php +$plugin = new RetryPlugin(['delay' => function(RequestInterface $request, Exception $e, $retries) { + return 0; +}); +``` + +### Deprecated + +- The `debug_plugins` option for `PluginClient` is deprecated and will be removed in 2.0. Use the decorator design pattern instead like in [ProfilePlugin](https://github.com/php-http/HttplugBundle/blob/de33f9c14252f22093a5ec7d84f17535ab31a384/Collector/ProfilePlugin.php). + +## 1.5.0 - 2017-03-30 + +### Added + +- `QueryDefaultsPlugin` to add default query parameters. + +## 1.4.2 - 2017-03-18 + +### Deprecated + +- `DecoderPlugin` does not longer claim to support `compress` content encoding + +### Fixed + +- `CookiePlugin` allows main domain cookies to be sent/stored for subdomains +- `DecoderPlugin` uses the right `FilteredStream` to handle `deflate` content encoding + + +## 1.4.1 - 2017-02-20 + +### Fixed + +- Cast return value of `StreamInterface::getSize` to string in `ContentLengthPlugin` + + +## 1.4.0 - 2016-11-04 + +### Added + +- Add Path plugin +- Base URI plugin that combines Add Host and Add Path plugins + + +## 1.3.0 - 2016-10-16 + +### Changed + +- Fix Emulated Trait to use Http based promise which respect the HttpAsyncClient interface +- Require Httplug 1.1 where we use HTTP specific promises. +- RedirectPlugin: use the full URL instead of the URI to properly keep track of redirects +- Add AddPathPlugin for API URLs with base path +- Add BaseUriPlugin that combines AddHostPlugin and AddPathPlugin + + +## 1.2.1 - 2016-07-26 + +### Changed + +- AddHostPlugin also sets the port if specified + + +## 1.2.0 - 2016-07-14 + +### Added + +- Suggest separate plugins in composer.json +- Introduced `debug_plugins` option for `PluginClient` + + +## 1.1.0 - 2016-05-04 + +### Added + +- Add a flexible http client providing both contract, and only emulating what's necessary +- HTTP Client Router: route requests to underlying clients +- Plugin client and core plugins moved here from `php-http/plugins` + +### Deprecated + +- Extending client classes, they will be made final in version 2.0 + + +## 1.0.0 - 2016-01-27 + +### Changed + +- Remove useless interface in BatchException + + +## 0.2.0 - 2016-01-12 + +### Changed + +- Updated package files +- Updated HTTPlug to RC1 + + +## 0.1.1 - 2015-12-26 + +### Added + +- Emulated clients + + +## 0.1.0 - 2015-12-25 + +### Added + +- Batch client from utils +- Methods client from utils +- Emulators and decorators from client-tools diff --git a/vendor/php-http/client-common/LICENSE b/vendor/php-http/client-common/LICENSE new file mode 100644 index 000000000..4558d6f06 --- /dev/null +++ b/vendor/php-http/client-common/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 PHP HTTP Team + +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/vendor/php-http/client-common/README.md b/vendor/php-http/client-common/README.md new file mode 100644 index 000000000..7d1365876 --- /dev/null +++ b/vendor/php-http/client-common/README.md @@ -0,0 +1,55 @@ +# HTTP Client Common + +[![Latest Version](https://img.shields.io/github/release/php-http/client-common.svg?style=flat-square)](https://github.com/php-http/client-common/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/client-common/master.svg?style=flat-square)](https://travis-ci.org/php-http/client-common) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/client-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/client-common) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/client-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/client-common) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/client-common.svg?style=flat-square)](https://packagist.org/packages/php-http/client-common) + +**Common HTTP Client implementations and tools for HTTPlug.** + + +## Install + +Via Composer + +``` bash +$ composer require php-http/client-common +``` + + +## Usage + +This package provides common tools for HTTP Clients: + +- BatchClient to handle sending requests in parallel +- A convenience client with HTTP method names as class methods +- Emulator, decorator layers for sync/async clients + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org/en/latest/components/client-common.html). + + +## Testing + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/client-common/composer.json b/vendor/php-http/client-common/composer.json new file mode 100644 index 000000000..2ea45aa69 --- /dev/null +++ b/vendor/php-http/client-common/composer.json @@ -0,0 +1,67 @@ +{ + "name": "php-http/client-common", + "description": "Common HTTP Client implementations and tools for HTTPlug", + "license": "MIT", + "keywords": ["http", "client", "httplug", "common"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": "^7.1 || ^8.0", + "php-http/httplug": "^2.0", + "php-http/message": "^1.6", + "php-http/message-factory": "^1.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "doctrine/instantiator": "^1.1", + "guzzlehttp/psr7": "^1.4", + "nyholm/psr7": "^1.2", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "phpspec/prophecy": "^1.10.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" + }, + "suggest": { + "ext-json": "To detect JSON responses with the ContentTypePlugin", + "ext-libxml": "To detect XML responses with the ContentTypePlugin", + "php-http/logger-plugin": "PSR-3 Logger plugin", + "php-http/cache-plugin": "PSR-6 Cache plugin", + "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" + }, + "autoload": { + "psr-4": { + "Http\\Client\\Common\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "spec\\Http\\Client\\Common\\": "spec/" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpspec run", + "vendor/bin/phpunit" + ], + "test-ci": [ + "vendor/bin/phpspec run -c phpspec.ci.yml", + "vendor/bin/phpunit" + ] + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + } +} diff --git a/vendor/php-http/client-common/src/BatchClient.php b/vendor/php-http/client-common/src/BatchClient.php new file mode 100644 index 000000000..51f13ff64 --- /dev/null +++ b/vendor/php-http/client-common/src/BatchClient.php @@ -0,0 +1,42 @@ +client = $client; + } + + public function sendRequests(array $requests): BatchResult + { + $batchResult = new BatchResult(); + + foreach ($requests as $request) { + try { + $response = $this->client->sendRequest($request); + $batchResult = $batchResult->addResponse($request, $response); + } catch (ClientExceptionInterface $e) { + $batchResult = $batchResult->addException($request, $e); + } + } + + if ($batchResult->hasExceptions()) { + throw new BatchException($batchResult); + } + + return $batchResult; + } +} diff --git a/vendor/php-http/client-common/src/BatchClientInterface.php b/vendor/php-http/client-common/src/BatchClientInterface.php new file mode 100644 index 000000000..d42eb2d4e --- /dev/null +++ b/vendor/php-http/client-common/src/BatchClientInterface.php @@ -0,0 +1,34 @@ + + */ +interface BatchClientInterface +{ + /** + * Send several requests. + * + * You may not assume that the requests are executed in a particular order. If the order matters + * for your application, use sendRequest sequentially. + * + * @param RequestInterface[] $requests The requests to send + * + * @return BatchResult Containing one result per request + * + * @throws BatchException If one or more requests fails. The exception gives access to the + * BatchResult with a map of request to result for success, request to + * exception for failures + */ + public function sendRequests(array $requests): BatchResult; +} diff --git a/vendor/php-http/client-common/src/BatchResult.php b/vendor/php-http/client-common/src/BatchResult.php new file mode 100644 index 000000000..ccaf83cb3 --- /dev/null +++ b/vendor/php-http/client-common/src/BatchResult.php @@ -0,0 +1,157 @@ + + */ +final class BatchResult +{ + /** + * @var \SplObjectStorage + */ + private $responses; + + /** + * @var \SplObjectStorage + */ + private $exceptions; + + public function __construct() + { + $this->responses = new \SplObjectStorage(); + $this->exceptions = new \SplObjectStorage(); + } + + /** + * Checks if there are any successful responses at all. + */ + public function hasResponses(): bool + { + return $this->responses->count() > 0; + } + + /** + * Returns all successful responses. + * + * @return ResponseInterface[] + */ + public function getResponses(): array + { + $responses = []; + + foreach ($this->responses as $request) { + $responses[] = $this->responses[$request]; + } + + return $responses; + } + + /** + * Checks if there is a successful response for a request. + */ + public function isSuccessful(RequestInterface $request): bool + { + return $this->responses->contains($request); + } + + /** + * Returns the response for a successful request. + * + * @throws \UnexpectedValueException If request was not part of the batch or failed + */ + public function getResponseFor(RequestInterface $request): ResponseInterface + { + try { + return $this->responses[$request]; + } catch (\UnexpectedValueException $e) { + throw new \UnexpectedValueException('Request not found', $e->getCode(), $e); + } + } + + /** + * Adds a response in an immutable way. + * + * @return BatchResult the new BatchResult with this request-response pair added to it + */ + public function addResponse(RequestInterface $request, ResponseInterface $response): self + { + $new = clone $this; + $new->responses->attach($request, $response); + + return $new; + } + + /** + * Checks if there are any unsuccessful requests at all. + */ + public function hasExceptions(): bool + { + return $this->exceptions->count() > 0; + } + + /** + * Returns all exceptions for the unsuccessful requests. + * + * @return ClientExceptionInterface[] + */ + public function getExceptions(): array + { + $exceptions = []; + + foreach ($this->exceptions as $request) { + $exceptions[] = $this->exceptions[$request]; + } + + return $exceptions; + } + + /** + * Checks if there is an exception for a request, meaning the request failed. + */ + public function isFailed(RequestInterface $request): bool + { + return $this->exceptions->contains($request); + } + + /** + * Returns the exception for a failed request. + * + * @throws \UnexpectedValueException If request was not part of the batch or was successful + */ + public function getExceptionFor(RequestInterface $request): ClientExceptionInterface + { + try { + return $this->exceptions[$request]; + } catch (\UnexpectedValueException $e) { + throw new \UnexpectedValueException('Request not found', $e->getCode(), $e); + } + } + + /** + * Adds an exception in an immutable way. + * + * @return BatchResult the new BatchResult with this request-exception pair added to it + */ + public function addException(RequestInterface $request, ClientExceptionInterface $exception): self + { + $new = clone $this; + $new->exceptions->attach($request, $exception); + + return $new; + } + + public function __clone() + { + $this->responses = clone $this->responses; + $this->exceptions = clone $this->exceptions; + } +} diff --git a/vendor/php-http/client-common/src/Deferred.php b/vendor/php-http/client-common/src/Deferred.php new file mode 100644 index 000000000..646f37559 --- /dev/null +++ b/vendor/php-http/client-common/src/Deferred.php @@ -0,0 +1,155 @@ +waitCallback = $waitCallback; + $this->state = Promise::PENDING; + $this->onFulfilledCallbacks = []; + $this->onRejectedCallbacks = []; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null): Promise + { + $deferred = new self($this->waitCallback); + + $this->onFulfilledCallbacks[] = function (ResponseInterface $response) use ($onFulfilled, $deferred) { + try { + if (null !== $onFulfilled) { + $response = $onFulfilled($response); + } + $deferred->resolve($response); + } catch (ClientExceptionInterface $exception) { + $deferred->reject($exception); + } + }; + + $this->onRejectedCallbacks[] = function (ClientExceptionInterface $exception) use ($onRejected, $deferred) { + try { + if (null !== $onRejected) { + $response = $onRejected($exception); + $deferred->resolve($response); + + return; + } + $deferred->reject($exception); + } catch (ClientExceptionInterface $newException) { + $deferred->reject($newException); + } + }; + + return $deferred; + } + + /** + * {@inheritdoc} + */ + public function getState(): string + { + return $this->state; + } + + /** + * Resolve this deferred with a Response. + */ + public function resolve(ResponseInterface $response): void + { + if (Promise::PENDING !== $this->state) { + return; + } + + $this->value = $response; + $this->state = Promise::FULFILLED; + + foreach ($this->onFulfilledCallbacks as $onFulfilledCallback) { + $onFulfilledCallback($response); + } + } + + /** + * Reject this deferred with an Exception. + */ + public function reject(ClientExceptionInterface $exception): void + { + if (Promise::PENDING !== $this->state) { + return; + } + + $this->failure = $exception; + $this->state = Promise::REJECTED; + + foreach ($this->onRejectedCallbacks as $onRejectedCallback) { + $onRejectedCallback($exception); + } + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if (Promise::PENDING === $this->state) { + $callback = $this->waitCallback; + $callback(); + } + + if (!$unwrap) { + return null; + } + + if (Promise::FULFILLED === $this->state) { + return $this->value; + } + + if (null === $this->failure) { + throw new \RuntimeException('Internal Error: Promise is not fulfilled but has no exception stored'); + } + + throw $this->failure; + } +} diff --git a/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php b/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php new file mode 100644 index 000000000..008f8880e --- /dev/null +++ b/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php @@ -0,0 +1,25 @@ + + */ +final class EmulatedHttpAsyncClient implements HttpClient, HttpAsyncClient +{ + use HttpAsyncClientEmulator; + use HttpClientDecorator; + + public function __construct(ClientInterface $httpClient) + { + $this->httpClient = $httpClient; + } +} diff --git a/vendor/php-http/client-common/src/EmulatedHttpClient.php b/vendor/php-http/client-common/src/EmulatedHttpClient.php new file mode 100644 index 000000000..5c2d8c489 --- /dev/null +++ b/vendor/php-http/client-common/src/EmulatedHttpClient.php @@ -0,0 +1,24 @@ + + */ +final class EmulatedHttpClient implements HttpClient, HttpAsyncClient +{ + use HttpAsyncClientDecorator; + use HttpClientEmulator; + + public function __construct(HttpAsyncClient $httpAsyncClient) + { + $this->httpAsyncClient = $httpAsyncClient; + } +} diff --git a/vendor/php-http/client-common/src/Exception/BatchException.php b/vendor/php-http/client-common/src/Exception/BatchException.php new file mode 100644 index 000000000..a9cb08c87 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/BatchException.php @@ -0,0 +1,37 @@ + + */ +final class BatchException extends TransferException +{ + /** + * @var BatchResult + */ + private $result; + + public function __construct(BatchResult $result) + { + $this->result = $result; + parent::__construct(); + } + + /** + * Returns the BatchResult that contains all responses and exceptions. + */ + public function getResult(): BatchResult + { + return $this->result; + } +} diff --git a/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php b/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php new file mode 100644 index 000000000..9db927c28 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php @@ -0,0 +1,16 @@ + + */ +final class CircularRedirectionException extends HttpException +{ +} diff --git a/vendor/php-http/client-common/src/Exception/ClientErrorException.php b/vendor/php-http/client-common/src/Exception/ClientErrorException.php new file mode 100644 index 000000000..c657a3f89 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/ClientErrorException.php @@ -0,0 +1,16 @@ + + */ +final class ClientErrorException extends HttpException +{ +} diff --git a/vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php b/vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php new file mode 100644 index 000000000..682c5dd0b --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/HttpClientNoMatchException.php @@ -0,0 +1,33 @@ + + */ +final class HttpClientNoMatchException extends TransferException +{ + /** + * @var RequestInterface + */ + private $request; + + public function __construct(string $message, RequestInterface $request, \Exception $previous = null) + { + $this->request = $request; + + parent::__construct($message, 0, $previous); + } + + public function getRequest(): RequestInterface + { + return $this->request; + } +} diff --git a/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php b/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php new file mode 100644 index 000000000..509daa530 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php @@ -0,0 +1,16 @@ + + */ +final class HttpClientNotFoundException extends TransferException +{ +} diff --git a/vendor/php-http/client-common/src/Exception/LoopException.php b/vendor/php-http/client-common/src/Exception/LoopException.php new file mode 100644 index 000000000..f4e173f34 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/LoopException.php @@ -0,0 +1,16 @@ + + */ +final class LoopException extends RequestException +{ +} diff --git a/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php b/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php new file mode 100644 index 000000000..bf6c9f73d --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php @@ -0,0 +1,16 @@ + + */ +final class MultipleRedirectionException extends HttpException +{ +} diff --git a/vendor/php-http/client-common/src/Exception/ServerErrorException.php b/vendor/php-http/client-common/src/Exception/ServerErrorException.php new file mode 100644 index 000000000..774b97f06 --- /dev/null +++ b/vendor/php-http/client-common/src/Exception/ServerErrorException.php @@ -0,0 +1,16 @@ + + */ +final class ServerErrorException extends HttpException +{ +} diff --git a/vendor/php-http/client-common/src/FlexibleHttpClient.php b/vendor/php-http/client-common/src/FlexibleHttpClient.php new file mode 100644 index 000000000..c1e327fde --- /dev/null +++ b/vendor/php-http/client-common/src/FlexibleHttpClient.php @@ -0,0 +1,36 @@ + + */ +final class FlexibleHttpClient implements HttpClient, HttpAsyncClient +{ + use HttpClientDecorator; + use HttpAsyncClientDecorator; + + /** + * @param ClientInterface|HttpAsyncClient $client + */ + public function __construct($client) + { + if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { + throw new \TypeError( + sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + $this->httpClient = $client instanceof ClientInterface ? $client : new EmulatedHttpClient($client); + $this->httpAsyncClient = $client instanceof HttpAsyncClient ? $client : new EmulatedHttpAsyncClient($client); + } +} diff --git a/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php b/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php new file mode 100644 index 000000000..2714b4acb --- /dev/null +++ b/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php @@ -0,0 +1,31 @@ + + */ +trait HttpAsyncClientDecorator +{ + /** + * @var HttpAsyncClient + */ + protected $httpAsyncClient; + + /** + * {@inheritdoc} + * + * @see HttpAsyncClient::sendAsyncRequest + */ + public function sendAsyncRequest(RequestInterface $request) + { + return $this->httpAsyncClient->sendAsyncRequest($request); + } +} diff --git a/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php b/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php new file mode 100644 index 000000000..53c2535f6 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php @@ -0,0 +1,39 @@ + + */ +trait HttpAsyncClientEmulator +{ + /** + * {@inheritdoc} + * + * @see HttpClient::sendRequest + */ + abstract public function sendRequest(RequestInterface $request): ResponseInterface; + + /** + * {@inheritdoc} + * + * @see HttpAsyncClient::sendAsyncRequest + */ + public function sendAsyncRequest(RequestInterface $request) + { + try { + return new Promise\HttpFulfilledPromise($this->sendRequest($request)); + } catch (Exception $e) { + return new Promise\HttpRejectedPromise($e); + } + } +} diff --git a/vendor/php-http/client-common/src/HttpClientDecorator.php b/vendor/php-http/client-common/src/HttpClientDecorator.php new file mode 100644 index 000000000..c00ba6f39 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientDecorator.php @@ -0,0 +1,32 @@ + + */ +trait HttpClientDecorator +{ + /** + * @var ClientInterface + */ + protected $httpClient; + + /** + * {@inheritdoc} + * + * @see ClientInterface::sendRequest + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->httpClient->sendRequest($request); + } +} diff --git a/vendor/php-http/client-common/src/HttpClientEmulator.php b/vendor/php-http/client-common/src/HttpClientEmulator.php new file mode 100644 index 000000000..51e2c0586 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientEmulator.php @@ -0,0 +1,35 @@ + + */ +trait HttpClientEmulator +{ + /** + * {@inheritdoc} + * + * @see HttpClient::sendRequest + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + $promise = $this->sendAsyncRequest($request); + + return $promise->wait(); + } + + /** + * {@inheritdoc} + * + * @see HttpAsyncClient::sendAsyncRequest + */ + abstract public function sendAsyncRequest(RequestInterface $request); +} diff --git a/vendor/php-http/client-common/src/HttpClientPool.php b/vendor/php-http/client-common/src/HttpClientPool.php new file mode 100644 index 000000000..24ab42117 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientPool.php @@ -0,0 +1,24 @@ +clientPool[] = $client; + } + + /** + * Return an http client given a specific strategy. + * + * @return HttpClientPoolItem Return a http client that can do both sync or async + * + * @throws HttpClientNotFoundException When no http client has been found into the pool + */ + abstract protected function chooseHttpClient(): HttpClientPoolItem; + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + return $this->chooseHttpClient()->sendAsyncRequest($request); + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->chooseHttpClient()->sendRequest($request); + } +} diff --git a/vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php b/vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php new file mode 100644 index 000000000..f29d06555 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientPool/HttpClientPoolItem.php @@ -0,0 +1,181 @@ + + */ +class HttpClientPoolItem implements HttpClient, HttpAsyncClient +{ + /** + * @var int Number of request this client is currently sending + */ + private $sendingRequestCount = 0; + + /** + * @var \DateTime|null Time when this client has been disabled or null if enable + */ + private $disabledAt; + + /** + * Number of seconds until this client is enabled again after an error. + * + * null: never reenable this client. + * + * @var int|null + */ + private $reenableAfter; + + /** + * @var FlexibleHttpClient A http client responding to async and sync request + */ + private $client; + + /** + * @param ClientInterface|HttpAsyncClient $client + * @param int|null $reenableAfter Number of seconds until this client is enabled again after an error + */ + public function __construct($client, int $reenableAfter = null) + { + if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { + throw new \TypeError( + sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + $this->client = new FlexibleHttpClient($client); + $this->reenableAfter = $reenableAfter; + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + if ($this->isDisabled()) { + throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request); + } + + try { + $this->incrementRequestCount(); + $response = $this->client->sendRequest($request); + $this->decrementRequestCount(); + } catch (Exception $e) { + $this->disable(); + $this->decrementRequestCount(); + + throw $e; + } + + return $response; + } + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + if ($this->isDisabled()) { + throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request); + } + + $this->incrementRequestCount(); + + return $this->client->sendAsyncRequest($request)->then(function ($response) { + $this->decrementRequestCount(); + + return $response; + }, function ($exception) { + $this->disable(); + $this->decrementRequestCount(); + + throw $exception; + }); + } + + /** + * Whether this client is disabled or not. + * + * If the client was disabled, calling this method checks if the client can + * be reenabled and if so enables it. + */ + public function isDisabled(): bool + { + if (null !== $this->reenableAfter && null !== $this->disabledAt) { + // Reenable after a certain time + $now = new \DateTime(); + + if (($now->getTimestamp() - $this->disabledAt->getTimestamp()) >= $this->reenableAfter) { + $this->enable(); + + return false; + } + + return true; + } + + return null !== $this->disabledAt; + } + + /** + * Get current number of request that are currently being sent by the underlying HTTP client. + */ + public function getSendingRequestCount(): int + { + return $this->sendingRequestCount; + } + + /** + * Increment the request count. + */ + private function incrementRequestCount(): void + { + ++$this->sendingRequestCount; + } + + /** + * Decrement the request count. + */ + private function decrementRequestCount(): void + { + --$this->sendingRequestCount; + } + + /** + * Enable the current client. + */ + private function enable(): void + { + $this->disabledAt = null; + } + + /** + * Disable the current client. + */ + private function disable(): void + { + $this->disabledAt = new \DateTime('now'); + } +} diff --git a/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php new file mode 100644 index 000000000..789c3579b --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php @@ -0,0 +1,45 @@ + + */ +final class LeastUsedClientPool extends HttpClientPool +{ + /** + * {@inheritdoc} + */ + protected function chooseHttpClient(): HttpClientPoolItem + { + $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) { + return !$clientPoolItem->isDisabled(); + }); + + if (0 === count($clientPool)) { + throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); + } + + usort($clientPool, function (HttpClientPoolItem $clientA, HttpClientPoolItem $clientB) { + if ($clientA->getSendingRequestCount() === $clientB->getSendingRequestCount()) { + return 0; + } + + if ($clientA->getSendingRequestCount() < $clientB->getSendingRequestCount()) { + return -1; + } + + return 1; + }); + + return reset($clientPool); + } +} diff --git a/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php new file mode 100644 index 000000000..789ba42f8 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php @@ -0,0 +1,31 @@ + + */ +final class RandomClientPool extends HttpClientPool +{ + /** + * {@inheritdoc} + */ + protected function chooseHttpClient(): HttpClientPoolItem + { + $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) { + return !$clientPoolItem->isDisabled(); + }); + + if (0 === count($clientPool)) { + throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); + } + + return $clientPool[array_rand($clientPool)]; + } +} diff --git a/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php new file mode 100644 index 000000000..7c7b1910f --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php @@ -0,0 +1,42 @@ + + */ +final class RoundRobinClientPool extends HttpClientPool +{ + /** + * {@inheritdoc} + */ + protected function chooseHttpClient(): HttpClientPoolItem + { + $last = current($this->clientPool); + + do { + $client = next($this->clientPool); + + if (false === $client) { + $client = reset($this->clientPool); + + if (false === $client) { + throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); + } + } + + // Case when there is only one and the last one has been disabled + if ($last === $client && $client->isDisabled()) { + throw new HttpClientNotFoundException('Cannot choose a http client as there is no one enabled in the pool'); + } + } while ($client->isDisabled()); + + return $client; + } +} diff --git a/vendor/php-http/client-common/src/HttpClientRouter.php b/vendor/php-http/client-common/src/HttpClientRouter.php new file mode 100644 index 000000000..040d893a6 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientRouter.php @@ -0,0 +1,74 @@ + + */ +final class HttpClientRouter implements HttpClientRouterInterface +{ + /** + * @var (array{matcher: RequestMatcher, client: FlexibleHttpClient})[] + */ + private $clients = []; + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->chooseHttpClient($request)->sendRequest($request); + } + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + return $this->chooseHttpClient($request)->sendAsyncRequest($request); + } + + /** + * Add a client to the router. + * + * @param ClientInterface|HttpAsyncClient $client + */ + public function addClient($client, RequestMatcher $requestMatcher): void + { + if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { + throw new \TypeError( + sprintf('%s::addClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + $this->clients[] = [ + 'matcher' => $requestMatcher, + 'client' => new FlexibleHttpClient($client), + ]; + } + + /** + * Choose an HTTP client given a specific request. + */ + private function chooseHttpClient(RequestInterface $request): FlexibleHttpClient + { + foreach ($this->clients as $client) { + if ($client['matcher']->matches($request)) { + return $client['client']; + } + } + + throw new HttpClientNoMatchException('No client found for the specified request', $request); + } +} diff --git a/vendor/php-http/client-common/src/HttpClientRouterInterface.php b/vendor/php-http/client-common/src/HttpClientRouterInterface.php new file mode 100644 index 000000000..ae012cf4a --- /dev/null +++ b/vendor/php-http/client-common/src/HttpClientRouterInterface.php @@ -0,0 +1,27 @@ + + */ +interface HttpClientRouterInterface extends HttpClient, HttpAsyncClient +{ + /** + * Add a client to the router. + * + * @param ClientInterface|HttpAsyncClient $client + */ + public function addClient($client, RequestMatcher $requestMatcher): void; +} diff --git a/vendor/php-http/client-common/src/HttpMethodsClient.php b/vendor/php-http/client-common/src/HttpMethodsClient.php new file mode 100644 index 000000000..497921b19 --- /dev/null +++ b/vendor/php-http/client-common/src/HttpMethodsClient.php @@ -0,0 +1,150 @@ +httpClient = $httpClient; + $this->requestFactory = $requestFactory; + $this->streamFactory = $streamFactory; + } + + public function get($uri, array $headers = []): ResponseInterface + { + return $this->send('GET', $uri, $headers, null); + } + + public function head($uri, array $headers = []): ResponseInterface + { + return $this->send('HEAD', $uri, $headers, null); + } + + public function trace($uri, array $headers = []): ResponseInterface + { + return $this->send('TRACE', $uri, $headers, null); + } + + public function post($uri, array $headers = [], $body = null): ResponseInterface + { + return $this->send('POST', $uri, $headers, $body); + } + + public function put($uri, array $headers = [], $body = null): ResponseInterface + { + return $this->send('PUT', $uri, $headers, $body); + } + + public function patch($uri, array $headers = [], $body = null): ResponseInterface + { + return $this->send('PATCH', $uri, $headers, $body); + } + + public function delete($uri, array $headers = [], $body = null): ResponseInterface + { + return $this->send('DELETE', $uri, $headers, $body); + } + + public function options($uri, array $headers = [], $body = null): ResponseInterface + { + return $this->send('OPTIONS', $uri, $headers, $body); + } + + public function send(string $method, $uri, array $headers = [], $body = null): ResponseInterface + { + if (!is_string($uri) && !$uri instanceof UriInterface) { + throw new \TypeError( + sprintf('%s::send(): Argument #2 ($uri) must be of type string|%s, %s given', self::class, UriInterface::class, get_debug_type($uri)) + ); + } + + if (!is_string($body) && !$body instanceof StreamInterface && null !== $body) { + throw new \TypeError( + sprintf('%s::send(): Argument #4 ($body) must be of type string|%s|null, %s given', self::class, StreamInterface::class, get_debug_type($body)) + ); + } + + return $this->sendRequest( + self::createRequest($method, $uri, $headers, $body) + ); + } + + /** + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + */ + private function createRequest(string $method, $uri, array $headers = [], $body = null): RequestInterface + { + if ($this->requestFactory instanceof RequestFactory) { + return $this->requestFactory->createRequest( + $method, + $uri, + $headers, + $body + ); + } + + $request = $this->requestFactory->createRequest($method, $uri); + + foreach ($headers as $key => $value) { + $request = $request->withHeader($key, $value); + } + + if (null !== $body && '' !== $body) { + if (null === $this->streamFactory) { + throw new \RuntimeException('Cannot create request: A stream factory is required to create a request with a non-empty string body.'); + } + + $request = $request->withBody( + is_string($body) ? $this->streamFactory->createStream($body) : $body + ); + } + + return $request; + } + + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->httpClient->sendRequest($request); + } +} diff --git a/vendor/php-http/client-common/src/HttpMethodsClientInterface.php b/vendor/php-http/client-common/src/HttpMethodsClientInterface.php new file mode 100644 index 000000000..bc0829aec --- /dev/null +++ b/vendor/php-http/client-common/src/HttpMethodsClientInterface.php @@ -0,0 +1,116 @@ +get('/foo') + * ->post('/bar') + * ; + * + * The client also exposes the sendRequest methods of the wrapped HttpClient. + * + * @author Márk Sági-Kazár + * @author David Buchmann + */ +interface HttpMethodsClientInterface extends HttpClient +{ + /** + * Sends a GET request. + * + * @param string|UriInterface $uri + * + * @throws Exception + */ + public function get($uri, array $headers = []): ResponseInterface; + + /** + * Sends an HEAD request. + * + * @param string|UriInterface $uri + * + * @throws Exception + */ + public function head($uri, array $headers = []): ResponseInterface; + + /** + * Sends a TRACE request. + * + * @param string|UriInterface $uri + * + * @throws Exception + */ + public function trace($uri, array $headers = []): ResponseInterface; + + /** + * Sends a POST request. + * + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function post($uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends a PUT request. + * + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function put($uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends a PATCH request. + * + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function patch($uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends a DELETE request. + * + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function delete($uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends an OPTIONS request. + * + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function options($uri, array $headers = [], $body = null): ResponseInterface; + + /** + * Sends a request with any HTTP method. + * + * @param string $method HTTP method to use + * @param string|UriInterface $uri + * @param string|StreamInterface|null $body + * + * @throws Exception + */ + public function send(string $method, $uri, array $headers = [], $body = null): ResponseInterface; +} diff --git a/vendor/php-http/client-common/src/Plugin.php b/vendor/php-http/client-common/src/Plugin.php new file mode 100644 index 000000000..99898b922 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin.php @@ -0,0 +1,33 @@ + + */ +interface Plugin +{ + /** + * Handle the request and return the response coming from the next callable. + * + * @see http://docs.php-http.org/en/latest/plugins/build-your-own.html + * + * @param callable(RequestInterface): Promise $next Next middleware in the chain, the request is passed as the first argument + * @param callable(RequestInterface): Promise $first First middleware in the chain, used to to restart a request + * + * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient) + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise; +} diff --git a/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php b/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php new file mode 100644 index 000000000..2a866ee6b --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php @@ -0,0 +1,76 @@ + + */ +final class AddHostPlugin implements Plugin +{ + /** + * @var UriInterface + */ + private $host; + + /** + * @var bool + */ + private $replace; + + /** + * @param array{'replace'?: bool} $config + * + * Configuration options: + * - replace: True will replace all hosts, false will only add host when none is specified + */ + public function __construct(UriInterface $host, array $config = []) + { + if ('' === $host->getHost()) { + throw new \LogicException('Host can not be empty'); + } + + $this->host = $host; + + $resolver = new OptionsResolver(); + $this->configureOptions($resolver); + $options = $resolver->resolve($config); + + $this->replace = $options['replace']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + if ($this->replace || '' === $request->getUri()->getHost()) { + $uri = $request->getUri() + ->withHost($this->host->getHost()) + ->withScheme($this->host->getScheme()) + ->withPort($this->host->getPort()) + ; + + $request = $request->withUri($uri); + } + + return $next($request); + } + + private function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'replace' => false, + ]); + $resolver->setAllowedTypes('replace', 'bool'); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php b/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php new file mode 100644 index 000000000..87fcdcebe --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php @@ -0,0 +1,78 @@ + + */ +final class AddPathPlugin implements Plugin +{ + /** + * @var UriInterface + */ + private $uri; + + public function __construct(UriInterface $uri) + { + if ('' === $uri->getPath()) { + throw new \LogicException('URI path cannot be empty'); + } + + if ('/' === substr($uri->getPath(), -1)) { + $uri = $uri->withPath(rtrim($uri->getPath(), '/')); + } + + $this->uri = $uri; + } + + /** + * Adds a prefix in the beginning of the URL's path. + * + * The prefix is not added if that prefix is already on the URL's path. This will fail on the edge + * case of the prefix being repeated, for example if `https://example.com/api/api/foo` is a valid + * URL on the server and the configured prefix is `/api`. + * + * We looked at other solutions, but they are all much more complicated, while still having edge + * cases: + * - Doing an spl_object_hash on `$first` will lead to collisions over time because over time the + * hash can collide. + * - Have the PluginClient provide a magic header to identify the request chain and only apply + * this plugin once. + * + * There are 2 reasons for the AddPathPlugin to be executed twice on the same request: + * - A plugin can restart the chain by calling `$first`, e.g. redirect + * - A plugin can call `$next` more than once, e.g. retry + * + * Depending on the scenario, the path should or should not be added. E.g. `$first` could + * be called after a redirect response from the server. The server likely already has the + * correct path. + * + * No solution fits all use cases. This implementation will work fine for the common use cases. + * If you have a specific situation where this is not the right thing, you can build a custom plugin + * that does exactly what you need. + * + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $prepend = $this->uri->getPath(); + $path = $request->getUri()->getPath(); + + if (substr($path, 0, strlen($prepend)) !== $prepend) { + $request = $request->withUri($request->getUri() + ->withPath($prepend.$path) + ); + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php b/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php new file mode 100644 index 000000000..ce9d4bd19 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php @@ -0,0 +1,38 @@ + + */ +final class AuthenticationPlugin implements Plugin +{ + /** + * @var Authentication An authentication system + */ + private $authentication; + + public function __construct(Authentication $authentication) + { + $this->authentication = $authentication; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $request = $this->authentication->authenticate($request); + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php b/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php new file mode 100644 index 000000000..34c3b641d --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php @@ -0,0 +1,57 @@ + + */ +final class BaseUriPlugin implements Plugin +{ + /** + * @var AddHostPlugin + */ + private $addHostPlugin; + + /** + * @var AddPathPlugin|null + */ + private $addPathPlugin = null; + + /** + * @param UriInterface $uri Has to contain a host name and can have a path + * @param array $hostConfig Config for AddHostPlugin. @see AddHostPlugin::configureOptions + */ + public function __construct(UriInterface $uri, array $hostConfig = []) + { + $this->addHostPlugin = new AddHostPlugin($uri, $hostConfig); + + if (rtrim($uri->getPath(), '/')) { + $this->addPathPlugin = new AddPathPlugin($uri); + } + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $addHostNext = function (RequestInterface $request) use ($next, $first) { + return $this->addHostPlugin->handleRequest($request, $next, $first); + }; + + if ($this->addPathPlugin) { + return $this->addPathPlugin->handleRequest($request, $addHostNext, $first); + } + + return $addHostNext($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php b/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php new file mode 100644 index 000000000..f313c330b --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php @@ -0,0 +1,39 @@ + + */ +final class ContentLengthPlugin implements Plugin +{ + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + if (!$request->hasHeader('Content-Length')) { + $stream = $request->getBody(); + + // Cannot determine the size so we use a chunk stream + if (null === $stream->getSize()) { + $stream = new ChunkStream($stream); + $request = $request->withBody($stream); + $request = $request->withAddedHeader('Transfer-Encoding', 'chunked'); + } else { + $request = $request->withHeader('Content-Length', (string) $stream->getSize()); + } + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php b/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php new file mode 100644 index 000000000..da3758ebb --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php @@ -0,0 +1,122 @@ + + */ +final class ContentTypePlugin implements Plugin +{ + /** + * Allow to disable the content type detection when stream is too large (as it can consume a lot of resource). + * + * @var bool + * + * true skip the content type detection + * false detect the content type (default value) + */ + private $skipDetection; + + /** + * Determine the size stream limit for which the detection as to be skipped (default to 16Mb). + * + * @var int + */ + private $sizeLimit; + + /** + * @param array{'skip_detection'?: bool, 'size_limit'?: int} $config + * + * Configuration options: + * - skip_detection: true skip detection if stream size is bigger than $size_limit + * - size_limit: size stream limit for which the detection as to be skipped + */ + public function __construct(array $config = []) + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'skip_detection' => false, + 'size_limit' => 16000000, + ]); + $resolver->setAllowedTypes('skip_detection', 'bool'); + $resolver->setAllowedTypes('size_limit', 'int'); + + $options = $resolver->resolve($config); + + $this->skipDetection = $options['skip_detection']; + $this->sizeLimit = $options['size_limit']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + if (!$request->hasHeader('Content-Type')) { + $stream = $request->getBody(); + $streamSize = $stream->getSize(); + + if (!$stream->isSeekable()) { + return $next($request); + } + + if (0 === $streamSize) { + return $next($request); + } + + if ($this->skipDetection && (null === $streamSize || $streamSize >= $this->sizeLimit)) { + return $next($request); + } + + if ($this->isJson($stream)) { + $request = $request->withHeader('Content-Type', 'application/json'); + + return $next($request); + } + + if ($this->isXml($stream)) { + $request = $request->withHeader('Content-Type', 'application/xml'); + + return $next($request); + } + } + + return $next($request); + } + + private function isJson(StreamInterface $stream): bool + { + if (!function_exists('json_decode')) { + return false; + } + $stream->rewind(); + + json_decode($stream->getContents()); + + return JSON_ERROR_NONE === json_last_error(); + } + + private function isXml(StreamInterface $stream): bool + { + if (!function_exists('simplexml_load_string')) { + return false; + } + $stream->rewind(); + + $previousValue = libxml_use_internal_errors(true); + $isXml = simplexml_load_string($stream->getContents()); + libxml_use_internal_errors($previousValue); + + return false !== $isXml; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/CookiePlugin.php b/vendor/php-http/client-common/src/Plugin/CookiePlugin.php new file mode 100644 index 000000000..aa4d5d7e6 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/CookiePlugin.php @@ -0,0 +1,180 @@ + + */ +final class CookiePlugin implements Plugin +{ + /** + * Cookie storage. + * + * @var CookieJar + */ + private $cookieJar; + + public function __construct(CookieJar $cookieJar) + { + $this->cookieJar = $cookieJar; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $cookies = []; + foreach ($this->cookieJar->getCookies() as $cookie) { + if ($cookie->isExpired()) { + continue; + } + + if (!$cookie->matchDomain($request->getUri()->getHost())) { + continue; + } + + if (!$cookie->matchPath($request->getUri()->getPath())) { + continue; + } + + if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) { + continue; + } + + $cookies[] = sprintf('%s=%s', $cookie->getName(), $cookie->getValue()); + } + + if (!empty($cookies)) { + $request = $request->withAddedHeader('Cookie', implode('; ', array_unique($cookies))); + } + + return $next($request)->then(function (ResponseInterface $response) use ($request) { + if ($response->hasHeader('Set-Cookie')) { + $setCookies = $response->getHeader('Set-Cookie'); + + foreach ($setCookies as $setCookie) { + $cookie = $this->createCookie($request, $setCookie); + + // Cookie invalid do not use it + if (null === $cookie) { + continue; + } + + // Restrict setting cookie from another domain + if (!preg_match("/\.{$cookie->getDomain()}$/", '.'.$request->getUri()->getHost())) { + continue; + } + + $this->cookieJar->addCookie($cookie); + } + } + + return $response; + }); + } + + /** + * Creates a cookie from a string. + * + * @throws TransferException + */ + private function createCookie(RequestInterface $request, string $setCookieHeader): ?Cookie + { + $parts = array_map('trim', explode(';', $setCookieHeader)); + + if ('' === $parts[0] || false === strpos($parts[0], '=')) { + return null; + } + + list($name, $cookieValue) = $this->createValueKey(array_shift($parts)); + + $maxAge = null; + $expires = null; + $domain = $request->getUri()->getHost(); + $path = $request->getUri()->getPath(); + $secure = false; + $httpOnly = false; + + // Add the cookie pieces into the parsed data array + foreach ($parts as $part) { + list($key, $value) = $this->createValueKey($part); + + switch (strtolower($key)) { + case 'expires': + try { + $expires = CookieUtil::parseDate((string) $value); + } catch (UnexpectedValueException $e) { + throw new TransferException( + sprintf( + 'Cookie header `%s` expires value `%s` could not be converted to date', + $name, + $value + ), + 0, + $e + ); + } + + break; + + case 'max-age': + $maxAge = (int) $value; + + break; + + case 'domain': + $domain = $value; + + break; + + case 'path': + $path = $value; + + break; + + case 'secure': + $secure = true; + + break; + + case 'httponly': + $httpOnly = true; + + break; + } + } + + return new Cookie($name, $cookieValue, $maxAge, $domain, $path, $secure, $httpOnly, $expires); + } + + /** + * Separates key/value pair from cookie. + * + * @param string $part A single cookie value in format key=value + * + * @return array{0:string, 1:?string} + */ + private function createValueKey(string $part): array + { + $parts = explode('=', $part, 2); + $key = trim($parts[0]); + $value = isset($parts[1]) ? trim($parts[1]) : null; + + return [$key, $value]; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php b/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php new file mode 100644 index 000000000..41c1a589b --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php @@ -0,0 +1,135 @@ + + */ +final class DecoderPlugin implements Plugin +{ + /** + * @var bool Whether this plugin decode stream with value in the Content-Encoding header (default to true). + * + * If set to false only the Transfer-Encoding header will be used + */ + private $useContentEncoding; + + /** + * @param array{'use_content_encoding'?: bool} $config + * + * Configuration options: + * - use_content_encoding: Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true) + */ + public function __construct(array $config = []) + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'use_content_encoding' => true, + ]); + $resolver->setAllowedTypes('use_content_encoding', 'bool'); + $options = $resolver->resolve($config); + + $this->useContentEncoding = $options['use_content_encoding']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $encodings = extension_loaded('zlib') ? ['gzip', 'deflate'] : ['identity']; + + if ($this->useContentEncoding) { + $request = $request->withHeader('Accept-Encoding', $encodings); + } + $encodings[] = 'chunked'; + $request = $request->withHeader('TE', $encodings); + + return $next($request)->then(function (ResponseInterface $response) { + return $this->decodeResponse($response); + }); + } + + /** + * Decode a response body given its Transfer-Encoding or Content-Encoding value. + */ + private function decodeResponse(ResponseInterface $response): ResponseInterface + { + $response = $this->decodeOnEncodingHeader('Transfer-Encoding', $response); + + if ($this->useContentEncoding) { + $response = $this->decodeOnEncodingHeader('Content-Encoding', $response); + } + + return $response; + } + + /** + * Decode a response on a specific header (content encoding or transfer encoding mainly). + */ + private function decodeOnEncodingHeader(string $headerName, ResponseInterface $response): ResponseInterface + { + if ($response->hasHeader($headerName)) { + $encodings = $response->getHeader($headerName); + $newEncodings = []; + + while ($encoding = array_pop($encodings)) { + $stream = $this->decorateStream($encoding, $response->getBody()); + + if (false === $stream) { + array_unshift($newEncodings, $encoding); + + continue; + } + + $response = $response->withBody($stream); + } + + if (\count($newEncodings) > 0) { + $response = $response->withHeader($headerName, $newEncodings); + } else { + $response = $response->withoutHeader($headerName); + } + } + + return $response; + } + + /** + * Decorate a stream given an encoding. + * + * @return StreamInterface|false A new stream interface or false if encoding is not supported + */ + private function decorateStream(string $encoding, StreamInterface $stream) + { + if ('chunked' === strtolower($encoding)) { + return new Encoding\DechunkStream($stream); + } + + if ('deflate' === strtolower($encoding)) { + return new Encoding\DecompressStream($stream); + } + + if ('gzip' === strtolower($encoding)) { + return new Encoding\GzipDecodeStream($stream); + } + + return false; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php b/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php new file mode 100644 index 000000000..678977f59 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php @@ -0,0 +1,92 @@ + + */ +final class ErrorPlugin implements Plugin +{ + /** + * @var bool Whether this plugin should only throw 5XX Exceptions (default to false). + * + * If set to true 4XX Responses code will never throw an exception + */ + private $onlyServerException; + + /** + * @param array{'only_server_exception'?: bool} $config + * + * Configuration options: + * - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false) + */ + public function __construct(array $config = []) + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'only_server_exception' => false, + ]); + $resolver->setAllowedTypes('only_server_exception', 'bool'); + $options = $resolver->resolve($config); + + $this->onlyServerException = $options['only_server_exception']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $promise = $next($request); + + return $promise->then(function (ResponseInterface $response) use ($request) { + return $this->transformResponseToException($request, $response); + }); + } + + /** + * Transform response to an error if possible. + * + * @param RequestInterface $request Request of the call + * @param ResponseInterface $response Response of the call + * + * @return ResponseInterface If status code is not in 4xx or 5xx return response + * + * @throws ClientErrorException If response status code is a 4xx + * @throws ServerErrorException If response status code is a 5xx + */ + private function transformResponseToException(RequestInterface $request, ResponseInterface $response): ResponseInterface + { + if (!$this->onlyServerException && $response->getStatusCode() >= 400 && $response->getStatusCode() < 500) { + throw new ClientErrorException($response->getReasonPhrase(), $request, $response); + } + + if ($response->getStatusCode() >= 500 && $response->getStatusCode() < 600) { + throw new ServerErrorException($response->getReasonPhrase(), $request, $response); + } + + return $response; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php new file mode 100644 index 000000000..95ea673c2 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php @@ -0,0 +1,48 @@ + + */ +final class HeaderAppendPlugin implements Plugin +{ + /** + * @var array + */ + private $headers; + + /** + * @param array $headers Hashmap of header name to header value + */ + public function __construct(array $headers) + { + $this->headers = $headers; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + foreach ($this->headers as $header => $headerValue) { + $request = $request->withAddedHeader($header, $headerValue); + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php new file mode 100644 index 000000000..bf5807001 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php @@ -0,0 +1,46 @@ + + */ +final class HeaderDefaultsPlugin implements Plugin +{ + /** + * @var array + */ + private $headers = []; + + /** + * @param array $headers Hashmap of header name to header value + */ + public function __construct(array $headers) + { + $this->headers = $headers; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + foreach ($this->headers as $header => $headerValue) { + if (!$request->hasHeader($header)) { + $request = $request->withHeader($header, $headerValue); + } + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php new file mode 100644 index 000000000..9f4ca44e1 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php @@ -0,0 +1,44 @@ + + */ +final class HeaderRemovePlugin implements Plugin +{ + /** + * @var array + */ + private $headers = []; + + /** + * @param array $headers List of header names to remove from the request + */ + public function __construct(array $headers) + { + $this->headers = $headers; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + foreach ($this->headers as $header) { + if ($request->hasHeader($header)) { + $request = $request->withoutHeader($header); + } + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php new file mode 100644 index 000000000..06f00eb85 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php @@ -0,0 +1,44 @@ + + */ +final class HeaderSetPlugin implements Plugin +{ + /** + * @var array + */ + private $headers; + + /** + * @param array $headers Hashmap of header name to header value + */ + public function __construct(array $headers) + { + $this->headers = $headers; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + foreach ($this->headers as $header => $headerValue) { + $request = $request->withHeader($header, $headerValue); + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php b/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php new file mode 100644 index 000000000..a1796a6f6 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php @@ -0,0 +1,49 @@ + + */ +final class HistoryPlugin implements Plugin +{ + /** + * Journal use to store request / responses / exception. + * + * @var Journal + */ + private $journal; + + public function __construct(Journal $journal) + { + $this->journal = $journal; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $journal = $this->journal; + + return $next($request)->then(function (ResponseInterface $response) use ($request, $journal) { + $journal->addSuccess($request, $response); + + return $response; + }, function (ClientExceptionInterface $exception) use ($request, $journal) { + $journal->addFailure($request, $exception); + + throw $exception; + }); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/Journal.php b/vendor/php-http/client-common/src/Plugin/Journal.php new file mode 100644 index 000000000..9faa9381f --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/Journal.php @@ -0,0 +1,33 @@ + + */ +interface Journal +{ + /** + * Record a successful call. + * + * @param RequestInterface $request Request use to make the call + * @param ResponseInterface $response Response returned by the call + */ + public function addSuccess(RequestInterface $request, ResponseInterface $response); + + /** + * Record a failed call. + * + * @param RequestInterface $request Request use to make the call + * @param ClientExceptionInterface $exception Exception returned by the call + */ + public function addFailure(RequestInterface $request, ClientExceptionInterface $exception); +} diff --git a/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php b/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php new file mode 100644 index 000000000..4c8087c4a --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php @@ -0,0 +1,50 @@ + + */ +final class QueryDefaultsPlugin implements Plugin +{ + /** + * @var array + */ + private $queryParams = []; + + /** + * @param array $queryParams Hashmap of query name to query value. Names and values must not be url encoded as + * this plugin will encode them + */ + public function __construct(array $queryParams) + { + $this->queryParams = $queryParams; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $uri = $request->getUri(); + + parse_str($uri->getQuery(), $query); + $query += $this->queryParams; + + $request = $request->withUri( + $uri->withQuery(http_build_query($query)) + ); + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php b/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php new file mode 100644 index 000000000..ee5c232fc --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php @@ -0,0 +1,344 @@ + + */ +final class RedirectPlugin implements Plugin +{ + /** + * Rule on how to redirect, change method for the new request. + * + * @var array + */ + private $redirectCodes = [ + 300 => [ + 'switch' => [ + 'unless' => ['GET', 'HEAD'], + 'to' => 'GET', + ], + 'multiple' => true, + 'permanent' => false, + ], + 301 => [ + 'switch' => [ + 'unless' => ['GET', 'HEAD'], + 'to' => 'GET', + ], + 'multiple' => false, + 'permanent' => true, + ], + 302 => [ + 'switch' => [ + 'unless' => ['GET', 'HEAD'], + 'to' => 'GET', + ], + 'multiple' => false, + 'permanent' => false, + ], + 303 => [ + 'switch' => [ + 'unless' => ['GET', 'HEAD'], + 'to' => 'GET', + ], + 'multiple' => false, + 'permanent' => false, + ], + 307 => [ + 'switch' => false, + 'multiple' => false, + 'permanent' => false, + ], + 308 => [ + 'switch' => false, + 'multiple' => false, + 'permanent' => true, + ], + ]; + + /** + * Determine how header should be preserved from old request. + * + * @var bool|array + * + * true will keep all previous headers (default value) + * false will ditch all previous headers + * string[] will keep only headers with the specified names + */ + private $preserveHeader; + + /** + * Store all previous redirect from 301 / 308 status code. + * + * @var array + */ + private $redirectStorage = []; + + /** + * Whether the location header must be directly used for a multiple redirection status code (300). + * + * @var bool + */ + private $useDefaultForMultiple; + + /** + * @var string[][] Chain identifier => list of URLs for this chain + */ + private $circularDetection = []; + + /** + * @var StreamFactoryInterface|null + */ + private $streamFactory; + + /** + * @param array{'preserve_header'?: bool|string[], 'use_default_for_multiple'?: bool, 'strict'?: bool} $config + * + * Configuration options: + * - preserve_header: True keeps all headers, false remove all of them, an array is interpreted as a list of header names to keep + * - use_default_for_multiple: Whether the location header must be directly used for a multiple redirection status code (300) + * - strict: When true, redirect codes 300, 301, 302 will not modify request method and body + * - stream_factory: If set, must be a PSR-17 StreamFactoryInterface - if not set, we try to discover one + */ + public function __construct(array $config = []) + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'preserve_header' => true, + 'use_default_for_multiple' => true, + 'strict' => false, + 'stream_factory' => null, + ]); + $resolver->setAllowedTypes('preserve_header', ['bool', 'array']); + $resolver->setAllowedTypes('use_default_for_multiple', 'bool'); + $resolver->setAllowedTypes('strict', 'bool'); + $resolver->setAllowedTypes('stream_factory', [StreamFactoryInterface::class, 'null']); + $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) { + if (is_bool($value) && false === $value) { + return []; + } + + return $value; + }); + $resolver->setDefault('stream_factory', function (Options $options): ?StreamFactoryInterface { + return $this->guessStreamFactory(); + }); + $options = $resolver->resolve($config); + + $this->preserveHeader = $options['preserve_header']; + $this->useDefaultForMultiple = $options['use_default_for_multiple']; + + if ($options['strict']) { + $this->redirectCodes[300]['switch'] = false; + $this->redirectCodes[301]['switch'] = false; + $this->redirectCodes[302]['switch'] = false; + } + + $this->streamFactory = $options['stream_factory']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + // Check in storage + if (array_key_exists((string) $request->getUri(), $this->redirectStorage)) { + $uri = $this->redirectStorage[(string) $request->getUri()]['uri']; + $statusCode = $this->redirectStorage[(string) $request->getUri()]['status']; + $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode); + + return $first($redirectRequest); + } + + return $next($request)->then(function (ResponseInterface $response) use ($request, $first): ResponseInterface { + $statusCode = $response->getStatusCode(); + + if (!array_key_exists($statusCode, $this->redirectCodes)) { + return $response; + } + + $uri = $this->createUri($response, $request); + $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode); + $chainIdentifier = spl_object_hash((object) $first); + + if (!array_key_exists($chainIdentifier, $this->circularDetection)) { + $this->circularDetection[$chainIdentifier] = []; + } + + $this->circularDetection[$chainIdentifier][] = (string) $request->getUri(); + + if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier], true)) { + throw new CircularRedirectionException('Circular redirection detected', $request, $response); + } + + if ($this->redirectCodes[$statusCode]['permanent']) { + $this->redirectStorage[(string) $request->getUri()] = [ + 'uri' => $uri, + 'status' => $statusCode, + ]; + } + + // Call redirect request synchronously + return $first($redirectRequest)->wait(); + }); + } + + /** + * The default only needs to be determined if no value is provided. + */ + public function guessStreamFactory(): ?StreamFactoryInterface + { + if (class_exists(Psr17FactoryDiscovery::class)) { + try { + return Psr17FactoryDiscovery::findStreamFactory(); + } catch (\Throwable $t) { + // ignore and try other options + } + } + if (class_exists(Psr17Factory::class)) { + return new Psr17Factory(); + } + if (class_exists(Utils::class)) { + return new class() implements StreamFactoryInterface { + public function createStream(string $content = ''): StreamInterface + { + return Utils::streamFor($content); + } + + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + throw new \RuntimeException('Internal error: this method should not be needed'); + } + + public function createStreamFromResource($resource): StreamInterface + { + throw new \RuntimeException('Internal error: this method should not be needed'); + } + }; + } + + return null; + } + + private function buildRedirectRequest(RequestInterface $originalRequest, UriInterface $targetUri, int $statusCode): RequestInterface + { + $originalRequest = $originalRequest->withUri($targetUri); + + if (false !== $this->redirectCodes[$statusCode]['switch'] && !in_array($originalRequest->getMethod(), $this->redirectCodes[$statusCode]['switch']['unless'], true)) { + $originalRequest = $originalRequest->withMethod($this->redirectCodes[$statusCode]['switch']['to']); + if ('GET' === $this->redirectCodes[$statusCode]['switch']['to'] && $this->streamFactory) { + // if we found a stream factory, remove the request body. otherwise leave the body there. + $originalRequest = $originalRequest->withoutHeader('content-type'); + $originalRequest = $originalRequest->withoutHeader('content-length'); + $originalRequest = $originalRequest->withBody($this->streamFactory->createStream()); + } + } + + if (is_array($this->preserveHeader)) { + $headers = array_keys($originalRequest->getHeaders()); + + foreach ($headers as $name) { + if (!in_array($name, $this->preserveHeader, true)) { + $originalRequest = $originalRequest->withoutHeader($name); + } + } + } + + return $originalRequest; + } + + /** + * Creates a new Uri from the old request and the location header. + * + * @throws HttpException If location header is not usable (missing or incorrect) + * @throws MultipleRedirectionException If a 300 status code is received and default location cannot be resolved (doesn't use the location header or not present) + */ + private function createUri(ResponseInterface $redirectResponse, RequestInterface $originalRequest): UriInterface + { + if ($this->redirectCodes[$redirectResponse->getStatusCode()]['multiple'] && (!$this->useDefaultForMultiple || !$redirectResponse->hasHeader('Location'))) { + throw new MultipleRedirectionException('Cannot choose a redirection', $originalRequest, $redirectResponse); + } + + if (!$redirectResponse->hasHeader('Location')) { + throw new HttpException('Redirect status code, but no location header present in the response', $originalRequest, $redirectResponse); + } + + $location = $redirectResponse->getHeaderLine('Location'); + $parsedLocation = parse_url($location); + + if (false === $parsedLocation || '' === $location) { + throw new HttpException(sprintf('Location "%s" could not be parsed', $location), $originalRequest, $redirectResponse); + } + + $uri = $originalRequest->getUri(); + + // Redirections can either use an absolute uri or a relative reference https://www.rfc-editor.org/rfc/rfc3986#section-4.2 + // If relative, we need to check if we have an absolute path or not + + $path = array_key_exists('path', $parsedLocation) ? $parsedLocation['path'] : ''; + if (!array_key_exists('host', $parsedLocation) && '/' !== $location[0]) { + // the target is a relative-path reference, we need to merge it with the base path + $originalPath = $uri->getPath(); + if ('' === $path) { + $path = $originalPath; + } elseif (($pos = strrpos($originalPath, '/')) !== false) { + $path = substr($originalPath, 0, $pos + 1).$path; + } else { + $path = '/'.$path; + } + /* replace '/./' or '/foo/../' with '/' */ + $re = ['#(/\./)#', '#/(?!\.\.)[^/]+/\.\./#']; + for ($n = 1; $n > 0; $path = preg_replace($re, '/', $path, -1, $n)) { + if (null === $path) { + throw new HttpException(sprintf('Failed to resolve Location %s', $location), $originalRequest, $redirectResponse); + } + } + } + if (null === $path) { + throw new HttpException(sprintf('Failed to resolve Location %s', $location), $originalRequest, $redirectResponse); + } + $uri = $uri + ->withPath($path) + ->withQuery(array_key_exists('query', $parsedLocation) ? $parsedLocation['query'] : '') + ->withFragment(array_key_exists('fragment', $parsedLocation) ? $parsedLocation['fragment'] : '') + ; + + if (array_key_exists('scheme', $parsedLocation)) { + $uri = $uri->withScheme($parsedLocation['scheme']); + } + + if (array_key_exists('host', $parsedLocation)) { + $uri = $uri->withHost($parsedLocation['host']); + } + + if (array_key_exists('port', $parsedLocation)) { + $uri = $uri->withPort($parsedLocation['port']); + } elseif (array_key_exists('host', $parsedLocation)) { + $uri = $uri->withPort(null); + } + + return $uri; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php b/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php new file mode 100644 index 000000000..45d4375d3 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php @@ -0,0 +1,56 @@ + + */ +final class RequestMatcherPlugin implements Plugin +{ + /** + * @var RequestMatcher + */ + private $requestMatcher; + + /** + * @var Plugin|null + */ + private $successPlugin; + + /** + * @var Plugin|null + */ + private $failurePlugin; + + public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, Plugin $delegateOnNoMatch = null) + { + $this->requestMatcher = $requestMatcher; + $this->successPlugin = $delegateOnMatch; + $this->failurePlugin = $delegateOnNoMatch; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + if ($this->requestMatcher->matches($request)) { + if (null !== $this->successPlugin) { + return $this->successPlugin->handleRequest($request, $next, $first); + } + } elseif (null !== $this->failurePlugin) { + return $this->failurePlugin->handleRequest($request, $next, $first); + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php b/vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php new file mode 100644 index 000000000..1b6c52893 --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/RequestSeekableBodyPlugin.php @@ -0,0 +1,29 @@ + + */ +final class RequestSeekableBodyPlugin extends SeekableBodyPlugin +{ + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + if (!$request->getBody()->isSeekable()) { + $request = $request->withBody(new BufferedStream($request->getBody(), $this->useFileBuffer, $this->memoryBufferSize)); + } + + return $next($request); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php b/vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php new file mode 100644 index 000000000..6f941b65e --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/ResponseSeekableBodyPlugin.php @@ -0,0 +1,32 @@ + + */ +final class ResponseSeekableBodyPlugin extends SeekableBodyPlugin +{ + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + return $next($request)->then(function (ResponseInterface $response) { + if ($response->getBody()->isSeekable()) { + return $response; + } + + return $response->withBody(new BufferedStream($response->getBody(), $this->useFileBuffer, $this->memoryBufferSize)); + }); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/RetryPlugin.php b/vendor/php-http/client-common/src/Plugin/RetryPlugin.php new file mode 100644 index 000000000..144679eac --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/RetryPlugin.php @@ -0,0 +1,179 @@ + + */ +final class RetryPlugin implements Plugin +{ + /** + * Number of retry before sending an exception. + * + * @var int + */ + private $retry; + + /** + * @var callable + */ + private $errorResponseDelay; + + /** + * @var callable + */ + private $errorResponseDecider; + + /** + * @var callable + */ + private $exceptionDecider; + + /** + * @var callable + */ + private $exceptionDelay; + + /** + * Store the retry counter for each request. + * + * @var array + */ + private $retryStorage = []; + + /** + * @param array{'retries'?: int, 'error_response_decider'?: callable, 'exception_decider'?: callable, 'error_response_delay'?: callable, 'exception_delay'?: callable} $config + * + * Configuration options: + * - retries: Number of retries to attempt if an exception occurs before letting the exception bubble up + * - error_response_decider: A callback that gets a request and response to decide whether the request should be retried + * - exception_decider: A callback that gets a request and an exception to decide after a failure whether the request should be retried + * - error_response_delay: A callback that gets a request and response and the current number of retries and returns how many microseconds we should wait before trying again + * - exception_delay: A callback that gets a request, an exception and the current number of retries and returns how many microseconds we should wait before trying again + */ + public function __construct(array $config = []) + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'retries' => 1, + 'error_response_decider' => function (RequestInterface $request, ResponseInterface $response) { + // do not retry client errors + return $response->getStatusCode() >= 500 && $response->getStatusCode() < 600; + }, + 'exception_decider' => function (RequestInterface $request, ClientExceptionInterface $e) { + // do not retry client errors + return !$e instanceof HttpException || $e->getCode() >= 500 && $e->getCode() < 600; + }, + 'error_response_delay' => __CLASS__.'::defaultErrorResponseDelay', + 'exception_delay' => __CLASS__.'::defaultExceptionDelay', + ]); + + $resolver->setAllowedTypes('retries', 'int'); + $resolver->setAllowedTypes('error_response_decider', 'callable'); + $resolver->setAllowedTypes('exception_decider', 'callable'); + $resolver->setAllowedTypes('error_response_delay', 'callable'); + $resolver->setAllowedTypes('exception_delay', 'callable'); + $options = $resolver->resolve($config); + + $this->retry = $options['retries']; + $this->errorResponseDecider = $options['error_response_decider']; + $this->errorResponseDelay = $options['error_response_delay']; + $this->exceptionDecider = $options['exception_decider']; + $this->exceptionDelay = $options['exception_delay']; + } + + /** + * {@inheritdoc} + */ + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + $chainIdentifier = spl_object_hash((object) $first); + + return $next($request)->then(function (ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) { + if (!array_key_exists($chainIdentifier, $this->retryStorage)) { + $this->retryStorage[$chainIdentifier] = 0; + } + + if ($this->retryStorage[$chainIdentifier] >= $this->retry) { + unset($this->retryStorage[$chainIdentifier]); + + return $response; + } + + if (call_user_func($this->errorResponseDecider, $request, $response)) { + /** @var int $time */ + $time = call_user_func($this->errorResponseDelay, $request, $response, $this->retryStorage[$chainIdentifier]); + $response = $this->retry($request, $next, $first, $chainIdentifier, $time); + } + + if (array_key_exists($chainIdentifier, $this->retryStorage)) { + unset($this->retryStorage[$chainIdentifier]); + } + + return $response; + }, function (ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) { + if (!array_key_exists($chainIdentifier, $this->retryStorage)) { + $this->retryStorage[$chainIdentifier] = 0; + } + + if ($this->retryStorage[$chainIdentifier] >= $this->retry) { + unset($this->retryStorage[$chainIdentifier]); + + throw $exception; + } + + if (!call_user_func($this->exceptionDecider, $request, $exception)) { + throw $exception; + } + + /** @var int $time */ + $time = call_user_func($this->exceptionDelay, $request, $exception, $this->retryStorage[$chainIdentifier]); + + return $this->retry($request, $next, $first, $chainIdentifier, $time); + }); + } + + /** + * @param int $retries The number of retries we made before. First time this get called it will be 0. + */ + public static function defaultErrorResponseDelay(RequestInterface $request, ResponseInterface $response, int $retries): int + { + return pow(2, $retries) * 500000; + } + + /** + * @param int $retries The number of retries we made before. First time this get called it will be 0. + */ + public static function defaultExceptionDelay(RequestInterface $request, ClientExceptionInterface $e, int $retries): int + { + return pow(2, $retries) * 500000; + } + + /** + * @throws \Exception if retrying returns a failed promise + */ + private function retry(RequestInterface $request, callable $next, callable $first, string $chainIdentifier, int $delay): ResponseInterface + { + usleep($delay); + + // Retry synchronously + ++$this->retryStorage[$chainIdentifier]; + $promise = $this->handleRequest($request, $next, $first); + + return $promise->wait(); + } +} diff --git a/vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php b/vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php new file mode 100644 index 000000000..1be2cdebc --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/SeekableBodyPlugin.php @@ -0,0 +1,47 @@ +setDefaults([ + 'use_file_buffer' => true, + 'memory_buffer_size' => 2097152, + ]); + $resolver->setAllowedTypes('use_file_buffer', 'bool'); + $resolver->setAllowedTypes('memory_buffer_size', 'int'); + + $options = $resolver->resolve($config); + + $this->useFileBuffer = $options['use_file_buffer']; + $this->memoryBufferSize = $options['memory_buffer_size']; + } +} diff --git a/vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php b/vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php new file mode 100644 index 000000000..0a2c714be --- /dev/null +++ b/vendor/php-http/client-common/src/Plugin/VersionBridgePlugin.php @@ -0,0 +1,24 @@ + + */ +trait VersionBridgePlugin +{ + abstract protected function doHandleRequest(RequestInterface $request, callable $next, callable $first); + + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + return $this->doHandleRequest($request, $next, $first); + } +} diff --git a/vendor/php-http/client-common/src/PluginChain.php b/vendor/php-http/client-common/src/PluginChain.php new file mode 100644 index 000000000..2dd630c38 --- /dev/null +++ b/vendor/php-http/client-common/src/PluginChain.php @@ -0,0 +1,63 @@ +plugins = $plugins; + $this->clientCallable = $clientCallable; + $this->maxRestarts = (int) ($options['max_restarts'] ?? 0); + } + + private function createChain(): callable + { + $lastCallable = $this->clientCallable; + $reversedPlugins = array_reverse($this->plugins); + + foreach ($reversedPlugins as $plugin) { + $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable) { + return $plugin->handleRequest($request, $lastCallable, $this); + }; + } + + return $lastCallable; + } + + public function __invoke(RequestInterface $request): Promise + { + if ($this->restarts > $this->maxRestarts) { + throw new LoopException('Too many restarts in plugin client', $request); + } + + ++$this->restarts; + + return $this->createChain()($request); + } +} diff --git a/vendor/php-http/client-common/src/PluginClient.php b/vendor/php-http/client-common/src/PluginClient.php new file mode 100644 index 000000000..db81243cc --- /dev/null +++ b/vendor/php-http/client-common/src/PluginClient.php @@ -0,0 +1,129 @@ + + */ +final class PluginClient implements HttpClient, HttpAsyncClient +{ + /** + * An HTTP async client. + * + * @var HttpAsyncClient + */ + private $client; + + /** + * The plugin chain. + * + * @var Plugin[] + */ + private $plugins; + + /** + * A list of options. + * + * @var array + */ + private $options; + + /** + * @param ClientInterface|HttpAsyncClient $client An HTTP async client + * @param Plugin[] $plugins A plugin chain + * @param array{'max_restarts'?: int} $options + */ + public function __construct($client, array $plugins = [], array $options = []) + { + if ($client instanceof HttpAsyncClient) { + $this->client = $client; + } elseif ($client instanceof ClientInterface) { + $this->client = new EmulatedHttpAsyncClient($client); + } else { + throw new \TypeError( + sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + $this->plugins = $plugins; + $this->options = $this->configure($options); + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + // If the client doesn't support sync calls, call async + if (!$this->client instanceof ClientInterface) { + return $this->sendAsyncRequest($request)->wait(); + } + + // Else we want to use the synchronous call of the underlying client, + // and not the async one in the case we have both an async and sync call + $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { + try { + return new HttpFulfilledPromise($this->client->sendRequest($request)); + } catch (HttplugException $exception) { + return new HttpRejectedPromise($exception); + } + }); + + return $pluginChain($request)->wait(); + } + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { + return $this->client->sendAsyncRequest($request); + }); + + return $pluginChain($request); + } + + /** + * Configure the plugin client. + */ + private function configure(array $options = []): array + { + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'max_restarts' => 10, + ]); + + $resolver->setAllowedTypes('max_restarts', 'int'); + + return $resolver->resolve($options); + } + + /** + * Create the plugin chain. + * + * @param Plugin[] $plugins A plugin chain + * @param callable $clientCallable Callable making the HTTP call + * + * @return callable(RequestInterface): Promise + */ + private function createPluginChain(array $plugins, callable $clientCallable): callable + { + return new PluginChain($plugins, $clientCallable, $this->options); + } +} diff --git a/vendor/php-http/client-common/src/PluginClientBuilder.php b/vendor/php-http/client-common/src/PluginClientBuilder.php new file mode 100644 index 000000000..874649820 --- /dev/null +++ b/vendor/php-http/client-common/src/PluginClientBuilder.php @@ -0,0 +1,76 @@ + + */ +final class PluginClientBuilder +{ + /** @var Plugin[][] List of plugins ordered by priority [priority => Plugin[]]). */ + private $plugins = []; + + /** @var array Array of options to give to the plugin client */ + private $options = []; + + /** + * @param int $priority Priority of the plugin. The higher comes first. + */ + public function addPlugin(Plugin $plugin, int $priority = 0): self + { + $this->plugins[$priority][] = $plugin; + + return $this; + } + + /** + * @param mixed $value + */ + public function setOption(string $name, $value): self + { + $this->options[$name] = $value; + + return $this; + } + + public function removeOption(string $name): self + { + unset($this->options[$name]); + + return $this; + } + + /** + * @param ClientInterface|HttpAsyncClient $client + */ + public function createClient($client): PluginClient + { + if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { + throw new \TypeError( + sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + $plugins = $this->plugins; + + if (0 === count($plugins)) { + $plugins[] = []; + } + + krsort($plugins); + $plugins = array_merge(...$plugins); + + return new PluginClient( + $client, + array_values($plugins), + $this->options + ); + } +} diff --git a/vendor/php-http/client-common/src/PluginClientFactory.php b/vendor/php-http/client-common/src/PluginClientFactory.php new file mode 100644 index 000000000..1d2b2beec --- /dev/null +++ b/vendor/php-http/client-common/src/PluginClientFactory.php @@ -0,0 +1,68 @@ + + */ +final class PluginClientFactory +{ + /** + * @var (callable(ClientInterface|HttpAsyncClient, Plugin[], array): PluginClient)|null + */ + private static $factory; + + /** + * Set the factory to use. + * The callable to provide must have the same arguments and return type as PluginClientFactory::createClient. + * This is used by the HTTPlugBundle to provide a better Symfony integration. + * Unlike the createClient method, this one is static to allow zero configuration profiling by hooking into early + * application execution. + * + * @internal + * + * @param callable(ClientInterface|HttpAsyncClient, Plugin[], array): PluginClient $factory + */ + public static function setFactory(callable $factory): void + { + static::$factory = $factory; + } + + /** + * @param ClientInterface|HttpAsyncClient $client + * @param Plugin[] $plugins + * @param array{'client_name'?: string} $options + * + * Configuration options: + * - client_name: to give client a name which may be used when displaying client information + * like in the HTTPlugBundle profiler + * + * @see PluginClient constructor for PluginClient specific $options. + */ + public function createClient($client, array $plugins = [], array $options = []): PluginClient + { + if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { + throw new \TypeError( + sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) + ); + } + + if (static::$factory) { + $factory = static::$factory; + + return $factory($client, $plugins, $options); + } + + unset($options['client_name']); + + return new PluginClient($client, $plugins, $options); + } +} diff --git a/vendor/php-http/client-common/src/VersionBridgeClient.php b/vendor/php-http/client-common/src/VersionBridgeClient.php new file mode 100644 index 000000000..a608edd7a --- /dev/null +++ b/vendor/php-http/client-common/src/VersionBridgeClient.php @@ -0,0 +1,24 @@ + + */ +trait VersionBridgeClient +{ + abstract protected function doSendRequest(RequestInterface $request); + + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->doSendRequest($request); + } +} diff --git a/vendor/php-http/discovery/.php-cs-fixer.php b/vendor/php-http/discovery/.php-cs-fixer.php new file mode 100644 index 000000000..83809c25d --- /dev/null +++ b/vendor/php-http/discovery/.php-cs-fixer.php @@ -0,0 +1,16 @@ +in(__DIR__.'/src') + ->name('*.php') +; + +$config = (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + ]) + ->setFinder($finder) +; + +return $config; diff --git a/vendor/php-http/discovery/CHANGELOG.md b/vendor/php-http/discovery/CHANGELOG.md new file mode 100644 index 000000000..50a604bbe --- /dev/null +++ b/vendor/php-http/discovery/CHANGELOG.md @@ -0,0 +1,340 @@ +# Change Log + +## 1.15.2 - 2023-02-11 + +- [#219](https://github.com/php-http/discovery/pull/219) - Fix handling of replaced packages + +## 1.15.1 - 2023-02-10 + +- [#214](https://github.com/php-http/discovery/pull/214) - Fix resolving deps for psr/http-message-implementation +- [#216](https://github.com/php-http/discovery/pull/216) - Fix keeping platform requirements when rebooting composer +- [#217](https://github.com/php-http/discovery/pull/217) - Set extra.plugin-optional composer flag + +## 1.15.0 - 2023-02-09 + +- [#209](https://github.com/php-http/discovery/pull/209) - Add generic `Psr17Factory` class +- [#208](https://github.com/php-http/discovery/pull/208) - Add composer plugin to auto-install missing implementations. + When libraries require an http implementation but no packages providing that implementation is installed in the application, the plugin will automatically install one. + This is only done for libraries that directly require php-http/discovery to avoid unexpected dependency installation. + +## 1.14.3 - 2022-07-11 + +- [#207](https://github.com/php-http/discovery/pull/207) - Updates Exception to extend Throwable solving static analysis errors for consumers + +## 1.14.2 - 2022-05-25 + +- [#202](https://github.com/php-http/discovery/pull/202) - Avoid error when the Symfony PSR-18 client exists but its dependencies are not installed + +## 1.14.1 - 2021-09-18 + +- [#199](https://github.com/php-http/discovery/pull/199) - Fixes message factory discovery for `laminas-diactoros ^2.7` + +## 1.14.0 - 2021-06-21 + +- Deprecate puli as it has been unmaintained for a long time and is not compatible with composer 2 https://github.com/php-http/discovery/pull/195 + +## 1.13.0 - 2020-11-27 + +- Support discovering PSR-17 factories of `slim/psr7` package https://github.com/php-http/discovery/pull/192 + +## 1.12.0 - 2020-09-22 + +- Support discovering HttpClient of `php-http/guzzle7-adapter` https://github.com/php-http/discovery/pull/189 + +## 1.11.0 - 2020-09-22 + +- Use correct method name to find Uri Factory in PSR17 https://github.com/php-http/discovery/pull/181 + +## 1.10.0 - 2020-09-04 + +- Discover PSR-18 implementation of phalcon + +## 1.9.1 - 2020-07-13 + +### Fixed + +- Support PHP 7.4 and 8.0 + +## 1.9.0 - 2020-07-02 + +### Added + +- Support discovering PSR-18 factories of `guzzlehttp/guzzle` 7+ + +## 1.8.0 - 2020-06-14 + +### Added + +- Support discovering PSR-17 factories of `guzzlehttp/psr7` package +- Support discovering PSR-17 factories of `laminas/laminas-diactoros` package +- `ClassDiscovery::getStrategies()` to retrieve the list of current strategies. + +### Fixed + +- Ignore exception during discovery when Symfony HttplugClient checks if HTTPlug is available. + +## 1.7.4 - 2020-01-03 + +### Fixed + +- Improve conditions on Symfony's async HTTPlug client. + +## 1.7.3 - 2019-12-27 + +### Fixed + +- Enough conditions to only use Symfony HTTP client if all needed components are available. + +## 1.7.2 - 2019-12-27 + +### Fixed + +- Allow a condition to specify an interface and not just classes. + +## 1.7.1 - 2019-12-26 + +### Fixed + +- Better conditions to see if Symfony's HTTP clients are available. + +## 1.7.0 - 2019-06-30 + +### Added + +- Dropped support for PHP < 7.1 +- Support for `symfony/http-client` + +## 1.6.1 - 2019-02-23 + +### Fixed + +- MockClientStrategy also provides the mock client when requesting an async client + +## 1.6.0 - 2019-01-23 + +### Added + +- Support for PSR-17 factories +- Support for PSR-18 clients + +## 1.5.2 - 2018-12-31 + +Corrected mistakes in 1.5.1. The different between 1.5.2 and 1.5.0 is that +we removed some PHP 7 code. + +https://github.com/php-http/discovery/compare/1.5.0...1.5.2 + +## 1.5.1 - 2018-12-31 + +This version added new features by mistake. These are reverted in 1.5.2. + +Do not use 1.5.1. + +### Fixed + +- Removed PHP 7 code + +## 1.5.0 - 2018-12-30 + +### Added + +- Support for `nyholm/psr7` version 1.0. +- `ClassDiscovery::safeClassExists` which will help Magento users. +- Support for HTTPlug 2.0 +- Support for Buzz 1.0 +- Better error message when nothing found by introducing a new exception: `NoCandidateFoundException`. + +### Fixed + +- Fixed condition evaluation, it should stop after first invalid condition. + +## 1.4.0 - 2018-02-06 + +### Added + +- Discovery support for nyholm/psr7 + +## 1.3.0 - 2017-08-03 + +### Added + +- Discovery support for CakePHP adapter +- Discovery support for Zend adapter +- Discovery support for Artax adapter + +## 1.2.1 - 2017-03-02 + +### Fixed + +- Fixed minor issue with `MockClientStrategy`, also added more tests. + +## 1.2.0 - 2017-02-12 + +### Added + +- MockClientStrategy class. + +## 1.1.1 - 2016-11-27 + +### Changed + +- Made exception messages clearer. `StrategyUnavailableException` is no longer the previous exception to `DiscoveryFailedException`. +- `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final. + +## 1.1.0 - 2016-10-20 + +### Added + +- Discovery support for Slim Framework factories + +## 1.0.0 - 2016-07-18 + +### Added + +- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version. You may upgrade from 0.8.x and 0.9.x to 1.0.0 without any BC breaks. +- Added interface `Http\Discovery\Exception` which is implemented by all our exceptions + +### Changed + +- Puli strategy renamed to Puli Beta strategy to prevent incompatibility with a future Puli stable + +### Deprecated + +- For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0 + + +## 0.9.1 - 2016-06-28 + +### Changed + +- Dropping PHP 5.4 support because we use the ::class constant. + + +## 0.9.0 - 2016-06-25 + +### Added + +- Discovery strategies to find classes + +### Changed + +- [Puli](http://puli.io) made optional +- Improved exceptions +- **[BC] `NotFoundException` moved to `Http\Discovery\Exception\NotFoundException`** + + +## 0.8.0 - 2016-02-11 + +### Changed + +- Puli composer plugin must be installed separately + + +## 0.7.0 - 2016-01-15 + +### Added + +- Temporary puli.phar (Beta 10) executable + +### Changed + +- Updated HTTPlug dependencies +- Updated Puli dependencies +- Local configuration to make tests passing + +### Removed + +- Puli CLI dependency + + +## 0.6.4 - 2016-01-07 + +### Fixed + +- Puli [not working](https://twitter.com/PuliPHP/status/685132540588507137) with the latest json-schema + + +## 0.6.3 - 2016-01-04 + +### Changed + +- Adjust Puli dependencies + + +## 0.6.2 - 2016-01-04 + +### Changed + +- Make Puli CLI a requirement + + +## 0.6.1 - 2016-01-03 + +### Changed + +- More flexible Puli requirement + + +## 0.6.0 - 2015-12-30 + +### Changed + +- Use [Puli](http://puli.io) for discovery +- Improved exception messages + + +## 0.5.0 - 2015-12-25 + +### Changed + +- Updated message factory dependency (php-http/message) + + +## 0.4.0 - 2015-12-17 + +### Added + +- Array condition evaluation in the Class Discovery + +### Removed + +- Message factories (moved to php-http/utils) + + +## 0.3.0 - 2015-11-18 + +### Added + +- HTTP Async Client Discovery +- Stream factories + +### Changed + +- Discoveries and Factories are final +- Message and Uri factories have the type in their names +- Diactoros Message factory uses Stream factory internally + +### Fixed + +- Improved docblocks for API documentation generation + + +## 0.2.0 - 2015-10-31 + +### Changed + +- Renamed AdapterDiscovery to ClientDiscovery + + +## 0.1.1 - 2015-06-13 + +### Fixed + +- Bad HTTP Adapter class name for Guzzle 5 + + +## 0.1.0 - 2015-06-12 + +### Added + +- Initial release diff --git a/vendor/php-http/discovery/LICENSE b/vendor/php-http/discovery/LICENSE new file mode 100644 index 000000000..4558d6f06 --- /dev/null +++ b/vendor/php-http/discovery/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 PHP HTTP Team + +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/vendor/php-http/discovery/README.md b/vendor/php-http/discovery/README.md new file mode 100644 index 000000000..25a688436 --- /dev/null +++ b/vendor/php-http/discovery/README.md @@ -0,0 +1,47 @@ +# HTTPlug Discovery + +[![Latest Version](https://img.shields.io/github/release/php-http/discovery.svg?style=flat-square)](https://github.com/php-http/discovery/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/discovery/master.svg?style=flat-square)](https://travis-ci.org/php-http/discovery) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/discovery.svg?style=flat-square)](https://packagist.org/packages/php-http/discovery) + +**Find installed PSR-17 factories, PSR-18 clients and HTTPlug factories.** + +Since 1.15.0, this library also provides a composer plugin that automatically installs well-known PSR implementations if composer dependencies require a PSR implementation but do not specify which implementation to install. + +## Install + +Via Composer + +``` bash +$ composer require php-http/discovery +``` + + +## Documentation + +Please see the [official documentation](http://php-http.readthedocs.org/en/latest/discovery.html). + + +## Testing + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/discovery/composer.json b/vendor/php-http/discovery/composer.json new file mode 100644 index 000000000..ecbbf4fb1 --- /dev/null +++ b/vendor/php-http/discovery/composer.json @@ -0,0 +1,59 @@ +{ + "name": "php-http/discovery", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "type": "composer-plugin", + "license": "MIT", + "keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7", "psr17"], + "homepage": "http://php-http.org", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require": { + "php": "^7.1 || ^8.0", + "composer-plugin-api": "^1.0|^2.0" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" + }, + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "spec\\Http\\Discovery\\": "spec/" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpspec run", + "vendor/bin/simple-phpunit --group NothingInstalled" + ], + "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" + }, + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "conflict": { + "nyholm/psr7": "<1.0" + }, + "prefer-stable": true, + "minimum-stability": "beta" +} diff --git a/vendor/php-http/discovery/src/ClassDiscovery.php b/vendor/php-http/discovery/src/ClassDiscovery.php new file mode 100644 index 000000000..4f47f3c87 --- /dev/null +++ b/vendor/php-http/discovery/src/ClassDiscovery.php @@ -0,0 +1,252 @@ + + * @author Márk Sági-Kazár + * @author Tobias Nyholm + */ +abstract class ClassDiscovery +{ + /** + * A list of strategies to find classes. + * + * @var array + */ + private static $strategies = [ + Strategy\CommonClassesStrategy::class, + Strategy\CommonPsr17ClassesStrategy::class, + Strategy\PuliBetaStrategy::class, + ]; + + private static $deprecatedStrategies = [ + Strategy\PuliBetaStrategy::class => true, + ]; + + /** + * Discovery cache to make the second time we use discovery faster. + * + * @var array + */ + private static $cache = []; + + /** + * Finds a class. + * + * @param string $type + * + * @return string|\Closure + * + * @throws DiscoveryFailedException + */ + protected static function findOneByType($type) + { + // Look in the cache + if (null !== ($class = self::getFromCache($type))) { + return $class; + } + + $exceptions = []; + foreach (self::$strategies as $strategy) { + try { + $candidates = call_user_func($strategy.'::getCandidates', $type); + } catch (StrategyUnavailableException $e) { + if (!isset(self::$deprecatedStrategies[$strategy])) { + $exceptions[] = $e; + } + + continue; + } + + foreach ($candidates as $candidate) { + if (isset($candidate['condition'])) { + if (!self::evaluateCondition($candidate['condition'])) { + continue; + } + } + + // save the result for later use + self::storeInCache($type, $candidate); + + return $candidate['class']; + } + + $exceptions[] = new NoCandidateFoundException($strategy, $candidates); + } + + throw DiscoveryFailedException::create($exceptions); + } + + /** + * Get a value from cache. + * + * @param string $type + * + * @return string|null + */ + private static function getFromCache($type) + { + if (!isset(self::$cache[$type])) { + return; + } + + $candidate = self::$cache[$type]; + if (isset($candidate['condition'])) { + if (!self::evaluateCondition($candidate['condition'])) { + return; + } + } + + return $candidate['class']; + } + + /** + * Store a value in cache. + * + * @param string $type + * @param string $class + */ + private static function storeInCache($type, $class) + { + self::$cache[$type] = $class; + } + + /** + * Set new strategies and clear the cache. + * + * @param array $strategies string array of fully qualified class name to a DiscoveryStrategy + */ + public static function setStrategies(array $strategies) + { + self::$strategies = $strategies; + self::clearCache(); + } + + /** + * Returns the currently configured discovery strategies as fully qualified class names. + * + * @return string[] + */ + public static function getStrategies(): iterable + { + return self::$strategies; + } + + /** + * Append a strategy at the end of the strategy queue. + * + * @param string $strategy Fully qualified class name to a DiscoveryStrategy + */ + public static function appendStrategy($strategy) + { + self::$strategies[] = $strategy; + self::clearCache(); + } + + /** + * Prepend a strategy at the beginning of the strategy queue. + * + * @param string $strategy Fully qualified class name to a DiscoveryStrategy + */ + public static function prependStrategy($strategy) + { + array_unshift(self::$strategies, $strategy); + self::clearCache(); + } + + /** + * Clear the cache. + */ + public static function clearCache() + { + self::$cache = []; + } + + /** + * Evaluates conditions to boolean. + * + * @param mixed $condition + * + * @return bool + */ + protected static function evaluateCondition($condition) + { + if (is_string($condition)) { + // Should be extended for functions, extensions??? + return self::safeClassExists($condition); + } + if (is_callable($condition)) { + return (bool) $condition(); + } + if (is_bool($condition)) { + return $condition; + } + if (is_array($condition)) { + foreach ($condition as $c) { + if (false === static::evaluateCondition($c)) { + // Immediately stop execution if the condition is false + return false; + } + } + + return true; + } + + return false; + } + + /** + * Get an instance of the $class. + * + * @param string|\Closure $class a FQCN of a class or a closure that instantiate the class + * + * @return object + * + * @throws ClassInstantiationFailedException + */ + protected static function instantiateClass($class) + { + try { + if (is_string($class)) { + return new $class(); + } + + if (is_callable($class)) { + return $class(); + } + } catch (\Exception $e) { + throw new ClassInstantiationFailedException('Unexpected exception when instantiating class.', 0, $e); + } + + throw new ClassInstantiationFailedException('Could not instantiate class because parameter is neither a callable nor a string'); + } + + /** + * We want to do a "safe" version of PHP's "class_exists" because Magento has a bug + * (or they call it a "feature"). Magento is throwing an exception if you do class_exists() + * on a class that ends with "Factory" and if that file does not exits. + * + * This function will catch all potential exceptions and make sure it returns a boolean. + * + * @param string $class + * @param bool $autoload + * + * @return bool + */ + public static function safeClassExists($class) + { + try { + return class_exists($class) || interface_exists($class); + } catch (\Exception $e) { + return false; + } + } +} diff --git a/vendor/php-http/discovery/src/Composer/Plugin.php b/vendor/php-http/discovery/src/Composer/Plugin.php new file mode 100644 index 000000000..9ef26fd8a --- /dev/null +++ b/vendor/php-http/discovery/src/Composer/Plugin.php @@ -0,0 +1,370 @@ + + * + * @internal + */ +class Plugin implements PluginInterface, EventSubscriberInterface +{ + /** + * Describes, for every supported virtual implementation, which packages + * provide said implementation and which extra dependencies each package + * requires to provide the implementation. + */ + private const PROVIDE_RULES = [ + 'php-http/async-client-implementation' => [ + 'symfony/http-client' => ['guzzlehttp/promises', 'php-http/message-factory', 'psr/http-factory-implementation'], + 'php-http/guzzle7-adapter' => [], + 'php-http/guzzle6-adapter' => [], + 'php-http/curl-client' => [], + 'php-http/react-adapter' => [], + ], + 'php-http/client-implementation' => [ + 'symfony/http-client' => ['php-http/message-factory', 'psr/http-factory-implementation'], + 'php-http/guzzle7-adapter' => [], + 'php-http/guzzle6-adapter' => [], + 'php-http/cakephp-adapter' => [], + 'php-http/curl-client' => [], + 'php-http/react-adapter' => [], + 'php-http/buzz-adapter' => [], + 'php-http/artax-adapter' => [], + 'kriswallsmith/buzz:^1' => [], + ], + 'psr/http-client-implementation' => [ + 'symfony/http-client' => ['psr/http-factory-implementation'], + 'guzzlehttp/guzzle' => [], + 'kriswallsmith/buzz:^1' => [], + ], + 'psr/http-message-implementation' => [ + 'php-http/discovery' => ['psr/http-factory-implementation'], + ], + 'psr/http-factory-implementation' => [ + 'nyholm/psr7' => [], + 'guzzlehttp/psr7:>=2' => [], + 'slim/psr7' => [], + 'laminas/laminas-diactoros' => [], + 'phalcon/cphalcon:^4' => [], + 'zendframework/zend-diactoros:>=2' => [], + 'http-interop/http-factory-guzzle' => [], + 'http-interop/http-factory-diactoros' => [], + 'http-interop/http-factory-slim' => [], + ], + ]; + + /** + * Describes which package should be preferred on the left side + * depending on which one is already installed on the right side. + */ + private const STICKYNESS_RULES = [ + 'symfony/http-client' => 'symfony/framework-bundle', + 'php-http/guzzle7-adapter' => 'guzzlehttp/guzzle:^7', + 'php-http/guzzle6-adapter' => 'guzzlehttp/guzzle:^6', + 'php-http/guzzle5-adapter' => 'guzzlehttp/guzzle:^5', + 'php-http/cakephp-adapter' => 'cakephp/cakephp', + 'php-http/react-adapter' => 'react/event-loop', + 'php-http/buzz-adapter' => 'kriswallsmith/buzz:^0.15.1', + 'php-http/artax-adapter' => 'amphp/artax:^3', + 'http-interop/http-factory-guzzle' => 'guzzlehttp/psr7:^1', + 'http-interop/http-factory-diactoros' => 'zendframework/zend-diactoros:^1', + 'http-interop/http-factory-slim' => 'slim/slim:^3', + ]; + + public static function getSubscribedEvents(): array + { + return [ + ScriptEvents::POST_UPDATE_CMD => 'postUpdate', + ]; + } + + public function activate(Composer $composer, IOInterface $io): void + { + } + + public function deactivate(Composer $composer, IOInterface $io) + { + } + + public function uninstall(Composer $composer, IOInterface $io) + { + } + + public function postUpdate(Event $event) + { + $composer = $event->getComposer(); + $repo = $composer->getRepositoryManager()->getLocalRepository(); + $requires = [ + $composer->getPackage()->getRequires(), + $composer->getPackage()->getDevRequires(), + ]; + + $missingRequires = $this->getMissingRequires($repo, $requires, 'project' === $composer->getPackage()->getType()); + $missingRequires = [ + 'require' => array_fill_keys(array_merge([], ...array_values($missingRequires[0])), '*'), + 'require-dev' => array_fill_keys(array_merge([], ...array_values($missingRequires[1])), '*'), + 'remove' => array_fill_keys(array_merge([], ...array_values($missingRequires[2])), '*'), + ]; + + if (!$missingRequires = array_filter($missingRequires)) { + return; + } + + $composerJsonContents = file_get_contents(Factory::getComposerFile()); + $this->updateComposerJson($missingRequires, $composer->getConfig()->get('sort-packages')); + + $installer = null; + // Find the composer installer, hack borrowed from symfony/flex + foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) { + if (isset($trace['object']) && $trace['object'] instanceof Installer) { + $installer = $trace['object']; + break; + } + } + + if (!$installer) { + return; + } + + $event->stopPropagation(); + + $dispatcher = $composer->getEventDispatcher(); + $disableScripts = !method_exists($dispatcher, 'setRunScripts') || !((array) $dispatcher)["\0*\0runScripts"]; + $composer = Factory::create($event->getIO(), null, false, $disableScripts); + + /** @var Installer $installer */ + $installer = clone $installer; + if (method_exists($installer, 'setAudit')) { + $trace['object']->setAudit(false); + } + // we need a clone of the installer to preserve its configuration state but with our own service objects + $installer->__construct( + $event->getIO(), + $composer->getConfig(), + $composer->getPackage(), + $composer->getDownloadManager(), + $composer->getRepositoryManager(), + $composer->getLocker(), + $composer->getInstallationManager(), + $composer->getEventDispatcher(), + $composer->getAutoloadGenerator() + ); + if (method_exists($installer, 'setPlatformRequirementFilter')) { + $installer->setPlatformRequirementFilter(((array) $trace['object'])["\0*\0platformRequirementFilter"]); + } + + if (0 !== $installer->run()) { + file_put_contents(Factory::getComposerFile(), $composerJsonContents); + + return; + } + + $versionSelector = new VersionSelector(class_exists(RepositorySet::class) ? new RepositorySet() : new Pool()); + $updateComposerJson = false; + + foreach ($composer->getRepositoryManager()->getLocalRepository()->getPackages() as $package) { + foreach (['require', 'require-dev'] as $key) { + if (!isset($missingRequires[$key][$package->getName()])) { + continue; + } + $updateComposerJson = true; + $missingRequires[$key][$package->getName()] = $versionSelector->findRecommendedRequireVersion($package); + } + } + + if ($updateComposerJson) { + $this->updateComposerJson($missingRequires, $composer->getConfig()->get('sort-packages')); + $this->updateComposerLock($composer, $event->getIO()); + } + } + + public function getMissingRequires(InstalledRepositoryInterface $repo, array $requires, bool $isProject): array + { + $allPackages = []; + $devPackages = method_exists($repo, 'getDevPackageNames') ? array_fill_keys($repo->getDevPackageNames(), true) : []; + + // One must require "php-http/discovery" + // to opt-in for auto-installation of virtual package implementations + if (!isset($requires[0]['php-http/discovery'])) { + $requires = [[], []]; + } + + foreach ($repo->getPackages() as $package) { + $allPackages[$package->getName()] = true; + + if (1 < \count($names = $package->getNames(false))) { + $allPackages += array_fill_keys($names, false); + + if (isset($devPackages[$package->getName()])) { + $devPackages += $names; + } + } + + if (isset($package->getRequires()['php-http/discovery'])) { + $requires[(int) isset($devPackages[$package->getName()])] += $package->getRequires(); + } + } + + $missingRequires = [[], [], []]; + $versionParser = new VersionParser(); + + if (class_exists(\Phalcon\Http\Message\RequestFactory::class, false)) { + $missingRequires[0]['psr/http-factory-implementation'] = []; + $missingRequires[1]['psr/http-factory-implementation'] = []; + } + + foreach ($requires as $dev => $rules) { + $abstractions = []; + $rules = array_intersect_key(self::PROVIDE_RULES, $rules); + + while ($rules) { + $abstractions[] = $abstraction = key($rules); + + foreach (array_shift($rules) as $candidate => $deps) { + [$candidate, $version] = explode(':', $candidate, 2) + [1 => null]; + + if (!isset($allPackages[$candidate])) { + continue; + } + if (null !== $version && !$repo->findPackage($candidate, $versionParser->parseConstraints($version))) { + continue; + } + if ($isProject && !$dev && isset($devPackages[$candidate])) { + $missingRequires[0][$abstraction] = [$candidate]; + $missingRequires[2][$abstraction] = [$candidate]; + } else { + $missingRequires[$dev][$abstraction] = []; + } + + foreach ($deps as $dep) { + if (isset(self::PROVIDE_RULES[$dep])) { + $rules[$dep] = self::PROVIDE_RULES[$dep]; + } elseif (!isset($allPackages[$dep])) { + $missingRequires[$dev][$abstraction][] = $dep; + } elseif ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[0][$abstraction][] = $dep; + $missingRequires[2][$abstraction][] = $dep; + } + } + break; + } + } + + while ($abstractions) { + $abstraction = array_shift($abstractions); + + if (isset($missingRequires[$dev][$abstraction])) { + continue; + } + $candidates = self::PROVIDE_RULES[$abstraction]; + + foreach ($candidates as $candidate => $deps) { + [$candidate, $version] = explode(':', $candidate, 2) + [1 => null]; + + if (null !== $version && !$repo->findPackage($candidate, $versionParser->parseConstraints($version))) { + continue; + } + if (isset($allPackages[$candidate]) && (!$isProject || $dev || !isset($devPackages[$candidate]))) { + continue 2; + } + } + + foreach (array_intersect_key(self::STICKYNESS_RULES, $candidates) as $candidate => $stickyRule) { + [$stickyName, $stickyVersion] = explode(':', $stickyRule, 2) + [1 => null]; + if (!isset($allPackages[$stickyName]) || ($isProject && !$dev && isset($devPackages[$stickyName]))) { + continue; + } + if (null !== $stickyVersion && !$repo->findPackage($stickyName, $versionParser->parseConstraints($stickyVersion))) { + continue; + } + + $candidates = [$candidate => $candidates[$candidate]]; + break; + } + + $dep = key($candidates); + $missingRequires[$dev][$abstraction] = [$dep]; + + if ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[2][$abstraction][] = $dep; + } + + foreach (current($candidates) as $dep) { + if (isset(self::PROVIDE_RULES[$dep])) { + $abstractions[] = $dep; + } elseif (!isset($allPackages[$dep])) { + $missingRequires[$dev][$abstraction][] = $dep; + } elseif ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[0][$abstraction][] = $dep; + $missingRequires[2][$abstraction][] = $dep; + } + } + } + } + + $missingRequires[1] = array_diff_key($missingRequires[1], $missingRequires[0]); + + return $missingRequires; + } + + private function updateComposerJson(array $missingRequires, bool $sortPackages) + { + $file = Factory::getComposerFile(); + $contents = file_get_contents($file); + + $manipulator = new JsonManipulator($contents); + + foreach ($missingRequires as $key => $packages) { + foreach ($packages as $package => $constraint) { + if ('remove' === $key) { + $manipulator->removeSubNode('require-dev', $package); + } else { + $manipulator->addLink($key, $package, $constraint, $sortPackages); + } + } + } + + file_put_contents($file, $manipulator->getContents()); + } + + private function updateComposerLock(Composer $composer, IOInterface $io) + { + $lock = substr(Factory::getComposerFile(), 0, -4).'lock'; + $composerJson = file_get_contents(Factory::getComposerFile()); + $lockFile = new JsonFile($lock, null, $io); + $locker = class_exists(RepositorySet::class) + ? new Locker($io, $lockFile, $composer->getInstallationManager(), $composerJson) + : new Locker($io, $lockFile, $composer->getRepositoryManager(), $composer->getInstallationManager(), $composerJson); + $lockData = $locker->getLockData(); + $lockData['content-hash'] = Locker::getContentHash($composerJson); + $lockFile->write($lockData); + } +} diff --git a/vendor/php-http/discovery/src/Exception.php b/vendor/php-http/discovery/src/Exception.php new file mode 100644 index 000000000..0fa8c767e --- /dev/null +++ b/vendor/php-http/discovery/src/Exception.php @@ -0,0 +1,12 @@ + + */ +interface Exception extends \Throwable +{ +} diff --git a/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php b/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php new file mode 100644 index 000000000..e95bf5d82 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php @@ -0,0 +1,14 @@ + + */ +final class ClassInstantiationFailedException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php b/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php new file mode 100644 index 000000000..304b7276e --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php @@ -0,0 +1,51 @@ + + */ +final class DiscoveryFailedException extends \Exception implements Exception +{ + /** + * @var \Exception[] + */ + private $exceptions; + + /** + * @param string $message + * @param \Exception[] $exceptions + */ + public function __construct($message, array $exceptions = []) + { + $this->exceptions = $exceptions; + + parent::__construct($message); + } + + /** + * @param \Exception[] $exceptions + */ + public static function create($exceptions) + { + $message = 'Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors'; + foreach ($exceptions as $e) { + $message .= "\n - ".$e->getMessage(); + } + $message .= "\n\n"; + + return new self($message, $exceptions); + } + + /** + * @return \Exception[] + */ + public function getExceptions() + { + return $this->exceptions; + } +} diff --git a/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php b/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php new file mode 100644 index 000000000..32f65db7b --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php @@ -0,0 +1,47 @@ + + */ +final class NoCandidateFoundException extends \Exception implements Exception +{ + /** + * @param string $strategy + */ + public function __construct($strategy, array $candidates) + { + $classes = array_map( + function ($a) { + return $a['class']; + }, + $candidates + ); + + $message = sprintf( + 'No valid candidate found using strategy "%s". We tested the following candidates: %s.', + $strategy, + implode(', ', array_map([$this, 'stringify'], $classes)) + ); + + parent::__construct($message); + } + + private function stringify($mixed) + { + if (is_string($mixed)) { + return $mixed; + } + + if (is_array($mixed) && 2 === count($mixed)) { + return sprintf('%s::%s', $this->stringify($mixed[0]), $mixed[1]); + } + + return is_object($mixed) ? get_class($mixed) : gettype($mixed); + } +} diff --git a/vendor/php-http/discovery/src/Exception/NotFoundException.php b/vendor/php-http/discovery/src/Exception/NotFoundException.php new file mode 100644 index 000000000..ef8b9c584 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/NotFoundException.php @@ -0,0 +1,16 @@ + + */ +/* final */ class NotFoundException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php b/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php new file mode 100644 index 000000000..a6ade7332 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php @@ -0,0 +1,12 @@ + + */ +final class PuliUnavailableException extends StrategyUnavailableException +{ +} diff --git a/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php b/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php new file mode 100644 index 000000000..89ecf3523 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php @@ -0,0 +1,15 @@ + + */ +class StrategyUnavailableException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php b/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php new file mode 100644 index 000000000..a0c4d5b7c --- /dev/null +++ b/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php @@ -0,0 +1,32 @@ + + */ +final class HttpAsyncClientDiscovery extends ClassDiscovery +{ + /** + * Finds an HTTP Async Client. + * + * @return HttpAsyncClient + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $asyncClient = static::findOneByType(HttpAsyncClient::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e); + } + + return static::instantiateClass($asyncClient); + } +} diff --git a/vendor/php-http/discovery/src/HttpClientDiscovery.php b/vendor/php-http/discovery/src/HttpClientDiscovery.php new file mode 100644 index 000000000..2072b94dd --- /dev/null +++ b/vendor/php-http/discovery/src/HttpClientDiscovery.php @@ -0,0 +1,32 @@ + + */ +final class HttpClientDiscovery extends ClassDiscovery +{ + /** + * Finds an HTTP Client. + * + * @return HttpClient + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $client = static::findOneByType(HttpClient::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e); + } + + return static::instantiateClass($client); + } +} diff --git a/vendor/php-http/discovery/src/MessageFactoryDiscovery.php b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php new file mode 100644 index 000000000..659916dca --- /dev/null +++ b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class MessageFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a Message Factory. + * + * @return MessageFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $messageFactory = static::findOneByType(MessageFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($messageFactory); + } +} diff --git a/vendor/php-http/discovery/src/NotFoundException.php b/vendor/php-http/discovery/src/NotFoundException.php new file mode 100644 index 000000000..d59dadbf8 --- /dev/null +++ b/vendor/php-http/discovery/src/NotFoundException.php @@ -0,0 +1,14 @@ + + * + * @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead. + */ +final class NotFoundException extends \Http\Discovery\Exception\NotFoundException +{ +} diff --git a/vendor/php-http/discovery/src/Psr17Factory.php b/vendor/php-http/discovery/src/Psr17Factory.php new file mode 100644 index 000000000..d61a4cce8 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr17Factory.php @@ -0,0 +1,282 @@ + + * Copyright (c) 2015 Michael Dowling + * Copyright (c) 2015 Márk Sági-Kazár + * Copyright (c) 2015 Graham Campbell + * Copyright (c) 2016 Tobias Schultze + * Copyright (c) 2016 George Mponos + * Copyright (c) 2016-2018 Tobias Nyholm + * + * @author Nicolas Grekas + */ +class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface +{ + private $requestFactory; + private $responseFactory; + private $serverRequestFactory; + private $streamFactory; + private $uploadedFileFactory; + private $uriFactory; + + public function __construct( + RequestFactoryInterface $requestFactory = null, + ResponseFactoryInterface $responseFactory = null, + ServerRequestFactoryInterface $serverRequestFactory = null, + StreamFactoryInterface $streamFactory = null, + UploadedFileFactoryInterface $uploadedFileFactory = null, + UriFactoryInterface $uriFactory = null + ) { + $this->requestFactory = $requestFactory; + $this->responseFactory = $responseFactory; + $this->serverRequestFactory = $serverRequestFactory; + $this->streamFactory = $streamFactory; + $this->uploadedFileFactory = $uploadedFileFactory; + $this->uriFactory = $uriFactory; + + $this->setFactory($requestFactory); + $this->setFactory($responseFactory); + $this->setFactory($serverRequestFactory); + $this->setFactory($streamFactory); + $this->setFactory($uploadedFileFactory); + $this->setFactory($uriFactory); + } + + /** + * @param UriInterface|string $uri + */ + public function createRequest(string $method, $uri): RequestInterface + { + $factory = $this->requestFactory ?? $this->setFactory(Psr17FactoryDiscovery::findRequestFactory()); + + return $factory->createRequest(...\func_get_args()); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + $factory = $this->responseFactory ?? $this->setFactory(Psr17FactoryDiscovery::findResponseFactory()); + + return $factory->createResponse(...\func_get_args()); + } + + /** + * @param UriInterface|string $uri + */ + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + $factory = $this->serverRequestFactory ?? $this->setFactory(Psr17FactoryDiscovery::findServerRequestFactory()); + + return $factory->createServerRequest(...\func_get_args()); + } + + public function createServerRequestFromGlobals(array $server = null, array $get = null, array $post = null, array $cookie = null, array $files = null, StreamInterface $body = null): ServerRequestInterface + { + $server = $server ?? $_SERVER; + $request = $this->createServerRequest($server['REQUEST_METHOD'] ?? 'GET', $this->createUriFromGlobals($server), $server); + + return $this->buildServerRequestFromGlobals($request, $server, $files ?? $_FILES) + ->withQueryParams($get ?? $_GET) + ->withParsedBody($post ?? $_POST) + ->withCookieParams($cookie ?? $_COOKIE) + ->withBody($body ?? $this->createStreamFromFile('php://input', 'r+')); + } + + public function createStream(string $content = ''): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStream($content); + } + + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStreamFromFile($filename, $mode); + } + + /** + * @param resource $resource + */ + public function createStreamFromResource($resource): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStreamFromResource($resource); + } + + public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null): UploadedFileInterface + { + $factory = $this->uploadedFileFactory ?? $this->setFactory(Psr17FactoryDiscovery::findUploadedFileFactory()); + + return $factory->createUploadedFile(...\func_get_args()); + } + + public function createUri(string $uri = ''): UriInterface + { + $factory = $this->uriFactory ?? $this->setFactory(Psr17FactoryDiscovery::findUriFactory()); + + return $factory->createUri(...\func_get_args()); + } + + public function createUriFromGlobals(array $server = null): UriInterface + { + return $this->buildUriFromGlobals($this->createUri(''), $server ?? $_SERVER); + } + + private function setFactory($factory) + { + if (!$this->requestFactory && $factory instanceof RequestFactoryInterface) { + $this->requestFactory = $factory; + } + if (!$this->responseFactory && $factory instanceof ResponseFactoryInterface) { + $this->responseFactory = $factory; + } + if (!$this->serverRequestFactory && $factory instanceof ServerRequestFactoryInterface) { + $this->serverRequestFactory = $factory; + } + if (!$this->streamFactory && $factory instanceof StreamFactoryInterface) { + $this->streamFactory = $factory; + } + if (!$this->uploadedFileFactory && $factory instanceof UploadedFileFactoryInterface) { + $this->uploadedFileFactory = $factory; + } + if (!$this->uriFactory && $factory instanceof UriFactoryInterface) { + $this->uriFactory = $factory; + } + + return $factory; + } + + private function buildServerRequestFromGlobals(ServerRequestInterface $request, array $server, array $files): ServerRequestInterface + { + $request = $request + ->withProtocolVersion(isset($server['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $server['SERVER_PROTOCOL']) : '1.1') + ->withUploadedFiles($this->normalizeFiles($files)); + + $headers = []; + foreach ($server as $key => $value) { + if (0 === strpos($key, 'HTTP_')) { + $key = substr($key, 5); + } elseif (!\in_array($key, ['CONTENT_TYPE', 'CONTENT_LENGTH', 'CONTENT_MD5'], true)) { + continue; + } + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + + $headers[$key] = $value; + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $headers['Authorization'] = 'Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].':'.($_SERVER['PHP_AUTH_PW'] ?? '')); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + foreach ($headers as $key => $value) { + try { + $request = $request->withHeader($key, $value); + } catch (\InvalidArgumentException $e) { + // ignore invalid headers + } + } + + return $request; + } + + private function buildUriFromGlobals(UriInterface $uri, array $server): UriInterface + { + $uri = $uri->withScheme(!empty($server['HTTPS']) && 'off' !== strtolower($server['HTTPS']) ? 'https' : 'http'); + + $hasPort = false; + if (isset($server['HTTP_HOST'])) { + $parts = parse_url('http://'.$server['HTTP_HOST']); + + $uri = $uri->withHost($parts['host'] ?? 'localhost'); + + if ($parts['port'] ?? false) { + $hasPort = true; + $uri = $uri->withPort($parts['port']); + } + } else { + $uri = $uri->withHost($server['SERVER_NAME'] ?? $server['SERVER_ADDR'] ?? 'localhost'); + } + + if (!$hasPort && isset($server['SERVER_PORT'])) { + $uri = $uri->withPort($server['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($server['REQUEST_URI'])) { + $requestUriParts = explode('?', $server['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($server['QUERY_STRING'])) { + $uri = $uri->withQuery($server['QUERY_STRING']); + } + + return $uri; + } + + private function normalizeFiles(array $files): array + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (!\is_array($value)) { + continue; + } elseif (!isset($value['tmp_name'])) { + $normalized[$key] = $this->normalizeFiles($value); + } elseif (\is_array($value['tmp_name'])) { + foreach ($value['tmp_name'] as $k => $v) { + $file = $this->createStreamFromFile($value['tmp_name'][$k], 'r'); + $normalized[$key][$k] = $this->createUploadedFile($file, $value['size'][$k], $value['error'][$k], $value['name'][$k], $value['type'][$k]); + } + } else { + $file = $this->createStreamFromFile($value['tmp_name'], 'r'); + $normalized[$key] = $this->createUploadedFile($file, $value['size'], $value['error'], $value['name'], $value['type']); + } + } + + return $normalized; + } +} diff --git a/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php b/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php new file mode 100644 index 000000000..a73c6414b --- /dev/null +++ b/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php @@ -0,0 +1,136 @@ + + */ +final class Psr17FactoryDiscovery extends ClassDiscovery +{ + private static function createException($type, Exception $e) + { + return new \Http\Discovery\Exception\NotFoundException( + 'No PSR-17 '.$type.' found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation', + 0, + $e + ); + } + + /** + * @return RequestFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findRequestFactory() + { + try { + $messageFactory = static::findOneByType(RequestFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('request factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return ResponseFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findResponseFactory() + { + try { + $messageFactory = static::findOneByType(ResponseFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('response factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return ServerRequestFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findServerRequestFactory() + { + try { + $messageFactory = static::findOneByType(ServerRequestFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('server request factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return StreamFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findStreamFactory() + { + try { + $messageFactory = static::findOneByType(StreamFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('stream factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UploadedFileFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findUploadedFileFactory() + { + try { + $messageFactory = static::findOneByType(UploadedFileFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('uploaded file factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UriFactoryInterface + * + * @throws Exception\NotFoundException + */ + public static function findUriFactory() + { + try { + $messageFactory = static::findOneByType(UriFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('url factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UriFactoryInterface + * + * @throws Exception\NotFoundException + * + * @deprecated This will be removed in 2.0. Consider using the findUriFactory() method. + */ + public static function findUrlFactory() + { + return static::findUriFactory(); + } +} diff --git a/vendor/php-http/discovery/src/Psr18ClientDiscovery.php b/vendor/php-http/discovery/src/Psr18ClientDiscovery.php new file mode 100644 index 000000000..dfd2dd1e7 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr18ClientDiscovery.php @@ -0,0 +1,32 @@ + + */ +final class Psr18ClientDiscovery extends ClassDiscovery +{ + /** + * Finds a PSR-18 HTTP Client. + * + * @return ClientInterface + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $client = static::findOneByType(ClientInterface::class); + } catch (DiscoveryFailedException $e) { + throw new \Http\Discovery\Exception\NotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter".', 0, $e); + } + + return static::instantiateClass($client); + } +} diff --git a/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php new file mode 100644 index 000000000..8126e12b0 --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php @@ -0,0 +1,191 @@ + + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. + */ +final class CommonClassesStrategy implements DiscoveryStrategy +{ + /** + * @var array + */ + private static $classes = [ + MessageFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]], + ['class' => DiactorosMessageFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosMessageFactory::class]], + ['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]], + ['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]], + ], + StreamFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]], + ['class' => DiactorosStreamFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosStreamFactory::class]], + ['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]], + ['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]], + ], + UriFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]], + ['class' => DiactorosUriFactory::class, 'condition' => [ZendDiactorosRequest::class, DiactorosUriFactory::class]], + ['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]], + ['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]], + ], + HttpAsyncClient::class => [ + ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, Promise::class, RequestFactory::class, [self::class, 'isPsr17FactoryInstalled']]], + ['class' => Guzzle7::class, 'condition' => Guzzle7::class], + ['class' => Guzzle6::class, 'condition' => Guzzle6::class], + ['class' => Curl::class, 'condition' => Curl::class], + ['class' => React::class, 'condition' => React::class], + ], + HttpClient::class => [ + ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, RequestFactory::class, [self::class, 'isPsr17FactoryInstalled']]], + ['class' => Guzzle7::class, 'condition' => Guzzle7::class], + ['class' => Guzzle6::class, 'condition' => Guzzle6::class], + ['class' => Guzzle5::class, 'condition' => Guzzle5::class], + ['class' => Curl::class, 'condition' => Curl::class], + ['class' => Socket::class, 'condition' => Socket::class], + ['class' => Buzz::class, 'condition' => Buzz::class], + ['class' => React::class, 'condition' => React::class], + ['class' => Cake::class, 'condition' => Cake::class], + ['class' => Zend::class, 'condition' => Zend::class], + ['class' => Artax::class, 'condition' => Artax::class], + [ + 'class' => [self::class, 'buzzInstantiate'], + 'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class], + ], + ], + Psr18Client::class => [ + [ + 'class' => [self::class, 'symfonyPsr18Instantiate'], + 'condition' => [SymfonyPsr18::class, Psr17RequestFactory::class], + ], + [ + 'class' => GuzzleHttp::class, + 'condition' => [self::class, 'isGuzzleImplementingPsr18'], + ], + [ + 'class' => [self::class, 'buzzInstantiate'], + 'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class], + ], + ], + ]; + + /** + * {@inheritdoc} + */ + public static function getCandidates($type) + { + if (Psr18Client::class === $type) { + return self::getPsr18Candidates(); + } + + return self::$classes[$type] ?? []; + } + + /** + * @return array The return value is always an array with zero or more elements. Each + * element is an array with two keys ['class' => string, 'condition' => mixed]. + */ + private static function getPsr18Candidates() + { + $candidates = self::$classes[Psr18Client::class]; + + // HTTPlug 2.0 clients implements PSR18Client too. + foreach (self::$classes[HttpClient::class] as $c) { + if (!is_string($c['class'])) { + continue; + } + try { + if (ClassDiscovery::safeClassExists($c['class']) && is_subclass_of($c['class'], Psr18Client::class)) { + $candidates[] = $c; + } + } catch (\Throwable $e) { + trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-18 Client is available', get_class($e), $e->getMessage()), E_USER_WARNING); + } + } + + return $candidates; + } + + public static function buzzInstantiate() + { + return new \Buzz\Client\FileGetContents(MessageFactoryDiscovery::find()); + } + + public static function symfonyPsr18Instantiate() + { + return new SymfonyPsr18(null, Psr17FactoryDiscovery::findResponseFactory(), Psr17FactoryDiscovery::findStreamFactory()); + } + + public static function isGuzzleImplementingPsr18() + { + return defined('GuzzleHttp\ClientInterface::MAJOR_VERSION'); + } + + /** + * Can be used as a condition. + * + * @return bool + */ + public static function isPsr17FactoryInstalled() + { + try { + Psr17FactoryDiscovery::findResponseFactory(); + } catch (NotFoundException $e) { + return false; + } catch (\Throwable $e) { + trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-17 ResponseFactory is available', get_class($e), $e->getMessage()), E_USER_WARNING); + + return false; + } + + return true; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php new file mode 100644 index 000000000..0a0b8c82a --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php @@ -0,0 +1,107 @@ + + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. + */ +final class CommonPsr17ClassesStrategy implements DiscoveryStrategy +{ + /** + * @var array + */ + private static $classes = [ + RequestFactoryInterface::class => [ + 'Phalcon\Http\Message\RequestFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\RequestFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\RequestFactory', + 'Http\Factory\Guzzle\RequestFactory', + 'Http\Factory\Slim\RequestFactory', + 'Laminas\Diactoros\RequestFactory', + 'Slim\Psr7\Factory\RequestFactory', + ], + ResponseFactoryInterface::class => [ + 'Phalcon\Http\Message\ResponseFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\ResponseFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\ResponseFactory', + 'Http\Factory\Guzzle\ResponseFactory', + 'Http\Factory\Slim\ResponseFactory', + 'Laminas\Diactoros\ResponseFactory', + 'Slim\Psr7\Factory\ResponseFactory', + ], + ServerRequestFactoryInterface::class => [ + 'Phalcon\Http\Message\ServerRequestFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\ServerRequestFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\ServerRequestFactory', + 'Http\Factory\Guzzle\ServerRequestFactory', + 'Http\Factory\Slim\ServerRequestFactory', + 'Laminas\Diactoros\ServerRequestFactory', + 'Slim\Psr7\Factory\ServerRequestFactory', + ], + StreamFactoryInterface::class => [ + 'Phalcon\Http\Message\StreamFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\StreamFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\StreamFactory', + 'Http\Factory\Guzzle\StreamFactory', + 'Http\Factory\Slim\StreamFactory', + 'Laminas\Diactoros\StreamFactory', + 'Slim\Psr7\Factory\StreamFactory', + ], + UploadedFileFactoryInterface::class => [ + 'Phalcon\Http\Message\UploadedFileFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\UploadedFileFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\UploadedFileFactory', + 'Http\Factory\Guzzle\UploadedFileFactory', + 'Http\Factory\Slim\UploadedFileFactory', + 'Laminas\Diactoros\UploadedFileFactory', + 'Slim\Psr7\Factory\UploadedFileFactory', + ], + UriFactoryInterface::class => [ + 'Phalcon\Http\Message\UriFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'Zend\Diactoros\UriFactory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\UriFactory', + 'Http\Factory\Guzzle\UriFactory', + 'Http\Factory\Slim\UriFactory', + 'Laminas\Diactoros\UriFactory', + 'Slim\Psr7\Factory\UriFactory', + ], + ]; + + /** + * {@inheritdoc} + */ + public static function getCandidates($type) + { + $candidates = []; + if (isset(self::$classes[$type])) { + foreach (self::$classes[$type] as $class) { + $candidates[] = ['class' => $class, 'condition' => [$class]]; + } + } + + return $candidates; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php b/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php new file mode 100644 index 000000000..1eadb145b --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php @@ -0,0 +1,23 @@ + + */ +interface DiscoveryStrategy +{ + /** + * Find a resource of a specific type. + * + * @param string $type + * + * @return array The return value is always an array with zero or more elements. Each + * element is an array with two keys ['class' => string, 'condition' => mixed]. + * + * @throws StrategyUnavailableException if we cannot use this strategy + */ + public static function getCandidates($type); +} diff --git a/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php b/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php new file mode 100644 index 000000000..0cee3f7ed --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php @@ -0,0 +1,27 @@ + + */ +final class MockClientStrategy implements DiscoveryStrategy +{ + /** + * {@inheritdoc} + */ + public static function getCandidates($type) + { + if (is_a(HttpClient::class, $type, true) || is_a(HttpAsyncClient::class, $type, true)) { + return [['class' => Mock::class, 'condition' => Mock::class]]; + } + + return []; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php new file mode 100644 index 000000000..6b3a862da --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php @@ -0,0 +1,93 @@ + + * @author Márk Sági-Kazár + */ +class PuliBetaStrategy implements DiscoveryStrategy +{ + /** + * @var GeneratedPuliFactory + */ + protected static $puliFactory; + + /** + * @var Discovery + */ + protected static $puliDiscovery; + + /** + * @return GeneratedPuliFactory + * + * @throws PuliUnavailableException + */ + private static function getPuliFactory() + { + if (null === self::$puliFactory) { + if (!defined('PULI_FACTORY_CLASS')) { + throw new PuliUnavailableException('Puli Factory is not available'); + } + + $puliFactoryClass = PULI_FACTORY_CLASS; + + if (!ClassDiscovery::safeClassExists($puliFactoryClass)) { + throw new PuliUnavailableException('Puli Factory class does not exist'); + } + + self::$puliFactory = new $puliFactoryClass(); + } + + return self::$puliFactory; + } + + /** + * Returns the Puli discovery layer. + * + * @return Discovery + * + * @throws PuliUnavailableException + */ + private static function getPuliDiscovery() + { + if (!isset(self::$puliDiscovery)) { + $factory = self::getPuliFactory(); + $repository = $factory->createRepository(); + + self::$puliDiscovery = $factory->createDiscovery($repository); + } + + return self::$puliDiscovery; + } + + /** + * {@inheritdoc} + */ + public static function getCandidates($type) + { + $returnData = []; + $bindings = self::getPuliDiscovery()->findBindings($type); + + foreach ($bindings as $binding) { + $condition = true; + if ($binding->hasParameterValue('depends')) { + $condition = $binding->getParameterValue('depends'); + } + $returnData[] = ['class' => $binding->getClassName(), 'condition' => $condition]; + } + + return $returnData; + } +} diff --git a/vendor/php-http/discovery/src/StreamFactoryDiscovery.php b/vendor/php-http/discovery/src/StreamFactoryDiscovery.php new file mode 100644 index 000000000..e11c49ae2 --- /dev/null +++ b/vendor/php-http/discovery/src/StreamFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class StreamFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a Stream Factory. + * + * @return StreamFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $streamFactory = static::findOneByType(StreamFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($streamFactory); + } +} diff --git a/vendor/php-http/discovery/src/UriFactoryDiscovery.php b/vendor/php-http/discovery/src/UriFactoryDiscovery.php new file mode 100644 index 000000000..db3add206 --- /dev/null +++ b/vendor/php-http/discovery/src/UriFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class UriFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a URI Factory. + * + * @return UriFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $uriFactory = static::findOneByType(UriFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($uriFactory); + } +} diff --git a/vendor/php-http/guzzle7-adapter/CHANGELOG.md b/vendor/php-http/guzzle7-adapter/CHANGELOG.md new file mode 100644 index 000000000..9aa94407b --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/CHANGELOG.md @@ -0,0 +1,18 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2021-03-09 + +- Stable release - no changes since 0.1.1 + +## [0.1.1] - 2020-10-21 + +* Allow installation with PHP 8 + +## [0.1.0] - 2020-08-16 + +First release diff --git a/vendor/php-http/guzzle7-adapter/LICENSE b/vendor/php-http/guzzle7-adapter/LICENSE new file mode 100644 index 000000000..0d6ce83b8 --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 PHP HTTP Team + +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/vendor/php-http/guzzle7-adapter/README.md b/vendor/php-http/guzzle7-adapter/README.md new file mode 100644 index 000000000..7e6b5b5dc --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/README.md @@ -0,0 +1,45 @@ +# Guzzle 7 HTTP Adapter + +[![Latest Version](https://img.shields.io/github/release/php-http/guzzle7-adapter.svg?style=flat-square)](https://github.com/php-http/guzzle7-adapter/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/guzzle7-adapter.svg?style=flat-square)](https://packagist.org/packages/php-http/guzzle7-adapter) + +**Guzzle 7 HTTP Adapter.** + +## Install + +Via Composer + +``` bash +$ composer require php-http/guzzle7-adapter +``` + +## Documentation + +Please see the [official documentation](http://docs.php-http.org/en/latest/clients/guzzle7-adapter.html). + +## Testing + +First launch the http server: + +```bash +$ ./vendor/bin/http_test_server > /dev/null 2>&1 & +``` + +Then the test suite: + +``` bash +$ composer test +``` + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/guzzle7-adapter/composer.json b/vendor/php-http/guzzle7-adapter/composer.json new file mode 100644 index 000000000..3299d2eb7 --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/composer.json @@ -0,0 +1,43 @@ +{ + "name": "php-http/guzzle7-adapter", + "description": "Guzzle 7 HTTP Adapter", + "license": "MIT", + "keywords": ["guzzle", "http"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + } + ], + "require": { + "php": "^7.2 | ^8.0", + "php-http/httplug": "^2.0", + "psr/http-client": "^1.0", + "guzzlehttp/guzzle": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.3", + "php-http/client-integration-tests": "^3.0" + }, + "provide": { + "php-http/client-implementation": "1.0", + "php-http/async-client-implementation": "1.0", + "psr/http-client-implementation": "1.0" + }, + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle7\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Http\\Adapter\\Guzzle7\\Tests\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "0.2.x-dev" + } + } +} diff --git a/vendor/php-http/guzzle7-adapter/phpstan.neon.dist b/vendor/php-http/guzzle7-adapter/phpstan.neon.dist new file mode 100644 index 000000000..d42940e93 --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/phpstan.neon.dist @@ -0,0 +1,5 @@ +parameters: + level: 5 + reportUnmatchedIgnoredErrors: false + paths: + - src diff --git a/vendor/php-http/guzzle7-adapter/psalm.baseline.xml b/vendor/php-http/guzzle7-adapter/psalm.baseline.xml new file mode 100644 index 000000000..96ab42cf9 --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/psalm.baseline.xml @@ -0,0 +1,8 @@ + + + + + $exception->getResponse() + + + diff --git a/vendor/php-http/guzzle7-adapter/psalm.xml b/vendor/php-http/guzzle7-adapter/psalm.xml new file mode 100644 index 000000000..d70acfe4f --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/psalm.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/vendor/php-http/guzzle7-adapter/src/Client.php b/vendor/php-http/guzzle7-adapter/src/Client.php new file mode 100644 index 000000000..a92ab06bd --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/src/Client.php @@ -0,0 +1,75 @@ + + */ +final class Client implements HttpClient, HttpAsyncClient +{ + /** + * @var ClientInterface + */ + private $guzzle; + + public function __construct(?ClientInterface $guzzle = null) + { + if (!$guzzle) { + $guzzle = self::buildClient(); + } + + $this->guzzle = $guzzle; + } + + /** + * Factory method to create the Guzzle 7 adapter with custom Guzzle configuration. + */ + public static function createWithConfig(array $config): Client + { + return new self(self::buildClient($config)); + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->sendAsyncRequest($request)->wait(); + } + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + $promise = $this->guzzle->sendAsync($request); + + return new Promise($promise, $request); + } + + /** + * Build the Guzzle client instance. + */ + private static function buildClient(array $config = []): GuzzleClient + { + $handlerStack = new HandlerStack(Utils::chooseHandler()); + $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); + $config = array_merge(['handler' => $handlerStack], $config); + + return new GuzzleClient($config); + } +} diff --git a/vendor/php-http/guzzle7-adapter/src/Exception/UnexpectedValueException.php b/vendor/php-http/guzzle7-adapter/src/Exception/UnexpectedValueException.php new file mode 100644 index 000000000..f4731be07 --- /dev/null +++ b/vendor/php-http/guzzle7-adapter/src/Exception/UnexpectedValueException.php @@ -0,0 +1,9 @@ + + */ +final class Promise implements HttpPromise +{ + /** + * @var PromiseInterface + */ + private $promise; + + /** + * @var string State of the promise + */ + private $state; + + /** + * @var ResponseInterface + */ + private $response; + + /** + * @var HttplugException + */ + private $exception; + + /** + * @var RequestInterface + */ + private $request; + + public function __construct(PromiseInterface $promise, RequestInterface $request) + { + $this->request = $request; + $this->state = self::PENDING; + $this->promise = $promise->then(function ($response) { + $this->response = $response; + $this->state = self::FULFILLED; + + return $response; + }, function ($reason) use ($request) { + $this->state = self::REJECTED; + + if ($reason instanceof HttplugException) { + $this->exception = $reason; + } elseif ($reason instanceof GuzzleExceptions\GuzzleException) { + $this->exception = $this->handleException($reason, $request); + } elseif ($reason instanceof \Throwable) { + $this->exception = new HttplugException\TransferException('Invalid exception returned from Guzzle7', 0, $reason); + } else { + $this->exception = new UnexpectedValueException('Reason returned from Guzzle7 must be an Exception'); + } + + throw $this->exception; + }); + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + return new static($this->promise->then($onFulfilled, $onRejected), $this->request); + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return $this->state; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + $this->promise->wait(false); + + if ($unwrap) { + if (self::REJECTED == $this->getState()) { + throw $this->exception; + } + + return $this->response; + } + } + + /** + * Converts a Guzzle exception into an Httplug exception. + * + * @return HttplugException + */ + private function handleException(GuzzleExceptions\GuzzleException $exception, RequestInterface $request) + { + if ($exception instanceof GuzzleExceptions\ConnectException) { + return new HttplugException\NetworkException($exception->getMessage(), $exception->getRequest(), $exception); + } + + if ($exception instanceof GuzzleExceptions\RequestException) { + // Make sure we have a response for the HttpException + if ($exception->hasResponse()) { + return new HttplugException\HttpException( + $exception->getMessage(), + $exception->getRequest(), + $exception->getResponse(), + $exception + ); + } + + return new HttplugException\RequestException($exception->getMessage(), $exception->getRequest(), $exception); + } + + return new HttplugException\TransferException($exception->getMessage(), 0, $exception); + } +} diff --git a/vendor/php-http/httplug/.php-cs-fixer.dist.php b/vendor/php-http/httplug/.php-cs-fixer.dist.php new file mode 100644 index 000000000..83809c25d --- /dev/null +++ b/vendor/php-http/httplug/.php-cs-fixer.dist.php @@ -0,0 +1,16 @@ +in(__DIR__.'/src') + ->name('*.php') +; + +$config = (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + ]) + ->setFinder($finder) +; + +return $config; diff --git a/vendor/php-http/httplug/CHANGELOG.md b/vendor/php-http/httplug/CHANGELOG.md new file mode 100644 index 000000000..26483c2c4 --- /dev/null +++ b/vendor/php-http/httplug/CHANGELOG.md @@ -0,0 +1,136 @@ +# Change Log + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + +## [2.3.0] - 2022-02-21 + +### Changed + +- Enabled the `$onRejected` callback of `HttpRejectedPromise` to return a promise for implementing a retry + mechanism [#168](https://github.com/php-http/httplug/pull/168) + +## [2.2.0] - 2020-07-13 + +### Changed + +- Support PHP 7.1-8.0 + +## [2.1.0] - 2019-12-27 + +### Changed + +- `Http\Client\Exception\NetworkException` no longer extends `Http\Client\Exception\RequestException`, + in accordance with [PSR-18](https://www.php-fig.org/psr/psr-18/) + +## [2.0.0] - 2018-10-31 + +This version is no BC break for consumers using HTTPlug. However, HTTP clients that +implement HTTPlug need to adjust because we add return type declarations. + +### Added + +- Support for PSR-18 (HTTP client). + +### Changed + +- **BC Break:** `HttpClient::sendRequest(RequestInterface $request)` has a return type annotation. The new +signature is `HttpClient::sendRequest(RequestInterface $request): ResponseInterface`. +- **BC Break:** `RequestException::getRequest()` has a return type annotation. The new +signature is `RequestException::getRequest(): RequestInterface`. + +### Removed + +- PHP 5 support + + +## [1.1.0] - 2016-08-31 + +### Added + +- HttpFulfilledPromise and HttpRejectedPromise which respect the HttpAsyncClient interface + + +## [1.0.0] - 2016-01-26 + +### Removed + +- Stability configuration from composer + + +## [1.0.0-RC1] - 2016-01-12 + +### Changed + +- Updated package files +- Updated promise dependency to RC1 + + +## [1.0.0-beta] - 2015-12-17 + +### Added + +- Puli configuration and binding types + +### Changed + +- Exception concept + + +## [1.0.0-alpha3] - 2015-12-13 + +### Changed + +- Async client does not throw exceptions + +### Removed + +- Promise interface moved to its own repository: [php-http/promise](https://github.com/php-http/promise) + + +## [1.0.0-alpha2] - 2015-11-16 + +### Added + +- Async client and Promise interface + + +## [1.0.0-alpha] - 2015-10-26 + +### Added + +- Better domain exceptions. + +### Changed + +- Purpose of the library: general HTTP CLient abstraction. + +### Removed + +- Request options: they should be configured at construction time. +- Multiple request sending: should be done asynchronously using Async Client. +- `getName` method + + +## 0.1.0 - 2015-06-03 + +### Added + +- Initial release + + +[Unreleased]: https://github.com/php-http/httplug/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/php-http/httplug/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/php-http/httplug/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/php-http/httplug/compare/v1.0.0-RC1...v1.0.0 +[1.0.0-RC1]: https://github.com/php-http/httplug/compare/v1.0.0-beta...v1.0.0-RC1 +[1.0.0-beta]: https://github.com/php-http/httplug/compare/v1.0.0-alpha3...v1.0.0-beta +[1.0.0-alpha3]: https://github.com/php-http/httplug/compare/v1.0.0-alpha2...v1.0.0-alpha3 +[1.0.0-alpha2]: https://github.com/php-http/httplug/compare/v1.0.0-alpha...v1.0.0-alpha2 +[1.0.0-alpha]: https://github.com/php-http/httplug/compare/v0.1.0...v1.0.0-alpha diff --git a/vendor/php-http/httplug/LICENSE b/vendor/php-http/httplug/LICENSE new file mode 100644 index 000000000..8cd264c6b --- /dev/null +++ b/vendor/php-http/httplug/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014 Eric GELOEN +Copyright (c) 2015 PHP HTTP Team + +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/vendor/php-http/httplug/README.md b/vendor/php-http/httplug/README.md new file mode 100644 index 000000000..ce60cfaa9 --- /dev/null +++ b/vendor/php-http/httplug/README.md @@ -0,0 +1,62 @@ +# HTTPlug + +[![Latest Version](https://img.shields.io/github/release/php-http/httplug.svg?style=flat-square)](https://github.com/php-http/httplug/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://github.com/php-http/httplug/actions/workflows/ci.yml/badge.svg)](https://github.com/php-http/httplug/actions/workflows/ci.yml) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/httplug.svg?style=flat-square)](https://packagist.org/packages/php-http/httplug) + +[![Email](https://img.shields.io/badge/email-team@httplug.io-blue.svg?style=flat-square)](mailto:team@httplug.io) + +**HTTPlug, the HTTP client abstraction for PHP.** + + +## Intro + +HTTP client standard built on [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP +messages. The HTTPlug client interface is compatible with the official standard +for the HTTP client interface, [PSR-18](http://www.php-fig.org/psr/psr-18/). +HTTPlug adds an interface for asynchronous HTTP requests, which PSR-18 does not +cover. + +Since HTTPlug has already been widely adopted and a whole ecosystem has been +built around it, we will keep maintaining this package for the time being. +HTTPlug 2.0 and newer extend the PSR-18 interface to allow for a convenient +migration path. + +New client implementations and consumers should use the PSR-18 interfaces +directly. In the long term, we expect PSR-18 to completely replace the need +for HTTPlug. + + +## History + +HTTPlug is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter). +HTTPlug is a predecessor of [PSR-18](http://www.php-fig.org/psr/psr-18/) + + +## Install + +Via Composer + +``` bash +$ composer require php-http/httplug +``` + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org). + + +## Testing + +``` bash +$ composer test +``` + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/httplug/composer.json b/vendor/php-http/httplug/composer.json new file mode 100644 index 000000000..268b27ec7 --- /dev/null +++ b/vendor/php-http/httplug/composer.json @@ -0,0 +1,45 @@ +{ + "name": "php-http/httplug", + "description": "HTTPlug, the HTTP client abstraction for PHP", + "keywords": [ + "http", + "client" + ], + "homepage": "http://httplug.io", + "license": "MIT", + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "require": { + "php": "^7.1 || ^8.0", + "php-http/promise": "^1.1", + "psr/http-client": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage": "^4.1", + "phpspec/phpspec": "^5.1 || ^6.0" + }, + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "scripts": { + "test": "vendor/bin/phpspec run", + "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" + } +} diff --git a/vendor/php-http/httplug/puli.json b/vendor/php-http/httplug/puli.json new file mode 100644 index 000000000..416833152 --- /dev/null +++ b/vendor/php-http/httplug/puli.json @@ -0,0 +1,12 @@ +{ + "version": "1.0", + "name": "php-http/httplug", + "binding-types": { + "Http\\Client\\HttpAsyncClient": { + "description": "Async HTTP Client" + }, + "Http\\Client\\HttpClient": { + "description": "HTTP Client" + } + } +} diff --git a/vendor/php-http/httplug/src/Exception.php b/vendor/php-http/httplug/src/Exception.php new file mode 100644 index 000000000..4df164c9a --- /dev/null +++ b/vendor/php-http/httplug/src/Exception.php @@ -0,0 +1,14 @@ + + */ +interface Exception extends PsrClientException +{ +} diff --git a/vendor/php-http/httplug/src/Exception/HttpException.php b/vendor/php-http/httplug/src/Exception/HttpException.php new file mode 100644 index 000000000..6c2a007a0 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/HttpException.php @@ -0,0 +1,65 @@ + + */ +class HttpException extends RequestException +{ + /** + * @var ResponseInterface + */ + protected $response; + + /** + * @param string $message + */ + public function __construct( + $message, + RequestInterface $request, + ResponseInterface $response, + \Exception $previous = null + ) { + parent::__construct($message, $request, $previous); + + $this->response = $response; + $this->code = $response->getStatusCode(); + } + + /** + * Returns the response. + * + * @return ResponseInterface + */ + public function getResponse() + { + return $this->response; + } + + /** + * Factory method to create a new exception with a normalized error message. + */ + public static function create( + RequestInterface $request, + ResponseInterface $response, + \Exception $previous = null + ) { + $message = sprintf( + '[url] %s [http method] %s [status code] %s [reason phrase] %s', + $request->getRequestTarget(), + $request->getMethod(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + return new static($message, $request, $response, $previous); + } +} diff --git a/vendor/php-http/httplug/src/Exception/NetworkException.php b/vendor/php-http/httplug/src/Exception/NetworkException.php new file mode 100644 index 000000000..9b4f1e8fd --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/NetworkException.php @@ -0,0 +1,28 @@ + + */ +class NetworkException extends TransferException implements PsrNetworkException +{ + use RequestAwareTrait; + + /** + * @param string $message + */ + public function __construct($message, RequestInterface $request, \Exception $previous = null) + { + $this->setRequest($request); + + parent::__construct($message, 0, $previous); + } +} diff --git a/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php b/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php new file mode 100644 index 000000000..71b4bb8c9 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php @@ -0,0 +1,26 @@ +request = $request; + } + + /** + * {@inheritdoc} + */ + public function getRequest(): RequestInterface + { + return $this->request; + } +} diff --git a/vendor/php-http/httplug/src/Exception/RequestException.php b/vendor/php-http/httplug/src/Exception/RequestException.php new file mode 100644 index 000000000..f6c60ce56 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/RequestException.php @@ -0,0 +1,29 @@ + + */ +class RequestException extends TransferException implements PsrRequestException +{ + use RequestAwareTrait; + + /** + * @param string $message + */ + public function __construct($message, RequestInterface $request, \Exception $previous = null) + { + $this->setRequest($request); + + parent::__construct($message, 0, $previous); + } +} diff --git a/vendor/php-http/httplug/src/Exception/TransferException.php b/vendor/php-http/httplug/src/Exception/TransferException.php new file mode 100644 index 000000000..a858cf5ec --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/TransferException.php @@ -0,0 +1,14 @@ + + */ +class TransferException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/httplug/src/HttpAsyncClient.php b/vendor/php-http/httplug/src/HttpAsyncClient.php new file mode 100644 index 000000000..c3b9d61aa --- /dev/null +++ b/vendor/php-http/httplug/src/HttpAsyncClient.php @@ -0,0 +1,25 @@ + + */ +interface HttpAsyncClient +{ + /** + * Sends a PSR-7 request in an asynchronous way. + * + * Exceptions related to processing the request are available from the returned Promise. + * + * @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception + * + * @throws \Exception If processing the request is impossible (eg. bad configuration). + */ + public function sendAsyncRequest(RequestInterface $request); +} diff --git a/vendor/php-http/httplug/src/HttpClient.php b/vendor/php-http/httplug/src/HttpClient.php new file mode 100644 index 000000000..4442bd013 --- /dev/null +++ b/vendor/php-http/httplug/src/HttpClient.php @@ -0,0 +1,15 @@ +response = $response; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onFulfilled) { + return $this; + } + + try { + return new self($onFulfilled($this->response)); + } catch (Exception $e) { + return new HttpRejectedPromise($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::FULFILLED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + return $this->response; + } + } +} diff --git a/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php b/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php new file mode 100644 index 000000000..624cc8a94 --- /dev/null +++ b/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php @@ -0,0 +1,58 @@ +exception = $exception; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onRejected) { + return $this; + } + + try { + $result = $onRejected($this->exception); + if ($result instanceof Promise) { + return $result; + } + + return new HttpFulfilledPromise($result); + } catch (Exception $e) { + return new self($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::REJECTED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + throw $this->exception; + } + } +} diff --git a/vendor/php-http/message-factory/CHANGELOG.md b/vendor/php-http/message-factory/CHANGELOG.md new file mode 100644 index 000000000..4711924c6 --- /dev/null +++ b/vendor/php-http/message-factory/CHANGELOG.md @@ -0,0 +1,65 @@ +# Change Log + + +## 1.0.2 - 2015-12-19 + +### Added + +- Request and Response factory binding types to Puli + + +## 1.0.1 - 2015-12-17 + +### Added + +- Puli configuration and binding types + + +## 1.0.0 - 2015-12-15 + +### Added + +- Response Factory in order to be reused in Message and Server Message factories +- Request Factory + +### Changed + +- Message Factory extends Request and Response factories + + +## 1.0.0-RC1 - 2015-12-14 + +### Added + +- CS check + +### Changed + +- RuntimeException is thrown when the StreamFactory cannot write to the underlying stream + + +## 0.3.0 - 2015-11-16 + +### Removed + +- Client Context Factory +- Factory Awares and Templates + + +## 0.2.0 - 2015-11-16 + +### Changed + +- Reordered the parameters when creating a message to have the protocol last, +as its the least likely to need to be changed. + + +## 0.1.0 - 2015-06-01 + +### Added + +- Initial release + +### Changed + +- Helpers are renamed to templates diff --git a/vendor/php-http/message-factory/LICENSE b/vendor/php-http/message-factory/LICENSE new file mode 100644 index 000000000..8e2c4a0b8 --- /dev/null +++ b/vendor/php-http/message-factory/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 PHP HTTP Team + +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/vendor/php-http/message-factory/README.md b/vendor/php-http/message-factory/README.md new file mode 100644 index 000000000..4654495a7 --- /dev/null +++ b/vendor/php-http/message-factory/README.md @@ -0,0 +1,36 @@ +# PSR-7 Message Factory + +[![Latest Version](https://img.shields.io/github/release/php-http/message-factory.svg?style=flat-square)](https://github.com/php-http/message-factory/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/message-factory.svg?style=flat-square)](https://packagist.org/packages/php-http/message-factory) + +**Factory interfaces for PSR-7 HTTP Message.** + + +## Install + +Via Composer + +``` bash +$ composer require php-http/message-factory +``` + + +## Documentation + +Please see the [official documentation](http://php-http.readthedocs.org/en/latest/message-factory/). + + +## Contributing + +Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details. + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/message-factory/composer.json b/vendor/php-http/message-factory/composer.json new file mode 100644 index 000000000..7c72febe5 --- /dev/null +++ b/vendor/php-http/message-factory/composer.json @@ -0,0 +1,27 @@ +{ + "name": "php-http/message-factory", + "description": "Factory interfaces for PSR-7 HTTP Message", + "license": "MIT", + "keywords": ["http", "factory", "message", "stream", "uri"], + "homepage": "http://php-http.org", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": ">=5.4", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + } +} diff --git a/vendor/php-http/message-factory/puli.json b/vendor/php-http/message-factory/puli.json new file mode 100644 index 000000000..08d37627d --- /dev/null +++ b/vendor/php-http/message-factory/puli.json @@ -0,0 +1,43 @@ +{ + "version": "1.0", + "binding-types": { + "Http\\Message\\MessageFactory": { + "description": "PSR-7 Message Factory", + "parameters": { + "depends": { + "description": "Optional class dependency which can be checked by consumers" + } + } + }, + "Http\\Message\\RequestFactory": { + "parameters": { + "depends": { + "description": "Optional class dependency which can be checked by consumers" + } + } + }, + "Http\\Message\\ResponseFactory": { + "parameters": { + "depends": { + "description": "Optional class dependency which can be checked by consumers" + } + } + }, + "Http\\Message\\StreamFactory": { + "description": "PSR-7 Stream Factory", + "parameters": { + "depends": { + "description": "Optional class dependency which can be checked by consumers" + } + } + }, + "Http\\Message\\UriFactory": { + "description": "PSR-7 URI Factory", + "parameters": { + "depends": { + "description": "Optional class dependency which can be checked by consumers" + } + } + } + } +} diff --git a/vendor/php-http/message-factory/src/MessageFactory.php b/vendor/php-http/message-factory/src/MessageFactory.php new file mode 100644 index 000000000..965aaa804 --- /dev/null +++ b/vendor/php-http/message-factory/src/MessageFactory.php @@ -0,0 +1,12 @@ + + */ +interface MessageFactory extends RequestFactory, ResponseFactory +{ +} diff --git a/vendor/php-http/message-factory/src/RequestFactory.php b/vendor/php-http/message-factory/src/RequestFactory.php new file mode 100644 index 000000000..624e82f36 --- /dev/null +++ b/vendor/php-http/message-factory/src/RequestFactory.php @@ -0,0 +1,34 @@ + + */ +interface RequestFactory +{ + /** + * Creates a new PSR-7 request. + * + * @param string $method + * @param string|UriInterface $uri + * @param array $headers + * @param resource|string|StreamInterface|null $body + * @param string $protocolVersion + * + * @return RequestInterface + */ + public function createRequest( + $method, + $uri, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ); +} diff --git a/vendor/php-http/message-factory/src/ResponseFactory.php b/vendor/php-http/message-factory/src/ResponseFactory.php new file mode 100644 index 000000000..2411ed3a1 --- /dev/null +++ b/vendor/php-http/message-factory/src/ResponseFactory.php @@ -0,0 +1,35 @@ + + */ +interface ResponseFactory +{ + /** + * Creates a new PSR-7 response. + * + * @param int $statusCode + * @param string|null $reasonPhrase + * @param array $headers + * @param resource|string|StreamInterface|null $body + * @param string $protocolVersion + * + * @return ResponseInterface + */ + public function createResponse( + $statusCode = 200, + $reasonPhrase = null, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ); +} diff --git a/vendor/php-http/message-factory/src/StreamFactory.php b/vendor/php-http/message-factory/src/StreamFactory.php new file mode 100644 index 000000000..327a902f9 --- /dev/null +++ b/vendor/php-http/message-factory/src/StreamFactory.php @@ -0,0 +1,25 @@ + + */ +interface StreamFactory +{ + /** + * Creates a new PSR-7 stream. + * + * @param string|resource|StreamInterface|null $body + * + * @return StreamInterface + * + * @throws \InvalidArgumentException If the stream body is invalid. + * @throws \RuntimeException If creating the stream from $body fails. + */ + public function createStream($body = null); +} diff --git a/vendor/php-http/message-factory/src/UriFactory.php b/vendor/php-http/message-factory/src/UriFactory.php new file mode 100644 index 000000000..f05e62521 --- /dev/null +++ b/vendor/php-http/message-factory/src/UriFactory.php @@ -0,0 +1,24 @@ + + */ +interface UriFactory +{ + /** + * Creates an PSR-7 URI. + * + * @param string|UriInterface $uri + * + * @return UriInterface + * + * @throws \InvalidArgumentException If the $uri argument can not be converted into a valid URI. + */ + public function createUri($uri); +} diff --git a/vendor/php-http/message/CHANGELOG.md b/vendor/php-http/message/CHANGELOG.md new file mode 100644 index 000000000..a185f4612 --- /dev/null +++ b/vendor/php-http/message/CHANGELOG.md @@ -0,0 +1,254 @@ +# Change Log + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.13.0] - 2022-02-11 + +- Added `Formatter::formatResponseForRequest()` to allow the formatter to get context from the request to decide what of the response to output. +- Deprecated `Formatter::formatResponse()` in favor of the new `formatResponseForRequest` method. + +## [1.12.0] - 2021-08-29 + +- Added support for adjusting binary detection regex in FullHttpMessageFormatter. + +## [1.11.2] - 2021-08-03 + +- Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleStreamFactory. + +## [1.11.1] - 2021-05-24 + +- Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleUriFactory. + +## [1.11.0] - 2020-02-01 + +- Migrated from `zendframework/zend-diactoros` to `laminas/laminas-diactoros`. + Users are encouraged to update their dependencies by simply replacing the Zend package with the Laminas package. + Due to the [laminas-zendframework-brige](https://github.com/laminas/laminas-zendframework-bridge), BC changes + are not expected and legacy code does not need to be refactored (though it is + [recommended and simple](https://docs.laminas.dev/migration/)). +- The diactoros factories of `php-http/message` will return objects from the `Laminas\Diactoros\` namespace, if + the respective classes are available via autoloading, but continue to return objects from `Zend\Diactoros\` + namespace otherwise. + +- Allow to specify the hashing algorithm for WSSE authentication. + +## [1.10.0] - 2020-11-11 + +- Added support for PHP 8.0. + +## [1.9.1] - 2020-10-13 + +- Improved detection of binary stream to not consider newlines, carriage return or tabs as binary. + +## [1.9.0] - 2020-08-17 + +- Omitted binary body in FullHttpMessageFormatter and CurlCommandFormatter. + `[binary stream omitted]` will be shown instead. + +### Added + +- New Header authentication method for arbitrary header authentication. + +## [1.8.0] - 2019-08-05 + +### Changed + +- Raised minimum PHP version to 7.1 + +### Fixed + +- Fatal error on `CurlCommandFormatter` when body is larger than `escapeshellarg` allowed length. +- Do not read stream in message formatter if stream is not seekable. + +## [1.7.2] - 2018-10-30 + +### Fixed + +- FilteredStream uses `@trigger_error` instead of throwing exceptions to not + break careless users. You still need to fix your stream code to respect + `isSeekable`. Seeking does not work as expected, and we will add exceptions + in version 2. + +## [1.7.1] - 2018-10-29 + +### Fixed + +- FilteredStream is not actually seekable + + +## [1.7.0] - 2018-08-15 + +### Fixed + +- Fix CurlCommandFormatter for binary request payloads +- Fix QueryParam authentication to assemble proper URL regardless of PHP `arg_separator.output` directive +- Do not pass `null` parameters to `Clue\StreamFilter\fun` + +### Changed + +- Dropped tests on HHVM + + +## [1.6.0] - 2017-07-05 + +### Added + +- CookieUtil::parseDate to create a date from cookie date string + +### Fixed + +- Fix curl command of CurlFormatter when there is an user-agent header + + +## [1.5.0] - 2017-02-14 + +### Added + +- Check for empty string in Stream factories +- Cookie::createWithoutValidation Static constructor to create a cookie. Will not perform any attribute validation during instantiation. +- Cookie::isValid Method to check if cookie attributes are valid. + +### Fixed + +- FilteredStream::getSize returns null because the contents size is unknown. +- Stream factories does not rewinds streams. The previous behavior was not coherent between factories and inputs. + +### Deprecated + +- FilteredStream::getReadFilter The read filter is internal and should never be used by consuming code. +- FilteredStream::getWriteFilter We did not implement writing to the streams at all. And if we do, the filter is an internal information and should not be used by consuming code. + + +## [1.4.1] - 2016-12-16 + +### Fixed + +- Cookie::matchPath Cookie with root path (`/`) will not match sub path (e.g. `/cookie`). + + +## [1.4.0] - 2016-10-20 + +### Added + +- Message, stream and URI factories for [Slim Framework](https://github.com/slimphp/Slim) +- BufferedStream that allow you to decorate a non-seekable stream with a seekable one. +- cUrlFormatter to be able to redo the request with a cURL command + + +## [1.3.1] - 2016-07-15 + +### Fixed + +- FullHttpMessageFormatter will not read from streams that you cannot rewind (non-seekable) +- FullHttpMessageFormatter will not read from the stream if $maxBodyLength is zero +- FullHttpMessageFormatter rewinds streams after they are read + + +## [1.3.0] - 2016-07-14 + +### Added + +- FullHttpMessageFormatter to include headers and body in the formatted message + +### Fixed + +- #41: Response builder broke header value + + +## [1.2.0] - 2016-03-29 + +### Added + +- The RequestMatcher is built after the Symfony RequestMatcher and separates + scheme, host and path expressions and provides an option to filter on the + method +- New RequestConditional authentication method using request matchers +- Add automatic basic auth info detection based on the URL + +### Changed + +- Improved ResponseBuilder + +### Deprecated + +- RegexRequestMatcher, use RequestMatcher instead +- Matching authenitcation method, use RequestConditional instead + + +## [1.1.0] - 2016-02-25 + +### Added + + - Add a request matcher interface and regex implementation + - Add a callback request matcher implementation + - Add a ResponseBuilder, to create PSR7 Response from a string + +### Fixed + + - Fix casting string on a FilteredStream not filtering the output + + +## [1.0.0] - 2016-01-27 + + +## [0.2.0] - 2015-12-29 + +### Added + +- Autoregistration of stream filters using Composer autoload +- Cookie +- [Apigen](http://www.apigen.org/) configuration + + +## [0.1.2] - 2015-12-26 + +### Added + +- Request and response factory bindings + +### Fixed + +- Chunk filter namespace in Dechunk stream + + +## [0.1.1] - 2015-12-25 + +### Added + +- Formatter + + +## 0.1.0 - 2015-12-24 + +### Added + +- Authentication +- Encoding +- Message decorator +- Message factory (Guzzle, Diactoros) + + +[Unreleased]: https://github.com/php-http/message/compare/1.10.0...HEAD +[1.10.0]: https://github.com/php-http/message/compare/1.9.1...1.10.0 +[1.9.1]: https://github.com/php-http/message/compare/1.9.0...1.9.1 +[1.9.0]: https://github.com/php-http/message/compare/1.8.0...1.9.0 +[1.8.0]: https://github.com/php-http/message/compare/1.7.2...1.8.0 +[1.7.2]: https://github.com/php-http/message/compare/v1.7.1...1.7.2 +[1.7.1]: https://github.com/php-http/message/compare/1.7.0...v1.7.1 +[1.7.0]: https://github.com/php-http/message/compare/1.6.0...1.7.0 +[1.6.0]: https://github.com/php-http/message/compare/1.5.0...1.6.0 +[1.5.0]: https://github.com/php-http/message/compare/v1.4.1...1.5.0 +[1.4.1]: https://github.com/php-http/message/compare/v1.4.0...v1.4.1 +[1.4.0]: https://github.com/php-http/message/compare/v1.3.1...v1.4.0 +[1.3.1]: https://github.com/php-http/message/compare/v1.3.0...v1.3.1 +[1.3.0]: https://github.com/php-http/message/compare/v1.2.0...v1.3.0 +[1.2.0]: https://github.com/php-http/message/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/php-http/message/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/php-http/message/compare/0.2.0...v1.0.0 +[0.2.0]: https://github.com/php-http/message/compare/v0.1.2...0.2.0 +[0.1.2]: https://github.com/php-http/message/compare/v0.1.1...v0.1.2 +[0.1.1]: https://github.com/php-http/message/compare/v0.1.0...v0.1.1 diff --git a/vendor/php-http/message/LICENSE b/vendor/php-http/message/LICENSE new file mode 100644 index 000000000..4558d6f06 --- /dev/null +++ b/vendor/php-http/message/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 PHP HTTP Team + +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/vendor/php-http/message/README.md b/vendor/php-http/message/README.md new file mode 100644 index 000000000..df1a7d552 --- /dev/null +++ b/vendor/php-http/message/README.md @@ -0,0 +1,51 @@ +# HTTP Message + +[![Latest Version](https://img.shields.io/github/release/php-http/message.svg?style=flat-square)](https://github.com/php-http/message/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/php-http/message/CI?style=flat-square)](https://github.com/php-http/message/actions?query=workflow%3ACI+branch%3Amaster) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/message.svg?style=flat-square)](https://packagist.org/packages/php-http/message) + +**HTTP Message related tools.** + + +## Install + +Via Composer + +``` bash +$ composer require php-http/message +``` + + +## Intro + +This package contains various PSR-7 tools which might be useful in an HTTP workflow: + +- Authentication method implementations +- Various Stream encoding tools +- Message decorators +- Message factory implementations for Guzzle PSR-7 and Diactoros +- Cookie implementation +- Request matchers + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org/en/latest/message.html). + + +## Testing + +``` bash +$ composer test +``` + + +## Credits + +Thanks to [Cuzzle](https://github.com/namshi/cuzzle) for inpiration for the `CurlCommandFormatter`. + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/message/apigen.neon b/vendor/php-http/message/apigen.neon new file mode 100644 index 000000000..0ba1a1850 --- /dev/null +++ b/vendor/php-http/message/apigen.neon @@ -0,0 +1,6 @@ +source: + - src/ + +destination: build/api/ + +templateTheme: bootstrap diff --git a/vendor/php-http/message/composer.json b/vendor/php-http/message/composer.json new file mode 100644 index 000000000..1a614df8d --- /dev/null +++ b/vendor/php-http/message/composer.json @@ -0,0 +1,68 @@ +{ + "name": "php-http/message", + "description": "HTTP Message related tools", + "keywords": [ + "message", + "http", + "psr-7" + ], + "homepage": "http://php-http.org", + "license": "MIT", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": "^7.1 || ^8.0", + "clue/stream-filter": "^1.5", + "php-http/message-factory": "^1.0.2", + "psr/http-message": "^1.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "ergebnis/composer-normalize": "^2.6", + "guzzlehttp/psr7": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "slim/slim": "^3.0", + "laminas/laminas-diactoros": "^2.0" + }, + "suggest": { + "ext-zlib": "Used with compressor/decompressor streams", + "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", + "laminas/laminas-diactoros": "Used with Diactoros Factories", + "slim/slim": "Used with Slim Framework PSR-7 implementation" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "ergebnis/composer-normalize": true + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Message\\": "src/" + }, + "files": [ + "src/filters.php" + ] + }, + "autoload-dev": { + "psr-4": { + "spec\\Http\\Message\\": "spec/" + } + }, + "scripts": { + "test": "vendor/bin/phpspec run", + "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" + } +} diff --git a/vendor/php-http/message/puli.json b/vendor/php-http/message/puli.json new file mode 100644 index 000000000..024a85d9e --- /dev/null +++ b/vendor/php-http/message/puli.json @@ -0,0 +1,111 @@ +{ + "version": "1.0", + "name": "php-http/message", + "bindings": { + "064d003d-78a1-48c4-8f3b-1f92ff25da69": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory", + "type": "Http\\Message\\MessageFactory", + "parameters": { + "depends": "Zend\\Diactoros\\Request" + } + }, + "0836751e-6558-4d1b-8993-4a52012947c3": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\SlimMessageFactory", + "type": "Http\\Message\\ResponseFactory" + }, + "1d127622-dc61-4bfa-b9da-d221548d72c3": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\SlimMessageFactory", + "type": "Http\\Message\\RequestFactory" + }, + "2438c2d0-0658-441f-8855-ddaf0f87d54d": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory", + "type": "Http\\Message\\MessageFactory", + "parameters": { + "depends": "GuzzleHttp\\Psr7\\Request" + } + }, + "253aa08c-d705-46e7-b1d2-e28c97eef792": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory", + "type": "Http\\Message\\RequestFactory", + "parameters": { + "depends": "GuzzleHttp\\Psr7\\Request" + } + }, + "273a34f9-62f4-4ba1-9801-b1284d49ff89": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\StreamFactory\\GuzzleStreamFactory", + "type": "Http\\Message\\StreamFactory", + "parameters": { + "depends": "GuzzleHttp\\Psr7\\Stream" + } + }, + "304b83db-b594-4d83-ae75-1f633adf92f7": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\UriFactory\\GuzzleUriFactory", + "type": "Http\\Message\\UriFactory", + "parameters": { + "depends": "GuzzleHttp\\Psr7\\Uri" + } + }, + "3f4bc1cd-aa95-4702-9fa7-65408e471691": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\UriFactory\\DiactorosUriFactory", + "type": "Http\\Message\\UriFactory", + "parameters": { + "depends": "Zend\\Diactoros\\Uri" + } + }, + "4672a6ee-ad9e-4109-a5d1-b7d46f26c7a1": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\SlimMessageFactory", + "type": "Http\\Message\\MessageFactory" + }, + "6234e947-d3bd-43eb-97d5-7f9e22e6bb1b": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory", + "type": "Http\\Message\\ResponseFactory", + "parameters": { + "depends": "Zend\\Diactoros\\Response" + } + }, + "6a9ad6ce-d82c-470f-8e30-60f21d9d95bf": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\UriFactory\\SlimUriFactory", + "type": "Http\\Message\\UriFactory" + }, + "72c2afa0-ea56-4d03-adb6-a9f241a8a734": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\StreamFactory\\SlimStreamFactory", + "type": "Http\\Message\\StreamFactory" + }, + "95c1be8f-39fe-4abd-8351-92cb14379a75": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\StreamFactory\\DiactorosStreamFactory", + "type": "Http\\Message\\StreamFactory", + "parameters": { + "depends": "Zend\\Diactoros\\Stream" + } + }, + "a018af27-7590-4dcf-83a1-497f95604cd6": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\GuzzleMessageFactory", + "type": "Http\\Message\\ResponseFactory", + "parameters": { + "depends": "GuzzleHttp\\Psr7\\Response" + } + }, + "c07955b1-de46-43db-923b-d07fae9382cb": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Message\\MessageFactory\\DiactorosMessageFactory", + "type": "Http\\Message\\RequestFactory", + "parameters": { + "depends": "Zend\\Diactoros\\Request" + } + } + } +} diff --git a/vendor/php-http/message/src/Authentication.php b/vendor/php-http/message/src/Authentication.php new file mode 100644 index 000000000..0fe0cb3ab --- /dev/null +++ b/vendor/php-http/message/src/Authentication.php @@ -0,0 +1,25 @@ + + */ +interface Authentication +{ + /** + * Alter the request to add the authentication credentials. + * + * To do that, the implementation might use pre-stored credentials or do + * separate HTTP requests to obtain a valid token. + * + * @param RequestInterface $request The request without authentication information + * + * @return RequestInterface The request with added authentication information + */ + public function authenticate(RequestInterface $request); +} diff --git a/vendor/php-http/message/src/Authentication/AutoBasicAuth.php b/vendor/php-http/message/src/Authentication/AutoBasicAuth.php new file mode 100644 index 000000000..7b6a42948 --- /dev/null +++ b/vendor/php-http/message/src/Authentication/AutoBasicAuth.php @@ -0,0 +1,48 @@ + + */ +final class AutoBasicAuth implements Authentication +{ + /** + * Whether user info should be removed from the URI. + * + * @var bool + */ + private $shouldRemoveUserInfo; + + /** + * @param bool|true $shouldRremoveUserInfo + */ + public function __construct($shouldRremoveUserInfo = true) + { + $this->shouldRemoveUserInfo = (bool) $shouldRremoveUserInfo; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $uri = $request->getUri(); + $userInfo = $uri->getUserInfo(); + + if (!empty($userInfo)) { + if ($this->shouldRemoveUserInfo) { + $request = $request->withUri($uri->withUserInfo('')); + } + + $request = $request->withHeader('Authorization', sprintf('Basic %s', base64_encode($userInfo))); + } + + return $request; + } +} diff --git a/vendor/php-http/message/src/Authentication/BasicAuth.php b/vendor/php-http/message/src/Authentication/BasicAuth.php new file mode 100644 index 000000000..23618a53c --- /dev/null +++ b/vendor/php-http/message/src/Authentication/BasicAuth.php @@ -0,0 +1,44 @@ + + */ +final class BasicAuth implements Authentication +{ + /** + * @var string + */ + private $username; + + /** + * @var string + */ + private $password; + + /** + * @param string $username + * @param string $password + */ + public function __construct($username, $password) + { + $this->username = $username; + $this->password = $password; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $header = sprintf('Basic %s', base64_encode(sprintf('%s:%s', $this->username, $this->password))); + + return $request->withHeader('Authorization', $header); + } +} diff --git a/vendor/php-http/message/src/Authentication/Bearer.php b/vendor/php-http/message/src/Authentication/Bearer.php new file mode 100644 index 000000000..a8fb21a14 --- /dev/null +++ b/vendor/php-http/message/src/Authentication/Bearer.php @@ -0,0 +1,37 @@ + + */ +final class Bearer implements Authentication +{ + /** + * @var string + */ + private $token; + + /** + * @param string $token + */ + public function __construct($token) + { + $this->token = $token; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $header = sprintf('Bearer %s', $this->token); + + return $request->withHeader('Authorization', $header); + } +} diff --git a/vendor/php-http/message/src/Authentication/Chain.php b/vendor/php-http/message/src/Authentication/Chain.php new file mode 100644 index 000000000..71002bb17 --- /dev/null +++ b/vendor/php-http/message/src/Authentication/Chain.php @@ -0,0 +1,47 @@ + + */ +final class Chain implements Authentication +{ + /** + * @var Authentication[] + */ + private $authenticationChain = []; + + /** + * @param Authentication[] $authenticationChain + */ + public function __construct(array $authenticationChain = []) + { + foreach ($authenticationChain as $authentication) { + if (!$authentication instanceof Authentication) { + throw new \InvalidArgumentException( + 'Members of the authentication chain must be of type Http\Message\Authentication' + ); + } + } + + $this->authenticationChain = $authenticationChain; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + foreach ($this->authenticationChain as $authentication) { + $request = $authentication->authenticate($request); + } + + return $request; + } +} diff --git a/vendor/php-http/message/src/Authentication/Header.php b/vendor/php-http/message/src/Authentication/Header.php new file mode 100644 index 000000000..77f638275 --- /dev/null +++ b/vendor/php-http/message/src/Authentication/Header.php @@ -0,0 +1,36 @@ +name = $name; + $this->value = $value; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + return $request->withHeader($this->name, $this->value); + } +} diff --git a/vendor/php-http/message/src/Authentication/Matching.php b/vendor/php-http/message/src/Authentication/Matching.php new file mode 100644 index 000000000..7a5c247be --- /dev/null +++ b/vendor/php-http/message/src/Authentication/Matching.php @@ -0,0 +1,69 @@ + + * + * @deprecated since since version 1.2, and will be removed in 2.0. Use {@link RequestConditional} instead. + */ +final class Matching implements Authentication +{ + /** + * @var Authentication + */ + private $authentication; + + /** + * @var CallbackRequestMatcher + */ + private $matcher; + + public function __construct(Authentication $authentication, callable $matcher = null) + { + if (is_null($matcher)) { + $matcher = function () { + return true; + }; + } + + $this->authentication = $authentication; + $this->matcher = new CallbackRequestMatcher($matcher); + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + if ($this->matcher->matches($request)) { + return $this->authentication->authenticate($request); + } + + return $request; + } + + /** + * Creates a matching authentication for an URL. + * + * @param string $url + * + * @return self + */ + public static function createUrlMatcher(Authentication $authentication, $url) + { + $matcher = function (RequestInterface $request) use ($url) { + return preg_match($url, $request->getRequestTarget()); + }; + + return new static($authentication, $matcher); + } +} diff --git a/vendor/php-http/message/src/Authentication/QueryParam.php b/vendor/php-http/message/src/Authentication/QueryParam.php new file mode 100644 index 000000000..243efef3f --- /dev/null +++ b/vendor/php-http/message/src/Authentication/QueryParam.php @@ -0,0 +1,47 @@ + + */ +final class QueryParam implements Authentication +{ + /** + * @var array + */ + private $params = []; + + public function __construct(array $params) + { + $this->params = $params; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $uri = $request->getUri(); + $query = $uri->getQuery(); + $params = []; + + parse_str($query, $params); + + $params = array_merge($params, $this->params); + + $query = http_build_query($params, '', '&'); + + $uri = $uri->withQuery($query); + + return $request->withUri($uri); + } +} diff --git a/vendor/php-http/message/src/Authentication/RequestConditional.php b/vendor/php-http/message/src/Authentication/RequestConditional.php new file mode 100644 index 000000000..01062cf69 --- /dev/null +++ b/vendor/php-http/message/src/Authentication/RequestConditional.php @@ -0,0 +1,43 @@ + + */ +final class RequestConditional implements Authentication +{ + /** + * @var RequestMatcher + */ + private $requestMatcher; + + /** + * @var Authentication + */ + private $authentication; + + public function __construct(RequestMatcher $requestMatcher, Authentication $authentication) + { + $this->requestMatcher = $requestMatcher; + $this->authentication = $authentication; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + if ($this->requestMatcher->matches($request)) { + return $this->authentication->authenticate($request); + } + + return $request; + } +} diff --git a/vendor/php-http/message/src/Authentication/Wsse.php b/vendor/php-http/message/src/Authentication/Wsse.php new file mode 100644 index 000000000..f343633de --- /dev/null +++ b/vendor/php-http/message/src/Authentication/Wsse.php @@ -0,0 +1,68 @@ + + */ +final class Wsse implements Authentication +{ + /** + * @var string + */ + private $username; + + /** + * @var string + */ + private $password; + + /** + * @var string + */ + private $hashAlgorithm; + + /** + * @param string $username + * @param string $password + * @param string $hashAlgorithm To use a better hashing algorithm than the weak sha1, pass the algorithm to use, e.g. "sha512" + */ + public function __construct($username, $password, $hashAlgorithm = 'sha1') + { + $this->username = $username; + $this->password = $password; + if (false === in_array($hashAlgorithm, hash_algos())) { + throw new InvalidArgumentException(sprintf('Unaccepted hashing algorithm: %s', $hashAlgorithm)); + } + $this->hashAlgorithm = $hashAlgorithm; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestInterface $request) + { + $nonce = substr(md5(uniqid(uniqid().'_', true)), 0, 16); + $created = date('c'); + $digest = base64_encode(hash($this->hashAlgorithm, base64_decode($nonce).$created.$this->password, true)); + + $wsse = sprintf( + 'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"', + $this->username, + $digest, + $nonce, + $created + ); + + return $request + ->withHeader('Authorization', 'WSSE profile="UsernameToken"') + ->withHeader('X-WSSE', $wsse) + ; + } +} diff --git a/vendor/php-http/message/src/Builder/ResponseBuilder.php b/vendor/php-http/message/src/Builder/ResponseBuilder.php new file mode 100644 index 000000000..4c3ecfc4f --- /dev/null +++ b/vendor/php-http/message/src/Builder/ResponseBuilder.php @@ -0,0 +1,146 @@ +response = $response; + } + + /** + * Return response. + * + * @return ResponseInterface + */ + public function getResponse() + { + return $this->response; + } + + /** + * Add headers represented by an array of header lines. + * + * @param string[] $headers response headers as array of header lines + * + * @return $this + * + * @throws \UnexpectedValueException for invalid header values + * @throws \InvalidArgumentException for invalid status code arguments + */ + public function setHeadersFromArray(array $headers) + { + $status = array_shift($headers); + $this->setStatus($status); + + foreach ($headers as $headerLine) { + $headerLine = trim($headerLine); + if ('' === $headerLine) { + continue; + } + + $this->addHeader($headerLine); + } + + return $this; + } + + /** + * Add headers represented by a single string. + * + * @param string $headers response headers as single string + * + * @return $this + * + * @throws \InvalidArgumentException if $headers is not a string on object with __toString() + * @throws \UnexpectedValueException for invalid header values + */ + public function setHeadersFromString($headers) + { + if (!(is_string($headers) + || (is_object($headers) && method_exists($headers, '__toString'))) + ) { + throw new \InvalidArgumentException( + sprintf( + '%s expects parameter 1 to be a string, %s given', + __METHOD__, + is_object($headers) ? get_class($headers) : gettype($headers) + ) + ); + } + + $this->setHeadersFromArray(explode("\r\n", $headers)); + + return $this; + } + + /** + * Set response status from a status string. + * + * @param string $statusLine response status as a string + * + * @return $this + * + * @throws \InvalidArgumentException for invalid status line + */ + public function setStatus($statusLine) + { + $parts = explode(' ', $statusLine, 3); + if (count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) { + throw new \InvalidArgumentException( + sprintf('"%s" is not a valid HTTP status line', $statusLine) + ); + } + + $reasonPhrase = count($parts) > 2 ? $parts[2] : ''; + $this->response = $this->response + ->withStatus((int) $parts[1], $reasonPhrase) + ->withProtocolVersion(substr($parts[0], 5)); + + return $this; + } + + /** + * Add header represented by a string. + * + * @param string $headerLine response header as a string + * + * @return $this + * + * @throws \InvalidArgumentException for invalid header names or values + */ + public function addHeader($headerLine) + { + $parts = explode(':', $headerLine, 2); + if (2 !== count($parts)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not a valid HTTP header line', $headerLine) + ); + } + $name = trim($parts[0]); + $value = trim($parts[1]); + if ($this->response->hasHeader($name)) { + $this->response = $this->response->withAddedHeader($name, $value); + } else { + $this->response = $this->response->withHeader($name, $value); + } + + return $this; + } +} diff --git a/vendor/php-http/message/src/Cookie.php b/vendor/php-http/message/src/Cookie.php new file mode 100644 index 000000000..0cc2d43c4 --- /dev/null +++ b/vendor/php-http/message/src/Cookie.php @@ -0,0 +1,524 @@ + + * + * @see http://tools.ietf.org/search/rfc6265 + */ +final class Cookie +{ + /** + * @var string + */ + private $name; + + /** + * @var string|null + */ + private $value; + + /** + * @var int|null + */ + private $maxAge; + + /** + * @var string|null + */ + private $domain; + + /** + * @var string + */ + private $path; + + /** + * @var bool + */ + private $secure; + + /** + * @var bool + */ + private $httpOnly; + + /** + * Expires attribute is HTTP 1.0 only and should be avoided. + * + * @var \DateTime|null + */ + private $expires; + + /** + * @param string $name + * @param string|null $value + * @param int|null $maxAge + * @param string|null $domain + * @param string|null $path + * @param bool $secure + * @param bool $httpOnly + * @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided. + * + * @throws \InvalidArgumentException if name, value or max age is not valid + */ + public function __construct( + $name, + $value = null, + $maxAge = null, + $domain = null, + $path = null, + $secure = false, + $httpOnly = false, + \DateTime $expires = null + ) { + $this->validateName($name); + $this->validateValue($value); + $this->validateMaxAge($maxAge); + + $this->name = $name; + $this->value = $value; + $this->maxAge = $maxAge; + $this->expires = $expires; + $this->domain = $this->normalizeDomain($domain); + $this->path = $this->normalizePath($path); + $this->secure = (bool) $secure; + $this->httpOnly = (bool) $httpOnly; + } + + /** + * Creates a new cookie without any attribute validation. + * + * @param string $name + * @param string|null $value + * @param int $maxAge + * @param string|null $domain + * @param string|null $path + * @param bool $secure + * @param bool $httpOnly + * @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided. + */ + public static function createWithoutValidation( + $name, + $value = null, + $maxAge = null, + $domain = null, + $path = null, + $secure = false, + $httpOnly = false, + \DateTime $expires = null + ) { + $cookie = new self('name', null, null, $domain, $path, $secure, $httpOnly, $expires); + $cookie->name = $name; + $cookie->value = $value; + $cookie->maxAge = $maxAge; + + return $cookie; + } + + /** + * Returns the name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Returns the value. + * + * @return string|null + */ + public function getValue() + { + return $this->value; + } + + /** + * Checks if there is a value. + * + * @return bool + */ + public function hasValue() + { + return isset($this->value); + } + + /** + * Sets the value. + * + * @param string|null $value + * + * @return Cookie + */ + public function withValue($value) + { + $this->validateValue($value); + + $new = clone $this; + $new->value = $value; + + return $new; + } + + /** + * Returns the max age. + * + * @return int|null + */ + public function getMaxAge() + { + return $this->maxAge; + } + + /** + * Checks if there is a max age. + * + * @return bool + */ + public function hasMaxAge() + { + return isset($this->maxAge); + } + + /** + * Sets the max age. + * + * @param int|null $maxAge + * + * @return Cookie + */ + public function withMaxAge($maxAge) + { + $this->validateMaxAge($maxAge); + + $new = clone $this; + $new->maxAge = $maxAge; + + return $new; + } + + /** + * Returns the expiration time. + * + * @return \DateTime|null + */ + public function getExpires() + { + return $this->expires; + } + + /** + * Checks if there is an expiration time. + * + * @return bool + */ + public function hasExpires() + { + return isset($this->expires); + } + + /** + * Sets the expires. + * + * @return Cookie + */ + public function withExpires(\DateTime $expires = null) + { + $new = clone $this; + $new->expires = $expires; + + return $new; + } + + /** + * Checks if the cookie is expired. + * + * @return bool + */ + public function isExpired() + { + return isset($this->expires) and $this->expires < new \DateTime(); + } + + /** + * Returns the domain. + * + * @return string|null + */ + public function getDomain() + { + return $this->domain; + } + + /** + * Checks if there is a domain. + * + * @return bool + */ + public function hasDomain() + { + return isset($this->domain); + } + + /** + * Sets the domain. + * + * @param string|null $domain + * + * @return Cookie + */ + public function withDomain($domain) + { + $new = clone $this; + $new->domain = $this->normalizeDomain($domain); + + return $new; + } + + /** + * Checks whether this cookie is meant for this domain. + * + * @see http://tools.ietf.org/html/rfc6265#section-5.1.3 + * + * @param string $domain + * + * @return bool + */ + public function matchDomain($domain) + { + // Domain is not set or exact match + if (!$this->hasDomain() || 0 === strcasecmp($domain, $this->domain)) { + return true; + } + + // Domain is not an IP address + if (filter_var($domain, FILTER_VALIDATE_IP)) { + return false; + } + + return (bool) preg_match(sprintf('/\b%s$/i', preg_quote($this->domain)), $domain); + } + + /** + * Returns the path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Sets the path. + * + * @param string|null $path + * + * @return Cookie + */ + public function withPath($path) + { + $new = clone $this; + $new->path = $this->normalizePath($path); + + return $new; + } + + /** + * Checks whether this cookie is meant for this path. + * + * @see http://tools.ietf.org/html/rfc6265#section-5.1.4 + * + * @param string $path + * + * @return bool + */ + public function matchPath($path) + { + return $this->path === $path || (0 === strpos($path, rtrim($this->path, '/').'/')); + } + + /** + * Checks whether this cookie may only be sent over HTTPS. + * + * @return bool + */ + public function isSecure() + { + return $this->secure; + } + + /** + * Sets whether this cookie should only be sent over HTTPS. + * + * @param bool $secure + * + * @return Cookie + */ + public function withSecure($secure) + { + $new = clone $this; + $new->secure = (bool) $secure; + + return $new; + } + + /** + * Check whether this cookie may not be accessed through Javascript. + * + * @return bool + */ + public function isHttpOnly() + { + return $this->httpOnly; + } + + /** + * Sets whether this cookie may not be accessed through Javascript. + * + * @param bool $httpOnly + * + * @return Cookie + */ + public function withHttpOnly($httpOnly) + { + $new = clone $this; + $new->httpOnly = (bool) $httpOnly; + + return $new; + } + + /** + * Checks if this cookie represents the same cookie as $cookie. + * + * This does not compare the values, only name, domain and path. + * + * @param Cookie $cookie + * + * @return bool + */ + public function match(self $cookie) + { + return $this->name === $cookie->name && $this->domain === $cookie->domain and $this->path === $cookie->path; + } + + /** + * Validates cookie attributes. + * + * @return bool + */ + public function isValid() + { + try { + $this->validateName($this->name); + $this->validateValue($this->value); + $this->validateMaxAge($this->maxAge); + } catch (\InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Validates the name attribute. + * + * @see http://tools.ietf.org/search/rfc2616#section-2.2 + * + * @param string $name + * + * @throws \InvalidArgumentException if the name is empty or contains invalid characters + */ + private function validateName($name) + { + if (strlen($name) < 1) { + throw new \InvalidArgumentException('The name cannot be empty'); + } + + // Name attribute is a token as per spec in RFC 2616 + if (preg_match('/[\x00-\x20\x22\x28-\x29\x2C\x2F\x3A-\x40\x5B-\x5D\x7B\x7D\x7F]/', $name)) { + throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); + } + } + + /** + * Validates a value. + * + * @see http://tools.ietf.org/html/rfc6265#section-4.1.1 + * + * @param string|null $value + * + * @throws \InvalidArgumentException if the value contains invalid characters + */ + private function validateValue($value) + { + if (isset($value)) { + if (preg_match('/[^\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/', $value)) { + throw new \InvalidArgumentException(sprintf('The cookie value "%s" contains invalid characters.', $value)); + } + } + } + + /** + * Validates a Max-Age attribute. + * + * @param int|null $maxAge + * + * @throws \InvalidArgumentException if the Max-Age is not an empty or integer value + */ + private function validateMaxAge($maxAge) + { + if (isset($maxAge)) { + if (!is_int($maxAge)) { + throw new \InvalidArgumentException('Max-Age must be integer'); + } + } + } + + /** + * Remove the leading '.' and lowercase the domain as per spec in RFC 6265. + * + * @see http://tools.ietf.org/html/rfc6265#section-4.1.2.3 + * @see http://tools.ietf.org/html/rfc6265#section-5.1.3 + * @see http://tools.ietf.org/html/rfc6265#section-5.2.3 + * + * @param string|null $domain + * + * @return string + */ + private function normalizeDomain($domain) + { + if (isset($domain)) { + $domain = ltrim(strtolower($domain), '.'); + } + + return $domain; + } + + /** + * Processes path as per spec in RFC 6265. + * + * @see http://tools.ietf.org/html/rfc6265#section-5.1.4 + * @see http://tools.ietf.org/html/rfc6265#section-5.2.4 + * + * @param string|null $path + * + * @return string + */ + private function normalizePath($path) + { + $path = rtrim($path, '/'); + + if (empty($path) or '/' !== substr($path, 0, 1)) { + $path = '/'; + } + + return $path; + } +} diff --git a/vendor/php-http/message/src/CookieJar.php b/vendor/php-http/message/src/CookieJar.php new file mode 100644 index 000000000..914ad9797 --- /dev/null +++ b/vendor/php-http/message/src/CookieJar.php @@ -0,0 +1,212 @@ + + */ +final class CookieJar implements \Countable, \IteratorAggregate +{ + /** + * @var \SplObjectStorage + */ + private $cookies; + + public function __construct() + { + $this->cookies = new \SplObjectStorage(); + } + + /** + * Checks if there is a cookie. + * + * @return bool + */ + public function hasCookie(Cookie $cookie) + { + return $this->cookies->contains($cookie); + } + + /** + * Adds a cookie. + */ + public function addCookie(Cookie $cookie) + { + if (!$this->hasCookie($cookie)) { + $cookies = $this->getMatchingCookies($cookie); + + foreach ($cookies as $matchingCookie) { + if ($cookie->getValue() !== $matchingCookie->getValue() || $cookie->getMaxAge() > $matchingCookie->getMaxAge()) { + $this->removeCookie($matchingCookie); + + continue; + } + } + + if ($cookie->hasValue()) { + $this->cookies->attach($cookie); + } + } + } + + /** + * Removes a cookie. + */ + public function removeCookie(Cookie $cookie) + { + $this->cookies->detach($cookie); + } + + /** + * Returns the cookies. + * + * @return Cookie[] + */ + public function getCookies() + { + $match = function ($matchCookie) { + return true; + }; + + return $this->findMatchingCookies($match); + } + + /** + * Returns all matching cookies. + * + * @return Cookie[] + */ + public function getMatchingCookies(Cookie $cookie) + { + $match = function ($matchCookie) use ($cookie) { + return $matchCookie->match($cookie); + }; + + return $this->findMatchingCookies($match); + } + + /** + * Finds matching cookies based on a callable. + * + * @return Cookie[] + */ + private function findMatchingCookies(callable $match) + { + $cookies = []; + + foreach ($this->cookies as $cookie) { + if ($match($cookie)) { + $cookies[] = $cookie; + } + } + + return $cookies; + } + + /** + * Checks if there are cookies. + * + * @return bool + */ + public function hasCookies() + { + return $this->cookies->count() > 0; + } + + /** + * Sets the cookies and removes any previous one. + * + * @param Cookie[] $cookies + */ + public function setCookies(array $cookies) + { + $this->clear(); + $this->addCookies($cookies); + } + + /** + * Adds some cookies. + * + * @param Cookie[] $cookies + */ + public function addCookies(array $cookies) + { + foreach ($cookies as $cookie) { + $this->addCookie($cookie); + } + } + + /** + * Removes some cookies. + * + * @param Cookie[] $cookies + */ + public function removeCookies(array $cookies) + { + foreach ($cookies as $cookie) { + $this->removeCookie($cookie); + } + } + + /** + * Removes cookies which match the given parameters. + * + * Null means that parameter should not be matched + * + * @param string|null $name + * @param string|null $domain + * @param string|null $path + */ + public function removeMatchingCookies($name = null, $domain = null, $path = null) + { + $match = function ($cookie) use ($name, $domain, $path) { + $match = true; + + if (isset($name)) { + $match = $match && ($cookie->getName() === $name); + } + + if (isset($domain)) { + $match = $match && $cookie->matchDomain($domain); + } + + if (isset($path)) { + $match = $match && $cookie->matchPath($path); + } + + return $match; + }; + + $cookies = $this->findMatchingCookies($match); + + $this->removeCookies($cookies); + } + + /** + * Removes all cookies. + */ + public function clear() + { + $this->cookies = new \SplObjectStorage(); + } + + /** + * {@inheritdoc} + */ + #[\ReturnTypeWillChange] + public function count() + { + return $this->cookies->count(); + } + + /** + * {@inheritdoc} + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return clone $this->cookies; + } +} diff --git a/vendor/php-http/message/src/CookieUtil.php b/vendor/php-http/message/src/CookieUtil.php new file mode 100644 index 000000000..44c53145e --- /dev/null +++ b/vendor/php-http/message/src/CookieUtil.php @@ -0,0 +1,53 @@ + + */ +trait MessageDecorator +{ + /** + * @var MessageInterface + */ + private $message; + + /** + * Returns the decorated message. + * + * Since the underlying Message is immutable as well + * exposing it is not an issue, because it's state cannot be altered + * + * @return MessageInterface + */ + public function getMessage() + { + return $this->message; + } + + /** + * {@inheritdoc} + */ + public function getProtocolVersion() + { + return $this->message->getProtocolVersion(); + } + + /** + * {@inheritdoc} + */ + public function withProtocolVersion($version) + { + $new = clone $this; + $new->message = $this->message->withProtocolVersion($version); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getHeaders() + { + return $this->message->getHeaders(); + } + + /** + * {@inheritdoc} + */ + public function hasHeader($header) + { + return $this->message->hasHeader($header); + } + + /** + * {@inheritdoc} + */ + public function getHeader($header) + { + return $this->message->getHeader($header); + } + + /** + * {@inheritdoc} + */ + public function getHeaderLine($header) + { + return $this->message->getHeaderLine($header); + } + + /** + * {@inheritdoc} + */ + public function withHeader($header, $value) + { + $new = clone $this; + $new->message = $this->message->withHeader($header, $value); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withAddedHeader($header, $value) + { + $new = clone $this; + $new->message = $this->message->withAddedHeader($header, $value); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutHeader($header) + { + $new = clone $this; + $new->message = $this->message->withoutHeader($header); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getBody() + { + return $this->message->getBody(); + } + + /** + * {@inheritdoc} + */ + public function withBody(StreamInterface $body) + { + $new = clone $this; + $new->message = $this->message->withBody($body); + + return $new; + } +} diff --git a/vendor/php-http/message/src/Decorator/RequestDecorator.php b/vendor/php-http/message/src/Decorator/RequestDecorator.php new file mode 100644 index 000000000..bd254a8fc --- /dev/null +++ b/vendor/php-http/message/src/Decorator/RequestDecorator.php @@ -0,0 +1,86 @@ + + */ +trait RequestDecorator +{ + use MessageDecorator { + getMessage as getRequest; + } + + /** + * Exchanges the underlying request with another. + * + * @return self + */ + public function withRequest(RequestInterface $request) + { + $new = clone $this; + $new->message = $request; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getRequestTarget() + { + return $this->message->getRequestTarget(); + } + + /** + * {@inheritdoc} + */ + public function withRequestTarget($requestTarget) + { + $new = clone $this; + $new->message = $this->message->withRequestTarget($requestTarget); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getMethod() + { + return $this->message->getMethod(); + } + + /** + * {@inheritdoc} + */ + public function withMethod($method) + { + $new = clone $this; + $new->message = $this->message->withMethod($method); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getUri() + { + return $this->message->getUri(); + } + + /** + * {@inheritdoc} + */ + public function withUri(UriInterface $uri, $preserveHost = false) + { + $new = clone $this; + $new->message = $this->message->withUri($uri, $preserveHost); + + return $new; + } +} diff --git a/vendor/php-http/message/src/Decorator/ResponseDecorator.php b/vendor/php-http/message/src/Decorator/ResponseDecorator.php new file mode 100644 index 000000000..20319ed31 --- /dev/null +++ b/vendor/php-http/message/src/Decorator/ResponseDecorator.php @@ -0,0 +1,55 @@ + + */ +trait ResponseDecorator +{ + use MessageDecorator { + getMessage as getResponse; + } + + /** + * Exchanges the underlying response with another. + * + * @return self + */ + public function withResponse(ResponseInterface $response) + { + $new = clone $this; + $new->message = $response; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getStatusCode() + { + return $this->message->getStatusCode(); + } + + /** + * {@inheritdoc} + */ + public function withStatus($code, $reasonPhrase = '') + { + $new = clone $this; + $new->message = $this->message->withStatus($code, $reasonPhrase); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getReasonPhrase() + { + return $this->message->getReasonPhrase(); + } +} diff --git a/vendor/php-http/message/src/Decorator/StreamDecorator.php b/vendor/php-http/message/src/Decorator/StreamDecorator.php new file mode 100644 index 000000000..f405c7afe --- /dev/null +++ b/vendor/php-http/message/src/Decorator/StreamDecorator.php @@ -0,0 +1,138 @@ + + */ +trait StreamDecorator +{ + /** + * @var StreamInterface + */ + protected $stream; + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->stream->__toString(); + } + + /** + * {@inheritdoc} + */ + public function close() + { + $this->stream->close(); + } + + /** + * {@inheritdoc} + */ + public function detach() + { + return $this->stream->detach(); + } + + /** + * {@inheritdoc} + */ + public function getSize() + { + return $this->stream->getSize(); + } + + /** + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell(); + } + + /** + * {@inheritdoc} + */ + public function eof() + { + return $this->stream->eof(); + } + + /** + * {@inheritdoc} + */ + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + $this->stream->seek($offset, $whence); + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + $this->stream->rewind(); + } + + /** + * {@inheritdoc} + */ + public function isWritable() + { + return $this->stream->isWritable(); + } + + /** + * {@inheritdoc} + */ + public function write($string) + { + return $this->stream->write($string); + } + + /** + * {@inheritdoc} + */ + public function isReadable() + { + return $this->stream->isReadable(); + } + + /** + * {@inheritdoc} + */ + public function read($length) + { + return $this->stream->read($length); + } + + /** + * {@inheritdoc} + */ + public function getContents() + { + return $this->stream->getContents(); + } + + /** + * {@inheritdoc} + */ + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } +} diff --git a/vendor/php-http/message/src/Encoding/ChunkStream.php b/vendor/php-http/message/src/Encoding/ChunkStream.php new file mode 100644 index 000000000..74c2fbd09 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/ChunkStream.php @@ -0,0 +1,39 @@ + + */ +class ChunkStream extends FilteredStream +{ + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'chunk'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'dechunk'; + } + + /** + * {@inheritdoc} + */ + protected function fill() + { + parent::fill(); + + if ($this->stream->eof()) { + $this->buffer .= "0\r\n\r\n"; + } + } +} diff --git a/vendor/php-http/message/src/Encoding/CompressStream.php b/vendor/php-http/message/src/Encoding/CompressStream.php new file mode 100644 index 000000000..bdb740a91 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/CompressStream.php @@ -0,0 +1,45 @@ + + */ +class CompressStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => 15, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.deflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.inflate'; + } +} diff --git a/vendor/php-http/message/src/Encoding/DechunkStream.php b/vendor/php-http/message/src/Encoding/DechunkStream.php new file mode 100644 index 000000000..4cade835c --- /dev/null +++ b/vendor/php-http/message/src/Encoding/DechunkStream.php @@ -0,0 +1,29 @@ + + */ +class DechunkStream extends FilteredStream +{ + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'dechunk'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'chunk'; + } +} diff --git a/vendor/php-http/message/src/Encoding/DecompressStream.php b/vendor/php-http/message/src/Encoding/DecompressStream.php new file mode 100644 index 000000000..ab3a34543 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/DecompressStream.php @@ -0,0 +1,45 @@ + + */ +class DecompressStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => 15]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15, 'level' => $level]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.inflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.deflate'; + } +} diff --git a/vendor/php-http/message/src/Encoding/DeflateStream.php b/vendor/php-http/message/src/Encoding/DeflateStream.php new file mode 100644 index 000000000..2ab3e0038 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/DeflateStream.php @@ -0,0 +1,41 @@ + + */ +class DeflateStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + parent::__construct($stream, ['window' => -15, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.deflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.inflate'; + } +} diff --git a/vendor/php-http/message/src/Encoding/Filter/Chunk.php b/vendor/php-http/message/src/Encoding/Filter/Chunk.php new file mode 100644 index 000000000..538e27007 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/Filter/Chunk.php @@ -0,0 +1,31 @@ + + */ +class Chunk extends \php_user_filter +{ + /** + * {@inheritdoc} + */ + #[\ReturnTypeWillChange] + public function filter($in, $out, &$consumed, $closing) + { + while ($bucket = stream_bucket_make_writeable($in)) { + $lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n"); + stream_bucket_append($out, $lenbucket); + + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + + $lenbucket = stream_bucket_new($this->stream, "\r\n"); + stream_bucket_append($out, $lenbucket); + } + + return PSFS_PASS_ON; + } +} diff --git a/vendor/php-http/message/src/Encoding/FilteredStream.php b/vendor/php-http/message/src/Encoding/FilteredStream.php new file mode 100644 index 000000000..a937c82f6 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/FilteredStream.php @@ -0,0 +1,234 @@ + + */ +abstract class FilteredStream implements StreamInterface +{ + use StreamDecorator { + rewind as private doRewind; + seek as private doSeek; + } + const BUFFER_SIZE = 8192; + + /** + * @var callable + */ + protected $readFilterCallback; + + /** + * @var resource + * + * @deprecated since version 1.5, will be removed in 2.0 + */ + protected $readFilter; + + /** + * @var callable + * + * @deprecated since version 1.5, will be removed in 2.0 + */ + protected $writeFilterCallback; + + /** + * @var resource + * + * @deprecated since version 1.5, will be removed in 2.0 + */ + protected $writeFilter; + + /** + * Internal buffer. + * + * @var string + */ + protected $buffer = ''; + + /** + * @param mixed|null $readFilterOptions + * @param mixed|null $writeFilterOptions deprecated since 1.5, will be removed in 2.0 + */ + public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null) + { + if (null !== $readFilterOptions) { + $this->readFilterCallback = Filter\fun($this->readFilter(), $readFilterOptions); + } else { + $this->readFilterCallback = Filter\fun($this->readFilter()); + } + + if (null !== $writeFilterOptions) { + $this->writeFilterCallback = Filter\fun($this->writeFilter(), $writeFilterOptions); + + @trigger_error('The $writeFilterOptions argument is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); + } else { + $this->writeFilterCallback = Filter\fun($this->writeFilter()); + } + + $this->stream = $stream; + } + + /** + * {@inheritdoc} + */ + public function read($length) + { + if (strlen($this->buffer) >= $length) { + $read = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + + return $read; + } + + if ($this->stream->eof()) { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + $read = $this->buffer; + $this->buffer = ''; + $this->fill(); + + return $read.$this->read($length - strlen($read)); + } + + /** + * {@inheritdoc} + */ + public function eof() + { + return $this->stream->eof() && '' === $this->buffer; + } + + /** + * Buffer is filled by reading underlying stream. + * + * Callback is reading once more even if the stream is ended. + * This allow to get last data in the PHP buffer otherwise this + * bug is present : https://bugs.php.net/bug.php?id=48725 + */ + protected function fill() + { + $readFilterCallback = $this->readFilterCallback; + $this->buffer .= $readFilterCallback($this->stream->read(self::BUFFER_SIZE)); + + if ($this->stream->eof()) { + $this->buffer .= $readFilterCallback(); + } + } + + /** + * {@inheritdoc} + */ + public function getContents() + { + $buffer = ''; + + while (!$this->eof()) { + $buf = $this->read(self::BUFFER_SIZE); + // Using a loose equality here to match on '' and false. + if (null == $buf) { + break; + } + + $buffer .= $buf; + } + + return $buffer; + } + + /** + * Always returns null because we can't tell the size of a stream when we filter. + */ + public function getSize() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->getContents(); + } + + /** + * Filtered streams are not seekable. + * + * We would need to buffer and process everything to allow seeking. + */ + public function isSeekable() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + @trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED); + $this->doRewind(); + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + @trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED); + $this->doSeek($offset, $whence); + } + + /** + * Returns the read filter name. + * + * @return string + * + * @deprecated since version 1.5, will be removed in 2.0 + */ + public function getReadFilter() + { + @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->readFilter(); + } + + /** + * Returns the write filter name. + * + * @return string + */ + abstract protected function readFilter(); + + /** + * Returns the write filter name. + * + * @return string + * + * @deprecated since version 1.5, will be removed in 2.0 + */ + public function getWriteFilter() + { + @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->writeFilter(); + } + + /** + * Returns the write filter name. + * + * @return string + */ + abstract protected function writeFilter(); +} diff --git a/vendor/php-http/message/src/Encoding/GzipDecodeStream.php b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php new file mode 100644 index 000000000..92b5dad57 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php @@ -0,0 +1,45 @@ + + */ +class GzipDecodeStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => 31]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31, 'level' => $level]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.inflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.deflate'; + } +} diff --git a/vendor/php-http/message/src/Encoding/GzipEncodeStream.php b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php new file mode 100644 index 000000000..13f097a87 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php @@ -0,0 +1,45 @@ + + */ +class GzipEncodeStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => 31, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.deflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.inflate'; + } +} diff --git a/vendor/php-http/message/src/Encoding/InflateStream.php b/vendor/php-http/message/src/Encoding/InflateStream.php new file mode 100644 index 000000000..06c518750 --- /dev/null +++ b/vendor/php-http/message/src/Encoding/InflateStream.php @@ -0,0 +1,45 @@ + + */ +class InflateStream extends FilteredStream +{ + /** + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => -15]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15, 'level' => $level]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.inflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.deflate'; + } +} diff --git a/vendor/php-http/message/src/Exception.php b/vendor/php-http/message/src/Exception.php new file mode 100644 index 000000000..80d4cd9de --- /dev/null +++ b/vendor/php-http/message/src/Exception.php @@ -0,0 +1,10 @@ + + * + * The formatResponseForRequest method will be added to this interface in the next major version, replacing the formatRequest method. + * Meanwhile, callers SHOULD check the formatter for the existence of formatResponseForRequest and call that if available. + * + * @method string formatResponseForRequest(ResponseInterface $response, RequestInterface $request) Formats a response in context of its request. + */ +interface Formatter +{ + /** + * Formats a request. + * + * @return string + */ + public function formatRequest(RequestInterface $request); + + /** + * @deprecated since 1.13, use formatResponseForRequest() instead + * + * Formats a response. + * + * @return string + */ + public function formatResponse(ResponseInterface $response); +} diff --git a/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php b/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php new file mode 100644 index 000000000..80d2971cb --- /dev/null +++ b/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php @@ -0,0 +1,103 @@ + + */ +class CurlCommandFormatter implements Formatter +{ + /** + * {@inheritdoc} + */ + public function formatRequest(RequestInterface $request) + { + $command = sprintf('curl %s', escapeshellarg((string) $request->getUri()->withFragment(''))); + if ('1.0' === $request->getProtocolVersion()) { + $command .= ' --http1.0'; + } elseif ('2.0' === $request->getProtocolVersion()) { + $command .= ' --http2'; + } + + $method = strtoupper($request->getMethod()); + if ('HEAD' === $method) { + $command .= ' --head'; + } elseif ('GET' !== $method) { + $command .= ' --request '.$method; + } + + $command .= $this->getHeadersAsCommandOptions($request); + + $body = $request->getBody(); + if ($body->getSize() > 0) { + // escapeshellarg argument max length on Windows, but longer body in curl command would be impractical anyways + if ($body->getSize() > 8192) { + $data = '[too long stream omitted]'; + } elseif ($body->isSeekable()) { + $data = $body->__toString(); + $body->rewind(); + // all non-printable ASCII characters and except for \t, \r, \n + if (preg_match('/([\x00-\x09\x0C\x0E-\x1F\x7F])/', $data)) { + $data = '[binary stream omitted]'; + } + } else { + $data = '[non-seekable stream omitted]'; + } + $escapedData = @escapeshellarg($data); + if (empty($escapedData)) { + $escapedData = 'We couldn\'t not escape the data properly'; + } + + $command .= sprintf(' --data %s', $escapedData); + } + + return $command; + } + + /** + * {@inheritdoc} + */ + public function formatResponse(ResponseInterface $response) + { + return ''; + } + + /** + * Formats a response in context of its request. + * + * @return string + */ + public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request) + { + return $this->formatResponse($response); + } + + /** + * @return string + */ + private function getHeadersAsCommandOptions(RequestInterface $request) + { + $command = ''; + foreach ($request->getHeaders() as $name => $values) { + if ('host' === strtolower($name) && $values[0] === $request->getUri()->getHost()) { + continue; + } + + if ('user-agent' === strtolower($name)) { + $command .= sprintf(' -A %s', escapeshellarg($values[0])); + + continue; + } + + $command .= sprintf(' -H %s', escapeshellarg($name.': '.$request->getHeaderLine($name))); + } + + return $command; + } +} diff --git a/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php b/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php new file mode 100644 index 000000000..8b9b1264e --- /dev/null +++ b/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php @@ -0,0 +1,116 @@ + + */ +class FullHttpMessageFormatter implements Formatter +{ + /** + * The maximum length of the body. + * + * @var int|null + */ + private $maxBodyLength; + + /** + * @var string + */ + private $binaryDetectionRegex; + + /** + * @param int|null $maxBodyLength + * @param string $binaryDetectionRegex By default, this is all non-printable ASCII characters and except for \t, \r, \n + */ + public function __construct($maxBodyLength = 1000, string $binaryDetectionRegex = '/([\x00-\x09\x0C\x0E-\x1F\x7F])/') + { + $this->maxBodyLength = $maxBodyLength; + $this->binaryDetectionRegex = $binaryDetectionRegex; + } + + /** + * {@inheritdoc} + */ + public function formatRequest(RequestInterface $request) + { + $message = sprintf( + "%s %s HTTP/%s\n", + $request->getMethod(), + $request->getRequestTarget(), + $request->getProtocolVersion() + ); + + foreach ($request->getHeaders() as $name => $values) { + $message .= $name.': '.implode(', ', $values)."\n"; + } + + return $this->addBody($request, $message); + } + + /** + * {@inheritdoc} + */ + public function formatResponse(ResponseInterface $response) + { + $message = sprintf( + "HTTP/%s %s %s\n", + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + foreach ($response->getHeaders() as $name => $values) { + $message .= $name.': '.implode(', ', $values)."\n"; + } + + return $this->addBody($response, $message); + } + + /** + * Formats a response in context of its request. + * + * @return string + */ + public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request) + { + return $this->formatResponse($response); + } + + /** + * Add the message body if the stream is seekable. + * + * @param string $message + * + * @return string + */ + private function addBody(MessageInterface $request, $message) + { + $message .= "\n"; + $stream = $request->getBody(); + if (!$stream->isSeekable() || 0 === $this->maxBodyLength) { + // Do not read the stream + return $message; + } + + $data = $stream->__toString(); + $stream->rewind(); + + if (preg_match($this->binaryDetectionRegex, $data)) { + return $message.'[binary stream omitted]'; + } + + if (null === $this->maxBodyLength) { + return $message.$data; + } + + return $message.mb_substr($data, 0, $this->maxBodyLength); + } +} diff --git a/vendor/php-http/message/src/Formatter/SimpleFormatter.php b/vendor/php-http/message/src/Formatter/SimpleFormatter.php new file mode 100644 index 000000000..ee99ae3f3 --- /dev/null +++ b/vendor/php-http/message/src/Formatter/SimpleFormatter.php @@ -0,0 +1,52 @@ + + * @author Márk Sági-Kazár + */ +class SimpleFormatter implements Formatter +{ + /** + * {@inheritdoc} + */ + public function formatRequest(RequestInterface $request) + { + return sprintf( + '%s %s %s', + $request->getMethod(), + $request->getUri()->__toString(), + $request->getProtocolVersion() + ); + } + + /** + * {@inheritdoc} + */ + public function formatResponse(ResponseInterface $response) + { + return sprintf( + '%s %s %s', + $response->getStatusCode(), + $response->getReasonPhrase(), + $response->getProtocolVersion() + ); + } + + /** + * Formats a response in context of its request. + * + * @return string + */ + public function formatResponseForRequest(ResponseInterface $response, RequestInterface $request) + { + return $this->formatResponse($response); + } +} diff --git a/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php b/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php new file mode 100644 index 000000000..6d54d3510 --- /dev/null +++ b/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php @@ -0,0 +1,82 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory + */ +final class DiactorosMessageFactory implements MessageFactory +{ + /** + * @var DiactorosStreamFactory + */ + private $streamFactory; + + public function __construct() + { + $this->streamFactory = new DiactorosStreamFactory(); + } + + /** + * {@inheritdoc} + */ + public function createRequest( + $method, + $uri, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + if (class_exists(LaminasRequest::class)) { + return (new LaminasRequest( + $uri, + $method, + $this->streamFactory->createStream($body), + $headers + ))->withProtocolVersion($protocolVersion); + } + + return (new ZendRequest( + $uri, + $method, + $this->streamFactory->createStream($body), + $headers + ))->withProtocolVersion($protocolVersion); + } + + /** + * {@inheritdoc} + */ + public function createResponse( + $statusCode = 200, + $reasonPhrase = null, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + if (class_exists(LaminasResponse::class)) { + return (new LaminasResponse( + $this->streamFactory->createStream($body), + $statusCode, + $headers + ))->withProtocolVersion($protocolVersion); + } + + return (new ZendResponse( + $this->streamFactory->createStream($body), + $statusCode, + $headers + ))->withProtocolVersion($protocolVersion); + } +} diff --git a/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php b/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php new file mode 100644 index 000000000..02989d9f6 --- /dev/null +++ b/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php @@ -0,0 +1,55 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory + */ +final class GuzzleMessageFactory implements MessageFactory +{ + /** + * {@inheritdoc} + */ + public function createRequest( + $method, + $uri, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + return new Request( + $method, + $uri, + $headers, + $body, + $protocolVersion + ); + } + + /** + * {@inheritdoc} + */ + public function createResponse( + $statusCode = 200, + $reasonPhrase = null, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + return new Response( + $statusCode, + $headers, + $body, + $protocolVersion, + $reasonPhrase + ); + } +} diff --git a/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php b/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php new file mode 100644 index 000000000..bee93228b --- /dev/null +++ b/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php @@ -0,0 +1,74 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory + */ +final class SlimMessageFactory implements MessageFactory +{ + /** + * @var SlimStreamFactory + */ + private $streamFactory; + + /** + * @var SlimUriFactory + */ + private $uriFactory; + + public function __construct() + { + $this->streamFactory = new SlimStreamFactory(); + $this->uriFactory = new SlimUriFactory(); + } + + /** + * {@inheritdoc} + */ + public function createRequest( + $method, + $uri, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + return (new Request( + $method, + $this->uriFactory->createUri($uri), + new Headers($headers), + [], + [], + $this->streamFactory->createStream($body), + [] + ))->withProtocolVersion($protocolVersion); + } + + /** + * {@inheritdoc} + */ + public function createResponse( + $statusCode = 200, + $reasonPhrase = null, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + return (new Response( + $statusCode, + new Headers($headers), + $this->streamFactory->createStream($body) + ))->withProtocolVersion($protocolVersion); + } +} diff --git a/vendor/php-http/message/src/RequestMatcher.php b/vendor/php-http/message/src/RequestMatcher.php new file mode 100644 index 000000000..94fe53240 --- /dev/null +++ b/vendor/php-http/message/src/RequestMatcher.php @@ -0,0 +1,26 @@ + + */ +interface RequestMatcher +{ + /** + * Decides whether the rule(s) implemented by the strategy matches the supplied request. + * + * @param RequestInterface $request The PSR7 request to check for a match + * + * @return bool true if the request matches, false otherwise + */ + public function matches(RequestInterface $request); +} diff --git a/vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php b/vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php new file mode 100644 index 000000000..1197dd959 --- /dev/null +++ b/vendor/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php @@ -0,0 +1,32 @@ + + */ +final class CallbackRequestMatcher implements RequestMatcher +{ + /** + * @var callable + */ + private $callback; + + public function __construct(callable $callback) + { + $this->callback = $callback; + } + + /** + * {@inheritdoc} + */ + public function matches(RequestInterface $request) + { + return (bool) call_user_func($this->callback, $request); + } +} diff --git a/vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php b/vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php new file mode 100644 index 000000000..91f3729e6 --- /dev/null +++ b/vendor/php-http/message/src/RequestMatcher/RegexRequestMatcher.php @@ -0,0 +1,41 @@ + + * + * @deprecated since version 1.2 and will be removed in 2.0. Use {@link RequestMatcher} instead. + */ +final class RegexRequestMatcher implements RequestMatcher +{ + /** + * Matching regex. + * + * @var string + */ + private $regex; + + /** + * @param string $regex + */ + public function __construct($regex) + { + $this->regex = $regex; + } + + /** + * {@inheritdoc} + */ + public function matches(RequestInterface $request) + { + return (bool) preg_match($this->regex, (string) $request->getUri()); + } +} diff --git a/vendor/php-http/message/src/RequestMatcher/RequestMatcher.php b/vendor/php-http/message/src/RequestMatcher/RequestMatcher.php new file mode 100644 index 000000000..e2aa02123 --- /dev/null +++ b/vendor/php-http/message/src/RequestMatcher/RequestMatcher.php @@ -0,0 +1,78 @@ + + * @author Joel Wurtz + */ +final class RequestMatcher implements RequestMatcherInterface +{ + /** + * @var string + */ + private $path; + + /** + * @var string + */ + private $host; + + /** + * @var array + */ + private $methods = []; + + /** + * @var string[] + */ + private $schemes = []; + + /** + * The regular expressions used for path or host must be specified without delimiter. + * You do not need to escape the forward slash / to match it. + * + * @param string|null $path Regular expression for the path + * @param string|null $host Regular expression for the hostname + * @param string|string[]|null $methods Method or list of methods to match + * @param string|string[]|null $schemes Scheme or list of schemes to match (e.g. http or https) + */ + public function __construct($path = null, $host = null, $methods = [], $schemes = []) + { + $this->path = $path; + $this->host = $host; + $this->methods = array_map('strtoupper', (array) $methods); + $this->schemes = array_map('strtolower', (array) $schemes); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function matches(RequestInterface $request) + { + if ($this->schemes && !in_array($request->getUri()->getScheme(), $this->schemes)) { + return false; + } + + if ($this->methods && !in_array($request->getMethod(), $this->methods)) { + return false; + } + + if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getUri()->getPath()))) { + return false; + } + + if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getUri()->getHost())) { + return false; + } + + return true; + } +} diff --git a/vendor/php-http/message/src/Stream/BufferedStream.php b/vendor/php-http/message/src/Stream/BufferedStream.php new file mode 100644 index 000000000..3d38731d6 --- /dev/null +++ b/vendor/php-http/message/src/Stream/BufferedStream.php @@ -0,0 +1,273 @@ +stream = $stream; + $this->size = $stream->getSize(); + + if ($useFileBuffer) { + $this->resource = fopen('php://temp/maxmemory:'.$memoryBuffer, 'rw+'); + } else { + $this->resource = fopen('php://memory', 'rw+'); + } + + if (false === $this->resource) { + throw new \RuntimeException('Cannot create a resource over temp or memory implementation'); + } + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + try { + $this->rewind(); + + return $this->getContents(); + } catch (\Throwable $throwable) { + return ''; + } catch (\Exception $exception) { // Layer to be BC with PHP 5, remove this when we only support PHP 7+ + return ''; + } + } + + /** + * {@inheritdoc} + */ + public function close() + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot close on a detached stream'); + } + + $this->stream->close(); + fclose($this->resource); + } + + /** + * {@inheritdoc} + */ + public function detach() + { + if (null === $this->resource) { + return; + } + + // Force reading the remaining data of the stream + $this->getContents(); + + $resource = $this->resource; + $this->stream->close(); + $this->stream = null; + $this->resource = null; + + return $resource; + } + + /** + * {@inheritdoc} + */ + public function getSize() + { + if (null === $this->resource) { + return; + } + + if (null === $this->size && $this->stream->eof()) { + return $this->written; + } + + return $this->size; + } + + /** + * {@inheritdoc} + */ + public function tell() + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot tell on a detached stream'); + } + + return ftell($this->resource); + } + + /** + * {@inheritdoc} + */ + public function eof() + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot call eof on a detached stream'); + } + + // We are at the end only when both our resource and underlying stream are at eof + return $this->stream->eof() && (ftell($this->resource) === $this->written); + } + + /** + * {@inheritdoc} + */ + public function isSeekable() + { + return null !== $this->resource; + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot seek on a detached stream'); + } + + fseek($this->resource, $offset, $whence); + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot rewind on a detached stream'); + } + + rewind($this->resource); + } + + /** + * {@inheritdoc} + */ + public function isWritable() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function write($string) + { + throw new \RuntimeException('Cannot write on this stream'); + } + + /** + * {@inheritdoc} + */ + public function isReadable() + { + return null !== $this->resource; + } + + /** + * {@inheritdoc} + */ + public function read($length) + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot read on a detached stream'); + } + if ($length < 0) { + throw new \InvalidArgumentException('Can not read a negative amount of bytes'); + } + + $read = ''; + + // First read from the resource + if (ftell($this->resource) !== $this->written) { + $read = fread($this->resource, $length); + } + + $bytesRead = strlen($read); + + if ($bytesRead < $length) { + $streamRead = $this->stream->read($length - $bytesRead); + + // Write on the underlying stream what we read + $this->written += fwrite($this->resource, $streamRead); + $read .= $streamRead; + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function getContents() + { + if (null === $this->resource) { + throw new \RuntimeException('Cannot read on a detached stream'); + } + + $read = ''; + + while (!$this->eof()) { + $read .= $this->read(8192); + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($key = null) + { + if (null === $this->resource) { + if (null === $key) { + return []; + } + + return; + } + + $metadata = stream_get_meta_data($this->resource); + + if (null === $key) { + return $metadata; + } + + if (!array_key_exists($key, $metadata)) { + return; + } + + return $metadata[$key]; + } +} diff --git a/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php b/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php new file mode 100644 index 000000000..8ae2b288e --- /dev/null +++ b/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php @@ -0,0 +1,48 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory + */ +final class DiactorosStreamFactory implements StreamFactory +{ + /** + * {@inheritdoc} + */ + public function createStream($body = null) + { + if ($body instanceof StreamInterface) { + return $body; + } + + if (is_resource($body)) { + if (class_exists(LaminasStream::class)) { + return new LaminasStream($body); + } + + return new ZendStream($body); + } + + if (class_exists(LaminasStream::class)) { + $stream = new LaminasStream('php://memory', 'rw'); + } else { + $stream = new ZendStream('php://memory', 'rw'); + } + + if (null !== $body && '' !== $body) { + $stream->write((string) $body); + } + + return $stream; + } +} diff --git a/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php b/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php new file mode 100644 index 000000000..14d83e943 --- /dev/null +++ b/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php @@ -0,0 +1,28 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory + */ +final class GuzzleStreamFactory implements StreamFactory +{ + /** + * {@inheritdoc} + */ + public function createStream($body = null) + { + if (class_exists(Utils::class)) { + return Utils::streamFor($body); + } + + return \GuzzleHttp\Psr7\stream_for($body); + } +} diff --git a/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php b/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php new file mode 100644 index 000000000..9274aaee8 --- /dev/null +++ b/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php @@ -0,0 +1,39 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory + */ +final class SlimStreamFactory implements StreamFactory +{ + /** + * {@inheritdoc} + */ + public function createStream($body = null) + { + if ($body instanceof StreamInterface) { + return $body; + } + + if (is_resource($body)) { + return new Stream($body); + } + + $resource = fopen('php://memory', 'r+'); + $stream = new Stream($resource); + if (null !== $body && '' !== $body) { + $stream->write((string) $body); + } + + return $stream; + } +} diff --git a/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php b/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php new file mode 100644 index 000000000..be883defa --- /dev/null +++ b/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php @@ -0,0 +1,36 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory + */ +final class DiactorosUriFactory implements UriFactory +{ + /** + * {@inheritdoc} + */ + public function createUri($uri) + { + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + if (class_exists(LaminasUri::class)) { + return new LaminasUri($uri); + } + + return new ZendUri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php b/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php new file mode 100644 index 000000000..e09ac61e9 --- /dev/null +++ b/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php @@ -0,0 +1,29 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory + */ +final class GuzzleUriFactory implements UriFactory +{ + /** + * {@inheritdoc} + */ + public function createUri($uri) + { + if (class_exists(Utils::class)) { + return Utils::uriFor($uri); + } + + return uri_for($uri); + } +} diff --git a/vendor/php-http/message/src/UriFactory/SlimUriFactory.php b/vendor/php-http/message/src/UriFactory/SlimUriFactory.php new file mode 100644 index 000000000..e5bef0367 --- /dev/null +++ b/vendor/php-http/message/src/UriFactory/SlimUriFactory.php @@ -0,0 +1,33 @@ + + * + * @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory + */ +final class SlimUriFactory implements UriFactory +{ + /** + * {@inheritdoc} + */ + public function createUri($uri) + { + if ($uri instanceof UriInterface) { + return $uri; + } + + if (is_string($uri)) { + return Uri::createFromString($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/vendor/php-http/message/src/filters.php b/vendor/php-http/message/src/filters.php new file mode 100644 index 000000000..15ed73de7 --- /dev/null +++ b/vendor/php-http/message/src/filters.php @@ -0,0 +1,6 @@ + + +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/vendor/php-http/promise/README.md b/vendor/php-http/promise/README.md new file mode 100644 index 000000000..ee95e0933 --- /dev/null +++ b/vendor/php-http/promise/README.md @@ -0,0 +1,48 @@ +# Promise + +[![Latest Version](https://img.shields.io/github/release/php-http/promise.svg?style=flat-square)](https://github.com/php-http/promise/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/promise.svg?style=flat-square)](https://travis-ci.org/php-http/promise) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/promise.svg?style=flat-square)](https://packagist.org/packages/php-http/promise) + +**Promise used for asynchronous HTTP requests.** + +**Note:** This will eventually be removed/deprecated and replaced with the upcoming Promise PSR. + + +## Install + +Via Composer + +``` bash +$ composer require php-http/promise +``` + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org/en/latest/components/promise.html). + + +## Testing + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/promise/composer.json b/vendor/php-http/promise/composer.json new file mode 100644 index 000000000..812167bc8 --- /dev/null +++ b/vendor/php-http/promise/composer.json @@ -0,0 +1,38 @@ +{ + "name": "php-http/promise", + "description": "Promise used for asynchronous HTTP requests", + "license": "MIT", + "keywords": ["promise"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php" : "^7.1 || ^8.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage" : "^4.3.2", + "phpspec/phpspec": "^5.1.2 || ^6.2" + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "scripts": { + "test": "vendor/bin/phpspec run", + "test-ci": "vendor/bin/phpspec run -c phpspec.yml.ci" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/vendor/php-http/promise/src/FulfilledPromise.php b/vendor/php-http/promise/src/FulfilledPromise.php new file mode 100644 index 000000000..f60f686a2 --- /dev/null +++ b/vendor/php-http/promise/src/FulfilledPromise.php @@ -0,0 +1,58 @@ + + */ +final class FulfilledPromise implements Promise +{ + /** + * @var mixed + */ + private $result; + + /** + * @param $result + */ + public function __construct($result) + { + $this->result = $result; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onFulfilled) { + return $this; + } + + try { + return new self($onFulfilled($this->result)); + } catch (\Exception $e) { + return new RejectedPromise($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::FULFILLED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + return $this->result; + } + } +} diff --git a/vendor/php-http/promise/src/Promise.php b/vendor/php-http/promise/src/Promise.php new file mode 100644 index 000000000..3258ed0d3 --- /dev/null +++ b/vendor/php-http/promise/src/Promise.php @@ -0,0 +1,69 @@ + + * @author Márk Sági-Kazár + */ +interface Promise +{ + /** + * Promise has not been fulfilled or rejected. + */ + const PENDING = 'pending'; + + /** + * Promise has been fulfilled. + */ + const FULFILLED = 'fulfilled'; + + /** + * Promise has been rejected. + */ + const REJECTED = 'rejected'; + + /** + * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens). + * + * If you do not care about one of the cases, you can set the corresponding callable to null + * The callback will be called when the value arrived and never more than once. + * + * @param callable|null $onFulfilled called when a response will be available + * @param callable|null $onRejected called when an exception occurs + * + * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected) + */ + public function then(callable $onFulfilled = null, callable $onRejected = null); + + /** + * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED. + * + * @return string + */ + public function getState(); + + /** + * Wait for the promise to be fulfilled or rejected. + * + * When this method returns, the request has been resolved and if callables have been + * specified, the appropriate one has terminated. + * + * When $unwrap is true (the default), the response is returned, or the exception thrown + * on failure. Otherwise, nothing is returned or thrown. + * + * @param bool $unwrap Whether to return resolved value / throw reason or not + * + * @return mixed Resolved value, null if $unwrap is set to false + * + * @throws \Exception the rejection reason if $unwrap is set to true and the request failed + */ + public function wait($unwrap = true); +} diff --git a/vendor/php-http/promise/src/RejectedPromise.php b/vendor/php-http/promise/src/RejectedPromise.php new file mode 100644 index 000000000..e396a40f7 --- /dev/null +++ b/vendor/php-http/promise/src/RejectedPromise.php @@ -0,0 +1,58 @@ + + */ +final class RejectedPromise implements Promise +{ + /** + * @var \Exception + */ + private $exception; + + /** + * @param \Exception $exception + */ + public function __construct(\Exception $exception) + { + $this->exception = $exception; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onRejected) { + return $this; + } + + try { + return new FulfilledPromise($onRejected($this->exception)); + } catch (\Exception $e) { + return new self($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::REJECTED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + throw $this->exception; + } + } +} diff --git a/vendor/phpoption/phpoption/Makefile b/vendor/phpoption/phpoption/Makefile deleted file mode 100644 index 84d715d98..000000000 --- a/vendor/phpoption/phpoption/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -install: - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base update - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base bin all update - -phpunit: - @rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:7.4-cli - -phpstan-analyze-src: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist - -phpstan-analyze-tests: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist - -phpstan-baseline: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist --generate-baseline - -psalm-analyze: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli - -psalm-show-info: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm .phar--rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true - -test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze - -clean: - @rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor diff --git a/vendor/phpoption/phpoption/composer.json b/vendor/phpoption/phpoption/composer.json index 3cff6ef82..0106c9771 100644 --- a/vendor/phpoption/phpoption/composer.json +++ b/vendor/phpoption/phpoption/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": "^7.0 || ^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + "bamarni/composer-bin-plugin": "^1.8", + "phpunit/phpunit": "^8.5.28 || ^9.5.21" }, "autoload": { "psr-4": { @@ -33,11 +33,18 @@ } }, "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, "preferred-install": "dist" }, "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "minimum-stability": "dev", diff --git a/vendor/phpunit/php-token-stream/.gitattributes b/vendor/phpunit/php-token-stream/.gitattributes index 461090b7e..a88b8c68e 100644 --- a/vendor/phpunit/php-token-stream/.gitattributes +++ b/vendor/phpunit/php-token-stream/.gitattributes @@ -1 +1,12 @@ +/.github export-ignore +/.phive export-ignore +/.php_cs.dist export-ignore +/.psalm export-ignore +/bin export-ignore +/build.xml export-ignore +/phpunit.xml export-ignore +/tests export-ignore +/tools export-ignore +/tools/* binary + *.php diff=php diff --git a/vendor/phpunit/php-token-stream/.github/FUNDING.yml b/vendor/phpunit/php-token-stream/.github/FUNDING.yml deleted file mode 100644 index b19ea81a0..000000000 --- a/vendor/phpunit/php-token-stream/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -patreon: s_bergmann diff --git a/vendor/phpunit/php-token-stream/.gitignore b/vendor/phpunit/php-token-stream/.gitignore index 77aae3df6..93a0be47b 100644 --- a/vendor/phpunit/php-token-stream/.gitignore +++ b/vendor/phpunit/php-token-stream/.gitignore @@ -1,3 +1,7 @@ /.idea +/.php_cs +/.php_cs.cache +/.phpunit.result.cache +/.psalm/cache /composer.lock /vendor diff --git a/vendor/phpunit/php-token-stream/.travis.yml b/vendor/phpunit/php-token-stream/.travis.yml deleted file mode 100644 index 4e8056d8e..000000000 --- a/vendor/phpunit/php-token-stream/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4snapshot - -sudo: false - -before_install: - - composer self-update - - composer clear-cache - -install: - - travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest - -script: - - ./vendor/bin/phpunit --coverage-clover=coverage.xml - -after_success: - - bash <(curl -s https://codecov.io/bash) - -notifications: - email: false - diff --git a/vendor/phpunit/php-token-stream/ChangeLog.md b/vendor/phpunit/php-token-stream/ChangeLog.md index bf59ea4df..4a93f524b 100644 --- a/vendor/phpunit/php-token-stream/ChangeLog.md +++ b/vendor/phpunit/php-token-stream/ChangeLog.md @@ -2,23 +2,41 @@ All notable changes to `sebastianbergmann/php-token-stream` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. -## [3.1.3] - 2021-07-26 +## [4.0.4] - 2020-08-04 -### Changed +### Added -* The declarations of methods in `PHP_Token_Stream` that implement the `ArrayAccess`, `Countable`, and `SeekableIterator` interfaces are now compatible with PHP 8.1 +* Support for `NAME_FULLY_QUALIFIED`, `NAME_QUALIFIED`, and `NAME_RELATIVE` tokens -## [3.1.2] - 2020-11-30 +## [4.0.3] - 2020-06-27 -### Changed +### Added -* Changed PHP version constraint in `composer.json` from `^7.1` to `>=7.1` to allow installation of this version of this library on PHP 8. However, this version of this library does not work on PHP 8. PHPUnit 8.5, which uses this version of this library (through phpunit/php-code-coverage), does not call into this library and instead shows a message that code coverage functionality is not available for PHPUnit 8.5 on PHP 8. +* This component is now supported on PHP 8 + +## [4.0.2] - 2020-06-16 + +### Fixed + +* Fixed backward compatibility breaks introduced in version 4.0.1 + +## [4.0.1] - 2020-05-06 + +### Fixed + +* [#93](https://github.com/sebastianbergmann/php-token-stream/issues/93): Class with method that uses anonymous class is not processed correctly + +## [4.0.0] - 2020-02-07 + +### Removed + +* This component is no longer supported PHP 7.1 and PHP 7.2 ## [3.1.1] - 2019-09-17 ### Fixed -* Fixed [#84](https://github.com/sebastianbergmann/php-token-stream/issues/84): Methods named `class` are not handled correctly +* [#84](https://github.com/sebastianbergmann/php-token-stream/issues/84): Methods named `class` are not handled correctly ## [3.1.0] - 2019-07-25 @@ -30,37 +48,40 @@ All notable changes to `sebastianbergmann/php-token-stream` are documented in th ### Changed -* Implemented [#82](https://github.com/sebastianbergmann/php-token-stream/issues/82): Make sure this component works when its classes are prefixed using php-scoper +* [#82](https://github.com/sebastianbergmann/php-token-stream/issues/82): Make sure this component works when its classes are prefixed using php-scoper ## [3.0.1] - 2018-10-30 ### Fixed -* Fixed [#78](https://github.com/sebastianbergmann/php-token-stream/pull/78): `getEndTokenId()` does not handle string-dollar (`"${var}"`) interpolation +* [#78](https://github.com/sebastianbergmann/php-token-stream/pull/78): `getEndTokenId()` does not handle string-dollar (`"${var}"`) interpolation ## [3.0.0] - 2018-02-01 ### Removed -* Implemented [#71](https://github.com/sebastianbergmann/php-token-stream/issues/71): Remove code specific to Hack language constructs -* Implemented [#72](https://github.com/sebastianbergmann/php-token-stream/issues/72): Drop support for PHP 7.0 +* [#71](https://github.com/sebastianbergmann/php-token-stream/issues/71): Remove code specific to Hack language constructs +* [#72](https://github.com/sebastianbergmann/php-token-stream/issues/72): Drop support for PHP 7.0 ## [2.0.2] - 2017-11-27 ### Fixed -* Fixed [#69](https://github.com/sebastianbergmann/php-token-stream/issues/69): `PHP_Token_USE_FUNCTION` does not serialize correctly +* [#69](https://github.com/sebastianbergmann/php-token-stream/issues/69): `PHP_Token_USE_FUNCTION` does not serialize correctly ## [2.0.1] - 2017-08-20 ### Fixed -* Fixed [#68](https://github.com/sebastianbergmann/php-token-stream/issues/68): Method with name `empty` wrongly recognized as anonymous function +* [#68](https://github.com/sebastianbergmann/php-token-stream/issues/68): Method with name `empty` wrongly recognized as anonymous function ## [2.0.0] - 2017-08-03 -[3.1.3]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.2...3.1.3 -[3.1.2]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.1...3.1.2 +[4.0.4]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.3...4.0.4 +[4.0.3]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.2...4.0.3 +[4.0.2]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.1...4.0.2 +[4.0.1]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.0...4.0.1 +[4.0.0]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.1...4.0.0 [3.1.1]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.0...3.1.1 [3.1.0]: https://github.com/sebastianbergmann/php-token-stream/compare/3.0.2...3.1.0 [3.0.2]: https://github.com/sebastianbergmann/php-token-stream/compare/3.0.1...3.0.2 diff --git a/vendor/phpunit/php-token-stream/LICENSE b/vendor/phpunit/php-token-stream/LICENSE index 2cad5be40..a6d0c8c4f 100644 --- a/vendor/phpunit/php-token-stream/LICENSE +++ b/vendor/phpunit/php-token-stream/LICENSE @@ -1,6 +1,6 @@ php-token-stream -Copyright (c) 2009-2019, Sebastian Bergmann . +Copyright (c) 2009-2020, Sebastian Bergmann . All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/vendor/phpunit/php-token-stream/README.md b/vendor/phpunit/php-token-stream/README.md index 149b7e2df..162de8d19 100644 --- a/vendor/phpunit/php-token-stream/README.md +++ b/vendor/phpunit/php-token-stream/README.md @@ -1,14 +1,18 @@ -[![Build Status](https://travis-ci.org/sebastianbergmann/php-token-stream.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-token-stream) +# phpunit/php-token-stream -# php-token-stream +[![CI Status](https://github.com/sebastianbergmann/php-token-stream/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/php-token-stream/actions) +[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/php-token-stream/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/php-token-stream) ## Installation You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): - composer require phpunit/php-token-stream +``` +composer require phpunit/php-token-stream +``` If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: - composer require --dev phpunit/php-token-stream - +``` +composer require --dev phpunit/php-token-stream +``` diff --git a/vendor/phpunit/php-token-stream/build.xml b/vendor/phpunit/php-token-stream/build.xml deleted file mode 100644 index 0da8056e5..000000000 --- a/vendor/phpunit/php-token-stream/build.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/phpunit/php-token-stream/composer.json b/vendor/phpunit/php-token-stream/composer.json index afaabacd9..e0d0b4de7 100644 --- a/vendor/phpunit/php-token-stream/composer.json +++ b/vendor/phpunit/php-token-stream/composer.json @@ -16,13 +16,16 @@ }, "prefer-stable": true, "require": { - "php": ">=7.1", + "php": "^7.3 || ^8.0", "ext-tokenizer": "*" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "config": { + "platform": { + "php": "7.3.0" + }, "optimize-autoloader": true, "sort-packages": true }, @@ -33,7 +36,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } } } diff --git a/vendor/phpunit/php-token-stream/phpunit.xml b/vendor/phpunit/php-token-stream/phpunit.xml deleted file mode 100644 index 8f159fbd1..000000000 --- a/vendor/phpunit/php-token-stream/phpunit.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - tests - - - - - - src - - - diff --git a/vendor/phpunit/php-token-stream/src/Abstract.php b/vendor/phpunit/php-token-stream/src/Abstract.php new file mode 100644 index 000000000..7bbb555d3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Abstract.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ABSTRACT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Ampersand.php b/vendor/phpunit/php-token-stream/src/Ampersand.php new file mode 100644 index 000000000..3996f3446 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Ampersand.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_AMPERSAND extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/AndEqual.php b/vendor/phpunit/php-token-stream/src/AndEqual.php new file mode 100644 index 000000000..9984442a6 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/AndEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_AND_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Array.php b/vendor/phpunit/php-token-stream/src/Array.php new file mode 100644 index 000000000..72041e944 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Array.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ARRAY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ArrayCast.php b/vendor/phpunit/php-token-stream/src/ArrayCast.php new file mode 100644 index 000000000..9d113db52 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ArrayCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ARRAY_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/As.php b/vendor/phpunit/php-token-stream/src/As.php new file mode 100644 index 000000000..286578e46 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/As.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_AS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/At.php b/vendor/phpunit/php-token-stream/src/At.php new file mode 100644 index 000000000..d8d246857 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/At.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_AT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Backtick.php b/vendor/phpunit/php-token-stream/src/Backtick.php new file mode 100644 index 000000000..3d8b55b7f --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Backtick.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BACKTICK extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/BadCharacter.php b/vendor/phpunit/php-token-stream/src/BadCharacter.php new file mode 100644 index 000000000..dfc7a40ff --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/BadCharacter.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BAD_CHARACTER extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/BoolCast.php b/vendor/phpunit/php-token-stream/src/BoolCast.php new file mode 100644 index 000000000..201cfeab6 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/BoolCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BOOL_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/BooleanAnd.php b/vendor/phpunit/php-token-stream/src/BooleanAnd.php new file mode 100644 index 000000000..03f983311 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/BooleanAnd.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BOOLEAN_AND extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/BooleanOr.php b/vendor/phpunit/php-token-stream/src/BooleanOr.php new file mode 100644 index 000000000..0f339245b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/BooleanOr.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BOOLEAN_OR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php b/vendor/phpunit/php-token-stream/src/CachingFactory.php similarity index 80% rename from vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php rename to vendor/phpunit/php-token-stream/src/CachingFactory.php index 9d693938a..c557a84f3 100644 --- a/vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php +++ b/vendor/phpunit/php-token-stream/src/CachingFactory.php @@ -1,16 +1,12 @@ - * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/** - * A caching factory for token stream objects. - */ class PHP_Token_Stream_CachingFactory { /** @@ -35,9 +31,9 @@ class PHP_Token_Stream_CachingFactory /** * @param string $filename */ - public static function clear($filename = null) + public static function clear($filename = null)/*: void*/ { - if (is_string($filename)) { + if (\is_string($filename)) { unset(self::$cache[$filename]); } else { self::$cache = []; diff --git a/vendor/phpunit/php-token-stream/src/Callable.php b/vendor/phpunit/php-token-stream/src/Callable.php new file mode 100644 index 000000000..4f5751259 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Callable.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CALLABLE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Caret.php b/vendor/phpunit/php-token-stream/src/Caret.php new file mode 100644 index 000000000..af453d897 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Caret.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CARET extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Case.php b/vendor/phpunit/php-token-stream/src/Case.php new file mode 100644 index 000000000..ab9b906db --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Case.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CASE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Catch.php b/vendor/phpunit/php-token-stream/src/Catch.php new file mode 100644 index 000000000..8c244acae --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Catch.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CATCH extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Character.php b/vendor/phpunit/php-token-stream/src/Character.php new file mode 100644 index 000000000..eea0db099 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Character.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CHARACTER extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Class.php b/vendor/phpunit/php-token-stream/src/Class.php new file mode 100644 index 000000000..09167f21c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Class.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLASS extends PHP_Token_INTERFACE +{ + /** + * @var bool + */ + private $anonymous = false; + + /** + * @var string + */ + private $name; + + /** + * @return string + */ + public function getName() + { + if ($this->name !== null) { + return $this->name; + } + + $next = $this->tokenStream[$this->id + 1]; + + if ($next instanceof PHP_Token_WHITESPACE) { + $next = $this->tokenStream[$this->id + 2]; + } + + if ($next instanceof PHP_Token_STRING) { + $this->name =(string) $next; + + return $this->name; + } + + if ($next instanceof PHP_Token_OPEN_CURLY || + $next instanceof PHP_Token_EXTENDS || + $next instanceof PHP_Token_IMPLEMENTS) { + $this->name = \sprintf( + 'AnonymousClass:%s#%s', + $this->getLine(), + $this->getId() + ); + + $this->anonymous = true; + + return $this->name; + } + } + + public function isAnonymous() + { + return $this->anonymous; + } +} diff --git a/vendor/phpunit/php-token-stream/src/ClassC.php b/vendor/phpunit/php-token-stream/src/ClassC.php new file mode 100644 index 000000000..2350c99bd --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ClassC.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLASS_C extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ClassNameConstant.php b/vendor/phpunit/php-token-stream/src/ClassNameConstant.php new file mode 100644 index 000000000..1b557e3c7 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ClassNameConstant.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Clone.php b/vendor/phpunit/php-token-stream/src/Clone.php new file mode 100644 index 000000000..24e661047 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Clone.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLONE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CloseBracket.php b/vendor/phpunit/php-token-stream/src/CloseBracket.php new file mode 100644 index 000000000..b86b74575 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CloseBracket.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLOSE_BRACKET extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CloseCurly.php b/vendor/phpunit/php-token-stream/src/CloseCurly.php new file mode 100644 index 000000000..aa86cdc4d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CloseCurly.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLOSE_CURLY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CloseSquare.php b/vendor/phpunit/php-token-stream/src/CloseSquare.php new file mode 100644 index 000000000..fc819d015 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CloseSquare.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLOSE_SQUARE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CloseTag.php b/vendor/phpunit/php-token-stream/src/CloseTag.php new file mode 100644 index 000000000..419510cf8 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CloseTag.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CLOSE_TAG extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Coalesce.php b/vendor/phpunit/php-token-stream/src/Coalesce.php new file mode 100644 index 000000000..55b2beb4a --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Coalesce.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_COALESCE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CoalesceEqual.php b/vendor/phpunit/php-token-stream/src/CoalesceEqual.php new file mode 100644 index 000000000..b60096181 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CoalesceEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_COALESCE_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Colon.php b/vendor/phpunit/php-token-stream/src/Colon.php new file mode 100644 index 000000000..66dd84089 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Colon.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_COLON extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Comma.php b/vendor/phpunit/php-token-stream/src/Comma.php new file mode 100644 index 000000000..b57ba370c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Comma.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_COMMA extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Comment.php b/vendor/phpunit/php-token-stream/src/Comment.php new file mode 100644 index 000000000..c50c80b80 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Comment.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_COMMENT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ConcatEqual.php b/vendor/phpunit/php-token-stream/src/ConcatEqual.php new file mode 100644 index 000000000..f57c748f3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ConcatEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CONCAT_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Const.php b/vendor/phpunit/php-token-stream/src/Const.php new file mode 100644 index 000000000..a5376422c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Const.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CONST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ConstantEncapsedString.php b/vendor/phpunit/php-token-stream/src/ConstantEncapsedString.php new file mode 100644 index 000000000..2a030cd3c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ConstantEncapsedString.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Continue.php b/vendor/phpunit/php-token-stream/src/Continue.php new file mode 100644 index 000000000..a21c8ba10 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Continue.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CONTINUE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/CurlyOpen.php b/vendor/phpunit/php-token-stream/src/CurlyOpen.php new file mode 100644 index 000000000..7c3e9bcea --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/CurlyOpen.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_CURLY_OPEN extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DNumber.php b/vendor/phpunit/php-token-stream/src/DNumber.php new file mode 100644 index 000000000..bf5751f32 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DNumber.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DNUMBER extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Dec.php b/vendor/phpunit/php-token-stream/src/Dec.php new file mode 100644 index 000000000..6f06341c4 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Dec.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DEC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Declare.php b/vendor/phpunit/php-token-stream/src/Declare.php new file mode 100644 index 000000000..60dab6f88 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Declare.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DECLARE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Default.php b/vendor/phpunit/php-token-stream/src/Default.php new file mode 100644 index 000000000..81f3bfd02 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Default.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DEFAULT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Dir.php b/vendor/phpunit/php-token-stream/src/Dir.php new file mode 100644 index 000000000..add4bf84d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Dir.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DIR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Div.php b/vendor/phpunit/php-token-stream/src/Div.php new file mode 100644 index 000000000..87e11d786 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Div.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DIV extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DivEqual.php b/vendor/phpunit/php-token-stream/src/DivEqual.php new file mode 100644 index 000000000..cb558a89d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DivEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DIV_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Do.php b/vendor/phpunit/php-token-stream/src/Do.php new file mode 100644 index 000000000..32ceff1c9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Do.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DO extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DocComment.php b/vendor/phpunit/php-token-stream/src/DocComment.php new file mode 100644 index 000000000..2ca6f2216 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DocComment.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOC_COMMENT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Dollar.php b/vendor/phpunit/php-token-stream/src/Dollar.php new file mode 100644 index 000000000..a2a8d5955 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Dollar.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOLLAR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php b/vendor/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php new file mode 100644 index 000000000..030bcb29b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DollarOpenCurlyBraces.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Dot.php b/vendor/phpunit/php-token-stream/src/Dot.php new file mode 100644 index 000000000..b50a49eed --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Dot.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DoubleArrow.php b/vendor/phpunit/php-token-stream/src/DoubleArrow.php new file mode 100644 index 000000000..bc2c6d06a --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DoubleArrow.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOUBLE_ARROW extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DoubleCast.php b/vendor/phpunit/php-token-stream/src/DoubleCast.php new file mode 100644 index 000000000..eb72f3642 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DoubleCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOUBLE_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DoubleColon.php b/vendor/phpunit/php-token-stream/src/DoubleColon.php new file mode 100644 index 000000000..46ff6e7f2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DoubleColon.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOUBLE_COLON extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/DoubleQuotes.php b/vendor/phpunit/php-token-stream/src/DoubleQuotes.php new file mode 100644 index 000000000..10779806e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/DoubleQuotes.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_DOUBLE_QUOTES extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Echo.php b/vendor/phpunit/php-token-stream/src/Echo.php new file mode 100644 index 000000000..bfee30cff --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Echo.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ECHO extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Ellipsis.php b/vendor/phpunit/php-token-stream/src/Ellipsis.php new file mode 100644 index 000000000..d932cedb6 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Ellipsis.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ELLIPSIS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Else.php b/vendor/phpunit/php-token-stream/src/Else.php new file mode 100644 index 000000000..a3266f863 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Else.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ELSE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Elseif.php b/vendor/phpunit/php-token-stream/src/Elseif.php new file mode 100644 index 000000000..76a7d4e7c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Elseif.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ELSEIF extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Empty.php b/vendor/phpunit/php-token-stream/src/Empty.php new file mode 100644 index 000000000..15f662cdb --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Empty.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EMPTY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/EncapsedAndWhitespace.php b/vendor/phpunit/php-token-stream/src/EncapsedAndWhitespace.php new file mode 100644 index 000000000..5224806db --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/EncapsedAndWhitespace.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/EndHeredoc.php b/vendor/phpunit/php-token-stream/src/EndHeredoc.php new file mode 100644 index 000000000..e95930cf4 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/EndHeredoc.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_END_HEREDOC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Enddeclare.php b/vendor/phpunit/php-token-stream/src/Enddeclare.php new file mode 100644 index 000000000..dd96d7f16 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Enddeclare.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDDECLARE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Endfor.php b/vendor/phpunit/php-token-stream/src/Endfor.php new file mode 100644 index 000000000..a5382a273 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Endfor.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDFOR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Endforeach.php b/vendor/phpunit/php-token-stream/src/Endforeach.php new file mode 100644 index 000000000..d2ab78a52 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Endforeach.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDFOREACH extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Endif.php b/vendor/phpunit/php-token-stream/src/Endif.php new file mode 100644 index 000000000..910eeea5c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Endif.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDIF extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Endswitch.php b/vendor/phpunit/php-token-stream/src/Endswitch.php new file mode 100644 index 000000000..0fc81462d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Endswitch.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDSWITCH extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Endwhile.php b/vendor/phpunit/php-token-stream/src/Endwhile.php new file mode 100644 index 000000000..9a289f110 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Endwhile.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ENDWHILE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Equal.php b/vendor/phpunit/php-token-stream/src/Equal.php new file mode 100644 index 000000000..c8ecb0b70 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Equal.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Eval.php b/vendor/phpunit/php-token-stream/src/Eval.php new file mode 100644 index 000000000..fb82bfd7b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Eval.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EVAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ExclamationMark.php b/vendor/phpunit/php-token-stream/src/ExclamationMark.php new file mode 100644 index 000000000..009ea238e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ExclamationMark.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EXCLAMATION_MARK extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Exit.php b/vendor/phpunit/php-token-stream/src/Exit.php new file mode 100644 index 000000000..9475887c6 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Exit.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EXIT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Extends.php b/vendor/phpunit/php-token-stream/src/Extends.php new file mode 100644 index 000000000..bf5116060 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Extends.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_EXTENDS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/File.php b/vendor/phpunit/php-token-stream/src/File.php new file mode 100644 index 000000000..a89449c3b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/File.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FILE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Final.php b/vendor/phpunit/php-token-stream/src/Final.php new file mode 100644 index 000000000..f1355d239 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Final.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FINAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Finally.php b/vendor/phpunit/php-token-stream/src/Finally.php new file mode 100644 index 000000000..8d31fc326 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Finally.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FINALLY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Fn.php b/vendor/phpunit/php-token-stream/src/Fn.php new file mode 100644 index 000000000..8c1ceecb1 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Fn.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FN extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/For.php b/vendor/phpunit/php-token-stream/src/For.php new file mode 100644 index 000000000..5b7bcbf8f --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/For.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FOR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Foreach.php b/vendor/phpunit/php-token-stream/src/Foreach.php new file mode 100644 index 000000000..76906b0d1 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Foreach.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FOREACH extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/FuncC.php b/vendor/phpunit/php-token-stream/src/FuncC.php new file mode 100644 index 000000000..853446f12 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/FuncC.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FUNC_C extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Function.php b/vendor/phpunit/php-token-stream/src/Function.php new file mode 100644 index 000000000..8cc9eb1ad --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Function.php @@ -0,0 +1,196 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var int + */ + protected $ccn; + + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $signature; + + /** + * @var bool + */ + private $anonymous = false; + + /** + * @return array + */ + public function getArguments() + { + if ($this->arguments !== null) { + return $this->arguments; + } + + $this->arguments = []; + $tokens = $this->tokenStream->tokens(); + $typeDeclaration = null; + + // Search for first token inside brackets + $i = $this->id + 2; + + while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) { + $i++; + } + + while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { + if ($tokens[$i] instanceof PHP_Token_STRING) { + $typeDeclaration = (string) $tokens[$i]; + } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) { + $this->arguments[(string) $tokens[$i]] = $typeDeclaration; + $typeDeclaration = null; + } + + $i++; + } + + return $this->arguments; + } + + /** + * @return string + */ + public function getName() + { + if ($this->name !== null) { + return $this->name; + } + + $tokens = $this->tokenStream->tokens(); + + $i = $this->id + 1; + + if ($tokens[$i] instanceof PHP_Token_WHITESPACE) { + $i++; + } + + if ($tokens[$i] instanceof PHP_Token_AMPERSAND) { + $i++; + } + + if ($tokens[$i + 1] instanceof PHP_Token_OPEN_BRACKET) { + $this->name = (string) $tokens[$i]; + } elseif ($tokens[$i + 1] instanceof PHP_Token_WHITESPACE && $tokens[$i + 2] instanceof PHP_Token_OPEN_BRACKET) { + $this->name = (string) $tokens[$i]; + } else { + $this->anonymous = true; + + $this->name = \sprintf( + 'anonymousFunction:%s#%s', + $this->getLine(), + $this->getId() + ); + } + + if (!$this->isAnonymous()) { + for ($i = $this->id; $i; --$i) { + if ($tokens[$i] instanceof PHP_Token_NAMESPACE) { + $this->name = $tokens[$i]->getName() . '\\' . $this->name; + + break; + } + + if ($tokens[$i] instanceof PHP_Token_INTERFACE) { + break; + } + } + } + + return $this->name; + } + + /** + * @return int + */ + public function getCCN() + { + if ($this->ccn !== null) { + return $this->ccn; + } + + $this->ccn = 1; + $end = $this->getEndTokenId(); + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id; $i <= $end; $i++) { + switch (\get_class($tokens[$i])) { + case PHP_Token_IF::class: + case PHP_Token_ELSEIF::class: + case PHP_Token_FOR::class: + case PHP_Token_FOREACH::class: + case PHP_Token_WHILE::class: + case PHP_Token_CASE::class: + case PHP_Token_CATCH::class: + case PHP_Token_BOOLEAN_AND::class: + case PHP_Token_LOGICAL_AND::class: + case PHP_Token_BOOLEAN_OR::class: + case PHP_Token_LOGICAL_OR::class: + case PHP_Token_QUESTION_MARK::class: + $this->ccn++; + + break; + } + } + + return $this->ccn; + } + + /** + * @return string + */ + public function getSignature() + { + if ($this->signature !== null) { + return $this->signature; + } + + if ($this->isAnonymous()) { + $this->signature = 'anonymousFunction'; + $i = $this->id + 1; + } else { + $this->signature = ''; + $i = $this->id + 2; + } + + $tokens = $this->tokenStream->tokens(); + + while (isset($tokens[$i]) && + !$tokens[$i] instanceof PHP_Token_OPEN_CURLY && + !$tokens[$i] instanceof PHP_Token_SEMICOLON) { + $this->signature .= $tokens[$i++]; + } + + $this->signature = \trim($this->signature); + + return $this->signature; + } + + /** + * @return bool + */ + public function isAnonymous() + { + return $this->anonymous; + } +} diff --git a/vendor/phpunit/php-token-stream/src/Global.php b/vendor/phpunit/php-token-stream/src/Global.php new file mode 100644 index 000000000..15d34c0f9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Global.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_GLOBAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Goto.php b/vendor/phpunit/php-token-stream/src/Goto.php new file mode 100644 index 000000000..68cbce0db --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Goto.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_GOTO extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Gt.php b/vendor/phpunit/php-token-stream/src/Gt.php new file mode 100644 index 000000000..1df2bc974 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Gt.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_GT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/HaltCompiler.php b/vendor/phpunit/php-token-stream/src/HaltCompiler.php new file mode 100644 index 000000000..1976e9b7d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/HaltCompiler.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_HALT_COMPILER extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/If.php b/vendor/phpunit/php-token-stream/src/If.php new file mode 100644 index 000000000..2f888f1ce --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/If.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IF extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Implements.php b/vendor/phpunit/php-token-stream/src/Implements.php new file mode 100644 index 000000000..bfb035bcc --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Implements.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IMPLEMENTS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Inc.php b/vendor/phpunit/php-token-stream/src/Inc.php new file mode 100644 index 000000000..ca19c33ab --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Inc.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Include.php b/vendor/phpunit/php-token-stream/src/Include.php new file mode 100644 index 000000000..cffb378e7 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Include.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INCLUDE extends PHP_Token_Includes +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IncludeOnce.php b/vendor/phpunit/php-token-stream/src/IncludeOnce.php new file mode 100644 index 000000000..da28d6178 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IncludeOnce.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Includes.php b/vendor/phpunit/php-token-stream/src/Includes.php new file mode 100644 index 000000000..285dfbf65 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Includes.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +abstract class PHP_Token_Includes extends PHP_Token +{ + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $type; + + /** + * @return string + */ + public function getName() + { + if ($this->name === null) { + $this->process(); + } + + return $this->name; + } + + /** + * @return string + */ + public function getType() + { + if ($this->type === null) { + $this->process(); + } + + return $this->type; + } + + private function process(): void + { + $tokens = $this->tokenStream->tokens(); + + if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { + $this->name = \trim((string) $tokens[$this->id + 2], "'\""); + $this->type = \strtolower( + \str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$this->id])) + ); + } + } +} diff --git a/vendor/phpunit/php-token-stream/src/InlineHtml.php b/vendor/phpunit/php-token-stream/src/InlineHtml.php new file mode 100644 index 000000000..a4fc15e05 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/InlineHtml.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INLINE_HTML extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Instanceof.php b/vendor/phpunit/php-token-stream/src/Instanceof.php new file mode 100644 index 000000000..c41dd0e60 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Instanceof.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INSTANCEOF extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Insteadof.php b/vendor/phpunit/php-token-stream/src/Insteadof.php new file mode 100644 index 000000000..d8c0bc470 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Insteadof.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INSTEADOF extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IntCast.php b/vendor/phpunit/php-token-stream/src/IntCast.php new file mode 100644 index 000000000..2b256017c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IntCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INT_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Interface.php b/vendor/phpunit/php-token-stream/src/Interface.php new file mode 100644 index 000000000..d2732f561 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Interface.php @@ -0,0 +1,166 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility +{ + /** + * @var array + */ + protected $interfaces; + + /** + * @return string + */ + public function getName() + { + return (string) $this->tokenStream[$this->id + 2]; + } + + /** + * @return bool + */ + public function hasParent() + { + return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS; + } + + /** + * @return array + */ + public function getPackage() + { + $result = [ + 'namespace' => '', + 'fullPackage' => '', + 'category' => '', + 'package' => '', + 'subpackage' => '', + ]; + + $docComment = $this->getDocblock(); + $className = $this->getName(); + + for ($i = $this->id; $i; --$i) { + if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) { + $result['namespace'] = $this->tokenStream[$i]->getName(); + + break; + } + } + + if ($docComment === null) { + return $result; + } + + if (\preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['category'] = $matches[1]; + } + + if (\preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['package'] = $matches[1]; + $result['fullPackage'] = $matches[1]; + } + + if (\preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['subpackage'] = $matches[1]; + $result['fullPackage'] .= '.' . $matches[1]; + } + + if (empty($result['fullPackage'])) { + $result['fullPackage'] = $this->arrayToName( + \explode('_', \str_replace('\\', '_', $className)), + '.' + ); + } + + return $result; + } + + /** + * @return bool|string + */ + public function getParent() + { + if (!$this->hasParent()) { + return false; + } + + $i = $this->id + 6; + $tokens = $this->tokenStream->tokens(); + $className = (string) $tokens[$i]; + + while (isset($tokens[$i + 1]) && + !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) { + $className .= (string) $tokens[++$i]; + } + + return $className; + } + + /** + * @return bool + */ + public function hasInterfaces() + { + return (isset($this->tokenStream[$this->id + 4]) && + $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) || + (isset($this->tokenStream[$this->id + 8]) && + $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS); + } + + /** + * @return array|bool + */ + public function getInterfaces() + { + if ($this->interfaces !== null) { + return $this->interfaces; + } + + if (!$this->hasInterfaces()) { + return $this->interfaces = false; + } + + if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) { + $i = $this->id + 3; + } else { + $i = $this->id + 7; + } + + $tokens = $this->tokenStream->tokens(); + + while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) { + $i++; + + if ($tokens[$i] instanceof PHP_Token_STRING) { + $this->interfaces[] = (string) $tokens[$i]; + } + } + + return $this->interfaces; + } + + /** + * @param string $join + * + * @return string + */ + protected function arrayToName(array $parts, $join = '\\') + { + $result = ''; + + if (\count($parts) > 1) { + \array_pop($parts); + + $result = \implode($join, $parts); + } + + return $result; + } +} diff --git a/vendor/phpunit/php-token-stream/src/IsEqual.php b/vendor/phpunit/php-token-stream/src/IsEqual.php new file mode 100644 index 000000000..70f00af5d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IsGreaterOrEqual.php b/vendor/phpunit/php-token-stream/src/IsGreaterOrEqual.php new file mode 100644 index 000000000..0227baf46 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsGreaterOrEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IsIdentical.php b/vendor/phpunit/php-token-stream/src/IsIdentical.php new file mode 100644 index 000000000..28388df5b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsIdentical.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_IDENTICAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IsNotEqual.php b/vendor/phpunit/php-token-stream/src/IsNotEqual.php new file mode 100644 index 000000000..f70f2290e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsNotEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_NOT_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IsNotIdentical.php b/vendor/phpunit/php-token-stream/src/IsNotIdentical.php new file mode 100644 index 000000000..9fe3a71a2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsNotIdentical.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/IsSmallerOrEqual.php b/vendor/phpunit/php-token-stream/src/IsSmallerOrEqual.php new file mode 100644 index 000000000..7ac0c2fa2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/IsSmallerOrEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Isset.php b/vendor/phpunit/php-token-stream/src/Isset.php new file mode 100644 index 000000000..47941d643 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Isset.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_ISSET extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Line.php b/vendor/phpunit/php-token-stream/src/Line.php new file mode 100644 index 000000000..ffed4dbcc --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Line.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LINE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/List.php b/vendor/phpunit/php-token-stream/src/List.php new file mode 100644 index 000000000..9410fc5a7 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/List.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LIST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Lnumber.php b/vendor/phpunit/php-token-stream/src/Lnumber.php new file mode 100644 index 000000000..e996bd0f8 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Lnumber.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LNUMBER extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/LogicalAnd.php b/vendor/phpunit/php-token-stream/src/LogicalAnd.php new file mode 100644 index 000000000..72beb476c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/LogicalAnd.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LOGICAL_AND extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/LogicalOr.php b/vendor/phpunit/php-token-stream/src/LogicalOr.php new file mode 100644 index 000000000..ec8be7030 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/LogicalOr.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LOGICAL_OR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/LogicalXor.php b/vendor/phpunit/php-token-stream/src/LogicalXor.php new file mode 100644 index 000000000..e1e223b99 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/LogicalXor.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LOGICAL_XOR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Lt.php b/vendor/phpunit/php-token-stream/src/Lt.php new file mode 100644 index 000000000..288a41330 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Lt.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_LT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/MethodC.php b/vendor/phpunit/php-token-stream/src/MethodC.php new file mode 100644 index 000000000..1bebf001a --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/MethodC.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_METHOD_C extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Minus.php b/vendor/phpunit/php-token-stream/src/Minus.php new file mode 100644 index 000000000..6ca52f523 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Minus.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_MINUS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/MinusEqual.php b/vendor/phpunit/php-token-stream/src/MinusEqual.php new file mode 100644 index 000000000..1bfb24c5e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/MinusEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_MINUS_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ModEqual.php b/vendor/phpunit/php-token-stream/src/ModEqual.php new file mode 100644 index 000000000..28aab5863 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ModEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_MOD_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/MulEqual.php b/vendor/phpunit/php-token-stream/src/MulEqual.php new file mode 100644 index 000000000..16a0d242e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/MulEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_MUL_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Mult.php b/vendor/phpunit/php-token-stream/src/Mult.php new file mode 100644 index 000000000..bd6daed76 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Mult.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_MULT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NameFullyQualified.php b/vendor/phpunit/php-token-stream/src/NameFullyQualified.php new file mode 100644 index 000000000..744118abc --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NameFullyQualified.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NAME_FULLY_QUALIFIED extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NameQualified.php b/vendor/phpunit/php-token-stream/src/NameQualified.php new file mode 100644 index 000000000..a893144c0 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NameQualified.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NAME_QUALIFIED extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NameRelative.php b/vendor/phpunit/php-token-stream/src/NameRelative.php new file mode 100644 index 000000000..0b358cc64 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NameRelative.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NAME_RELATIVE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Namespace.php b/vendor/phpunit/php-token-stream/src/Namespace.php new file mode 100644 index 000000000..634d8ad76 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Namespace.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NAMESPACE extends PHP_TokenWithScope +{ + /** + * @return string + */ + public function getName() + { + $tokens = $this->tokenStream->tokens(); + $namespace = (string) $tokens[$this->id + 2]; + + for ($i = $this->id + 3;; $i += 2) { + if (isset($tokens[$i]) && + $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) { + $namespace .= '\\' . $tokens[$i + 1]; + } else { + break; + } + } + + return $namespace; + } +} diff --git a/vendor/phpunit/php-token-stream/src/New.php b/vendor/phpunit/php-token-stream/src/New.php new file mode 100644 index 000000000..bd67af28b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/New.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NEW extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NsC.php b/vendor/phpunit/php-token-stream/src/NsC.php new file mode 100644 index 000000000..2778ea4cd --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NsC.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NS_C extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NsSeparator.php b/vendor/phpunit/php-token-stream/src/NsSeparator.php new file mode 100644 index 000000000..950291ed9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NsSeparator.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NS_SEPARATOR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/NumString.php b/vendor/phpunit/php-token-stream/src/NumString.php new file mode 100644 index 000000000..a073e3d06 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/NumString.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_NUM_STRING extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ObjectCast.php b/vendor/phpunit/php-token-stream/src/ObjectCast.php new file mode 100644 index 000000000..c0ec7d5b7 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ObjectCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OBJECT_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/ObjectOperator.php b/vendor/phpunit/php-token-stream/src/ObjectOperator.php new file mode 100644 index 000000000..a4ca75b81 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/ObjectOperator.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OBJECT_OPERATOR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OpenBracket.php b/vendor/phpunit/php-token-stream/src/OpenBracket.php new file mode 100644 index 000000000..2cb93ed20 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OpenBracket.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OPEN_BRACKET extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OpenCurly.php b/vendor/phpunit/php-token-stream/src/OpenCurly.php new file mode 100644 index 000000000..59c118d1b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OpenCurly.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OPEN_CURLY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OpenSquare.php b/vendor/phpunit/php-token-stream/src/OpenSquare.php new file mode 100644 index 000000000..04cfefab0 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OpenSquare.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OPEN_SQUARE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OpenTag.php b/vendor/phpunit/php-token-stream/src/OpenTag.php new file mode 100644 index 000000000..d3e00239e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OpenTag.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OPEN_TAG extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OpenTagWithEcho.php b/vendor/phpunit/php-token-stream/src/OpenTagWithEcho.php new file mode 100644 index 000000000..ec981a2a3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OpenTagWithEcho.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/OrEqual.php b/vendor/phpunit/php-token-stream/src/OrEqual.php new file mode 100644 index 000000000..8e7005df2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/OrEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_OR_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/PaamayimNekudotayim.php b/vendor/phpunit/php-token-stream/src/PaamayimNekudotayim.php new file mode 100644 index 000000000..3185555d9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/PaamayimNekudotayim.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Percent.php b/vendor/phpunit/php-token-stream/src/Percent.php new file mode 100644 index 000000000..a2baab533 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Percent.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PERCENT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Pipe.php b/vendor/phpunit/php-token-stream/src/Pipe.php new file mode 100644 index 000000000..4e9438fd9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Pipe.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PIPE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Plus.php b/vendor/phpunit/php-token-stream/src/Plus.php new file mode 100644 index 000000000..5a4ae324c --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Plus.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PLUS extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/PlusEqual.php b/vendor/phpunit/php-token-stream/src/PlusEqual.php new file mode 100644 index 000000000..23825f377 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/PlusEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PLUS_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Pow.php b/vendor/phpunit/php-token-stream/src/Pow.php new file mode 100644 index 000000000..84276d73d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Pow.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_POW extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/PowEqual.php b/vendor/phpunit/php-token-stream/src/PowEqual.php new file mode 100644 index 000000000..5e5288db7 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/PowEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_POW_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Print.php b/vendor/phpunit/php-token-stream/src/Print.php new file mode 100644 index 000000000..72ef8e6ab --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Print.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PRINT extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Private.php b/vendor/phpunit/php-token-stream/src/Private.php new file mode 100644 index 000000000..0eb36d522 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Private.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PRIVATE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Protected.php b/vendor/phpunit/php-token-stream/src/Protected.php new file mode 100644 index 000000000..9c9cc33ba --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Protected.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PROTECTED extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Public.php b/vendor/phpunit/php-token-stream/src/Public.php new file mode 100644 index 000000000..b37d4a94d --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Public.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_PUBLIC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/QuestionMark.php b/vendor/phpunit/php-token-stream/src/QuestionMark.php new file mode 100644 index 000000000..4202d5921 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/QuestionMark.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_QUESTION_MARK extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Require.php b/vendor/phpunit/php-token-stream/src/Require.php new file mode 100644 index 000000000..e18c03fcc --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Require.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_REQUIRE extends PHP_Token_Includes +{ +} diff --git a/vendor/phpunit/php-token-stream/src/RequireOnce.php b/vendor/phpunit/php-token-stream/src/RequireOnce.php new file mode 100644 index 000000000..15628a3a8 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/RequireOnce.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Return.php b/vendor/phpunit/php-token-stream/src/Return.php new file mode 100644 index 000000000..acdbc23b1 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Return.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_RETURN extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Semicolon.php b/vendor/phpunit/php-token-stream/src/Semicolon.php new file mode 100644 index 000000000..47bfa5e16 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Semicolon.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SEMICOLON extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Sl.php b/vendor/phpunit/php-token-stream/src/Sl.php new file mode 100644 index 000000000..cda5ecc11 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Sl.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/SlEqual.php b/vendor/phpunit/php-token-stream/src/SlEqual.php new file mode 100644 index 000000000..3d8a17e5a --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/SlEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SL_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Spaceship.php b/vendor/phpunit/php-token-stream/src/Spaceship.php new file mode 100644 index 000000000..639a2e30a --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Spaceship.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SPACESHIP extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Sr.php b/vendor/phpunit/php-token-stream/src/Sr.php new file mode 100644 index 000000000..749bf0da5 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Sr.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/SrEqual.php b/vendor/phpunit/php-token-stream/src/SrEqual.php new file mode 100644 index 000000000..674039fbd --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/SrEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SR_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/StartHeredoc.php b/vendor/phpunit/php-token-stream/src/StartHeredoc.php new file mode 100644 index 000000000..867a35760 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/StartHeredoc.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_START_HEREDOC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Static.php b/vendor/phpunit/php-token-stream/src/Static.php new file mode 100644 index 000000000..53307ce29 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Static.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_STATIC extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Token/Stream.php b/vendor/phpunit/php-token-stream/src/Stream.php similarity index 54% rename from vendor/phpunit/php-token-stream/src/Token/Stream.php rename to vendor/phpunit/php-token-stream/src/Stream.php index c2817b169..bcdb48a73 100644 --- a/vendor/phpunit/php-token-stream/src/Token/Stream.php +++ b/vendor/phpunit/php-token-stream/src/Stream.php @@ -1,50 +1,46 @@ - * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/** - * A stream of PHP tokens. - */ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator { /** - * @var array + * @var array> */ protected static $customTokens = [ - '(' => 'PHP_Token_OPEN_BRACKET', - ')' => 'PHP_Token_CLOSE_BRACKET', - '[' => 'PHP_Token_OPEN_SQUARE', - ']' => 'PHP_Token_CLOSE_SQUARE', - '{' => 'PHP_Token_OPEN_CURLY', - '}' => 'PHP_Token_CLOSE_CURLY', - ';' => 'PHP_Token_SEMICOLON', - '.' => 'PHP_Token_DOT', - ',' => 'PHP_Token_COMMA', - '=' => 'PHP_Token_EQUAL', - '<' => 'PHP_Token_LT', - '>' => 'PHP_Token_GT', - '+' => 'PHP_Token_PLUS', - '-' => 'PHP_Token_MINUS', - '*' => 'PHP_Token_MULT', - '/' => 'PHP_Token_DIV', - '?' => 'PHP_Token_QUESTION_MARK', - '!' => 'PHP_Token_EXCLAMATION_MARK', - ':' => 'PHP_Token_COLON', - '"' => 'PHP_Token_DOUBLE_QUOTES', - '@' => 'PHP_Token_AT', - '&' => 'PHP_Token_AMPERSAND', - '%' => 'PHP_Token_PERCENT', - '|' => 'PHP_Token_PIPE', - '$' => 'PHP_Token_DOLLAR', - '^' => 'PHP_Token_CARET', - '~' => 'PHP_Token_TILDE', - '`' => 'PHP_Token_BACKTICK' + '(' => PHP_Token_OPEN_BRACKET::class, + ')' => PHP_Token_CLOSE_BRACKET::class, + '[' => PHP_Token_OPEN_SQUARE::class, + ']' => PHP_Token_CLOSE_SQUARE::class, + '{' => PHP_Token_OPEN_CURLY::class, + '}' => PHP_Token_CLOSE_CURLY::class, + ';' => PHP_Token_SEMICOLON::class, + '.' => PHP_Token_DOT::class, + ',' => PHP_Token_COMMA::class, + '=' => PHP_Token_EQUAL::class, + '<' => PHP_Token_LT::class, + '>' => PHP_Token_GT::class, + '+' => PHP_Token_PLUS::class, + '-' => PHP_Token_MINUS::class, + '*' => PHP_Token_MULT::class, + '/' => PHP_Token_DIV::class, + '?' => PHP_Token_QUESTION_MARK::class, + '!' => PHP_Token_EXCLAMATION_MARK::class, + ':' => PHP_Token_COLON::class, + '"' => PHP_Token_DOUBLE_QUOTES::class, + '@' => PHP_Token_AT::class, + '&' => PHP_Token_AMPERSAND::class, + '%' => PHP_Token_PERCENT::class, + '|' => PHP_Token_PIPE::class, + '$' => PHP_Token_DOLLAR::class, + '^' => PHP_Token_CARET::class, + '~' => PHP_Token_TILDE::class, + '`' => PHP_Token_BACKTICK::class, ]; /** @@ -57,6 +53,11 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator */ protected $tokens = []; + /** + * @var array + */ + protected $tokensByLine = []; + /** * @var int */ @@ -104,9 +105,9 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator */ public function __construct($sourceCode) { - if (is_file($sourceCode)) { + if (\is_file($sourceCode)) { $this->filename = $sourceCode; - $sourceCode = file_get_contents($sourceCode); + $sourceCode = \file_get_contents($sourceCode); } $this->scan($sourceCode); @@ -117,7 +118,8 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator */ public function __destruct() { - $this->tokens = []; + $this->tokens = []; + $this->tokensByLine = []; } /** @@ -143,70 +145,11 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator } /** - * Scans the source for sequences of characters and converts them into a - * stream of tokens. - * - * @param string $sourceCode + * @return int */ - protected function scan($sourceCode) + public function count() { - $id = 0; - $line = 1; - $tokens = token_get_all($sourceCode); - $numTokens = count($tokens); - - $lastNonWhitespaceTokenWasDoubleColon = false; - - for ($i = 0; $i < $numTokens; ++$i) { - $token = $tokens[$i]; - $skip = 0; - - if (is_array($token)) { - $name = substr(token_name($token[0]), 2); - $text = $token[1]; - - if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') { - $name = 'CLASS_NAME_CONSTANT'; - } elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == T_FUNCTION) { - $name = 'USE_FUNCTION'; - $text .= $tokens[$i + 1][1] . $tokens[$i + 2][1]; - $skip = 2; - } - - $tokenClass = 'PHP_Token_' . $name; - } else { - $text = $token; - $tokenClass = self::$customTokens[$token]; - } - - $this->tokens[] = new $tokenClass($text, $line, $this, $id++); - $lines = substr_count($text, "\n"); - $line += $lines; - - if ($tokenClass == 'PHP_Token_HALT_COMPILER') { - break; - } elseif ($tokenClass == 'PHP_Token_COMMENT' || - $tokenClass == 'PHP_Token_DOC_COMMENT') { - $this->linesOfCode['cloc'] += $lines + 1; - } - - if ($name == 'DOUBLE_COLON') { - $lastNonWhitespaceTokenWasDoubleColon = true; - } elseif ($name != 'WHITESPACE') { - $lastNonWhitespaceTokenWasDoubleColon = false; - } - - $i += $skip; - } - - $this->linesOfCode['loc'] = substr_count($sourceCode, "\n"); - $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] - - $this->linesOfCode['cloc']; - } - - public function count(): int - { - return count($this->tokens); + return \count($this->tokens); } /** @@ -285,7 +228,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator * * @param bool $categorize OPTIONAL * @param string $category OPTIONAL Either 'require_once', 'require', - * 'include_once', 'include'. + * 'include_once', 'include' * * @return array */ @@ -293,19 +236,20 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator { if ($this->includes === null) { $this->includes = [ - 'require_once' => [], - 'require' => [], - 'include_once' => [], - 'include' => [] + 'require_once' => [], + 'require' => [], + 'include_once' => [], + 'include' => [], ]; foreach ($this->tokens as $token) { - switch (PHP_Token_Util::getClass($token)) { - case 'PHP_Token_REQUIRE_ONCE': - case 'PHP_Token_REQUIRE': - case 'PHP_Token_INCLUDE_ONCE': - case 'PHP_Token_INCLUDE': + switch (\get_class($token)) { + case PHP_Token_REQUIRE_ONCE::class: + case PHP_Token_REQUIRE::class: + case PHP_Token_INCLUDE_ONCE::class: + case PHP_Token_INCLUDE::class: $this->includes[$token->getType()][] = $token->getName(); + break; } } @@ -314,7 +258,7 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator if (isset($this->includes[$category])) { $includes = $this->includes[$category]; } elseif ($categorize === false) { - $includes = array_merge( + $includes = \array_merge( $this->includes['require_once'], $this->includes['require'], $this->includes['include_once'], @@ -341,131 +285,6 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator } } - protected function parse() - { - $this->interfaces = []; - $this->classes = []; - $this->traits = []; - $this->functions = []; - $class = []; - $classEndLine = []; - $trait = false; - $traitEndLine = false; - $interface = false; - $interfaceEndLine = false; - - foreach ($this->tokens as $token) { - switch (PHP_Token_Util::getClass($token)) { - case 'PHP_Token_HALT_COMPILER': - return; - - case 'PHP_Token_INTERFACE': - $interface = $token->getName(); - $interfaceEndLine = $token->getEndLine(); - - $this->interfaces[$interface] = [ - 'methods' => [], - 'parent' => $token->getParent(), - 'keywords' => $token->getKeywords(), - 'docblock' => $token->getDocblock(), - 'startLine' => $token->getLine(), - 'endLine' => $interfaceEndLine, - 'package' => $token->getPackage(), - 'file' => $this->filename - ]; - break; - - case 'PHP_Token_CLASS': - case 'PHP_Token_TRAIT': - $tmp = [ - 'methods' => [], - 'parent' => $token->getParent(), - 'interfaces'=> $token->getInterfaces(), - 'keywords' => $token->getKeywords(), - 'docblock' => $token->getDocblock(), - 'startLine' => $token->getLine(), - 'endLine' => $token->getEndLine(), - 'package' => $token->getPackage(), - 'file' => $this->filename - ]; - - if ($token->getName() !== null) { - if ($token instanceof PHP_Token_CLASS) { - $class[] = $token->getName(); - $classEndLine[] = $token->getEndLine(); - - $this->classes[$class[count($class) - 1]] = $tmp; - } else { - $trait = $token->getName(); - $traitEndLine = $token->getEndLine(); - $this->traits[$trait] = $tmp; - } - } - break; - - case 'PHP_Token_FUNCTION': - $name = $token->getName(); - $tmp = [ - 'docblock' => $token->getDocblock(), - 'keywords' => $token->getKeywords(), - 'visibility'=> $token->getVisibility(), - 'signature' => $token->getSignature(), - 'startLine' => $token->getLine(), - 'endLine' => $token->getEndLine(), - 'ccn' => $token->getCCN(), - 'file' => $this->filename - ]; - - if (empty($class) && - $trait === false && - $interface === false) { - $this->functions[$name] = $tmp; - - $this->addFunctionToMap( - $name, - $tmp['startLine'], - $tmp['endLine'] - ); - } elseif (!empty($class)) { - $this->classes[$class[count($class) - 1]]['methods'][$name] = $tmp; - - $this->addFunctionToMap( - $class[count($class) - 1] . '::' . $name, - $tmp['startLine'], - $tmp['endLine'] - ); - } elseif ($trait !== false) { - $this->traits[$trait]['methods'][$name] = $tmp; - - $this->addFunctionToMap( - $trait . '::' . $name, - $tmp['startLine'], - $tmp['endLine'] - ); - } else { - $this->interfaces[$interface]['methods'][$name] = $tmp; - } - break; - - case 'PHP_Token_CLOSE_CURLY': - if (!empty($classEndLine) && - $classEndLine[count($classEndLine) - 1] == $token->getLine()) { - array_pop($classEndLine); - array_pop($class); - } elseif ($traitEndLine !== false && - $traitEndLine == $token->getLine()) { - $trait = false; - $traitEndLine = false; - } elseif ($interfaceEndLine !== false && - $interfaceEndLine == $token->getLine()) { - $interface = false; - $interfaceEndLine = false; - } - break; - } - } - } - /** * @return array */ @@ -474,47 +293,60 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator return $this->linesOfCode; } - public function rewind(): void + public function rewind()/*: void*/ { $this->position = 0; } - public function valid(): bool + /** + * @return bool + */ + public function valid() { return isset($this->tokens[$this->position]); } - #[\ReturnTypeWillChange] + /** + * @return int + */ public function key() { return $this->position; } - #[\ReturnTypeWillChange] + /** + * @return PHP_Token + */ public function current() { return $this->tokens[$this->position]; } - public function next(): void + public function next()/*: void*/ { $this->position++; } /** * @param int $offset + * + * @return bool */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->tokens[$offset]); } - #[\ReturnTypeWillChange] + /** + * @param int $offset + * + * @throws OutOfBoundsException + */ public function offsetGet($offset) { if (!$this->offsetExists($offset)) { throw new OutOfBoundsException( - sprintf( + \sprintf( 'No token at position "%s"', $offset ) @@ -525,10 +357,9 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator } /** - * @param int $offset - * @param mixed $value + * @param int $offset */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value)/*: void*/ { $this->tokens[$offset] = $value; } @@ -538,11 +369,11 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator * * @throws OutOfBoundsException */ - public function offsetUnset($offset): void + public function offsetUnset($offset)/*: void*/ { if (!$this->offsetExists($offset)) { throw new OutOfBoundsException( - sprintf( + \sprintf( 'No token at position "%s"', $offset ) @@ -559,13 +390,13 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator * * @throws OutOfBoundsException */ - public function seek($position): void + public function seek($position)/*: void*/ { $this->position = $position; if (!$this->valid()) { throw new OutOfBoundsException( - sprintf( + \sprintf( 'No token at position "%s"', $this->position ) @@ -573,12 +404,252 @@ class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator } } + /** + * Scans the source for sequences of characters and converts them into a + * stream of tokens. + * + * @param string $sourceCode + */ + protected function scan($sourceCode)/*: void*/ + { + $id = 0; + $line = 1; + $tokens = \token_get_all($sourceCode); + $numTokens = \count($tokens); + + $lastNonWhitespaceTokenWasDoubleColon = false; + + $name = null; + + for ($i = 0; $i < $numTokens; ++$i) { + $token = $tokens[$i]; + $skip = 0; + + if (\is_array($token)) { + $name = \substr(\token_name($token[0]), 2); + $text = $token[1]; + + if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') { + $name = 'CLASS_NAME_CONSTANT'; + } elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == \T_FUNCTION) { + $name = 'USE_FUNCTION'; + $text .= $tokens[$i + 1][1] . $tokens[$i + 2][1]; + $skip = 2; + } + + /** @var class-string $tokenClass */ + $tokenClass = 'PHP_Token_' . $name; + } else { + $text = $token; + $tokenClass = self::$customTokens[$token]; + } + + /* + * @see https://github.com/sebastianbergmann/php-token-stream/issues/95 + */ + if (PHP_MAJOR_VERSION >= 8 && + $name === 'WHITESPACE' && // Current token is T_WHITESPACE + isset($this->tokens[$id - 1]) && // Current token is not the first token + $this->tokens[$id - 1] instanceof PHP_Token_COMMENT && // Previous token is T_COMMENT + strpos((string) $this->tokens[$id - 1], '/*') === false && // Previous token is comment that starts with '#' or '//' + strpos($text, "\n") === 0 // Text of current token begins with newline + ) { + $this->tokens[$id - 1] = new PHP_Token_COMMENT( + $this->tokens[$id - 1] . "\n", + $this->tokens[$id - 1]->getLine(), + $this, + $id - 1 + ); + + $text = substr($text, 1); + + $line++; + + if (empty($text)) { + continue; + } + } + + if (!isset($this->tokensByLine[$line])) { + $this->tokensByLine[$line] = []; + } + + $token = new $tokenClass($text, $line, $this, $id++); + + $this->tokens[] = $token; + $this->tokensByLine[$line][] = $token; + + $line += \substr_count($text, "\n"); + + if ($tokenClass == PHP_Token_HALT_COMPILER::class) { + break; + } + + if ($name == 'DOUBLE_COLON') { + $lastNonWhitespaceTokenWasDoubleColon = true; + } elseif ($name != 'WHITESPACE') { + $lastNonWhitespaceTokenWasDoubleColon = false; + } + + $i += $skip; + } + + foreach ($this->tokens as $token) { + if (!$token instanceof PHP_Token_COMMENT && !$token instanceof PHP_Token_DOC_COMMENT) { + continue; + } + + foreach ($this->tokensByLine[$token->getLine()] as $_token) { + if (!$_token instanceof PHP_Token_COMMENT && !$_token instanceof PHP_Token_DOC_COMMENT && !$_token instanceof PHP_Token_WHITESPACE) { + continue 2; + } + } + + $this->linesOfCode['cloc'] += max(1, \substr_count((string) $token, "\n")); + } + + $this->linesOfCode['loc'] = \substr_count($sourceCode, "\n"); + $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] - + $this->linesOfCode['cloc']; + } + + protected function parse()/*: void*/ + { + $this->interfaces = []; + $this->classes = []; + $this->traits = []; + $this->functions = []; + $class = []; + $classEndLine = []; + $trait = false; + $traitEndLine = false; + $interface = false; + $interfaceEndLine = false; + + foreach ($this->tokens as $token) { + switch (\get_class($token)) { + case PHP_Token_HALT_COMPILER::class: + return; + + case PHP_Token_INTERFACE::class: + $interface = $token->getName(); + $interfaceEndLine = $token->getEndLine(); + + $this->interfaces[$interface] = [ + 'methods' => [], + 'parent' => $token->getParent(), + 'keywords' => $token->getKeywords(), + 'docblock' => $token->getDocblock(), + 'startLine' => $token->getLine(), + 'endLine' => $interfaceEndLine, + 'package' => $token->getPackage(), + 'file' => $this->filename, + ]; + + break; + + case PHP_Token_CLASS::class: + case PHP_Token_TRAIT::class: + $tmp = [ + 'methods' => [], + 'parent' => $token->getParent(), + 'interfaces'=> $token->getInterfaces(), + 'keywords' => $token->getKeywords(), + 'docblock' => $token->getDocblock(), + 'startLine' => $token->getLine(), + 'endLine' => $token->getEndLine(), + 'package' => $token->getPackage(), + 'file' => $this->filename, + ]; + + if ($token instanceof PHP_Token_CLASS) { + $class[] = $token->getName(); + $classEndLine[] = $token->getEndLine(); + + if ($token->getName() !== null) { + $this->classes[$class[\count($class) - 1]] = $tmp; + } + } else { + $trait = $token->getName(); + $traitEndLine = $token->getEndLine(); + $this->traits[$trait] = $tmp; + } + + break; + + case PHP_Token_FUNCTION::class: + $name = $token->getName(); + $tmp = [ + 'docblock' => $token->getDocblock(), + 'keywords' => $token->getKeywords(), + 'visibility'=> $token->getVisibility(), + 'signature' => $token->getSignature(), + 'startLine' => $token->getLine(), + 'endLine' => $token->getEndLine(), + 'ccn' => $token->getCCN(), + 'file' => $this->filename, + ]; + + if (empty($class) && + $trait === false && + $interface === false) { + $this->functions[$name] = $tmp; + + $this->addFunctionToMap( + $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } elseif (!empty($class)) { + if ($class[\count($class) - 1] !== null) { + $this->classes[$class[\count($class) - 1]]['methods'][$name] = $tmp; + + $this->addFunctionToMap( + $class[\count($class) - 1] . '::' . $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } + } elseif ($trait !== false) { + $this->traits[$trait]['methods'][$name] = $tmp; + + $this->addFunctionToMap( + $trait . '::' . $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } else { + $this->interfaces[$interface]['methods'][$name] = $tmp; + } + + break; + + case PHP_Token_CLOSE_CURLY::class: + if (!empty($classEndLine) && + $classEndLine[\count($classEndLine) - 1] == $token->getLine()) { + \array_pop($classEndLine); + \array_pop($class); + } elseif ($traitEndLine !== false && + $traitEndLine == $token->getLine()) { + $trait = false; + $traitEndLine = false; + } elseif ($interfaceEndLine !== false && + $interfaceEndLine == $token->getLine()) { + $interface = false; + $interfaceEndLine = false; + } + + break; + } + } + } + /** * @param string $name * @param int $startLine * @param int $endLine */ - private function addFunctionToMap($name, $startLine, $endLine) + private function addFunctionToMap($name, $startLine, $endLine): void { for ($line = $startLine; $line <= $endLine; $line++) { $this->lineToFunctionMap[$line] = $name; diff --git a/vendor/phpunit/php-token-stream/src/String.php b/vendor/phpunit/php-token-stream/src/String.php new file mode 100644 index 000000000..89deb0048 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/String.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_STRING extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/StringCast.php b/vendor/phpunit/php-token-stream/src/StringCast.php new file mode 100644 index 000000000..f2df377ce --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/StringCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_STRING_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/StringVarname.php b/vendor/phpunit/php-token-stream/src/StringVarname.php new file mode 100644 index 000000000..9012f1f9b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/StringVarname.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_STRING_VARNAME extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Switch.php b/vendor/phpunit/php-token-stream/src/Switch.php new file mode 100644 index 000000000..030d43b52 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Switch.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_SWITCH extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Throw.php b/vendor/phpunit/php-token-stream/src/Throw.php new file mode 100644 index 000000000..213fda067 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Throw.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_THROW extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Tilde.php b/vendor/phpunit/php-token-stream/src/Tilde.php new file mode 100644 index 000000000..c6c6ca5b9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Tilde.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_TILDE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Token.php b/vendor/phpunit/php-token-stream/src/Token.php index 65fdb0677..d6280f3e9 100644 --- a/vendor/phpunit/php-token-stream/src/Token.php +++ b/vendor/phpunit/php-token-stream/src/Token.php @@ -1,16 +1,12 @@ - * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/** - * A PHP token. - */ abstract class PHP_Token { /** @@ -34,10 +30,9 @@ abstract class PHP_Token protected $id; /** - * @param string $text - * @param int $line - * @param PHP_Token_Stream $tokenStream - * @param int $id + * @param string $text + * @param int $line + * @param int $id */ public function __construct($text, $line, PHP_Token_Stream $tokenStream, $id) { @@ -71,1291 +66,3 @@ abstract class PHP_Token return $this->id; } } - -abstract class PHP_TokenWithScope extends PHP_Token -{ - /** - * @var int - */ - protected $endTokenId; - - /** - * Get the docblock for this token - * - * This method will fetch the docblock belonging to the current token. The - * docblock must be placed on the line directly above the token to be - * recognized. - * - * @return string|null Returns the docblock as a string if found - */ - public function getDocblock() - { - $tokens = $this->tokenStream->tokens(); - $currentLineNumber = $tokens[$this->id]->getLine(); - $prevLineNumber = $currentLineNumber - 1; - - for ($i = $this->id - 1; $i; $i--) { - if (!isset($tokens[$i])) { - return; - } - - if ($tokens[$i] instanceof PHP_Token_FUNCTION || - $tokens[$i] instanceof PHP_Token_CLASS || - $tokens[$i] instanceof PHP_Token_TRAIT) { - // Some other trait, class or function, no docblock can be - // used for the current token - break; - } - - $line = $tokens[$i]->getLine(); - - if ($line == $currentLineNumber || - ($line == $prevLineNumber && - $tokens[$i] instanceof PHP_Token_WHITESPACE)) { - continue; - } - - if ($line < $currentLineNumber && - !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) { - break; - } - - return (string) $tokens[$i]; - } - } - - /** - * @return int - */ - public function getEndTokenId() - { - $block = 0; - $i = $this->id; - $tokens = $this->tokenStream->tokens(); - - while ($this->endTokenId === null && isset($tokens[$i])) { - if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY || - $tokens[$i] instanceof PHP_Token_DOLLAR_OPEN_CURLY_BRACES || - $tokens[$i] instanceof PHP_Token_CURLY_OPEN) { - $block++; - } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) { - $block--; - - if ($block === 0) { - $this->endTokenId = $i; - } - } elseif (($this instanceof PHP_Token_FUNCTION || - $this instanceof PHP_Token_NAMESPACE) && - $tokens[$i] instanceof PHP_Token_SEMICOLON) { - if ($block === 0) { - $this->endTokenId = $i; - } - } - - $i++; - } - - if ($this->endTokenId === null) { - $this->endTokenId = $this->id; - } - - return $this->endTokenId; - } - - /** - * @return int - */ - public function getEndLine() - { - return $this->tokenStream[$this->getEndTokenId()]->getLine(); - } -} - -abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope -{ - /** - * @return string - */ - public function getVisibility() - { - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_PRIVATE || - $tokens[$i] instanceof PHP_Token_PROTECTED || - $tokens[$i] instanceof PHP_Token_PUBLIC)) { - return strtolower( - str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i])) - ); - } - if (isset($tokens[$i]) && - !($tokens[$i] instanceof PHP_Token_STATIC || - $tokens[$i] instanceof PHP_Token_FINAL || - $tokens[$i] instanceof PHP_Token_ABSTRACT)) { - // no keywords; stop visibility search - break; - } - } - } - - /** - * @return string - */ - public function getKeywords() - { - $keywords = []; - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_PRIVATE || - $tokens[$i] instanceof PHP_Token_PROTECTED || - $tokens[$i] instanceof PHP_Token_PUBLIC)) { - continue; - } - - if (isset($tokens[$i]) && - ($tokens[$i] instanceof PHP_Token_STATIC || - $tokens[$i] instanceof PHP_Token_FINAL || - $tokens[$i] instanceof PHP_Token_ABSTRACT)) { - $keywords[] = strtolower( - str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i])) - ); - } - } - - return implode(',', $keywords); - } -} - -abstract class PHP_Token_Includes extends PHP_Token -{ - /** - * @var string - */ - protected $name; - - /** - * @var string - */ - protected $type; - - /** - * @return string - */ - public function getName() - { - if ($this->name === null) { - $this->process(); - } - - return $this->name; - } - - /** - * @return string - */ - public function getType() - { - if ($this->type === null) { - $this->process(); - } - - return $this->type; - } - - private function process() - { - $tokens = $this->tokenStream->tokens(); - - if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { - $this->name = trim($tokens[$this->id + 2], "'\""); - $this->type = strtolower( - str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$this->id])) - ); - } - } -} - -class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility -{ - /** - * @var array - */ - protected $arguments; - - /** - * @var int - */ - protected $ccn; - - /** - * @var string - */ - protected $name; - - /** - * @var string - */ - protected $signature; - - /** - * @var bool - */ - private $anonymous = false; - - /** - * @return array - */ - public function getArguments() - { - if ($this->arguments !== null) { - return $this->arguments; - } - - $this->arguments = []; - $tokens = $this->tokenStream->tokens(); - $typeDeclaration = null; - - // Search for first token inside brackets - $i = $this->id + 2; - - while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) { - $i++; - } - - while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { - if ($tokens[$i] instanceof PHP_Token_STRING) { - $typeDeclaration = (string) $tokens[$i]; - } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) { - $this->arguments[(string) $tokens[$i]] = $typeDeclaration; - $typeDeclaration = null; - } - - $i++; - } - - return $this->arguments; - } - - /** - * @return string - */ - public function getName() - { - if ($this->name !== null) { - return $this->name; - } - - $tokens = $this->tokenStream->tokens(); - - $i = $this->id + 1; - - if ($tokens[$i] instanceof PHP_Token_WHITESPACE) { - $i++; - } - - if ($tokens[$i] instanceof PHP_Token_AMPERSAND) { - $i++; - } - - if ($tokens[$i + 1] instanceof PHP_Token_OPEN_BRACKET) { - $this->name = (string) $tokens[$i]; - } elseif ($tokens[$i + 1] instanceof PHP_Token_WHITESPACE && $tokens[$i + 2] instanceof PHP_Token_OPEN_BRACKET) { - $this->name = (string) $tokens[$i]; - } else { - $this->anonymous = true; - - $this->name = sprintf( - 'anonymousFunction:%s#%s', - $this->getLine(), - $this->getId() - ); - } - - if (!$this->isAnonymous()) { - for ($i = $this->id; $i; --$i) { - if ($tokens[$i] instanceof PHP_Token_NAMESPACE) { - $this->name = $tokens[$i]->getName() . '\\' . $this->name; - - break; - } - - if ($tokens[$i] instanceof PHP_Token_INTERFACE) { - break; - } - } - } - - return $this->name; - } - - /** - * @return int - */ - public function getCCN() - { - if ($this->ccn !== null) { - return $this->ccn; - } - - $this->ccn = 1; - $end = $this->getEndTokenId(); - $tokens = $this->tokenStream->tokens(); - - for ($i = $this->id; $i <= $end; $i++) { - switch (PHP_Token_Util::getClass($tokens[$i])) { - case 'PHP_Token_IF': - case 'PHP_Token_ELSEIF': - case 'PHP_Token_FOR': - case 'PHP_Token_FOREACH': - case 'PHP_Token_WHILE': - case 'PHP_Token_CASE': - case 'PHP_Token_CATCH': - case 'PHP_Token_BOOLEAN_AND': - case 'PHP_Token_LOGICAL_AND': - case 'PHP_Token_BOOLEAN_OR': - case 'PHP_Token_LOGICAL_OR': - case 'PHP_Token_QUESTION_MARK': - $this->ccn++; - break; - } - } - - return $this->ccn; - } - - /** - * @return string - */ - public function getSignature() - { - if ($this->signature !== null) { - return $this->signature; - } - - if ($this->isAnonymous()) { - $this->signature = 'anonymousFunction'; - $i = $this->id + 1; - } else { - $this->signature = ''; - $i = $this->id + 2; - } - - $tokens = $this->tokenStream->tokens(); - - while (isset($tokens[$i]) && - !$tokens[$i] instanceof PHP_Token_OPEN_CURLY && - !$tokens[$i] instanceof PHP_Token_SEMICOLON) { - $this->signature .= $tokens[$i++]; - } - - $this->signature = trim($this->signature); - - return $this->signature; - } - - /** - * @return bool - */ - public function isAnonymous() - { - return $this->anonymous; - } -} - -class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility -{ - /** - * @var array - */ - protected $interfaces; - - /** - * @return string - */ - public function getName() - { - return (string) $this->tokenStream[$this->id + 2]; - } - - /** - * @return bool - */ - public function hasParent() - { - return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS; - } - - /** - * @return array - */ - public function getPackage() - { - $className = $this->getName(); - $docComment = $this->getDocblock(); - - $result = [ - 'namespace' => '', - 'fullPackage' => '', - 'category' => '', - 'package' => '', - 'subpackage' => '' - ]; - - for ($i = $this->id; $i; --$i) { - if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) { - $result['namespace'] = $this->tokenStream[$i]->getName(); - break; - } - } - - if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['category'] = $matches[1]; - } - - if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['package'] = $matches[1]; - $result['fullPackage'] = $matches[1]; - } - - if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) { - $result['subpackage'] = $matches[1]; - $result['fullPackage'] .= '.' . $matches[1]; - } - - if (empty($result['fullPackage'])) { - $result['fullPackage'] = $this->arrayToName( - explode('_', str_replace('\\', '_', $className)), - '.' - ); - } - - return $result; - } - - /** - * @param array $parts - * @param string $join - * - * @return string - */ - protected function arrayToName(array $parts, $join = '\\') - { - $result = ''; - - if (count($parts) > 1) { - array_pop($parts); - - $result = implode($join, $parts); - } - - return $result; - } - - /** - * @return bool|string - */ - public function getParent() - { - if (!$this->hasParent()) { - return false; - } - - $i = $this->id + 6; - $tokens = $this->tokenStream->tokens(); - $className = (string) $tokens[$i]; - - while (isset($tokens[$i + 1]) && - !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) { - $className .= (string) $tokens[++$i]; - } - - return $className; - } - - /** - * @return bool - */ - public function hasInterfaces() - { - return (isset($this->tokenStream[$this->id + 4]) && - $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) || - (isset($this->tokenStream[$this->id + 8]) && - $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS); - } - - /** - * @return array|bool - */ - public function getInterfaces() - { - if ($this->interfaces !== null) { - return $this->interfaces; - } - - if (!$this->hasInterfaces()) { - return ($this->interfaces = false); - } - - if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) { - $i = $this->id + 3; - } else { - $i = $this->id + 7; - } - - $tokens = $this->tokenStream->tokens(); - - while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) { - $i++; - - if ($tokens[$i] instanceof PHP_Token_STRING) { - $this->interfaces[] = (string) $tokens[$i]; - } - } - - return $this->interfaces; - } -} - -class PHP_Token_ABSTRACT extends PHP_Token -{ -} - -class PHP_Token_AMPERSAND extends PHP_Token -{ -} - -class PHP_Token_AND_EQUAL extends PHP_Token -{ -} - -class PHP_Token_ARRAY extends PHP_Token -{ -} - -class PHP_Token_ARRAY_CAST extends PHP_Token -{ -} - -class PHP_Token_AS extends PHP_Token -{ -} - -class PHP_Token_AT extends PHP_Token -{ -} - -class PHP_Token_BACKTICK extends PHP_Token -{ -} - -class PHP_Token_BAD_CHARACTER extends PHP_Token -{ -} - -class PHP_Token_BOOLEAN_AND extends PHP_Token -{ -} - -class PHP_Token_BOOLEAN_OR extends PHP_Token -{ -} - -class PHP_Token_BOOL_CAST extends PHP_Token -{ -} - -class PHP_Token_BREAK extends PHP_Token -{ -} - -class PHP_Token_CARET extends PHP_Token -{ -} - -class PHP_Token_CASE extends PHP_Token -{ -} - -class PHP_Token_CATCH extends PHP_Token -{ -} - -class PHP_Token_CHARACTER extends PHP_Token -{ -} - -class PHP_Token_CLASS extends PHP_Token_INTERFACE -{ - /** - * @var bool - */ - private $anonymous = false; - - /** - * @var string - */ - private $name; - - /** - * @return string - */ - public function getName() - { - if ($this->name !== null) { - return $this->name; - } - - $next = $this->tokenStream[$this->id + 1]; - - if ($next instanceof PHP_Token_WHITESPACE) { - $next = $this->tokenStream[$this->id + 2]; - } - - if ($next instanceof PHP_Token_STRING) { - $this->name =(string) $next; - - return $this->name; - } - - if ($next instanceof PHP_Token_OPEN_CURLY || - $next instanceof PHP_Token_EXTENDS || - $next instanceof PHP_Token_IMPLEMENTS) { - - $this->name = sprintf( - 'AnonymousClass:%s#%s', - $this->getLine(), - $this->getId() - ); - - $this->anonymous = true; - - return $this->name; - } - } - - public function isAnonymous() - { - return $this->anonymous; - } -} - -class PHP_Token_CLASS_C extends PHP_Token -{ -} - -class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token -{ -} - -class PHP_Token_CLONE extends PHP_Token -{ -} - -class PHP_Token_CLOSE_BRACKET extends PHP_Token -{ -} - -class PHP_Token_CLOSE_CURLY extends PHP_Token -{ -} - -class PHP_Token_CLOSE_SQUARE extends PHP_Token -{ -} - -class PHP_Token_CLOSE_TAG extends PHP_Token -{ -} - -class PHP_Token_COLON extends PHP_Token -{ -} - -class PHP_Token_COMMA extends PHP_Token -{ -} - -class PHP_Token_COMMENT extends PHP_Token -{ -} - -class PHP_Token_CONCAT_EQUAL extends PHP_Token -{ -} - -class PHP_Token_CONST extends PHP_Token -{ -} - -class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token -{ -} - -class PHP_Token_CONTINUE extends PHP_Token -{ -} - -class PHP_Token_CURLY_OPEN extends PHP_Token -{ -} - -class PHP_Token_DEC extends PHP_Token -{ -} - -class PHP_Token_DECLARE extends PHP_Token -{ -} - -class PHP_Token_DEFAULT extends PHP_Token -{ -} - -class PHP_Token_DIV extends PHP_Token -{ -} - -class PHP_Token_DIV_EQUAL extends PHP_Token -{ -} - -class PHP_Token_DNUMBER extends PHP_Token -{ -} - -class PHP_Token_DO extends PHP_Token -{ -} - -class PHP_Token_DOC_COMMENT extends PHP_Token -{ -} - -class PHP_Token_DOLLAR extends PHP_Token -{ -} - -class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token -{ -} - -class PHP_Token_DOT extends PHP_Token -{ -} - -class PHP_Token_DOUBLE_ARROW extends PHP_Token -{ -} - -class PHP_Token_DOUBLE_CAST extends PHP_Token -{ -} - -class PHP_Token_DOUBLE_COLON extends PHP_Token -{ -} - -class PHP_Token_DOUBLE_QUOTES extends PHP_Token -{ -} - -class PHP_Token_ECHO extends PHP_Token -{ -} - -class PHP_Token_ELSE extends PHP_Token -{ -} - -class PHP_Token_ELSEIF extends PHP_Token -{ -} - -class PHP_Token_EMPTY extends PHP_Token -{ -} - -class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token -{ -} - -class PHP_Token_ENDDECLARE extends PHP_Token -{ -} - -class PHP_Token_ENDFOR extends PHP_Token -{ -} - -class PHP_Token_ENDFOREACH extends PHP_Token -{ -} - -class PHP_Token_ENDIF extends PHP_Token -{ -} - -class PHP_Token_ENDSWITCH extends PHP_Token -{ -} - -class PHP_Token_ENDWHILE extends PHP_Token -{ -} - -class PHP_Token_END_HEREDOC extends PHP_Token -{ -} - -class PHP_Token_EQUAL extends PHP_Token -{ -} - -class PHP_Token_EVAL extends PHP_Token -{ -} - -class PHP_Token_EXCLAMATION_MARK extends PHP_Token -{ -} - -class PHP_Token_EXIT extends PHP_Token -{ -} - -class PHP_Token_EXTENDS extends PHP_Token -{ -} - -class PHP_Token_FILE extends PHP_Token -{ -} - -class PHP_Token_FINAL extends PHP_Token -{ -} - -class PHP_Token_FOR extends PHP_Token -{ -} - -class PHP_Token_FOREACH extends PHP_Token -{ -} - -class PHP_Token_FUNC_C extends PHP_Token -{ -} - -class PHP_Token_GLOBAL extends PHP_Token -{ -} - -class PHP_Token_GT extends PHP_Token -{ -} - -class PHP_Token_IF extends PHP_Token -{ -} - -class PHP_Token_IMPLEMENTS extends PHP_Token -{ -} - -class PHP_Token_INC extends PHP_Token -{ -} - -class PHP_Token_INCLUDE extends PHP_Token_Includes -{ -} - -class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes -{ -} - -class PHP_Token_INLINE_HTML extends PHP_Token -{ -} - -class PHP_Token_INSTANCEOF extends PHP_Token -{ -} - -class PHP_Token_INT_CAST extends PHP_Token -{ -} - -class PHP_Token_ISSET extends PHP_Token -{ -} - -class PHP_Token_IS_EQUAL extends PHP_Token -{ -} - -class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token -{ -} - -class PHP_Token_IS_IDENTICAL extends PHP_Token -{ -} - -class PHP_Token_IS_NOT_EQUAL extends PHP_Token -{ -} - -class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token -{ -} - -class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token -{ -} - -class PHP_Token_LINE extends PHP_Token -{ -} - -class PHP_Token_LIST extends PHP_Token -{ -} - -class PHP_Token_LNUMBER extends PHP_Token -{ -} - -class PHP_Token_LOGICAL_AND extends PHP_Token -{ -} - -class PHP_Token_LOGICAL_OR extends PHP_Token -{ -} - -class PHP_Token_LOGICAL_XOR extends PHP_Token -{ -} - -class PHP_Token_LT extends PHP_Token -{ -} - -class PHP_Token_METHOD_C extends PHP_Token -{ -} - -class PHP_Token_MINUS extends PHP_Token -{ -} - -class PHP_Token_MINUS_EQUAL extends PHP_Token -{ -} - -class PHP_Token_MOD_EQUAL extends PHP_Token -{ -} - -class PHP_Token_MULT extends PHP_Token -{ -} - -class PHP_Token_MUL_EQUAL extends PHP_Token -{ -} - -class PHP_Token_NEW extends PHP_Token -{ -} - -class PHP_Token_NUM_STRING extends PHP_Token -{ -} - -class PHP_Token_OBJECT_CAST extends PHP_Token -{ -} - -class PHP_Token_OBJECT_OPERATOR extends PHP_Token -{ -} - -class PHP_Token_OPEN_BRACKET extends PHP_Token -{ -} - -class PHP_Token_OPEN_CURLY extends PHP_Token -{ -} - -class PHP_Token_OPEN_SQUARE extends PHP_Token -{ -} - -class PHP_Token_OPEN_TAG extends PHP_Token -{ -} - -class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token -{ -} - -class PHP_Token_OR_EQUAL extends PHP_Token -{ -} - -class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token -{ -} - -class PHP_Token_PERCENT extends PHP_Token -{ -} - -class PHP_Token_PIPE extends PHP_Token -{ -} - -class PHP_Token_PLUS extends PHP_Token -{ -} - -class PHP_Token_PLUS_EQUAL extends PHP_Token -{ -} - -class PHP_Token_PRINT extends PHP_Token -{ -} - -class PHP_Token_PRIVATE extends PHP_Token -{ -} - -class PHP_Token_PROTECTED extends PHP_Token -{ -} - -class PHP_Token_PUBLIC extends PHP_Token -{ -} - -class PHP_Token_QUESTION_MARK extends PHP_Token -{ -} - -class PHP_Token_REQUIRE extends PHP_Token_Includes -{ -} - -class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes -{ -} - -class PHP_Token_RETURN extends PHP_Token -{ -} - -class PHP_Token_SEMICOLON extends PHP_Token -{ -} - -class PHP_Token_SL extends PHP_Token -{ -} - -class PHP_Token_SL_EQUAL extends PHP_Token -{ -} - -class PHP_Token_SR extends PHP_Token -{ -} - -class PHP_Token_SR_EQUAL extends PHP_Token -{ -} - -class PHP_Token_START_HEREDOC extends PHP_Token -{ -} - -class PHP_Token_STATIC extends PHP_Token -{ -} - -class PHP_Token_STRING extends PHP_Token -{ -} - -class PHP_Token_STRING_CAST extends PHP_Token -{ -} - -class PHP_Token_STRING_VARNAME extends PHP_Token -{ -} - -class PHP_Token_SWITCH extends PHP_Token -{ -} - -class PHP_Token_THROW extends PHP_Token -{ -} - -class PHP_Token_TILDE extends PHP_Token -{ -} - -class PHP_Token_TRY extends PHP_Token -{ -} - -class PHP_Token_UNSET extends PHP_Token -{ -} - -class PHP_Token_UNSET_CAST extends PHP_Token -{ -} - -class PHP_Token_USE extends PHP_Token -{ -} - -class PHP_Token_USE_FUNCTION extends PHP_Token -{ -} - -class PHP_Token_VAR extends PHP_Token -{ -} - -class PHP_Token_VARIABLE extends PHP_Token -{ -} - -class PHP_Token_WHILE extends PHP_Token -{ -} - -class PHP_Token_WHITESPACE extends PHP_Token -{ -} - -class PHP_Token_XOR_EQUAL extends PHP_Token -{ -} - -// Tokens introduced in PHP 5.1 -class PHP_Token_HALT_COMPILER extends PHP_Token -{ -} - -// Tokens introduced in PHP 5.3 -class PHP_Token_DIR extends PHP_Token -{ -} - -class PHP_Token_GOTO extends PHP_Token -{ -} - -class PHP_Token_NAMESPACE extends PHP_TokenWithScope -{ - /** - * @return string - */ - public function getName() - { - $tokens = $this->tokenStream->tokens(); - $namespace = (string) $tokens[$this->id + 2]; - - for ($i = $this->id + 3;; $i += 2) { - if (isset($tokens[$i]) && - $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) { - $namespace .= '\\' . $tokens[$i + 1]; - } else { - break; - } - } - - return $namespace; - } -} - -class PHP_Token_NS_C extends PHP_Token -{ -} - -class PHP_Token_NS_SEPARATOR extends PHP_Token -{ -} - -// Tokens introduced in PHP 5.4 -class PHP_Token_CALLABLE extends PHP_Token -{ -} - -class PHP_Token_INSTEADOF extends PHP_Token -{ -} - -class PHP_Token_TRAIT extends PHP_Token_INTERFACE -{ -} - -class PHP_Token_TRAIT_C extends PHP_Token -{ -} - -// Tokens introduced in PHP 5.5 -class PHP_Token_FINALLY extends PHP_Token -{ -} - -class PHP_Token_YIELD extends PHP_Token -{ -} - -// Tokens introduced in PHP 5.6 -class PHP_Token_ELLIPSIS extends PHP_Token -{ -} - -class PHP_Token_POW extends PHP_Token -{ -} - -class PHP_Token_POW_EQUAL extends PHP_Token -{ -} - -// Tokens introduced in PHP 7.0 -class PHP_Token_COALESCE extends PHP_Token -{ -} - -class PHP_Token_SPACESHIP extends PHP_Token -{ -} - -class PHP_Token_YIELD_FROM extends PHP_Token -{ -} - -// Tokens introduced in PHP 7.4 -class PHP_Token_COALESCE_EQUAL extends PHP_Token -{ -} - -class PHP_Token_FN extends PHP_Token -{ -} diff --git a/vendor/phpunit/php-token-stream/src/TokenWithScope.php b/vendor/phpunit/php-token-stream/src/TokenWithScope.php new file mode 100644 index 000000000..876b3508b --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/TokenWithScope.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +abstract class PHP_TokenWithScope extends PHP_Token +{ + /** + * @var int + */ + protected $endTokenId; + + /** + * Get the docblock for this token. + * + * This method will fetch the docblock belonging to the current token. The + * docblock must be placed on the line directly above the token to be + * recognized. + * + * @return null|string Returns the docblock as a string if found + */ + public function getDocblock() + { + $tokens = $this->tokenStream->tokens(); + $currentLineNumber = $tokens[$this->id]->getLine(); + $prevLineNumber = $currentLineNumber - 1; + + for ($i = $this->id - 1; $i; $i--) { + if (!isset($tokens[$i])) { + return; + } + + if ($tokens[$i] instanceof PHP_Token_FUNCTION || + $tokens[$i] instanceof PHP_Token_CLASS || + $tokens[$i] instanceof PHP_Token_TRAIT) { + // Some other trait, class or function, no docblock can be + // used for the current token + break; + } + + $line = $tokens[$i]->getLine(); + + if ($line == $currentLineNumber || + ($line == $prevLineNumber && + $tokens[$i] instanceof PHP_Token_WHITESPACE)) { + continue; + } + + if ($line < $currentLineNumber && + !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) { + break; + } + + return (string) $tokens[$i]; + } + } + + /** + * @return int + */ + public function getEndTokenId() + { + $block = 0; + $i = $this->id; + $tokens = $this->tokenStream->tokens(); + + while ($this->endTokenId === null && isset($tokens[$i])) { + if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY || + $tokens[$i] instanceof PHP_Token_DOLLAR_OPEN_CURLY_BRACES || + $tokens[$i] instanceof PHP_Token_CURLY_OPEN) { + $block++; + } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) { + $block--; + + if ($block === 0) { + $this->endTokenId = $i; + } + } elseif (($this instanceof PHP_Token_FUNCTION || + $this instanceof PHP_Token_NAMESPACE) && + $tokens[$i] instanceof PHP_Token_SEMICOLON) { + if ($block === 0) { + $this->endTokenId = $i; + } + } + + $i++; + } + + if ($this->endTokenId === null) { + $this->endTokenId = $this->id; + } + + return $this->endTokenId; + } + + /** + * @return int + */ + public function getEndLine() + { + return $this->tokenStream[$this->getEndTokenId()]->getLine(); + } +} diff --git a/vendor/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php b/vendor/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php new file mode 100644 index 000000000..fce0c8ea2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/TokenWithScopeAndVisibility.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope +{ + /** + * @return string + */ + public function getVisibility() + { + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_PRIVATE || + $tokens[$i] instanceof PHP_Token_PROTECTED || + $tokens[$i] instanceof PHP_Token_PUBLIC)) { + return \strtolower( + \str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i])) + ); + } + + if (isset($tokens[$i]) && + !($tokens[$i] instanceof PHP_Token_STATIC || + $tokens[$i] instanceof PHP_Token_FINAL || + $tokens[$i] instanceof PHP_Token_ABSTRACT)) { + // no keywords; stop visibility search + break; + } + } + } + + /** + * @return string + */ + public function getKeywords() + { + $keywords = []; + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_PRIVATE || + $tokens[$i] instanceof PHP_Token_PROTECTED || + $tokens[$i] instanceof PHP_Token_PUBLIC)) { + continue; + } + + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_STATIC || + $tokens[$i] instanceof PHP_Token_FINAL || + $tokens[$i] instanceof PHP_Token_ABSTRACT)) { + $keywords[] = \strtolower( + \str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i])) + ); + } + } + + return \implode(',', $keywords); + } +} diff --git a/vendor/phpunit/php-token-stream/src/Trait.php b/vendor/phpunit/php-token-stream/src/Trait.php new file mode 100644 index 000000000..f635f5dfb --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Trait.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_TRAIT extends PHP_Token_INTERFACE +{ +} diff --git a/vendor/phpunit/php-token-stream/src/TraitC.php b/vendor/phpunit/php-token-stream/src/TraitC.php new file mode 100644 index 000000000..ae4b2a5ae --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/TraitC.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_TRAIT_C extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Try.php b/vendor/phpunit/php-token-stream/src/Try.php new file mode 100644 index 000000000..8c3783e89 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Try.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_TRY extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Unset.php b/vendor/phpunit/php-token-stream/src/Unset.php new file mode 100644 index 000000000..3d39d0b68 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Unset.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_UNSET extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/UnsetCast.php b/vendor/phpunit/php-token-stream/src/UnsetCast.php new file mode 100644 index 000000000..133ef29fc --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/UnsetCast.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_UNSET_CAST extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Use.php b/vendor/phpunit/php-token-stream/src/Use.php new file mode 100644 index 000000000..e62a54972 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Use.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_USE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/UseFunction.php b/vendor/phpunit/php-token-stream/src/UseFunction.php new file mode 100644 index 000000000..8250864a9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/UseFunction.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_USE_FUNCTION extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Token/Util.php b/vendor/phpunit/php-token-stream/src/Util.php similarity index 69% rename from vendor/phpunit/php-token-stream/src/Token/Util.php rename to vendor/phpunit/php-token-stream/src/Util.php index 4d82f1a83..13b636c21 100644 --- a/vendor/phpunit/php-token-stream/src/Token/Util.php +++ b/vendor/phpunit/php-token-stream/src/Util.php @@ -1,19 +1,18 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - final class PHP_Token_Util { public static function getClass($object): string { - $parts = explode('\\', get_class($object)); + $parts = \explode('\\', \get_class($object)); - return array_pop($parts); + return \array_pop($parts); } -} \ No newline at end of file +} diff --git a/vendor/phpunit/php-token-stream/src/Var.php b/vendor/phpunit/php-token-stream/src/Var.php new file mode 100644 index 000000000..3dbd16ff2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Var.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_VAR extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Variable.php b/vendor/phpunit/php-token-stream/src/Variable.php new file mode 100644 index 000000000..921e3ae85 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Variable.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_VARIABLE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/While.php b/vendor/phpunit/php-token-stream/src/While.php new file mode 100644 index 000000000..e92409fff --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/While.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_WHILE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Whitespace.php b/vendor/phpunit/php-token-stream/src/Whitespace.php new file mode 100644 index 000000000..6b5b641ca --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Whitespace.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_WHITESPACE extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/XorEqual.php b/vendor/phpunit/php-token-stream/src/XorEqual.php new file mode 100644 index 000000000..0095b283e --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/XorEqual.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_XOR_EQUAL extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Yield.php b/vendor/phpunit/php-token-stream/src/Yield.php new file mode 100644 index 000000000..3fecb6c10 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Yield.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_YIELD extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/YieldFrom.php b/vendor/phpunit/php-token-stream/src/YieldFrom.php new file mode 100644 index 000000000..8f1a71680 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/YieldFrom.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_YIELD_FROM extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/break.php b/vendor/phpunit/php-token-stream/src/break.php new file mode 100644 index 000000000..97e96fee4 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/break.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class PHP_Token_BREAK extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php deleted file mode 100644 index 05eca32f2..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_ClassTest extends TestCase -{ - /** - * @var PHP_Token_CLASS - */ - private $class; - - /** - * @var PHP_Token_FUNCTION - */ - private $function; - - protected function setUp() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source2.php') as $token) { - if ($token instanceof PHP_Token_CLASS) { - $this->class = $token; - } - - if ($token instanceof PHP_Token_FUNCTION) { - $this->function = $token; - break; - } - } - } - - public function testGetClassKeywords() - { - $this->assertEquals('abstract', $this->class->getKeywords()); - } - - public function testGetFunctionKeywords() - { - $this->assertEquals('abstract,static', $this->function->getKeywords()); - } - - public function testGetFunctionVisibility() - { - $this->assertEquals('public', $this->function->getVisibility()); - } - - public function testIssue19() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'issue19.php') as $token) { - if ($token instanceof PHP_Token_CLASS) { - $this->assertFalse($token->hasInterfaces()); - } - } - } - - public function testIssue30() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue30.php'); - $this->assertCount(1, $ts->getClasses()); - } - - public function testAnonymousClassesAreHandledCorrectly() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class.php'); - - $classes = $ts->getClasses(); - - $this->assertEquals( - [ - 'class_with_method_that_declares_anonymous_class', - 'AnonymousClass:9#31', - 'AnonymousClass:10#55', - 'AnonymousClass:11#75', - 'AnonymousClass:12#91', - 'AnonymousClass:13#107' - ], - array_keys($classes) - ); - } - - /** - * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/52 - */ - public function testAnonymousClassesAreHandledCorrectly2() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class2.php'); - - $classes = $ts->getClasses(); - - $this->assertEquals(['Test', 'AnonymousClass:4#23'], array_keys($classes)); - $this->assertEquals(['methodOne', 'methodTwo'], array_keys($classes['Test']['methods'])); - - $this->assertEmpty($ts->getFunctions()); - } - - public function testImportedFunctionsAreHandledCorrectly() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'classUsesNamespacedFunction.php'); - - $this->assertEmpty($ts->getFunctions()); - $this->assertCount(1, $ts->getClasses()); - } - - /** - * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/543 - */ - public function testClassWithMultipleAnonymousClassesAndFunctionsIsHandledCorrectly() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_multiple_anonymous_classes_and_functions.php'); - - $classes = $ts->getClasses(); - - $this->assertArrayHasKey('class_with_multiple_anonymous_classes_and_functions', $classes); - $this->assertArrayHasKey('AnonymousClass:6#23', $classes); - $this->assertArrayHasKey('AnonymousClass:12#53', $classes); - $this->assertArrayHasKey('m', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); - $this->assertArrayHasKey('anonymousFunction:18#81', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); - $this->assertArrayHasKey('anonymousFunction:22#108', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); - } - - /** - * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/68 - */ - public function testClassWithMethodNamedEmptyIsHandledCorrectly() - { - $classes = (new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_named_empty.php'))->getClasses(); - - $this->assertArrayHasKey('class_with_method_named_empty', $classes); - $this->assertArrayHasKey('empty', $classes['class_with_method_named_empty']['methods']); - } - - /** - * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/424 - */ - public function testAnonymousFunctionDoesNotAffectStartAndEndLineOfMethod() - { - $classes = (new PHP_Token_Stream(TEST_FILES_PATH . 'php-code-coverage-issue-424.php'))->getClasses(); - - $this->assertSame(5, $classes['Example']['methods']['even']['startLine']); - $this->assertSame(12, $classes['Example']['methods']['even']['endLine']); - - $this->assertSame(7, $classes['Example']['methods']['anonymousFunction:7#28']['startLine']); - $this->assertSame(9, $classes['Example']['methods']['anonymousFunction:7#28']['endLine']); - } -} diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php deleted file mode 100644 index 4e893d8d1..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_ClosureTest extends TestCase -{ - /** - * @var PHP_Token_FUNCTION[] - */ - private $functions; - - protected function setUp() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php') as $token) { - if ($token instanceof PHP_Token_FUNCTION) { - $this->functions[] = $token; - } - } - } - - public function testGetArguments() - { - $this->assertEquals(['$foo' => null, '$bar' => null], $this->functions[0]->getArguments()); - $this->assertEquals(['$foo' => 'Foo', '$bar' => null], $this->functions[1]->getArguments()); - $this->assertEquals(['$foo' => null, '$bar' => null, '$baz' => null], $this->functions[2]->getArguments()); - $this->assertEquals(['$foo' => 'Foo', '$bar' => null, '$baz' => null], $this->functions[3]->getArguments()); - $this->assertEquals([], $this->functions[4]->getArguments()); - $this->assertEquals([], $this->functions[5]->getArguments()); - } - - public function testGetName() - { - $this->assertEquals('anonymousFunction:2#5', $this->functions[0]->getName()); - $this->assertEquals('anonymousFunction:3#27', $this->functions[1]->getName()); - $this->assertEquals('anonymousFunction:4#51', $this->functions[2]->getName()); - $this->assertEquals('anonymousFunction:5#71', $this->functions[3]->getName()); - $this->assertEquals('anonymousFunction:6#93', $this->functions[4]->getName()); - $this->assertEquals('anonymousFunction:7#106', $this->functions[5]->getName()); - } - - public function testGetLine() - { - $this->assertEquals(2, $this->functions[0]->getLine()); - $this->assertEquals(3, $this->functions[1]->getLine()); - $this->assertEquals(4, $this->functions[2]->getLine()); - $this->assertEquals(5, $this->functions[3]->getLine()); - } - - public function testGetEndLine() - { - $this->assertEquals(2, $this->functions[0]->getLine()); - $this->assertEquals(3, $this->functions[1]->getLine()); - $this->assertEquals(4, $this->functions[2]->getLine()); - $this->assertEquals(5, $this->functions[3]->getLine()); - } -} diff --git a/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php b/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php deleted file mode 100644 index c88454b9c..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_FunctionTest extends TestCase -{ - /** - * @var PHP_Token_FUNCTION[] - */ - private $functions; - - protected function setUp() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source.php') as $token) { - if ($token instanceof PHP_Token_FUNCTION) { - $this->functions[] = $token; - } - } - } - - public function testGetArguments() - { - $this->assertEquals([], $this->functions[0]->getArguments()); - - $this->assertEquals( - ['$baz' => 'Baz'], $this->functions[1]->getArguments() - ); - - $this->assertEquals( - ['$foobar' => 'Foobar'], $this->functions[2]->getArguments() - ); - - $this->assertEquals( - ['$barfoo' => 'Barfoo'], $this->functions[3]->getArguments() - ); - - $this->assertEquals([], $this->functions[4]->getArguments()); - - $this->assertEquals(['$x' => null, '$y' => null], $this->functions[5]->getArguments()); - } - - public function testGetName() - { - $this->assertEquals('foo', $this->functions[0]->getName()); - $this->assertEquals('bar', $this->functions[1]->getName()); - $this->assertEquals('foobar', $this->functions[2]->getName()); - $this->assertEquals('barfoo', $this->functions[3]->getName()); - $this->assertEquals('baz', $this->functions[4]->getName()); - } - - public function testGetLine() - { - $this->assertEquals(5, $this->functions[0]->getLine()); - $this->assertEquals(10, $this->functions[1]->getLine()); - $this->assertEquals(17, $this->functions[2]->getLine()); - $this->assertEquals(21, $this->functions[3]->getLine()); - $this->assertEquals(29, $this->functions[4]->getLine()); - $this->assertEquals(37, $this->functions[6]->getLine()); - } - - public function testGetEndLine() - { - $this->assertEquals(5, $this->functions[0]->getEndLine()); - $this->assertEquals(12, $this->functions[1]->getEndLine()); - $this->assertEquals(19, $this->functions[2]->getEndLine()); - $this->assertEquals(23, $this->functions[3]->getEndLine()); - $this->assertEquals(31, $this->functions[4]->getEndLine()); - $this->assertEquals(41, $this->functions[6]->getEndLine()); - } - - public function testGetDocblock() - { - $this->assertNull($this->functions[0]->getDocblock()); - - $this->assertEquals( - "/**\n * @param Baz \$baz\n */", - $this->functions[1]->getDocblock() - ); - - $this->assertEquals( - "/**\n * @param Foobar \$foobar\n */", - $this->functions[2]->getDocblock() - ); - - $this->assertNull($this->functions[3]->getDocblock()); - $this->assertNull($this->functions[4]->getDocblock()); - } - - public function testSignature() - { - $tokens = new PHP_Token_Stream(TEST_FILES_PATH . 'source5.php'); - $functions = $tokens->getFunctions(); - $classes = $tokens->getClasses(); - $interfaces = $tokens->getInterfaces(); - - $this->assertEquals( - 'foo($a, array $b, array $c = array())', - $functions['foo']['signature'] - ); - - $this->assertEquals( - 'm($a, array $b, array $c = array())', - $classes['c']['methods']['m']['signature'] - ); - - $this->assertEquals( - 'm($a, array $b, array $c = array())', - $classes['a']['methods']['m']['signature'] - ); - - $this->assertEquals( - 'm($a, array $b, array $c = array())', - $interfaces['i']['methods']['m']['signature'] - ); - } -} diff --git a/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php b/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php deleted file mode 100644 index 7f83a7360..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_IncludeTest extends TestCase -{ - /** - * @var PHP_Token_Stream - */ - private $ts; - - protected function setUp() - { - $this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php'); - } - - public function testGetIncludes() - { - $this->assertSame( - ['test4.php', 'test3.php', 'test2.php', 'test1.php'], - $this->ts->getIncludes() - ); - } - - public function testGetIncludesCategorized() - { - $this->assertSame( - [ - 'require_once' => ['test4.php'], - 'require' => ['test3.php'], - 'include_once' => ['test2.php'], - 'include' => ['test1.php'] - ], - $this->ts->getIncludes(true) - ); - } - - public function testGetIncludesCategory() - { - $this->assertSame( - ['test4.php'], - $this->ts->getIncludes(true, 'require_once') - ); - } -} diff --git a/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php deleted file mode 100644 index c61ec3871..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_InterfaceTest extends TestCase -{ - /** - * @var PHP_Token_CLASS - */ - private $class; - - /** - * @var PHP_Token_INTERFACE[] - */ - private $interfaces; - - protected function setUp() - { - $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php'); - $i = 0; - - foreach ($ts as $token) { - if ($token instanceof PHP_Token_CLASS) { - $this->class = $token; - } elseif ($token instanceof PHP_Token_INTERFACE) { - $this->interfaces[$i] = $token; - $i++; - } - } - } - - public function testGetName() - { - $this->assertEquals( - 'iTemplate', $this->interfaces[0]->getName() - ); - } - - public function testGetParentNotExists() - { - $this->assertFalse( - $this->interfaces[0]->getParent() - ); - } - - public function testHasParentNotExists() - { - $this->assertFalse( - $this->interfaces[0]->hasParent() - ); - } - - public function testGetParentExists() - { - $this->assertEquals( - 'a', $this->interfaces[2]->getParent() - ); - } - - public function testHasParentExists() - { - $this->assertTrue( - $this->interfaces[2]->hasParent() - ); - } - - public function testGetInterfacesExists() - { - $this->assertEquals( - ['b'], - $this->class->getInterfaces() - ); - } - - public function testHasInterfacesExists() - { - $this->assertTrue( - $this->class->hasInterfaces() - ); - } - - public function testGetPackageNamespace() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) { - if ($token instanceof PHP_Token_INTERFACE) { - $package = $token->getPackage(); - $this->assertSame('Foo\\Bar', $package['namespace']); - } - } - } - - public function provideFilesWithClassesWithinMultipleNamespaces() - { - return [ - [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingBraces.php'], - [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingNonBraceSyntax.php'], - ]; - } - - /** - * @dataProvider provideFilesWithClassesWithinMultipleNamespaces - */ - public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath) - { - $tokenStream = new PHP_Token_Stream($filepath); - $firstClassFound = false; - - foreach ($tokenStream as $token) { - if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) { - $package = $token->getPackage(); - $this->assertSame('TestClassInBar', $token->getName()); - $this->assertSame('Foo\\Bar', $package['namespace']); - $firstClassFound = true; - continue; - } - // Secound class - if ($token instanceof PHP_Token_INTERFACE) { - $package = $token->getPackage(); - $this->assertSame('TestClassInBaz', $token->getName()); - $this->assertSame('Foo\\Baz', $package['namespace']); - - return; - } - } - $this->fail('Searching for 2 classes failed'); - } - - public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces() - { - foreach ($this->interfaces as $token) { - $package = $token->getPackage(); - $this->assertSame('', $package['namespace']); - } - } - - public function testGetPackageNamespaceWhenExtentingFromNamespaceClass() - { - $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php'); - $firstClassFound = false; - - foreach ($tokenStream as $token) { - if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) { - $package = $token->getPackage(); - $this->assertSame('Baz', $token->getName()); - $this->assertSame('Foo\\Bar', $package['namespace']); - $firstClassFound = true; - continue; - } - - if ($token instanceof PHP_Token_INTERFACE) { - $package = $token->getPackage(); - $this->assertSame('Extender', $token->getName()); - $this->assertSame('Other\\Space', $package['namespace']); - - return; - } - } - - $this->fail('Searching for 2 classes failed'); - } -} diff --git a/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php deleted file mode 100644 index 97a922498..000000000 --- a/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use PHPUnit\Framework\TestCase; - -class PHP_Token_NamespaceTest extends TestCase -{ - public function testGetName() - { - $tokenStream = new PHP_Token_Stream( - TEST_FILES_PATH . 'classInNamespace.php' - ); - - foreach ($tokenStream as $token) { - if ($token instanceof PHP_Token_NAMESPACE) { - $this->assertSame('Foo\\Bar', $token->getName()); - } - } - } - - public function testGetStartLineWithUnscopedNamespace() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) { - if ($token instanceof PHP_Token_NAMESPACE) { - $this->assertSame(2, $token->getLine()); - } - } - } - - public function testGetEndLineWithUnscopedNamespace() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) { - if ($token instanceof PHP_Token_NAMESPACE) { - $this->assertSame(2, $token->getEndLine()); - } - } - } - public function testGetStartLineWithScopedNamespace() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php') as $token) { - if ($token instanceof PHP_Token_NAMESPACE) { - $this->assertSame(2, $token->getLine()); - } - } - } - - public function testGetEndLineWithScopedNamespace() - { - foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php') as $token) { - if ($token instanceof PHP_Token_NAMESPACE) { - $this->assertSame(8, $token->getEndLine()); - } - } - } -} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php b/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php deleted file mode 100644 index 560eec94c..000000000 --- a/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php +++ /dev/null @@ -1,10 +0,0 @@ -method_in_anonymous_class(); - } - - public function methodTwo() { - return false; - } -} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php deleted file mode 100644 index 3267ba561..000000000 --- a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -require __DIR__ . '/../vendor/autoload.php'; - -define( - 'TEST_FILES_PATH', - __DIR__ . DIRECTORY_SEPARATOR . '_fixture' . DIRECTORY_SEPARATOR -); diff --git a/vendor/phpunit/phpunit/ChangeLog-8.5.md b/vendor/phpunit/phpunit/ChangeLog-8.5.md index 9d0f4a1f9..6485b8e53 100644 --- a/vendor/phpunit/phpunit/ChangeLog-8.5.md +++ b/vendor/phpunit/phpunit/ChangeLog-8.5.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [8.5.32] - 2023-01-26 + +### Fixed + +* [#5120](https://github.com/sebastianbergmann/phpunit/issues/5120): Test Runner incorrectly treats `--testsuite` and `--list-tests` as not combinable options + ## [8.5.31] - 2022-10-28 ### Fixed @@ -256,6 +262,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil * [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable` * [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside +[8.5.32]: https://github.com/sebastianbergmann/phpunit/compare/8.5.31...8.5.32 [8.5.31]: https://github.com/sebastianbergmann/phpunit/compare/8.5.30...8.5.31 [8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5.30 [8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5.29 diff --git a/vendor/phpunit/phpunit/LICENSE b/vendor/phpunit/phpunit/LICENSE index 567141f2d..73e955128 100644 --- a/vendor/phpunit/phpunit/LICENSE +++ b/vendor/phpunit/phpunit/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2001-2022, Sebastian Bergmann +Copyright (c) 2001-2023, Sebastian Bergmann All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/vendor/phpunit/phpunit/README.md b/vendor/phpunit/phpunit/README.md index d8694bf04..e0f451c55 100644 --- a/vendor/phpunit/phpunit/README.md +++ b/vendor/phpunit/phpunit/README.md @@ -2,12 +2,12 @@ # PHPUnit -PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. - -[![Latest Stable Version](https://img.shields.io/packagist/v/phpunit/phpunit.svg?style=flat-square)](https://packagist.org/packages/phpunit/phpunit) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg?style=flat-square)](https://php.net/) -[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg?branch=8.5&event=push)](https://phpunit.de/build-status.html) +[![Latest Stable Version](https://poser.pugx.org/phpunit/phpunit/v/stable.png)](https://packagist.org/packages/phpunit/phpunit) +[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpunit/actions) [![Type Coverage](https://shepherd.dev/github/sebastianbergmann/phpunit/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/phpunit) +[![codecov](https://codecov.io/gh/sebastianbergmann/phpunit/branch/8.5/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/phpunit) + +PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. ## Installation diff --git a/vendor/phpunit/phpunit/src/Framework/Assert.php b/vendor/phpunit/phpunit/src/Framework/Assert.php index 3e2abfa01..12536edcd 100644 --- a/vendor/phpunit/phpunit/src/Framework/Assert.php +++ b/vendor/phpunit/phpunit/src/Framework/Assert.php @@ -3458,7 +3458,7 @@ abstract class Assert } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php index c42964cf5..6107a5aa1 100644 --- a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php @@ -59,7 +59,7 @@ class ClassHasAttribute extends Constraint } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php index 16e2917f6..6171d6730 100644 --- a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php @@ -51,7 +51,7 @@ final class ClassHasStaticAttribute extends ClassHasAttribute } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php index 121b16936..49fbd2e52 100644 --- a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php @@ -234,7 +234,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -301,7 +301,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -481,7 +481,7 @@ EOT; } catch (SoapFault $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -568,7 +568,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -598,7 +598,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -628,7 +628,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -656,7 +656,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -689,7 +689,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -716,7 +716,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -773,7 +773,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -795,7 +795,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -845,7 +845,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -872,7 +872,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -888,7 +888,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -929,7 +929,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -968,7 +968,7 @@ EOT; } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -1024,10 +1024,10 @@ EOT; $isInterface, $additionalInterfaces ), - 'clone' => $cloneTrait, - 'mock_class_name' => $mockClassName['className'], - 'mocked_methods' => $mockedMethods, - 'method' => $method, + 'clone' => $cloneTrait, + 'mock_class_name' => $mockClassName['className'], + 'mocked_methods' => $mockedMethods, + 'method' => $method, ] ); diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php index 6ff2b264e..955b9d7fa 100644 --- a/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php @@ -230,7 +230,7 @@ final class MockBuilder } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -276,7 +276,7 @@ final class MockBuilder } catch (ReflectionException $e) { throw new RuntimeException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/TestCase.php b/vendor/phpunit/phpunit/src/Framework/TestCase.php index 9ec27f923..d00b97771 100644 --- a/vendor/phpunit/phpunit/src/Framework/TestCase.php +++ b/vendor/phpunit/phpunit/src/Framework/TestCase.php @@ -518,7 +518,7 @@ abstract class TestCase extends Assert implements SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -728,7 +728,7 @@ abstract class TestCase extends Assert implements SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -2542,7 +2542,7 @@ abstract class TestCase extends Assert implements SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/TestResult.php b/vendor/phpunit/phpunit/src/Framework/TestResult.php index e72bd260a..57f1a5ef0 100644 --- a/vendor/phpunit/phpunit/src/Framework/TestResult.php +++ b/vendor/phpunit/phpunit/src/Framework/TestResult.php @@ -877,7 +877,7 @@ final class TestResult implements Countable } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -892,7 +892,7 @@ final class TestResult implements Countable } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/TestSuite.php b/vendor/phpunit/phpunit/src/Framework/TestSuite.php index 4c3075cc1..6c1c799cd 100644 --- a/vendor/phpunit/phpunit/src/Framework/TestSuite.php +++ b/vendor/phpunit/phpunit/src/Framework/TestSuite.php @@ -43,6 +43,8 @@ use ReflectionMethod; use Throwable; /** + * @template-implements IteratorAggregate + * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ class TestSuite implements IteratorAggregate, SelfDescribing, Test @@ -170,7 +172,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -253,7 +255,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -308,7 +310,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -329,7 +331,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -404,7 +406,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -426,7 +428,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -446,7 +448,7 @@ class TestSuite implements IteratorAggregate, SelfDescribing, Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php b/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php index e351622f3..76b12fcfb 100644 --- a/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php +++ b/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php @@ -14,6 +14,8 @@ use function count; use RecursiveIterator; /** + * @template-implements RecursiveIterator + * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestSuiteIterator implements RecursiveIterator diff --git a/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php b/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php index b658dfcc4..3131e764a 100644 --- a/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php +++ b/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php @@ -64,7 +64,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -89,7 +89,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -113,7 +113,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -137,7 +137,7 @@ final class StandardTestSuiteLoader implements TestSuiteLoader } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Runner/Version.php b/vendor/phpunit/phpunit/src/Runner/Version.php index 4e3537f81..d191c6967 100644 --- a/vendor/phpunit/phpunit/src/Runner/Version.php +++ b/vendor/phpunit/phpunit/src/Runner/Version.php @@ -38,7 +38,7 @@ final class Version } if (self::$version === '') { - self::$version = (new VersionId('8.5.31', dirname(__DIR__, 2)))->getVersion(); + self::$version = (new VersionId('8.5.32', dirname(__DIR__, 2)))->getVersion(); } return self::$version; diff --git a/vendor/phpunit/phpunit/src/TextUI/Command.php b/vendor/phpunit/phpunit/src/TextUI/Command.php index 4b8e5367c..93ca12837 100644 --- a/vendor/phpunit/phpunit/src/TextUI/Command.php +++ b/vendor/phpunit/phpunit/src/TextUI/Command.php @@ -1017,7 +1017,7 @@ class Command } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -1082,7 +1082,7 @@ class Command } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); // @codeCoverageIgnoreEnd @@ -1314,7 +1314,6 @@ class Command 'filter', 'groups', 'excludeGroups', - 'testsuite', ] ); @@ -1342,7 +1341,6 @@ class Command 'filter', 'groups', 'excludeGroups', - 'testsuite', ] ); diff --git a/vendor/phpunit/phpunit/src/TextUI/Help.php b/vendor/phpunit/phpunit/src/TextUI/Help.php index 2dd895604..5fa918fca 100644 --- a/vendor/phpunit/phpunit/src/TextUI/Help.php +++ b/vendor/phpunit/phpunit/src/TextUI/Help.php @@ -29,11 +29,11 @@ final class Help private const LEFT_MARGIN = ' '; private const HELP_TEXT = [ - 'Usage' => [ + 'Usage' => [ ['text' => 'phpunit [options] UnitTest [UnitTest.php]'], ['text' => 'phpunit [options] '], ], - 'Code Coverage Options' => [ + 'Code Coverage Options' => [ ['arg' => '--coverage-clover ', 'desc' => 'Generate code coverage report in Clover XML format'], ['arg' => '--coverage-crap4j ', 'desc' => 'Generate code coverage report in Crap4J XML format'], ['arg' => '--coverage-html ', 'desc' => 'Generate code coverage report in HTML format'], @@ -46,7 +46,7 @@ final class Help ['arg' => '--dump-xdebug-filter ', 'desc' => 'Generate script to set Xdebug code coverage filter'], ], - 'Logging Options' => [ + 'Logging Options' => [ ['arg' => '--log-junit ', 'desc' => 'Log test execution in JUnit XML format to file'], ['arg' => '--log-teamcity ', 'desc' => 'Log test execution in TeamCity format to file'], ['arg' => '--testdox-html ', 'desc' => 'Write agile documentation in HTML format to file'], @@ -111,13 +111,13 @@ final class Help ['arg' => '--printer ', 'desc' => 'TestListener implementation to use'], ['spacer' => ''], - ['arg' => '--order-by=', 'desc' => 'Run tests in order: default|defects|duration|no-depends|random|reverse|size'], - ['arg' => '--random-order-seed=', 'desc' => 'Use a specific random seed for random order'], - ['arg' => '--cache-result', 'desc' => 'Write test results to cache file'], - ['arg' => '--do-not-cache-result', 'desc' => 'Do not write test results to cache file'], + ['arg' => '--order-by=', 'desc' => 'Run tests in order: default|defects|duration|no-depends|random|reverse|size'], + ['arg' => '--random-order-seed=', 'desc' => 'Use a specific random seed for random order'], + ['arg' => '--cache-result', 'desc' => 'Write test results to cache file'], + ['arg' => '--do-not-cache-result', 'desc' => 'Do not write test results to cache file'], ], - 'Configuration Options' => [ + 'Configuration Options' => [ ['arg' => '--prepend ', 'desc' => 'A PHP script that is included as early as possible'], ['arg' => '--bootstrap ', 'desc' => 'A PHP script that is included before the tests run'], ['arg' => '-c|--configuration ', 'desc' => 'Read configuration from XML file'], @@ -129,7 +129,7 @@ final class Help ['arg' => '--cache-result-file=', 'desc' => 'Specify result cache path and filename'], ], - 'Miscellaneous Options' => [ + 'Miscellaneous Options' => [ ['arg' => '-h|--help', 'desc' => 'Prints this usage information'], ['arg' => '--version', 'desc' => 'Prints the version and exits'], ['arg' => '--atleast-version ', 'desc' => 'Checks that version is greater than min and exits'], diff --git a/vendor/phpunit/phpunit/src/TextUI/TestRunner.php b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php index ebf0e8dda..70b1340b1 100644 --- a/vendor/phpunit/phpunit/src/TextUI/TestRunner.php +++ b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php @@ -296,7 +296,7 @@ final class TestRunner extends BaseTestRunner } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -1073,7 +1073,7 @@ final class TestRunner extends BaseTestRunner } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -1121,7 +1121,7 @@ final class TestRunner extends BaseTestRunner } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php b/vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php index 22d33130f..84aad5f9c 100644 --- a/vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php +++ b/vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php @@ -480,7 +480,7 @@ final class DocBlock } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); // @codeCoverageIgnoreEnd diff --git a/vendor/phpunit/phpunit/src/Util/Annotation/Registry.php b/vendor/phpunit/phpunit/src/Util/Annotation/Registry.php index 798305be4..8ee6c8395 100644 --- a/vendor/phpunit/phpunit/src/Util/Annotation/Registry.php +++ b/vendor/phpunit/phpunit/src/Util/Annotation/Registry.php @@ -58,7 +58,7 @@ final class Registry } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -84,7 +84,7 @@ final class Registry } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Blacklist.php b/vendor/phpunit/phpunit/src/Util/Blacklist.php index dd89dcd55..6d95db91b 100644 --- a/vendor/phpunit/phpunit/src/Util/Blacklist.php +++ b/vendor/phpunit/phpunit/src/Util/Blacklist.php @@ -57,91 +57,91 @@ final class Blacklist */ public static $blacklistedClassNames = [ // composer - ClassLoader::class => 1, + ClassLoader::class => 1, // doctrine/instantiator - Instantiator::class => 1, + Instantiator::class => 1, // myclabs/deepcopy - DeepCopy::class => 1, + DeepCopy::class => 1, // phar-io/manifest - Manifest::class => 1, + Manifest::class => 1, // phar-io/version - PharIoVersion::class => 1, + PharIoVersion::class => 1, // phpdocumentor/reflection-common - Project::class => 1, + Project::class => 1, // phpdocumentor/reflection-docblock - DocBlock::class => 1, + DocBlock::class => 1, // phpdocumentor/type-resolver - Type::class => 1, + Type::class => 1, // phpspec/prophecy - Prophet::class => 1, + Prophet::class => 1, // phpunit/phpunit - TestCase::class => 2, + TestCase::class => 2, // phpunit/php-code-coverage - CodeCoverage::class => 1, + CodeCoverage::class => 1, // phpunit/php-file-iterator FileIteratorFacade::class => 1, // phpunit/php-invoker - Invoker::class => 1, + Invoker::class => 1, // phpunit/php-text-template - Text_Template::class => 1, + Text_Template::class => 1, // phpunit/php-timer - Timer::class => 1, + Timer::class => 1, // phpunit/php-token-stream - PHP_Token::class => 1, + PHP_Token::class => 1, // sebastian/code-unit-reverse-lookup - Wizard::class => 1, + Wizard::class => 1, // sebastian/comparator - Comparator::class => 1, + Comparator::class => 1, // sebastian/diff - Diff::class => 1, + Diff::class => 1, // sebastian/environment - Runtime::class => 1, + Runtime::class => 1, // sebastian/exporter - Exporter::class => 1, + Exporter::class => 1, // sebastian/global-state - Snapshot::class => 1, + Snapshot::class => 1, // sebastian/object-enumerator - Enumerator::class => 1, + Enumerator::class => 1, // sebastian/recursion-context - Context::class => 1, + Context::class => 1, // sebastian/resource-operations ResourceOperations::class => 1, // sebastian/type - TypeName::class => 1, + TypeName::class => 1, // sebastian/version - Version::class => 1, + Version::class => 1, // theseer/tokenizer - Tokenizer::class => 1, + Tokenizer::class => 1, // webmozart/assert - Assert::class => 1, + Assert::class => 1, ]; /** @@ -200,7 +200,7 @@ final class Blacklist } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Configuration.php b/vendor/phpunit/phpunit/src/Util/Configuration.php index 1cb5f772d..029b225d7 100644 --- a/vendor/phpunit/phpunit/src/Util/Configuration.php +++ b/vendor/phpunit/phpunit/src/Util/Configuration.php @@ -226,7 +226,7 @@ final class Configuration 'directory' => $includeDirectory, 'file' => $includeFile, ], - 'exclude' => [ + 'exclude' => [ 'directory' => $excludeDirectory, 'file' => $excludeFile, ], diff --git a/vendor/phpunit/phpunit/src/Util/Log/JUnit.php b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php index 710e2c47d..bdf04f76b 100644 --- a/vendor/phpunit/phpunit/src/Util/Log/JUnit.php +++ b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php @@ -302,7 +302,7 @@ final class JUnit extends Printer implements TestListener } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -317,7 +317,7 @@ final class JUnit extends Printer implements TestListener } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php b/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php index 695760d95..7964b9ae8 100644 --- a/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php +++ b/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php @@ -369,7 +369,7 @@ final class TeamCity extends ResultPrinter } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Test.php b/vendor/phpunit/phpunit/src/Util/Test.php index 0a8e3c5d8..82aec6806 100644 --- a/vendor/phpunit/phpunit/src/Util/Test.php +++ b/vendor/phpunit/phpunit/src/Util/Test.php @@ -376,7 +376,7 @@ final class Test public static function getBackupSettings(string $className, string $methodName): array { return [ - 'backupGlobals' => self::getBooleanAnnotationSetting( + 'backupGlobals' => self::getBooleanAnnotationSetting( $className, $methodName, 'backupGlobals' @@ -686,7 +686,7 @@ final class Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -716,7 +716,7 @@ final class Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -752,7 +752,7 @@ final class Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -778,7 +778,7 @@ final class Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -823,7 +823,7 @@ final class Test } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php b/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php index 5c6621190..76136ebdc 100644 --- a/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php +++ b/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php @@ -67,26 +67,26 @@ class CliTestDoxPrinter extends TestDoxPrinter ]; private const STATUS_STYLES = [ - BaseTestRunner::STATUS_PASSED => [ + BaseTestRunner::STATUS_PASSED => [ 'symbol' => '✔', 'color' => 'fg-green', ], - BaseTestRunner::STATUS_ERROR => [ + BaseTestRunner::STATUS_ERROR => [ 'symbol' => '✘', 'color' => 'fg-yellow', 'message' => 'bg-yellow,fg-black', ], - BaseTestRunner::STATUS_FAILURE => [ + BaseTestRunner::STATUS_FAILURE => [ 'symbol' => '✘', 'color' => 'fg-red', 'message' => 'bg-red,fg-white', ], - BaseTestRunner::STATUS_SKIPPED => [ + BaseTestRunner::STATUS_SKIPPED => [ 'symbol' => '↩', 'color' => 'fg-cyan', 'message' => 'fg-cyan', ], - BaseTestRunner::STATUS_RISKY => [ + BaseTestRunner::STATUS_RISKY => [ 'symbol' => '☢', 'color' => 'fg-yellow', 'message' => 'fg-yellow', @@ -96,12 +96,12 @@ class CliTestDoxPrinter extends TestDoxPrinter 'color' => 'fg-yellow', 'message' => 'fg-yellow', ], - BaseTestRunner::STATUS_WARNING => [ + BaseTestRunner::STATUS_WARNING => [ 'symbol' => '⚠', 'color' => 'fg-yellow', 'message' => 'fg-yellow', ], - BaseTestRunner::STATUS_UNKNOWN => [ + BaseTestRunner::STATUS_UNKNOWN => [ 'symbol' => '?', 'color' => 'fg-blue', 'message' => 'fg-white,bg-blue', diff --git a/vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php b/vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php index ca5af055a..d6d3ce2dd 100644 --- a/vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php +++ b/vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php @@ -238,7 +238,7 @@ final class NamePrettifier } catch (ReflectionException $e) { throw new UtilException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } @@ -258,7 +258,7 @@ final class NamePrettifier } catch (ReflectionException $e) { throw new UtilException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php b/vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php index fc511edd4..5d98c8e21 100644 --- a/vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php +++ b/vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php @@ -233,7 +233,7 @@ final class XmlResultPrinter extends Printer implements TestListener } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/phpunit/phpunit/src/Util/Xml.php b/vendor/phpunit/phpunit/src/Util/Xml.php index 1bf6a6146..ab053b57c 100644 --- a/vendor/phpunit/phpunit/src/Util/Xml.php +++ b/vendor/phpunit/phpunit/src/Util/Xml.php @@ -247,7 +247,7 @@ final class Xml } catch (ReflectionException $e) { throw new Exception( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } diff --git a/vendor/psr/container/composer.json b/vendor/psr/container/composer.json index 3797a2538..017f41ea6 100644 --- a/vendor/psr/container/composer.json +++ b/vendor/psr/container/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "autoload": { "psr-4": { diff --git a/vendor/psr/container/src/ContainerExceptionInterface.php b/vendor/psr/container/src/ContainerExceptionInterface.php index cf10b8b4f..0f213f2fe 100644 --- a/vendor/psr/container/src/ContainerExceptionInterface.php +++ b/vendor/psr/container/src/ContainerExceptionInterface.php @@ -2,9 +2,11 @@ namespace Psr\Container; +use Throwable; + /** * Base interface representing a generic exception in a container. */ -interface ContainerExceptionInterface +interface ContainerExceptionInterface extends Throwable { } diff --git a/vendor/psr/http-client/CHANGELOG.md b/vendor/psr/http-client/CHANGELOG.md new file mode 100644 index 000000000..e2dc25f51 --- /dev/null +++ b/vendor/psr/http-client/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.0.1 + +Allow installation with PHP 8. No code changes. + +## 1.0.0 + +First stable release. No changes since 0.3.0. + +## 0.3.0 + +Added Interface suffix on exceptions + +## 0.2.0 + +All exceptions are in `Psr\Http\Client` namespace + +## 0.1.0 + +First release diff --git a/vendor/psr/http-client/LICENSE b/vendor/psr/http-client/LICENSE new file mode 100644 index 000000000..cd5e0020a --- /dev/null +++ b/vendor/psr/http-client/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 PHP Framework Interoperability Group + +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/vendor/psr/http-client/README.md b/vendor/psr/http-client/README.md new file mode 100644 index 000000000..6876b8403 --- /dev/null +++ b/vendor/psr/http-client/README.md @@ -0,0 +1,12 @@ +HTTP Client +=========== + +This repository holds all the common code related to [PSR-18 (HTTP Client)][psr-url]. + +Note that this is not a HTTP Client implementation of its own. It is merely abstractions that describe the components of a HTTP Client. + +The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. + +[psr-url]: http://www.php-fig.org/psr/psr-18 +[package-url]: https://packagist.org/packages/psr/http-client +[implementation-url]: https://packagist.org/providers/psr/http-client-implementation diff --git a/vendor/psr/http-client/composer.json b/vendor/psr/http-client/composer.json new file mode 100644 index 000000000..c195f8ff1 --- /dev/null +++ b/vendor/psr/http-client/composer.json @@ -0,0 +1,27 @@ +{ + "name": "psr/http-client", + "description": "Common interface for HTTP clients", + "keywords": ["psr", "psr-18", "http", "http-client"], + "homepage": "https://github.com/php-fig/http-client", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-client/src/ClientExceptionInterface.php b/vendor/psr/http-client/src/ClientExceptionInterface.php new file mode 100644 index 000000000..aa0b9cf14 --- /dev/null +++ b/vendor/psr/http-client/src/ClientExceptionInterface.php @@ -0,0 +1,10 @@ +=7.0.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-factory/src/RequestFactoryInterface.php b/vendor/psr/http-factory/src/RequestFactoryInterface.php new file mode 100644 index 000000000..cb39a08bf --- /dev/null +++ b/vendor/psr/http-factory/src/RequestFactoryInterface.php @@ -0,0 +1,18 @@ +=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php new file mode 100644 index 000000000..dd46e5ec8 --- /dev/null +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -0,0 +1,187 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders(); + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader($name); + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader($name); + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine($name); + + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader($name, $value); + + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader($name, $value); + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader($name); + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody(); + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body); +} diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php new file mode 100644 index 000000000..a96d4fd63 --- /dev/null +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -0,0 +1,129 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams(); + + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query); + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles(); + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles); + + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data); + + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes(); + + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute($name, $default = null); + + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute($name, $value); + + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute($name); +} diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php new file mode 100644 index 000000000..f68f39126 --- /dev/null +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -0,0 +1,158 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority(); + + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo(); + + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost(); + + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort(); + + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath(); + + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery(); + + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment(); + + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme($scheme); + + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo($user, $password = null); + + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost($host); + + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort($port); + + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath($path); + + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery($query); + + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment($fragment); + + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString(); +} diff --git a/vendor/psy/psysh/LICENSE b/vendor/psy/psysh/LICENSE index 2c6a45137..007634a5f 100644 --- a/vendor/psy/psysh/LICENSE +++ b/vendor/psy/psysh/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2012-2018 Justin Hileman +Copyright (c) 2012-2023 Justin Hileman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/psy/psysh/README.md b/vendor/psy/psysh/README.md index 0be99d7a6..fc731d115 100644 --- a/vendor/psy/psysh/README.md +++ b/vendor/psy/psysh/README.md @@ -7,7 +7,7 @@ PsySH is a runtime developer console, interactive debugger and [REPL](https://en [![Monthly downloads](http://img.shields.io/packagist/dm/psy/psysh.svg?style=flat-square)](https://packagist.org/packages/psy/psysh) [![Made out of awesome](https://img.shields.io/badge/made_out_of_awesome-✓-brightgreen.svg?style=flat-square)](http://psysh.org) -[![Build status](https://img.shields.io/github/workflow/status/bobthecow/psysh/Tests/main.svg?style=flat-square)](https://github.com/bobthecow/psysh/actions?query=branch:main) +[![Build status](https://img.shields.io/github/actions/workflow/status/bobthecow/psysh/tests.yml?branch=main&style=flat-square)](https://github.com/bobthecow/psysh/actions?query=branch:main) [![StyleCI](https://styleci.io/repos/4549925/shield)](https://styleci.io/repos/4549925) @@ -30,6 +30,7 @@ PsySH is a runtime developer console, interactive debugger and [REPL](https://en ### [🛠 Configuration](https://github.com/bobthecow/psysh/wiki/Configuration) * [🎛 Config options](https://github.com/bobthecow/psysh/wiki/Config-options) + * [🎨 Themes](https://github.com/bobthecow/psysh/wiki/Themes) * [📄 Sample config file](https://github.com/bobthecow/psysh/wiki/Sample-config) ### [🔌 Integrations](https://github.com/bobthecow/psysh/wiki/Integrations) diff --git a/vendor/psy/psysh/bin/psysh b/vendor/psy/psysh/bin/psysh index ccb68f1b7..a20a3e115 100755 --- a/vendor/psy/psysh/bin/psysh +++ b/vendor/psy/psysh/bin/psysh @@ -4,7 +4,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2017 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/composer.json b/vendor/psy/psysh/composer.json index 95e6641da..c076d041f 100644 --- a/vendor/psy/psysh/composer.json +++ b/vendor/psy/psysh/composer.json @@ -13,23 +13,21 @@ } ], "require": { - "php": "^8.0 || ^7.0 || ^5.5.9", + "php": "^8.0 || ^7.0.8", "ext-json": "*", "ext-tokenizer": "*", - "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", - "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7", - "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3" + "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4", + "nikic/php-parser": "^4.0 || ^3.1" }, "require-dev": { - "hoa/console": "3.17.*", "bamarni/composer-bin-plugin": "^1.2" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + "ext-pdo-sqlite": "The doc command requires SQLite to work." }, "autoload": { "files": ["src/functions.php"], @@ -43,9 +41,17 @@ } }, "bin": ["bin/psysh"], + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + } + }, "extra": { "branch-alias": { - "dev-main": "0.10.x-dev" + "dev-main": "0.11.x-dev" } + }, + "conflict": { + "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" } } diff --git a/vendor/psy/psysh/src/CodeCleaner.php b/vendor/psy/psysh/src/CodeCleaner.php index c23bd2b36..d5f2720c3 100644 --- a/vendor/psy/psysh/src/CodeCleaner.php +++ b/vendor/psy/psysh/src/CodeCleaner.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,6 +18,7 @@ use Psy\CodeCleaner\AbstractClassPass; use Psy\CodeCleaner\AssignThisVariablePass; use Psy\CodeCleaner\CalledClassPass; use Psy\CodeCleaner\CallTimePassByReferencePass; +use Psy\CodeCleaner\CodeCleanerPass; use Psy\CodeCleaner\EmptyArrayDimFetchPass; use Psy\CodeCleaner\ExitPass; use Psy\CodeCleaner\FinalClassPass; @@ -38,7 +39,6 @@ use Psy\CodeCleaner\ReturnTypePass; use Psy\CodeCleaner\StrictTypesPass; use Psy\CodeCleaner\UseStatementPass; use Psy\CodeCleaner\ValidClassNamePass; -use Psy\CodeCleaner\ValidConstantPass; use Psy\CodeCleaner\ValidConstructorPass; use Psy\CodeCleaner\ValidFunctionNamePass; use Psy\Exception\ParseErrorException; @@ -63,7 +63,7 @@ class CodeCleaner * @param NodeTraverser|null $traverser A PhpParser NodeTraverser instance. One will be created if not explicitly supplied * @param bool $yolo run without input validation */ - public function __construct(Parser $parser = null, Printer $printer = null, NodeTraverser $traverser = null, $yolo = false) + public function __construct(Parser $parser = null, Printer $printer = null, NodeTraverser $traverser = null, bool $yolo = false) { $this->yolo = $yolo; @@ -83,10 +83,8 @@ class CodeCleaner /** * Check whether this CodeCleaner is in YOLO mode. - * - * @return bool */ - public function yolo() + public function yolo(): bool { return $this->yolo; } @@ -94,9 +92,9 @@ class CodeCleaner /** * Get default CodeCleaner passes. * - * @return array + * @return CodeCleanerPass[] */ - private function getDefaultPasses() + private function getDefaultPasses(): array { if ($this->yolo) { return $this->getYoloPasses(); @@ -140,7 +138,6 @@ class CodeCleaner // Namespace-aware validation (which depends on aforementioned shenanigans) new ValidClassNamePass(), - new ValidConstantPass(), new ValidFunctionNamePass(), ]; } @@ -152,9 +149,9 @@ class CodeCleaner * This list should stay in sync with the "rewriting shenanigans" in * getDefaultPasses above. * - * @return array + * @return CodeCleanerPass[] */ - private function getYoloPasses() + private function getYoloPasses(): array { $useStatementPass = new UseStatementPass(); $namespacePass = new NamespacePass($this); @@ -211,8 +208,6 @@ class CodeCleaner $traverser->traverse($stmts); } catch (\Throwable $e) { // Don't care. - } catch (\Exception $e) { - // Still don't care. } } @@ -244,10 +239,8 @@ class CodeCleaner * Check whether a given backtrace frame is a call to Psy\debug. * * @param array $stackFrame - * - * @return bool */ - private static function isDebugCall(array $stackFrame) + private static function isDebugCall(array $stackFrame): bool { $class = isset($stackFrame['class']) ? $stackFrame['class'] : null; $function = isset($stackFrame['function']) ? $stackFrame['function'] : null; @@ -266,7 +259,7 @@ class CodeCleaner * * @return string|false Cleaned PHP code, False if the input is incomplete */ - public function clean(array $codeLines, $requireSemicolons = false) + public function clean(array $codeLines, bool $requireSemicolons = false) { $stmts = $this->parse('parser->parse($code); @@ -357,7 +348,7 @@ class CodeCleaner } } - private function parseErrorIsEOF(\PhpParser\Error $e) + private function parseErrorIsEOF(\PhpParser\Error $e): bool { $msg = $e->getRawMessage(); @@ -373,10 +364,8 @@ class CodeCleaner * * @param \PhpParser\Error $e * @param string $code - * - * @return bool */ - private function parseErrorIsUnclosedString(\PhpParser\Error $e, $code) + private function parseErrorIsUnclosedString(\PhpParser\Error $e, string $code): bool { if ($e->getRawMessage() !== 'Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE') { return false; @@ -384,19 +373,19 @@ class CodeCleaner try { $this->parser->parse($code."';"); - } catch (\Exception $e) { + } catch (\Throwable $e) { return false; } return true; } - private function parseErrorIsUnterminatedComment(\PhpParser\Error $e, $code) + private function parseErrorIsUnterminatedComment(\PhpParser\Error $e, $code): bool { return $e->getRawMessage() === 'Unterminated comment'; } - private function parseErrorIsTrailingComma(\PhpParser\Error $e, $code) + private function parseErrorIsTrailingComma(\PhpParser\Error $e, $code): bool { return ($e->getRawMessage() === 'A trailing comma is not allowed here') && (\substr(\rtrim($code), -1) === ','); } diff --git a/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php b/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php index 4c0c859d0..af32fca25 100644 --- a/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,6 +28,8 @@ class AbstractClassPass extends CodeCleanerPass * @throws FatalErrorException if the node is an abstract function with a body * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -51,6 +53,8 @@ class AbstractClassPass extends CodeCleanerPass * @throws FatalErrorException if the node is a non-abstract class with abstract methods * * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php b/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php index ed3b4c812..0a884f0cf 100644 --- a/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -29,6 +29,8 @@ class AssignThisVariablePass extends CodeCleanerPass * @throws FatalErrorException if the user assign the `$this` variable * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php b/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php index e686d1799..3efaa6267 100644 --- a/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -15,6 +15,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; +use PhpParser\Node\VariadicPlaceholder; use Psy\Exception\FatalErrorException; /** @@ -34,6 +35,8 @@ class CallTimePassByReferencePass extends CodeCleanerPass * @throws FatalErrorException if the user used call-time pass-by-reference * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -42,6 +45,10 @@ class CallTimePassByReferencePass extends CodeCleanerPass } foreach ($node->args as $arg) { + if ($arg instanceof VariadicPlaceholder) { + continue; + } + if ($arg->byRef) { throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, \E_ERROR, null, $node->getLine()); } diff --git a/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php b/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php index 1e85ae359..b1dd00e10 100644 --- a/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -17,6 +17,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Trait_; +use PhpParser\Node\VariadicPlaceholder; use Psy\Exception\ErrorException; /** @@ -29,6 +30,8 @@ class CalledClassPass extends CodeCleanerPass /** * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { @@ -39,6 +42,8 @@ class CalledClassPass extends CodeCleanerPass * @throws ErrorException if get_class or get_called_class is called without an object from outside a class * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -68,6 +73,8 @@ class CalledClassPass extends CodeCleanerPass /** * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { @@ -76,8 +83,12 @@ class CalledClassPass extends CodeCleanerPass } } - private function isNull(Node $node) + private function isNull(Node $node): bool { + if ($node instanceof VariadicPlaceholder) { + return false; + } + return $node->value instanceof ConstFetch && \strtolower($node->value->name) === 'null'; } } diff --git a/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php b/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php index 7d80ac896..244c9d4e8 100644 --- a/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php b/vendor/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php index 60f5c5641..d4dd6777c 100644 --- a/vendor/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,6 +25,9 @@ class EmptyArrayDimFetchPass extends CodeCleanerPass private $theseOnesAreFine = []; + /** + * @return Node[]|null Array of nodes + */ public function beforeTraverse(array $nodes) { $this->theseOnesAreFine = []; @@ -34,6 +37,8 @@ class EmptyArrayDimFetchPass extends CodeCleanerPass * @throws FatalErrorException if the user used empty empty array dim fetch outside of assignment * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/ExitPass.php b/vendor/psy/psysh/src/CodeCleaner/ExitPass.php index 6571bb755..e58a8d68a 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ExitPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ExitPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,6 +23,8 @@ class ExitPass extends CodeCleanerPass * Converts exit calls to BreakExceptions. * * @param \PhpParser\Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php b/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php index 1051f07e9..889176f05 100644 --- a/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,6 +24,8 @@ class FinalClassPass extends CodeCleanerPass /** * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { @@ -34,6 +36,8 @@ class FinalClassPass extends CodeCleanerPass * @throws FatalErrorException if the node is a class that extends a final class * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -54,10 +58,8 @@ class FinalClassPass extends CodeCleanerPass /** * @param string $name Class name - * - * @return bool */ - private function isFinalClass($name) + private function isFinalClass(string $name): bool { if (!\class_exists($name)) { return isset($this->finalClasses[\strtolower($name)]); diff --git a/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php b/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php index ea646e9c0..e73e85b3b 100644 --- a/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,12 +23,17 @@ class FunctionContextPass extends CodeCleanerPass /** * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { $this->functionDepth = 0; } + /** + * @return int|Node|null Replacement node (or special return value) + */ public function enterNode(Node $node) { if ($node instanceof FunctionLike) { @@ -51,6 +56,8 @@ class FunctionContextPass extends CodeCleanerPass /** * @param \PhpParser\Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php b/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php index e3b764d7b..a0c74d012 100644 --- a/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,6 +19,7 @@ use PhpParser\Node\Expr\Isset_; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Stmt\Unset_; +use PhpParser\Node\VariadicPlaceholder; use Psy\Exception\FatalErrorException; /** @@ -39,12 +40,18 @@ class FunctionReturnInWriteContextPass extends CodeCleanerPass * @throws FatalErrorException if a value is assigned to a function * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { if ($node instanceof Array_ || $this->isCallNode($node)) { $items = $node instanceof Array_ ? $node->items : $node->args; foreach ($items as $item) { + if ($item instanceof VariadicPlaceholder) { + continue; + } + if ($item && $item->byRef && $this->isCallNode($item->value)) { throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, \E_ERROR, null, $node->getLine()); } @@ -63,7 +70,7 @@ class FunctionReturnInWriteContextPass extends CodeCleanerPass } } - private function isCallNode(Node $node) + private function isCallNode(Node $node): bool { return $node instanceof FuncCall || $node instanceof MethodCall || $node instanceof StaticCall; } diff --git a/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php b/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php index 94f886337..04481db99 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,7 +32,7 @@ class ImplicitReturnPass extends CodeCleanerPass * * @return array */ - public function beforeTraverse(array $nodes) + public function beforeTraverse(array $nodes): array { return $this->addImplicitReturn($nodes); } @@ -42,7 +42,7 @@ class ImplicitReturnPass extends CodeCleanerPass * * @return array */ - private function addImplicitReturn(array $nodes) + private function addImplicitReturn(array $nodes): array { // If nodes is empty, it can't have a return value. if (empty($nodes)) { @@ -115,10 +115,8 @@ class ImplicitReturnPass extends CodeCleanerPass * we'll exclude them here. * * @param Node $node - * - * @return bool */ - private static function isNonExpressionStmt(Node $node) + private static function isNonExpressionStmt(Node $node): bool { return $node instanceof Stmt && !$node instanceof Expression && diff --git a/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php b/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php index a976df6c4..f5cc704a4 100644 --- a/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -43,6 +43,8 @@ class InstanceOfPass extends CodeCleanerPass * @throws FatalErrorException if a scalar or a non-class constant is given * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/IssetPass.php b/vendor/psy/psysh/src/CodeCleaner/IssetPass.php index d0be550e4..2729bea1c 100644 --- a/vendor/psy/psysh/src/CodeCleaner/IssetPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/IssetPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,6 +31,8 @@ class IssetPass extends CodeCleanerPass * @throws FatalErrorException * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/LabelContextPass.php b/vendor/psy/psysh/src/CodeCleaner/LabelContextPass.php index c640de862..f34424d5c 100644 --- a/vendor/psy/psysh/src/CodeCleaner/LabelContextPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/LabelContextPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -41,6 +41,8 @@ class LabelContextPass extends CodeCleanerPass /** * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { @@ -49,6 +51,9 @@ class LabelContextPass extends CodeCleanerPass $this->labelGotos = []; } + /** + * @return int|Node|null Replacement node (or special return value) + */ public function enterNode(Node $node) { if ($node instanceof FunctionLike) { @@ -71,6 +76,8 @@ class LabelContextPass extends CodeCleanerPass /** * @param \PhpParser\Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { @@ -79,6 +86,9 @@ class LabelContextPass extends CodeCleanerPass } } + /** + * @return Node[]|null Array of nodes + */ public function afterTraverse(array $nodes) { foreach ($this->labelGotos as $name => $line) { diff --git a/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php b/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php index 2c2823863..67ba68b16 100644 --- a/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,6 +26,8 @@ class LeavePsyshAlonePass extends CodeCleanerPass * @throws RuntimeException if the user is messing with $__psysh__ * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/ListPass.php b/vendor/psy/psysh/src/CodeCleaner/ListPass.php index ef1d63bdd..a44ba003d 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ListPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ListPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -42,6 +42,8 @@ class ListPass extends CodeCleanerPass * @throws ParseErrorException if the user used empty with anything but a variable * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -94,10 +96,8 @@ class ListPass extends CodeCleanerPass * Validate whether a given item in an array is valid for short assignment. * * @param Expr $item - * - * @return bool */ - private static function isValidArrayItem(Expr $item) + private static function isValidArrayItem(Expr $item): bool { $value = ($item instanceof ArrayItem) ? $item->value : $item; diff --git a/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php b/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php index 44582baa8..c41d4b8a5 100644 --- a/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,6 +32,8 @@ class LoopContextPass extends CodeCleanerPass /** * {@inheritdoc} + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { @@ -45,6 +47,8 @@ class LoopContextPass extends CodeCleanerPass * @throws FatalErrorException if the node is a break or continue and has an argument less than 1 * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -87,6 +91,8 @@ class LoopContextPass extends CodeCleanerPass /** * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php b/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php index adf92fba1..3c468af09 100644 --- a/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php b/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php index 55318fede..ba82f9d8d 100644 --- a/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -29,6 +29,8 @@ abstract class NamespaceAwarePass extends CodeCleanerPass * use afterTraverse or call parent::beforeTraverse() when overloading. * * Reset the namespace and the current scope before beginning analysis + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { @@ -41,6 +43,8 @@ abstract class NamespaceAwarePass extends CodeCleanerPass * leaveNode or call parent::enterNode() when overloading * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -53,10 +57,8 @@ abstract class NamespaceAwarePass extends CodeCleanerPass * Get a fully-qualified name (class, function, interface, etc). * * @param mixed $name - * - * @return string */ - protected function getFullyQualifiedName($name) + protected function getFullyQualifiedName($name): string { if ($name instanceof FullyQualifiedName) { return \implode('\\', $name->parts); diff --git a/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php b/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php index 1f11072ef..470f0fa41 100644 --- a/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,6 +11,7 @@ namespace Psy\CodeCleaner; +use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Namespace_; use Psy\CodeCleaner; @@ -46,6 +47,8 @@ class NamespacePass extends CodeCleanerPass * is encountered. * * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { diff --git a/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php b/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php index d9c920bc7..53f30a221 100644 --- a/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php +++ b/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,10 +25,8 @@ class NoReturnValue { /** * Get PhpParser AST expression for creating a new NoReturnValue. - * - * @return \PhpParser\Node\Expr\New_ */ - public static function create() + public static function create(): New_ { return new New_(new FullyQualifiedName(self::class)); } diff --git a/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php b/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php index 8d7a8bfaa..9a911e4be 100644 --- a/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -34,6 +34,8 @@ class PassableByReferencePass extends CodeCleanerPass * @throws FatalErrorException if non-variables are passed by reference * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -68,7 +70,7 @@ class PassableByReferencePass extends CodeCleanerPass } } - private function isPassableByReference(Node $arg) + private function isPassableByReference(Node $arg): bool { // Unpacked arrays can be passed by reference if ($arg->value instanceof Array_) { diff --git a/vendor/psy/psysh/src/CodeCleaner/RequirePass.php b/vendor/psy/psysh/src/CodeCleaner/RequirePass.php index 4f7c36abe..15cb3a0a7 100644 --- a/vendor/psy/psysh/src/CodeCleaner/RequirePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/RequirePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -29,6 +29,8 @@ class RequirePass extends CodeCleanerPass /** * {@inheritdoc} + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $origNode) { @@ -73,7 +75,7 @@ class RequirePass extends CodeCleanerPass * * @return string Exactly the same as $file, unless $file collides with a path in the currently running phar */ - public static function resolve($file, $lineNumber = null) + public static function resolve($file, $lineNumber = null): string { $file = (string) $file; @@ -115,12 +117,12 @@ class RequirePass extends CodeCleanerPass return $file; } - private function isRequireNode(Node $node) + private function isRequireNode(Node $node): bool { return $node instanceof Include_ && \in_array($node->type, self::$requireTypes); } - private static function getIncludePath() + private static function getIncludePath(): array { if (\PATH_SEPARATOR === ':') { return \preg_split('#:(?!//)#', \get_include_path()); diff --git a/vendor/psy/psysh/src/CodeCleaner/ReturnTypePass.php b/vendor/psy/psysh/src/CodeCleaner/ReturnTypePass.php index 6a43ba42c..626e5a625 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ReturnTypePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ReturnTypePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,6 +18,7 @@ use PhpParser\Node\Identifier; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; +use PhpParser\Node\UnionType; use Psy\Exception\FatalErrorException; /** @@ -41,6 +42,8 @@ class ReturnTypePass extends CodeCleanerPass /** * {@inheritdoc} + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -86,6 +89,8 @@ class ReturnTypePass extends CodeCleanerPass /** * {@inheritdoc} + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { @@ -98,13 +103,17 @@ class ReturnTypePass extends CodeCleanerPass } } - private function isFunctionNode(Node $node) + private function isFunctionNode(Node $node): bool { return $node instanceof Function_ || $node instanceof Closure; } - private function typeName(Node $node) + private function typeName(Node $node): string { + if ($node instanceof UnionType) { + return \implode('|', \array_map([$this, 'typeName'], $node->types)); + } + if ($node instanceof NullableType) { return \strtolower($node->type->name); } diff --git a/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php b/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php index d0fe4c3f4..13c35b66d 100644 --- a/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,6 +11,7 @@ namespace Psy\CodeCleaner; +use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\Declare_; @@ -32,12 +33,6 @@ class StrictTypesPass extends CodeCleanerPass const EXCEPTION_MESSAGE = 'strict_types declaration must have 0 or 1 as its value'; private $strictTypes = false; - private $atLeastPhp7; - - public function __construct() - { - $this->atLeastPhp7 = \version_compare(\PHP_VERSION, '7.0', '>='); - } /** * If this is a standalone strict types declaration, remember it for later. @@ -48,13 +43,11 @@ class StrictTypesPass extends CodeCleanerPass * @throws FatalErrorException if an invalid `strict_types` declaration is found * * @param array $nodes + * + * @return Node[]|null Array of nodes */ public function beforeTraverse(array $nodes) { - if (!$this->atLeastPhp7) { - return; // @codeCoverageIgnore - } - $prependStrictTypes = $this->strictTypes; foreach ($nodes as $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php b/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php index 112728a10..862785139 100644 --- a/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -44,13 +44,15 @@ class UseStatementPass extends CodeCleanerPass * work like you'd expect. * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { if ($node instanceof Namespace_) { // If this is the same namespace as last namespace, let's do ourselves // a favor and reload all the aliases... - if (\strtolower($node->name) === \strtolower($this->lastNamespace)) { + if (\strtolower($node->name ?: '') === \strtolower($this->lastNamespace ?: '')) { $this->aliases = $this->lastAliases; } } @@ -63,6 +65,8 @@ class UseStatementPass extends CodeCleanerPass * remembered aliases to the code. * * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php b/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php index 11f69f5c9..d068ff50f 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,9 +13,6 @@ namespace Psy\CodeCleaner; use PhpParser\Node; use PhpParser\Node\Expr; -use PhpParser\Node\Expr\ClassConstFetch; -use PhpParser\Node\Expr\New_; -use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; @@ -40,12 +37,6 @@ class ValidClassNamePass extends NamespaceAwarePass const TRAIT_TYPE = 'trait'; private $conditionalScopes = 0; - private $atLeastPhp7; - - public function __construct() - { - $this->atLeastPhp7 = \version_compare(\PHP_VERSION, '7.0', '>='); - } /** * Validate class, interface and trait definitions. @@ -55,6 +46,8 @@ class ValidClassNamePass extends NamespaceAwarePass * trait methods. * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -78,15 +71,9 @@ class ValidClassNamePass extends NamespaceAwarePass } /** - * Validate `new` expressions, class constant fetches, and static calls. - * - * @throws FatalErrorException if a class, interface or trait is referenced which does not exist - * @throws FatalErrorException if a class extends something that is not a class - * @throws FatalErrorException if a class implements something that is not an interface - * @throws FatalErrorException if an interface extends something that is not an interface - * @throws FatalErrorException if a class, interface or trait redefines an existing class, interface or trait name - * * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { @@ -95,19 +82,9 @@ class ValidClassNamePass extends NamespaceAwarePass return; } - - if (!$this->atLeastPhp7) { - if ($node instanceof New_) { - $this->validateNewExpression($node); - } elseif ($node instanceof ClassConstFetch) { - $this->validateClassConstFetchExpression($node); - } elseif ($node instanceof StaticCall) { - $this->validateStaticCallExpression($node); - } - } } - private static function isConditional(Node $node) + private static function isConditional(Node $node): bool { return $node instanceof If_ || $node instanceof While_ || @@ -151,50 +128,6 @@ class ValidClassNamePass extends NamespaceAwarePass $this->ensureCanDefine($stmt, self::TRAIT_TYPE); } - /** - * Validate a `new` expression. - * - * @param New_ $stmt - */ - protected function validateNewExpression(New_ $stmt) - { - // if class name is an expression or an anonymous class, give it a pass for now - if (!$stmt->class instanceof Expr && !$stmt->class instanceof Class_) { - $this->ensureClassExists($this->getFullyQualifiedName($stmt->class), $stmt); - } - } - - /** - * Validate a class constant fetch expression's class. - * - * @param ClassConstFetch $stmt - */ - protected function validateClassConstFetchExpression(ClassConstFetch $stmt) - { - // there is no need to check exists for ::class const - if (\strtolower($stmt->name) === 'class') { - return; - } - - // if class name is an expression, give it a pass for now - if (!$stmt->class instanceof Expr) { - $this->ensureClassOrInterfaceExists($this->getFullyQualifiedName($stmt->class), $stmt); - } - } - - /** - * Validate a class constant fetch expression's class. - * - * @param StaticCall $stmt - */ - protected function validateStaticCallExpression(StaticCall $stmt) - { - // if class name is an expression, give it a pass for now - if (!$stmt->class instanceof Expr) { - $this->ensureMethodExists($this->getFullyQualifiedName($stmt->class), $stmt->name, $stmt); - } - } - /** * Ensure that no class, interface or trait name collides with a new definition. * @@ -203,7 +136,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param Stmt $stmt * @param string $scopeType */ - protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE) + protected function ensureCanDefine(Stmt $stmt, string $scopeType = self::CLASS_TYPE) { // Anonymous classes don't have a name, and uniqueness shouldn't be enforced. if ($stmt->name === null) { @@ -239,7 +172,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param string $name * @param Stmt $stmt */ - protected function ensureClassExists($name, $stmt) + protected function ensureClassExists(string $name, Stmt $stmt) { if (!$this->classExists($name)) { throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt); @@ -254,7 +187,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param string $name * @param Stmt $stmt */ - protected function ensureClassOrInterfaceExists($name, $stmt) + protected function ensureClassOrInterfaceExists(string $name, Stmt $stmt) { if (!$this->classExists($name) && !$this->interfaceExists($name)) { throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt); @@ -269,7 +202,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param string $name * @param Stmt $stmt */ - protected function ensureClassOrTraitExists($name, $stmt) + protected function ensureClassOrTraitExists(string $name, Stmt $stmt) { if (!$this->classExists($name) && !$this->traitExists($name)) { throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt); @@ -285,7 +218,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param string $name * @param Stmt $stmt */ - protected function ensureMethodExists($class, $name, $stmt) + protected function ensureMethodExists(string $class, string $name, Stmt $stmt) { $this->ensureClassOrTraitExists($class, $stmt); @@ -317,7 +250,7 @@ class ValidClassNamePass extends NamespaceAwarePass * @param Interface_[] $interfaces * @param Stmt $stmt */ - protected function ensureInterfacesExist($interfaces, $stmt) + protected function ensureInterfacesExist(array $interfaces, Stmt $stmt) { foreach ($interfaces as $interface) { /** @var string $name */ @@ -334,11 +267,11 @@ class ValidClassNamePass extends NamespaceAwarePass * @deprecated No longer used. Scope type should be passed into ensureCanDefine directly. * @codeCoverageIgnore * - * @param Stmt $stmt + * @throws FatalErrorException * - * @return string + * @param Stmt $stmt */ - protected function getScopeType(Stmt $stmt) + protected function getScopeType(Stmt $stmt): string { if ($stmt instanceof Class_) { return self::CLASS_TYPE; @@ -347,6 +280,8 @@ class ValidClassNamePass extends NamespaceAwarePass } elseif ($stmt instanceof Trait_) { return self::TRAIT_TYPE; } + + throw $this->createError('Unsupported statement type', $stmt); } /** @@ -355,10 +290,8 @@ class ValidClassNamePass extends NamespaceAwarePass * Gives `self`, `static` and `parent` a free pass. * * @param string $name - * - * @return bool */ - protected function classExists($name) + protected function classExists(string $name): bool { // Give `self`, `static` and `parent` a pass. This will actually let // some errors through, since we're not checking whether the keyword is @@ -374,10 +307,8 @@ class ValidClassNamePass extends NamespaceAwarePass * Check whether an interface exists, or has been defined in the current code snippet. * * @param string $name - * - * @return bool */ - protected function interfaceExists($name) + protected function interfaceExists(string $name): bool { return \interface_exists($name) || $this->findInScope($name) === self::INTERFACE_TYPE; } @@ -386,10 +317,8 @@ class ValidClassNamePass extends NamespaceAwarePass * Check whether a trait exists, or has been defined in the current code snippet. * * @param string $name - * - * @return bool */ - protected function traitExists($name) + protected function traitExists(string $name): bool { return \trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE; } @@ -401,7 +330,7 @@ class ValidClassNamePass extends NamespaceAwarePass * * @return string|null */ - protected function findInScope($name) + protected function findInScope(string $name) { $name = \strtolower($name); if (isset($this->currentScope[$name])) { @@ -414,10 +343,8 @@ class ValidClassNamePass extends NamespaceAwarePass * * @param string $msg * @param Stmt $stmt - * - * @return FatalErrorException */ - protected function createError($msg, $stmt) + protected function createError(string $msg, Stmt $stmt): FatalErrorException { return new FatalErrorException($msg, 0, \E_ERROR, null, $stmt->getLine()); } diff --git a/vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php b/vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php deleted file mode 100644 index 8e69813a3..000000000 --- a/vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php +++ /dev/null @@ -1,90 +0,0 @@ -name->parts) > 1) { - $name = $this->getFullyQualifiedName($node->name); - if (!\defined($name)) { - $msg = \sprintf('Undefined constant %s', $name); - throw new FatalErrorException($msg, 0, \E_ERROR, null, $node->getLine()); - } - } elseif ($node instanceof ClassConstFetch) { - $this->validateClassConstFetchExpression($node); - } - } - - /** - * Validate a class constant fetch expression. - * - * @throws FatalErrorException if a class constant is not defined - * - * @param ClassConstFetch $stmt - */ - protected function validateClassConstFetchExpression(ClassConstFetch $stmt) - { - // For PHP Parser 4.x - $constName = $stmt->name instanceof Identifier ? $stmt->name->toString() : $stmt->name; - - // give the `class` pseudo-constant a pass - if ($constName === 'class') { - return; - } - - // if class name is an expression, give it a pass for now - if (!$stmt->class instanceof Expr) { - $className = $this->getFullyQualifiedName($stmt->class); - - // if the class doesn't exist, don't throw an exception… it might be - // defined in the same line it's used or something stupid like that. - if (\class_exists($className) || \interface_exists($className)) { - $refl = new \ReflectionClass($className); - if (!$refl->hasConstant($constName)) { - $constType = \class_exists($className) ? 'Class' : 'Interface'; - $msg = \sprintf('%s constant \'%s::%s\' not found', $constType, $className, $constName); - throw new FatalErrorException($msg, 0, \E_ERROR, null, $stmt->getLine()); - } - } - } - } -} diff --git a/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php b/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php index 44928cc8f..817104a61 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -35,6 +35,9 @@ class ValidConstructorPass extends CodeCleanerPass { private $namespace; + /** + * @return Node[]|null Array of nodes + */ public function beforeTraverse(array $nodes) { $this->namespace = []; @@ -47,6 +50,8 @@ class ValidConstructorPass extends CodeCleanerPass * @throws FatalErrorException the constructor function has a return type * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { diff --git a/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php b/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php index 9c1e669f1..7703d7d37 100644 --- a/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php +++ b/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -12,9 +12,6 @@ namespace Psy\CodeCleaner; use PhpParser\Node; -use PhpParser\Node\Expr; -use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Do_; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\If_; @@ -35,7 +32,11 @@ class ValidFunctionNamePass extends NamespaceAwarePass /** * Store newly defined function names on the way in, to allow recursion. * + * @throws FatalErrorException if a function is redefined in a non-conditional scope + * * @param Node $node + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -61,29 +62,14 @@ class ValidFunctionNamePass extends NamespaceAwarePass } /** - * Validate that function calls will succeed. - * - * @throws FatalErrorException if a function is redefined - * @throws FatalErrorException if the function name is a string (not an expression) and is not defined - * * @param Node $node + * + * @return int|Node|Node[]|null Replacement node (or special return value) */ public function leaveNode(Node $node) { if (self::isConditional($node)) { $this->conditionalScopes--; - } elseif ($node instanceof FuncCall) { - // if function name is an expression or a variable, give it a pass for now. - $name = $node->name; - if (!$name instanceof Expr && !$name instanceof Variable) { - $shortName = \implode('\\', $name->parts); - $fullName = $this->getFullyQualifiedName($name); - $inScope = isset($this->currentScope[\strtolower($fullName)]); - if (!$inScope && !\function_exists($shortName) && !\function_exists($fullName)) { - $message = \sprintf('Call to undefined function %s()', $name); - throw new FatalErrorException($message, 0, \E_ERROR, null, $node->getLine()); - } - } } } diff --git a/vendor/psy/psysh/src/Command/BufferCommand.php b/vendor/psy/psysh/src/Command/BufferCommand.php index 6e16ac536..81d8ff912 100644 --- a/vendor/psy/psysh/src/Command/BufferCommand.php +++ b/vendor/psy/psysh/src/Command/BufferCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,6 +11,7 @@ namespace Psy\Command; +use Psy\Exception\RuntimeException; use Psy\Output\ShellOutput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -46,12 +47,19 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { - $buf = $this->getApplication()->getCodeBuffer(); + $app = $this->getApplication(); + if (!$app instanceof \Psy\Shell) { + throw new RuntimeException('Buffer command requires a \Psy\Shell application'); + } + + $buf = $app->getCodeBuffer(); if ($input->getOption('clear')) { - $this->getApplication()->resetCodeBuffer(); + $app->resetCodeBuffer(); $output->writeln($this->formatLines($buf, 'urgent'), ShellOutput::NUMBER_LINES); } else { $output->writeln($this->formatLines($buf), ShellOutput::NUMBER_LINES); @@ -68,7 +76,7 @@ HELP * * @return array Formatted strings */ - protected function formatLines(array $lines, $type = 'return') + protected function formatLines(array $lines, string $type = 'return'): array { $template = \sprintf('<%s>%%s', $type, $type); diff --git a/vendor/psy/psysh/src/Command/ClearCommand.php b/vendor/psy/psysh/src/Command/ClearCommand.php index d20abab12..baca9af03 100644 --- a/vendor/psy/psysh/src/Command/ClearCommand.php +++ b/vendor/psy/psysh/src/Command/ClearCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -41,6 +41,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/vendor/psy/psysh/src/Command/Command.php b/vendor/psy/psysh/src/Command/Command.php index 2a58eece8..182e358c4 100644 --- a/vendor/psy/psysh/src/Command/Command.php +++ b/vendor/psy/psysh/src/Command/Command.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -43,7 +43,7 @@ abstract class Command extends BaseCommand /** * {@inheritdoc} */ - public function asText() + public function asText(): string { $messages = [ 'Usage:', @@ -74,7 +74,7 @@ abstract class Command extends BaseCommand /** * {@inheritdoc} */ - private function getArguments() + private function getArguments(): array { $hidden = $this->getHiddenArguments(); @@ -86,9 +86,9 @@ abstract class Command extends BaseCommand /** * These arguments will be excluded from help output. * - * @return array + * @return string[] */ - protected function getHiddenArguments() + protected function getHiddenArguments(): array { return ['command']; } @@ -96,7 +96,7 @@ abstract class Command extends BaseCommand /** * {@inheritdoc} */ - private function getOptions() + private function getOptions(): array { $hidden = $this->getHiddenOptions(); @@ -108,29 +108,25 @@ abstract class Command extends BaseCommand /** * These options will be excluded from help output. * - * @return array + * @return string[] */ - protected function getHiddenOptions() + protected function getHiddenOptions(): array { return ['verbose']; } /** * Format command aliases as text.. - * - * @return string */ - private function aliasesAsText() + private function aliasesAsText(): string { return 'Aliases: '.\implode(', ', $this->getAliases()).''.\PHP_EOL; } /** * Format command arguments as text. - * - * @return string */ - private function argumentsAsText() + private function argumentsAsText(): string { $max = $this->getMaxWidth(); $messages = []; @@ -147,7 +143,7 @@ abstract class Command extends BaseCommand $description = \str_replace("\n", "\n".\str_pad('', $max + 2, ' '), $argument->getDescription()); - $messages[] = \sprintf(" %-${max}s %s%s", $argument->getName(), $description, $default); + $messages[] = \sprintf(" %-{$max}s %s%s", $argument->getName(), $description, $default); } $messages[] = ''; @@ -158,10 +154,8 @@ abstract class Command extends BaseCommand /** * Format options as text. - * - * @return string */ - private function optionsAsText() + private function optionsAsText(): string { $max = $this->getMaxWidth(); $messages = []; @@ -182,7 +176,7 @@ abstract class Command extends BaseCommand $optionMax = $max - \strlen($option->getName()) - 2; $messages[] = \sprintf( - " %s %-${optionMax}s%s%s%s", + " %s %-{$optionMax}s%s%s%s", '--'.$option->getName(), $option->getShortcut() ? \sprintf('(-%s) ', $option->getShortcut()) : '', $description, @@ -199,10 +193,8 @@ abstract class Command extends BaseCommand /** * Calculate the maximum padding width for a set of lines. - * - * @return int */ - private function getMaxWidth() + private function getMaxWidth(): int { $max = 0; @@ -226,10 +218,8 @@ abstract class Command extends BaseCommand * Format an option default as text. * * @param mixed $default - * - * @return string */ - private function formatDefaultValue($default) + private function formatDefaultValue($default): string { if (\is_array($default) && $default === \array_values($default)) { return \sprintf("['%s']", \implode("', '", $default)); @@ -273,10 +263,8 @@ abstract class Command extends BaseCommand /** * Legacy fallback for getTable. - * - * @return TableHelper */ - protected function getTableHelper() + protected function getTableHelper(): TableHelper { $table = $this->getApplication()->getHelperSet()->get('table'); diff --git a/vendor/psy/psysh/src/Command/DocCommand.php b/vendor/psy/psysh/src/Command/DocCommand.php index 40fbd0f82..5360832a3 100644 --- a/vendor/psy/psysh/src/Command/DocCommand.php +++ b/vendor/psy/psysh/src/Command/DocCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,6 +14,7 @@ namespace Psy\Command; use Psy\Formatter\DocblockFormatter; use Psy\Formatter\SignatureFormatter; use Psy\Input\CodeArgument; +use Psy\Output\ShellOutput; use Psy\Reflection\ReflectionClassConstant; use Psy\Reflection\ReflectionConstant_; use Psy\Reflection\ReflectionLanguageConstruct; @@ -59,6 +60,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -169,9 +172,9 @@ HELP * yield Reflectors for the same-named method or property on all traits and * parent classes. * - * @return Generator a whole bunch of \Reflector instances + * @return \Generator a whole bunch of \Reflector instances */ - private function getParentReflectors($reflector) + private function getParentReflectors($reflector): \Generator { $seenClasses = []; @@ -242,9 +245,10 @@ HELP private function getManualDocById($id) { if ($db = $this->getApplication()->getManualDb()) { - return $db - ->query(\sprintf('SELECT doc FROM php_manual WHERE id = %s', $db->quote($id))) - ->fetchColumn(0); + $result = $db->query(\sprintf('SELECT doc FROM php_manual WHERE id = %s', $db->quote($id))); + if ($result !== false) { + return $result->fetchColumn(0); + } } } } diff --git a/vendor/psy/psysh/src/Command/DumpCommand.php b/vendor/psy/psysh/src/Command/DumpCommand.php index 9e279e761..c44bb40a8 100644 --- a/vendor/psy/psysh/src/Command/DumpCommand.php +++ b/vendor/psy/psysh/src/Command/DumpCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -66,6 +66,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -87,7 +89,7 @@ HELP * * @return mixed */ - protected function resolveTarget($name) + protected function resolveTarget(string $name) { @\trigger_error('`resolveTarget` is deprecated; use `resolveCode` instead.', \E_USER_DEPRECATED); diff --git a/vendor/psy/psysh/src/Command/EditCommand.php b/vendor/psy/psysh/src/Command/EditCommand.php index 6b3f98b1e..af2914d58 100644 --- a/vendor/psy/psysh/src/Command/EditCommand.php +++ b/vendor/psy/psysh/src/Command/EditCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -74,6 +74,8 @@ class EditCommand extends Command implements ContextAware * @param InputInterface $input * @param OutputInterface $output * + * @return int 0 if everything went fine, or an exit code + * * @throws \InvalidArgumentException when both exec and no-exec flags are given or if a given variable is not found in the current context * @throws \UnexpectedValueException if file_get_contents on the edited file returns false instead of a string */ @@ -112,10 +114,8 @@ class EditCommand extends Command implements ContextAware * @param bool $execOption * @param bool $noExecOption * @param string|null $filePath - * - * @return bool */ - private function shouldExecuteFile($execOption, $noExecOption, $filePath) + private function shouldExecuteFile(bool $execOption, bool $noExecOption, string $filePath = null): bool { if ($execOption) { return true; @@ -136,7 +136,7 @@ class EditCommand extends Command implements ContextAware * * @throws \InvalidArgumentException If the variable is not found in the current context */ - private function extractFilePath($fileArgument) + private function extractFilePath(string $fileArgument = null) { // If the file argument was a variable, get it from the context if ($fileArgument !== null && @@ -152,11 +152,9 @@ class EditCommand extends Command implements ContextAware * @param string $filePath * @param bool $shouldRemoveFile * - * @return string - * * @throws \UnexpectedValueException if file_get_contents on $filePath returns false instead of a string */ - private function editFile($filePath, $shouldRemoveFile) + private function editFile(string $filePath, bool $shouldRemoveFile): string { $escapedFilePath = \escapeshellarg($filePath); $editor = (isset($_SERVER['EDITOR']) && $_SERVER['EDITOR']) ? $_SERVER['EDITOR'] : 'nano'; diff --git a/vendor/psy/psysh/src/Command/ExitCommand.php b/vendor/psy/psysh/src/Command/ExitCommand.php index 3e51a3462..01f72d9f9 100644 --- a/vendor/psy/psysh/src/Command/ExitCommand.php +++ b/vendor/psy/psysh/src/Command/ExitCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -44,6 +44,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/vendor/psy/psysh/src/Command/HelpCommand.php b/vendor/psy/psysh/src/Command/HelpCommand.php index d3cdb9402..5aa72fa6c 100644 --- a/vendor/psy/psysh/src/Command/HelpCommand.php +++ b/vendor/psy/psysh/src/Command/HelpCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -46,13 +46,15 @@ class HelpCommand extends Command * * @param Command $command */ - public function setCommand($command) + public function setCommand(Command $command) { $this->command = $command; } /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/vendor/psy/psysh/src/Command/HistoryCommand.php b/vendor/psy/psysh/src/Command/HistoryCommand.php index 22318a4dc..94306e401 100644 --- a/vendor/psy/psysh/src/Command/HistoryCommand.php +++ b/vendor/psy/psysh/src/Command/HistoryCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -90,6 +90,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -156,7 +158,7 @@ HELP * * @return array [ start, end ] */ - private function extractRange($range) + private function extractRange(string $range): array { if (\preg_match('/^\d+$/', $range)) { return [$range, $range + 1]; @@ -176,13 +178,13 @@ HELP /** * Retrieve a slice of the readline history. * - * @param string $show - * @param string $head - * @param string $tail + * @param string|null $show + * @param string|null $head + * @param string|null $tail * - * @return array A slilce of history + * @return array A slice of history */ - private function getHistorySlice($show, $head, $tail) + private function getHistorySlice($show, $head, $tail): array { $history = $this->readline->listHistory(); @@ -241,7 +243,7 @@ HELP $this->readline->clearHistory(); } - public static function escape($string) + public static function escape(string $string): string { return OutputFormatter::escape($string); } diff --git a/vendor/psy/psysh/src/Command/ListCommand.php b/vendor/psy/psysh/src/Command/ListCommand.php index bcc1f33ff..41f56c9c4 100644 --- a/vendor/psy/psysh/src/Command/ListCommand.php +++ b/vendor/psy/psysh/src/Command/ListCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -112,6 +112,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -223,10 +225,8 @@ HELP * Format an item name given its visibility. * * @param array $item - * - * @return string */ - private function formatItemName($item) + private function formatItemName(array $item): string { return \sprintf('<%s>%s', $item['style'], OutputFormatter::escape($item['name']), $item['style']); } diff --git a/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php index 3b5b0dfaa..2ae84b123 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class ClassConstantEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // only list constants when a Reflector is present. if ($reflector === null) { @@ -56,12 +56,12 @@ class ClassConstantEnumerator extends Enumerator /** * Get defined constants for the given class or object Reflector. * - * @param \Reflector $reflector - * @param bool $noInherit Exclude inherited constants + * @param \ReflectionClass $reflector + * @param bool $noInherit Exclude inherited constants * * @return array */ - protected function getConstants(\Reflector $reflector, $noInherit = false) + protected function getConstants(\ReflectionClass $reflector, bool $noInherit = false): array { $className = $reflector->getName(); @@ -88,7 +88,7 @@ class ClassConstantEnumerator extends Enumerator * * @return array */ - protected function prepareConstants(array $constants) + protected function prepareConstants(array $constants): array { // My kingdom for a generator. $ret = []; @@ -110,10 +110,8 @@ class ClassConstantEnumerator extends Enumerator * Get a label for the particular kind of "class" represented. * * @param \ReflectionClass $reflector - * - * @return string */ - protected function getKindLabel(\ReflectionClass $reflector) + protected function getKindLabel(\ReflectionClass $reflector): string { if ($reflector->isInterface()) { return 'Interface Constants'; diff --git a/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php index c939a0bb8..cf80ba726 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class ClassEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // if we have a reflector, ensure that it's a namespace reflector if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) { @@ -66,7 +66,7 @@ class ClassEnumerator extends Enumerator * * @return array */ - protected function filterClasses($key, $classes, $internal, $user, $prefix = null) + protected function filterClasses(string $key, array $classes, bool $internal, bool $user, string $prefix = null): array { $ret = []; @@ -110,7 +110,7 @@ class ClassEnumerator extends Enumerator * * @return array */ - protected function prepareClasses(array $classes) + protected function prepareClasses(array $classes): array { \natcasesort($classes); diff --git a/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php index 7471c2d23..c8346e946 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -49,7 +49,7 @@ class ConstantEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // if we have a reflector, ensure that it's a namespace reflector if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) { @@ -122,7 +122,7 @@ class ConstantEnumerator extends Enumerator * * @return array */ - protected function getConstants($category = null) + protected function getConstants(string $category = null): array { if (!$category) { return \get_defined_constants(); @@ -133,7 +133,7 @@ class ConstantEnumerator extends Enumerator if ($category === 'internal') { unset($consts['user']); - return \call_user_func_array('array_merge', \array_values($consts)); + return \array_merge(...\array_values($consts)); } foreach ($consts as $key => $value) { @@ -152,7 +152,7 @@ class ConstantEnumerator extends Enumerator * * @return array */ - protected function prepareConstants(array $constants) + protected function prepareConstants(array $constants): array { // My kingdom for a generator. $ret = []; diff --git a/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php b/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php index f6705d08e..ecc4613f8 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -54,7 +54,7 @@ abstract class Enumerator * * @return array */ - public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null) + public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null): array { $this->filter->bind($input); @@ -82,7 +82,7 @@ abstract class Enumerator * * @return array */ - abstract protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null); + abstract protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array; protected function showItem($name) { diff --git a/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php index c651c707f..beccb4bdc 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class FunctionEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // if we have a reflector, ensure that it's a namespace reflector if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) { @@ -67,7 +67,7 @@ class FunctionEnumerator extends Enumerator * * @return array */ - protected function getFunctions($type = null) + protected function getFunctions(string $type = null): array { $funcs = \get_defined_functions(); @@ -86,7 +86,7 @@ class FunctionEnumerator extends Enumerator * * @return array */ - protected function prepareFunctions(array $functions, $prefix = null) + protected function prepareFunctions(array $functions, string $prefix = null): array { \natcasesort($functions); @@ -105,8 +105,8 @@ class FunctionEnumerator extends Enumerator 'style' => self::IS_FUNCTION, 'value' => $this->presentSignature($name), ]; - } catch (\Exception $e) { - // Ignore failures. HHVM does this sometimes for internal functions. + } catch (\Throwable $e) { + // Ignore failures. } } } diff --git a/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php index a2a4d83f7..fab59704d 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class GlobalVariableEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // only list globals when no Reflector is present. if ($reflector !== null || $target !== null) { @@ -49,7 +49,7 @@ class GlobalVariableEnumerator extends Enumerator * * @return array */ - protected function getGlobals() + protected function getGlobals(): array { global $GLOBALS; @@ -71,7 +71,7 @@ class GlobalVariableEnumerator extends Enumerator * * @return array */ - protected function prepareGlobals($globals) + protected function prepareGlobals(array $globals): array { // My kingdom for a generator. $ret = []; diff --git a/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php index 66b988c7e..68c74dd4f 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class MethodEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // only list methods when a Reflector is present. if ($reflector === null) { @@ -55,13 +55,13 @@ class MethodEnumerator extends Enumerator /** * Get defined methods for the given class or object Reflector. * - * @param bool $showAll Include private and protected methods - * @param \Reflector $reflector - * @param bool $noInherit Exclude inherited methods + * @param bool $showAll Include private and protected methods + * @param \ReflectionClass $reflector + * @param bool $noInherit Exclude inherited methods * * @return array */ - protected function getMethods($showAll, \Reflector $reflector, $noInherit = false) + protected function getMethods(bool $showAll, \ReflectionClass $reflector, bool $noInherit = false): array { $className = $reflector->getName(); @@ -90,7 +90,7 @@ class MethodEnumerator extends Enumerator * * @return array */ - protected function prepareMethods(array $methods) + protected function prepareMethods(array $methods): array { // My kingdom for a generator. $ret = []; @@ -112,10 +112,8 @@ class MethodEnumerator extends Enumerator * Get a label for the particular kind of "class" represented. * * @param \ReflectionClass $reflector - * - * @return string */ - protected function getKindLabel(\ReflectionClass $reflector) + protected function getKindLabel(\ReflectionClass $reflector): string { if ($reflector->isInterface()) { return 'Interface Methods'; @@ -130,10 +128,8 @@ class MethodEnumerator extends Enumerator * Get output style for the given method's visibility. * * @param \ReflectionMethod $method - * - * @return string */ - private function getVisibilityStyle(\ReflectionMethod $method) + private function getVisibilityStyle(\ReflectionMethod $method): string { if ($method->isPublic()) { return self::IS_PUBLIC; diff --git a/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php index a414726d6..dfde8eafd 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class PropertyEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // only list properties when a Reflector is present. @@ -56,13 +56,13 @@ class PropertyEnumerator extends Enumerator /** * Get defined properties for the given class or object Reflector. * - * @param bool $showAll Include private and protected properties - * @param \Reflector $reflector - * @param bool $noInherit Exclude inherited properties + * @param bool $showAll Include private and protected properties + * @param \ReflectionClass $reflector + * @param bool $noInherit Exclude inherited properties * * @return array */ - protected function getProperties($showAll, \Reflector $reflector, $noInherit = false) + protected function getProperties(bool $showAll, \ReflectionClass $reflector, bool $noInherit = false): array { $className = $reflector->getName(); @@ -89,7 +89,7 @@ class PropertyEnumerator extends Enumerator * * @return array */ - protected function prepareProperties(array $properties, $target = null) + protected function prepareProperties(array $properties, $target = null): array { // My kingdom for a generator. $ret = []; @@ -112,10 +112,8 @@ class PropertyEnumerator extends Enumerator * Get a label for the particular kind of "class" represented. * * @param \ReflectionClass $reflector - * - * @return string */ - protected function getKindLabel(\ReflectionClass $reflector) + protected function getKindLabel(\ReflectionClass $reflector): string { if (\method_exists($reflector, 'isTrait') && $reflector->isTrait()) { return 'Trait Properties'; @@ -128,10 +126,8 @@ class PropertyEnumerator extends Enumerator * Get output style for the given property's visibility. * * @param \ReflectionProperty $property - * - * @return string */ - private function getVisibilityStyle(\ReflectionProperty $property) + private function getVisibilityStyle(\ReflectionProperty $property): string { if ($property->isPublic()) { return self::IS_PUBLIC; @@ -147,11 +143,13 @@ class PropertyEnumerator extends Enumerator * * @param \ReflectionProperty $property * @param mixed $target - * - * @return string */ - protected function presentValue(\ReflectionProperty $property, $target) + protected function presentValue(\ReflectionProperty $property, $target): string { + if (!$target) { + return ''; + } + // If $target is a class or trait (try to) get the default // value for the property. if (!\is_object($target)) { @@ -163,7 +161,7 @@ class PropertyEnumerator extends Enumerator return $this->presentRef($props[$property->name]).$suffix; } - } catch (\Exception $e) { + } catch (\Throwable $e) { // Well, we gave it a shot. } diff --git a/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php index 2cd0345fe..38f3f6023 100644 --- a/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php +++ b/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -45,7 +45,7 @@ class VariableEnumerator extends Enumerator /** * {@inheritdoc} */ - protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null) + protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array { // only list variables when no Reflector is present. if ($reflector !== null || $target !== null) { @@ -76,7 +76,7 @@ class VariableEnumerator extends Enumerator * * @return array */ - protected function getVariables($showAll) + protected function getVariables(bool $showAll): array { $scopeVars = $this->context->getAll(); \uksort($scopeVars, function ($a, $b) { @@ -117,7 +117,7 @@ class VariableEnumerator extends Enumerator * * @return array */ - protected function prepareVariables(array $variables) + protected function prepareVariables(array $variables): array { // My kingdom for a generator. $ret = []; diff --git a/vendor/psy/psysh/src/Command/ParseCommand.php b/vendor/psy/psysh/src/Command/ParseCommand.php index 2df2b9aa6..21005f338 100644 --- a/vendor/psy/psysh/src/Command/ParseCommand.php +++ b/vendor/psy/psysh/src/Command/ParseCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -90,23 +90,17 @@ class ParseCommand extends Command implements ContextAware, PresenterAware */ protected function configure() { - $definition = [ - new CodeArgument('code', CodeArgument::REQUIRED, 'PHP code to parse.'), - new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10), - ]; - - if ($this->parserFactory->hasKindsSupport()) { - $msg = 'One of PhpParser\\ParserFactory constants: ' - .\implode(', ', ParserFactory::getPossibleKinds()) - ." (default is based on current interpreter's version)."; - $defaultKind = $this->parserFactory->getDefaultKind(); - - $definition[] = new InputOption('kind', '', InputOption::VALUE_REQUIRED, $msg, $defaultKind); - } + $kindMsg = 'One of PhpParser\\ParserFactory constants: ' + .\implode(', ', ParserFactory::getPossibleKinds()) + ." (default is based on current interpreter's version)."; $this ->setName('parse') - ->setDefinition($definition) + ->setDefinition([ + new CodeArgument('code', CodeArgument::REQUIRED, 'PHP code to parse.'), + new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10), + new InputOption('kind', '', InputOption::VALUE_REQUIRED, $kindMsg, $this->parserFactory->getDefaultKind()), + ]) ->setDescription('Parse PHP code and show the abstract syntax tree.') ->setHelp( <<<'HELP' @@ -132,7 +126,7 @@ HELP $code = 'parserFactory->hasKindsSupport() ? $input->getOption('kind') : null; + $parserKind = $input->getOption('kind'); $depth = $input->getOption('depth'); $nodes = $this->parse($this->getParser($parserKind), $code); $output->page($this->presenter->present($nodes, $depth)); @@ -150,7 +144,7 @@ HELP * * @return array Statements */ - private function parse(Parser $parser, $code) + private function parse(Parser $parser, string $code): array { try { return $parser->parse($code); @@ -168,10 +162,8 @@ HELP * Get (or create) the Parser instance. * * @param string|null $kind One of Psy\ParserFactory constants (only for PHP parser 2.0 and above) - * - * @return Parser */ - private function getParser($kind = null) + private function getParser(string $kind = null): Parser { if (!\array_key_exists($kind, $this->parsers)) { $this->parsers[$kind] = $this->parserFactory->createParser($kind); diff --git a/vendor/psy/psysh/src/Command/PsyVersionCommand.php b/vendor/psy/psysh/src/Command/PsyVersionCommand.php index 1355841f1..44e75283f 100644 --- a/vendor/psy/psysh/src/Command/PsyVersionCommand.php +++ b/vendor/psy/psysh/src/Command/PsyVersionCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Command/ReflectingCommand.php b/vendor/psy/psysh/src/Command/ReflectingCommand.php index 47b779e21..b85b2c401 100644 --- a/vendor/psy/psysh/src/Command/ReflectingCommand.php +++ b/vendor/psy/psysh/src/Command/ReflectingCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -57,7 +57,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return array (class or instance name, member name, kind) */ - protected function getTarget($valueName) + protected function getTarget(string $valueName): array { $valueName = \trim($valueName); $matches = []; @@ -92,10 +92,8 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @param string $name * @param bool $includeFunctions (default: false) - * - * @return string */ - protected function resolveName($name, $includeFunctions = false) + protected function resolveName(string $name, bool $includeFunctions = false): string { $shell = $this->getApplication(); @@ -140,10 +138,10 @@ abstract class ReflectingCommand extends Command implements ContextAware /** * Check whether a given name could be a class name. */ - protected function couldBeClassName($name) + protected function couldBeClassName(string $name): bool { // Regex based on https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class - return \preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*(\\\\[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)*$/', $name); + return \preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*(\\\\[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)*$/', $name) === 1; } /** @@ -153,7 +151,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return array (value, Reflector) */ - protected function getTargetAndReflector($valueName) + protected function getTargetAndReflector(string $valueName): array { list($value, $member, $kind) = $this->getTarget($valueName); @@ -169,11 +167,11 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return mixed Variable value */ - protected function resolveCode($code) + protected function resolveCode(string $code) { try { $value = $this->getApplication()->execute($code, true); - } catch (\Exception $e) { + } catch (\Throwable $e) { // Swallow all exceptions? } @@ -193,7 +191,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return object Variable instance */ - private function resolveObject($code) + private function resolveObject(string $code) { $value = $this->resolveCode($code); @@ -211,7 +209,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return mixed Variable instance */ - protected function resolveInstance($name) + protected function resolveInstance(string $name) { @\trigger_error('`resolveInstance` is deprecated; use `resolveCode` instead.', \E_USER_DEPRECATED); @@ -225,7 +223,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return mixed */ - protected function getScopeVariable($name) + protected function getScopeVariable(string $name) { return $this->context->get($name); } @@ -235,7 +233,7 @@ abstract class ReflectingCommand extends Command implements ContextAware * * @return array */ - protected function getScopeVariables() + protected function getScopeVariables(): array { return $this->context->getAll(); } diff --git a/vendor/psy/psysh/src/Command/ShowCommand.php b/vendor/psy/psysh/src/Command/ShowCommand.php index 564b3f710..ecb427cfb 100644 --- a/vendor/psy/psysh/src/Command/ShowCommand.php +++ b/vendor/psy/psysh/src/Command/ShowCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -69,6 +69,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -122,7 +124,9 @@ HELP ]); } - return $output->page(CodeFormatter::formatCode($code)); + $output->page(CodeFormatter::formatCode($code)); + + return; } else { throw $e; } @@ -193,7 +197,7 @@ HELP )); } - private function replaceCwd($file) + private function replaceCwd(string $file): string { if ($cwd = \getcwd()) { $cwd = \rtrim($cwd, \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR; @@ -252,7 +256,7 @@ HELP if ($namespace = $refl->getNamespaceName()) { $vars['__namespace'] = $namespace; } - } catch (\Exception $e) { + } catch (\Throwable $e) { // oh well } } elseif (isset($context['function'])) { @@ -263,7 +267,7 @@ HELP if ($namespace = $refl->getNamespaceName()) { $vars['__namespace'] = $namespace; } - } catch (\Exception $e) { + } catch (\Throwable $e) { // oh well } } @@ -288,7 +292,7 @@ HELP $this->context->setCommandScopeVariables($vars); } - private function extractEvalFileAndLine($file) + private function extractEvalFileAndLine(string $file) { if (\preg_match('/(.*)\\((\\d+)\\) : eval\\(\\)\'d code$/', $file, $matches)) { return [$matches[1], $matches[2]]; diff --git a/vendor/psy/psysh/src/Command/SudoCommand.php b/vendor/psy/psysh/src/Command/SudoCommand.php index c55f1e4b1..cd9facbab 100644 --- a/vendor/psy/psysh/src/Command/SudoCommand.php +++ b/vendor/psy/psysh/src/Command/SudoCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -95,6 +95,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -129,7 +131,7 @@ HELP * * @return array Statements */ - private function parse($code) + private function parse(string $code): array { try { return $this->parser->parse($code); diff --git a/vendor/psy/psysh/src/Command/ThrowUpCommand.php b/vendor/psy/psysh/src/Command/ThrowUpCommand.php index d2a12b91c..ccca8776a 100644 --- a/vendor/psy/psysh/src/Command/ThrowUpCommand.php +++ b/vendor/psy/psysh/src/Command/ThrowUpCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,6 @@ namespace Psy\Command; use PhpParser\Node\Arg; use PhpParser\Node\Expr\New_; -use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name\FullyQualified as FullyQualifiedName; use PhpParser\Node\Scalar\String_; @@ -87,12 +86,14 @@ HELP /** * {@inheritdoc} * + * @return int 0 if everything went fine, or an exit code + * * @throws \InvalidArgumentException if there is no exception to throw */ protected function execute(InputInterface $input, OutputInterface $output) { $args = $this->prepareArgs($input->getArgument('exception')); - $throwStmt = new Throw_(new StaticCall(new FullyQualifiedName(ThrowUpException::class), 'fromThrowable', $args)); + $throwStmt = new Throw_(new New_(new FullyQualifiedName(ThrowUpException::class), $args)); $throwCode = $this->printer->prettyPrint([$throwStmt]); $shell = $this->getApplication(); @@ -112,7 +113,7 @@ HELP * * @return Arg[] */ - private function prepareArgs($code = null) + private function prepareArgs(string $code = null): array { if (!$code) { // Default to last exception if nothing else was supplied @@ -150,7 +151,7 @@ HELP * * @return array Statements */ - private function parse($code) + private function parse(string $code): array { try { return $this->parser->parse($code); diff --git a/vendor/psy/psysh/src/Command/TimeitCommand.php b/vendor/psy/psysh/src/Command/TimeitCommand.php index 3a3f29e7c..82b9e0e72 100644 --- a/vendor/psy/psysh/src/Command/TimeitCommand.php +++ b/vendor/psy/psysh/src/Command/TimeitCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -76,6 +76,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -164,10 +166,8 @@ HELP * accurate times are recorded for just the code being executed. * * @param string $code - * - * @return string */ - private function instrumentCode($code) + private function instrumentCode(string $code): string { return $this->printer->prettyPrint($this->traverser->traverse($this->parse($code))); } @@ -179,7 +179,7 @@ HELP * * @return array Statements */ - private function parse($code) + private function parse(string $code): array { $code = 'filter, $count, $includePsy); } diff --git a/vendor/psy/psysh/src/Command/WhereamiCommand.php b/vendor/psy/psysh/src/Command/WhereamiCommand.php index 913a9ef2a..0c0a6e9c2 100644 --- a/vendor/psy/psysh/src/Command/WhereamiCommand.php +++ b/vendor/psy/psysh/src/Command/WhereamiCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -67,7 +67,7 @@ HELP * * @return array */ - protected function trace() + protected function trace(): array { foreach (\array_reverse($this->backtrace) as $stackFrame) { if ($this->isDebugCall($stackFrame)) { @@ -78,7 +78,7 @@ HELP return \end($this->backtrace); } - private static function isDebugCall(array $stackFrame) + private static function isDebugCall(array $stackFrame): bool { $class = isset($stackFrame['class']) ? $stackFrame['class'] : null; $function = isset($stackFrame['function']) ? $stackFrame['function'] : null; @@ -92,7 +92,7 @@ HELP * * @return array */ - protected function fileInfo() + protected function fileInfo(): array { $stackFrame = $this->trace(); if (\preg_match('/eval\(/', $stackFrame['file'])) { @@ -109,6 +109,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -142,10 +144,8 @@ HELP * Replace the given directory from the start of a filepath. * * @param string $file - * - * @return string */ - private function replaceCwd($file) + private function replaceCwd(string $file): string { $cwd = \getcwd(); if ($cwd === false) { diff --git a/vendor/psy/psysh/src/Command/WtfCommand.php b/vendor/psy/psysh/src/Command/WtfCommand.php index 77c174ec2..3d967fc52 100644 --- a/vendor/psy/psysh/src/Command/WtfCommand.php +++ b/vendor/psy/psysh/src/Command/WtfCommand.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -81,6 +81,8 @@ HELP /** * {@inheritdoc} + * + * @return int 0 if everything went fine, or an exit code */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/vendor/psy/psysh/src/ConfigPaths.php b/vendor/psy/psysh/src/ConfigPaths.php index 4b40879ea..67fab9865 100644 --- a/vendor/psy/psysh/src/ConfigPaths.php +++ b/vendor/psy/psysh/src/ConfigPaths.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class ConfigPaths * @param string[] $overrides Directory overrides * @param EnvInterface $env */ - public function __construct($overrides = [], $env = null) + public function __construct(array $overrides = [], EnvInterface $env = null) { $this->overrideDirs($overrides); $this->env = $env ?: new SuperglobalsEnv(); @@ -45,7 +45,7 @@ class ConfigPaths * * @param string[] $overrides Directory overrides */ - public function overrideDirs($overrides) + public function overrideDirs(array $overrides) { if (\array_key_exists('configDir', $overrides)) { $this->configDir = $overrides['configDir'] ?: null; @@ -108,7 +108,7 @@ class ConfigPaths * * @return string[] */ - public function configDirs() + public function configDirs(): array { if ($this->configDir !== null) { return [$this->configDir]; @@ -122,7 +122,7 @@ class ConfigPaths /** * @deprecated */ - public static function getConfigDirs() + public static function getConfigDirs(): array { return (new self())->configDirs(); } @@ -139,7 +139,7 @@ class ConfigPaths * * @return string[] */ - public static function getHomeConfigDirs() + public static function getHomeConfigDirs(): array { // Not quite the same, but this is deprecated anyway /shrug return self::getConfigDirs(); @@ -154,10 +154,8 @@ class ConfigPaths * everywhere else). * * @see self::homeConfigDir - * - * @return string */ - public function currentConfigDir() + public function currentConfigDir(): string { if ($this->configDir !== null) { return $this->configDir; @@ -177,7 +175,7 @@ class ConfigPaths /** * @deprecated */ - public static function getCurrentConfigDir() + public static function getCurrentConfigDir(): string { return (new self())->currentConfigDir(); } @@ -189,7 +187,7 @@ class ConfigPaths * * @return string[] */ - public function configFiles(array $names) + public function configFiles(array $names): array { return $this->allRealFiles($this->configDirs(), $names); } @@ -197,7 +195,7 @@ class ConfigPaths /** * @deprecated */ - public static function getConfigFiles(array $names, $configDir = null) + public static function getConfigFiles(array $names, $configDir = null): array { return (new self(['configDir' => $configDir]))->configFiles($names); } @@ -214,7 +212,7 @@ class ConfigPaths * * @return string[] */ - public function dataDirs() + public function dataDirs(): array { if ($this->dataDir !== null) { return [$this->dataDir]; @@ -229,7 +227,7 @@ class ConfigPaths /** * @deprecated */ - public static function getDataDirs() + public static function getDataDirs(): array { return (new self())->dataDirs(); } @@ -241,7 +239,7 @@ class ConfigPaths * * @return string[] */ - public function dataFiles(array $names) + public function dataFiles(array $names): array { return $this->allRealFiles($this->dataDirs(), $names); } @@ -249,7 +247,7 @@ class ConfigPaths /** * @deprecated */ - public static function getDataFiles(array $names, $dataDir = null) + public static function getDataFiles(array $names, $dataDir = null): array { return (new self(['dataDir' => $dataDir]))->dataFiles($names); } @@ -258,10 +256,8 @@ class ConfigPaths * Get a runtime directory. * * Defaults to `/psysh` inside the system's temp dir. - * - * @return string */ - public function runtimeDir() + public function runtimeDir(): string { if ($this->runtimeDir !== null) { return $this->runtimeDir; @@ -276,11 +272,45 @@ class ConfigPaths /** * @deprecated */ - public static function getRuntimeDir() + public static function getRuntimeDir(): string { return (new self())->runtimeDir(); } + /** + * Get a list of directories in PATH. + * + * If $PATH is unset/empty it defaults to '/usr/sbin:/usr/bin:/sbin:/bin'. + * + * @return string[] + */ + public function pathDirs(): array + { + return $this->getEnvArray('PATH') ?: ['/usr/sbin', '/usr/bin', '/sbin', '/bin']; + } + + /** + * Locate a command (an executable) in $PATH. + * + * Behaves like 'command -v COMMAND' or 'which COMMAND'. + * If $PATH is unset/empty it defaults to '/usr/sbin:/usr/bin:/sbin:/bin'. + * + * @param string $command the executable to locate + * + * @return string + */ + public function which($command) + { + foreach ($this->pathDirs() as $path) { + $fullpath = $path.\DIRECTORY_SEPARATOR.$command; + if (@\is_file($fullpath) && @\is_executable($fullpath)) { + return $fullpath; + } + } + + return null; + } + /** * Get all PsySH directory name candidates given a list of base directories. * @@ -292,7 +322,7 @@ class ConfigPaths * * @return string[] */ - private function allDirNames(array $baseDirs) + private function allDirNames(array $baseDirs): array { $dirs = \array_map(function ($dir) { return \strtr($dir, '\\', '/').'/psysh'; @@ -327,7 +357,7 @@ class ConfigPaths * * @return string[] */ - private function allRealFiles(array $dirNames, array $fileNames) + private function allRealFiles(array $dirNames, array $fileNames): array { $files = []; foreach ($dirNames as $dir) { @@ -351,7 +381,7 @@ class ConfigPaths * * @return bool False if directory exists but is not writeable, or cannot be created */ - public static function ensureDir($dir) + public static function ensureDir(string $dir): bool { if (!\is_dir($dir)) { // Just try making it and see if it works @@ -376,7 +406,7 @@ class ConfigPaths * * @return string|false Full path to $file, or false if file is not writable */ - public static function touchFileWithMkdir($file) + public static function touchFileWithMkdir(string $file) { if (\file_exists($file)) { if (\is_writable($file)) { @@ -405,7 +435,7 @@ class ConfigPaths private function getEnvArray($key) { if ($value = $this->getEnv($key)) { - return \explode(':', $value); + return \explode(\PATH_SEPARATOR, $value); } return null; diff --git a/vendor/psy/psysh/src/Configuration.php b/vendor/psy/psysh/src/Configuration.php index fbd28e6a1..ddb35ea65 100644 --- a/vendor/psy/psysh/src/Configuration.php +++ b/vendor/psy/psysh/src/Configuration.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,6 +16,7 @@ use Psy\Exception\RuntimeException; use Psy\ExecutionLoop\ProcessForker; use Psy\Output\OutputPager; use Psy\Output\ShellOutput; +use Psy\Output\Theme; use Psy\TabCompletion\AutoCompleter; use Psy\VarDumper\Presenter; use Psy\VersionUpdater\Checker; @@ -56,6 +57,7 @@ class Configuration 'errorLoggingLevel', 'forceArrayIndexes', 'formatterStyles', + 'historyFile', 'historySize', 'interactiveMode', 'manualDbFile', @@ -65,6 +67,7 @@ class Configuration 'requireSemicolons', 'runtimeDir', 'startupMessage', + 'theme', 'updateCheck', 'useBracketedPaste', 'usePcntl', @@ -106,12 +109,16 @@ class Configuration private $updateCheck; private $startupMessage; private $forceArrayIndexes = false; + /** @deprecated */ private $formatterStyles = []; private $verbosity = self::VERBOSITY_NORMAL; private $yolo = false; + /** @var Theme */ + private $theme; // services private $readline; + /** @var ShellOutput */ private $output; private $shell; private $cleaner; @@ -170,10 +177,8 @@ class Configuration * @throws \InvalidArgumentException * * @param InputInterface $input - * - * @return self */ - public static function fromInput(InputInterface $input) + public static function fromInput(InputInterface $input): self { $config = new self(['configFile' => self::getConfigFileFromInput($input)]); @@ -196,6 +201,11 @@ class Configuration $config->setInteractiveMode(self::INTERACTIVE_MODE_DISABLED); } + // Handle --compact + if (self::getOptionFromInput($input, ['compact'])) { + $config->setTheme('compact'); + } + // Handle --raw-output // @todo support raw output with interactive input? if (!$config->getInputInteractive()) { @@ -236,7 +246,7 @@ class Configuration * * @return bool true if the option (or an alias) is present */ - private static function getOptionFromInput(InputInterface $input, array $names, array $otherParams = []) + private static function getOptionFromInput(InputInterface $input, array $names, array $otherParams = []): bool { // Best case, input is properly bound and validated. foreach ($names as $name) { @@ -331,7 +341,7 @@ class Configuration * * @return InputOption[] */ - public static function getInputOptions() + public static function getInputOptions(): array { return [ new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use an alternate PsySH config file location.'), @@ -345,6 +355,7 @@ class Configuration new InputOption('quiet', 'q', InputOption::VALUE_NONE, 'Shhhhhh.'), new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_OPTIONAL, 'Increase the verbosity of messages.', '0'), + new InputOption('compact', null, InputOption::VALUE_NONE, 'Run PsySH with compact output.'), new InputOption('interactive', 'i|a', InputOption::VALUE_NONE, 'Force PsySH to run in interactive mode.'), new InputOption('no-interactive', 'n', InputOption::VALUE_NONE, 'Run PsySH without interactive input. Requires input from stdin.'), // --interaction and --no-interaction aliases for compatibility with Symfony, Composer, etc @@ -352,6 +363,8 @@ class Configuration new InputOption('no-interaction', null, InputOption::VALUE_NONE, 'Run PsySH without interactive input. Requires input from stdin.'), new InputOption('raw-output', 'r', InputOption::VALUE_NONE, 'Print var_export-style return values (for non-interactive input)'), + new InputOption('self-update', 'u', InputOption::VALUE_NONE, 'Update to the latest version'), + new InputOption('yolo', null, InputOption::VALUE_NONE, 'Run PsySH with minimal input validation. You probably don\'t want this.'), ]; } @@ -399,7 +412,7 @@ class Configuration * * ~/.config/psysh/config.php * - * @return string + * @return string|null */ public function getConfigFile() { @@ -425,7 +438,7 @@ class Configuration * Searches for a project specific config file `.psysh.php` in the current * working directory. * - * @return string + * @return string|null */ public function getLocalConfigFile() { @@ -485,7 +498,7 @@ class Configuration * * @param string $file */ - public function loadConfigFile($file) + public function loadConfigFile(string $file) { if (!\is_file($file)) { throw new \InvalidArgumentException(\sprintf('Invalid configuration file specified, %s does not exist', $file)); @@ -522,9 +535,9 @@ class Configuration /** * Get files to be included by default at the start of each shell session. * - * @return array + * @return string[] */ - public function getDefaultIncludes() + public function getDefaultIncludes(): array { return $this->defaultIncludes ?: []; } @@ -534,7 +547,7 @@ class Configuration * * @param string $dir */ - public function setConfigDir($dir) + public function setConfigDir(string $dir) { $this->configDir = (string) $dir; @@ -548,7 +561,7 @@ class Configuration /** * Get the current configuration directory, if any is explicitly set. * - * @return string + * @return string|null */ public function getConfigDir() { @@ -560,7 +573,7 @@ class Configuration * * @param string $dir */ - public function setDataDir($dir) + public function setDataDir(string $dir) { $this->dataDir = (string) $dir; @@ -574,7 +587,7 @@ class Configuration /** * Get the current data directory, if any is explicitly set. * - * @return string + * @return string|null */ public function getDataDir() { @@ -586,7 +599,7 @@ class Configuration * * @param string $dir */ - public function setRuntimeDir($dir) + public function setRuntimeDir(string $dir) { $this->runtimeDir = (string) $dir; @@ -603,9 +616,9 @@ class Configuration * Defaults to `/psysh` inside the system's temp dir unless explicitly * overridden. * - * @return string + * @throws RuntimeException if no temporary directory is set and it is not possible to create one */ - public function getRuntimeDir() + public function getRuntimeDir(): string { $runtimeDir = $this->configPaths->runtimeDir(); @@ -623,7 +636,7 @@ class Configuration * * @param string $file */ - public function setHistoryFile($file) + public function setHistoryFile(string $file) { $this->historyFile = ConfigPaths::touchFileWithMkdir($file); } @@ -633,10 +646,8 @@ class Configuration * * Defaults to `/history` inside the shell's base config dir unless * explicitly overridden. - * - * @return string */ - public function getHistoryFile() + public function getHistoryFile(): string { if (isset($this->historyFile)) { return $this->historyFile; @@ -664,7 +675,7 @@ class Configuration * * @param int $value */ - public function setHistorySize($value) + public function setHistorySize(int $value) { $this->historySize = (int) $value; } @@ -684,7 +695,7 @@ class Configuration * * @param bool $value */ - public function setEraseDuplicates($value) + public function setEraseDuplicates(bool $value) { $this->eraseDuplicates = (bool) $value; } @@ -692,7 +703,7 @@ class Configuration /** * Get whether readline erases old duplicate history entries. * - * @return bool + * @return bool|null */ public function getEraseDuplicates() { @@ -711,7 +722,7 @@ class Configuration * * @return string Temporary file name */ - public function getTempFile($type, $pid) + public function getTempFile(string $type, int $pid): string { return \tempnam($this->getRuntimeDir(), $type.'_'.$pid.'_'); } @@ -726,7 +737,7 @@ class Configuration * * @return string Pipe name */ - public function getPipe($type, $pid) + public function getPipe(string $type, int $pid): string { return \sprintf('%s/%s_%s', $this->getRuntimeDir(), $type, $pid); } @@ -736,7 +747,7 @@ class Configuration * * @return bool True if Readline is available */ - public function hasReadline() + public function hasReadline(): bool { return $this->hasReadline; } @@ -746,7 +757,7 @@ class Configuration * * @param bool $useReadline */ - public function setUseReadline($useReadline) + public function setUseReadline(bool $useReadline) { $this->useReadline = (bool) $useReadline; } @@ -759,7 +770,7 @@ class Configuration * * @return bool True if the current Shell should use Readline */ - public function useReadline() + public function useReadline(): bool { return isset($this->useReadline) ? ($this->hasReadline && $this->useReadline) : $this->hasReadline; } @@ -785,7 +796,7 @@ class Configuration * * @return Readline\Readline */ - public function getReadline() + public function getReadline(): Readline\Readline { if (!isset($this->readline)) { $className = $this->getReadlineClass(); @@ -803,21 +814,21 @@ class Configuration * Get the appropriate Readline implementation class name. * * @see self::getReadline - * - * @return string */ - private function getReadlineClass() + private function getReadlineClass(): string { if ($this->useReadline()) { if (Readline\GNUReadline::isSupported()) { return Readline\GNUReadline::class; } elseif (Readline\Libedit::isSupported()) { return Readline\Libedit::class; - } elseif (Readline\HoaConsole::isSupported()) { - return Readline\HoaConsole::class; } } + if (Readline\Userland::isSupported()) { + return Readline\Userland::class; + } + return Readline\Transient::class; } @@ -828,7 +839,7 @@ class Configuration * * @param bool $useBracketedPaste */ - public function setUseBracketedPaste($useBracketedPaste) + public function setUseBracketedPaste(bool $useBracketedPaste) { $this->useBracketedPaste = (bool) $useBracketedPaste; } @@ -848,15 +859,14 @@ class Configuration * * @return bool True if the shell should use bracketed paste */ - public function useBracketedPaste() + public function useBracketedPaste(): bool { - // For now, only the GNU readline implementation supports bracketed paste. - $supported = ($this->getReadlineClass() === Readline\GNUReadline::class) && Readline\GNUReadline::supportsBracketedPaste(); + $readlineClass = $this->getReadlineClass(); - return $supported && $this->useBracketedPaste; + return $this->useBracketedPaste && $readlineClass::supportsBracketedPaste(); // @todo mebbe turn this on by default some day? - // return isset($this->useBracketedPaste) ? ($supported && $this->useBracketedPaste) : $supported; + // return $readlineClass::supportsBracketedPaste() && $this->useBracketedPaste !== false; } /** @@ -864,7 +874,7 @@ class Configuration * * @return bool True if Pcntl is available */ - public function hasPcntl() + public function hasPcntl(): bool { return $this->hasPcntl; } @@ -874,7 +884,7 @@ class Configuration * * @param bool $usePcntl */ - public function setUsePcntl($usePcntl) + public function setUsePcntl(bool $usePcntl) { $this->usePcntl = (bool) $usePcntl; } @@ -887,9 +897,19 @@ class Configuration * * @return bool True if the current Shell should use Pcntl */ - public function usePcntl() + public function usePcntl(): bool { - return isset($this->usePcntl) ? ($this->hasPcntl && $this->usePcntl) : $this->hasPcntl; + if (!isset($this->usePcntl)) { + // Unless pcntl is explicitly *enabled*, don't use it while XDebug is debugging. + // See https://github.com/bobthecow/psysh/issues/742 + if (\function_exists('xdebug_is_debugger_active') && \xdebug_is_debugger_active()) { + return false; + } + + return $this->hasPcntl; + } + + return $this->hasPcntl && $this->usePcntl; } /** @@ -900,7 +920,7 @@ class Configuration * * @return bool true if raw output is enabled */ - public function rawOutput() + public function rawOutput(): bool { return $this->rawOutput; } @@ -910,7 +930,7 @@ class Configuration * * @param bool $rawOutput */ - public function setRawOutput($rawOutput) + public function setRawOutput(bool $rawOutput) { $this->rawOutput = (bool) $rawOutput; } @@ -922,7 +942,7 @@ class Configuration * * @param bool $requireSemicolons */ - public function setRequireSemicolons($requireSemicolons) + public function setRequireSemicolons(bool $requireSemicolons) { $this->requireSemicolons = (bool) $requireSemicolons; } @@ -933,10 +953,8 @@ class Configuration * By default, PsySH will automatically insert semicolons at the end of * statements if they're missing. To strictly require semicolons, set * `requireSemicolons` to true. - * - * @return bool */ - public function requireSemicolons() + public function requireSemicolons(): bool { return $this->requireSemicolons; } @@ -949,7 +967,7 @@ class Configuration * * @param bool $useUnicode */ - public function setUseUnicode($useUnicode) + public function setUseUnicode(bool $useUnicode) { $this->useUnicode = (bool) $useUnicode; } @@ -959,10 +977,8 @@ class Configuration * * Note that this does not disable Unicode output in general, it just makes * it so PsySH won't output any itself. - * - * @return bool */ - public function useUnicode() + public function useUnicode(): bool { if (isset($this->useUnicode)) { return $this->useUnicode; @@ -977,7 +993,7 @@ class Configuration * * @see self::errorLoggingLevel * - * @param bool $errorLoggingLevel + * @param int $errorLoggingLevel */ public function setErrorLoggingLevel($errorLoggingLevel) { @@ -995,10 +1011,8 @@ class Configuration * level. * * http://php.net/manual/en/function.error-reporting.php - * - * @return int */ - public function errorLoggingLevel() + public function errorLoggingLevel(): int { return $this->errorLoggingLevel; } @@ -1017,10 +1031,8 @@ class Configuration * Get a CodeCleaner service instance. * * If none has been explicitly defined, this will create a new instance. - * - * @return CodeCleaner */ - public function getCodeCleaner() + public function getCodeCleaner(): CodeCleaner { if (!isset($this->cleaner)) { $this->cleaner = new CodeCleaner(null, null, null, $this->yolo()); @@ -1042,7 +1054,7 @@ class Configuration /** * Check whether to disable input validation. */ - public function yolo() + public function yolo(): bool { return $this->yolo; } @@ -1052,7 +1064,7 @@ class Configuration * * @param bool $useTabCompletion */ - public function setUseTabCompletion($useTabCompletion) + public function setUseTabCompletion(bool $useTabCompletion) { $this->useTabCompletion = (bool) $useTabCompletion; } @@ -1062,7 +1074,7 @@ class Configuration * * @param bool $useTabCompletion */ - public function setTabCompletion($useTabCompletion) + public function setTabCompletion(bool $useTabCompletion) { $this->setUseTabCompletion($useTabCompletion); } @@ -1075,17 +1087,15 @@ class Configuration * * @return bool True if the current Shell should use tab completion */ - public function useTabCompletion() + public function useTabCompletion(): bool { return isset($this->useTabCompletion) ? ($this->hasReadline && $this->useTabCompletion) : $this->hasReadline; } /** * @deprecated Call `useTabCompletion` instead - * - * @return bool */ - public function getTabCompletion() + public function getTabCompletion(): bool { return $this->useTabCompletion(); } @@ -1099,6 +1109,11 @@ class Configuration { $this->output = $output; $this->pipedOutput = null; // Reset cached pipe info + + if (isset($this->theme)) { + $output->setTheme($this->theme); + } + $this->applyFormatterStyles(); } @@ -1110,17 +1125,16 @@ class Configuration * * @see self::verbosity * @see self::getPager - * - * @return ShellOutput */ - public function getOutput() + public function getOutput(): ShellOutput { if (!isset($this->output)) { $this->setOutput(new ShellOutput( $this->getOutputVerbosity(), null, null, - $this->getPager() + $this->getPager() ?: null, + $this->theme() )); // This is racy because `getOutputDecorated` needs access to the @@ -1143,29 +1157,29 @@ class Configuration public function getOutputDecorated() { switch ($this->colorMode()) { - case self::COLOR_MODE_AUTO: - return $this->outputIsPiped() ? false : null; case self::COLOR_MODE_FORCED: return true; case self::COLOR_MODE_DISABLED: return false; + case self::COLOR_MODE_AUTO: + default: + return $this->outputIsPiped() ? false : null; } } /** * Get the interactive setting for shell input. - * - * @return bool */ - public function getInputInteractive() + public function getInputInteractive(): bool { switch ($this->interactiveMode()) { - case self::INTERACTIVE_MODE_AUTO: - return !$this->inputIsPiped(); case self::INTERACTIVE_MODE_FORCED: return true; case self::INTERACTIVE_MODE_DISABLED: return false; + case self::INTERACTIVE_MODE_AUTO: + default: + return !$this->inputIsPiped(); } } @@ -1175,13 +1189,19 @@ class Configuration * If a string is supplied, a ProcOutputPager will be used which shells out * to the specified command. * + * `cat` is special-cased to use the PassthruPager directly. + * * @throws \InvalidArgumentException if $pager is not a string or OutputPager instance * - * @param string|OutputPager $pager + * @param string|OutputPager|false $pager */ public function setPager($pager) { - if ($pager && !\is_string($pager) && !$pager instanceof OutputPager) { + if ($pager === null || $pager === false || $pager === 'cat') { + $pager = false; + } + + if ($pager !== false && !\is_string($pager) && !$pager instanceof OutputPager) { throw new \InvalidArgumentException('Unexpected pager instance'); } @@ -1194,17 +1214,21 @@ class Configuration * If no Pager has been explicitly provided, and Pcntl is available, this * will default to `cli.pager` ini value, falling back to `which less`. * - * @return string|OutputPager + * @return string|OutputPager|false */ public function getPager() { if (!isset($this->pager) && $this->usePcntl()) { + if (\getenv('TERM') === 'dumb') { + return false; + } + if ($pager = \ini_get('cli.pager')) { // use the default pager $this->pager = $pager; - } elseif ($less = \exec('which less 2>/dev/null')) { + } elseif ($less = $this->configPaths->which('less')) { // check for the presence of less... - $this->pager = $less.' -R -S -F -X'; + $this->pager = $less.' -R -F -X'; } } @@ -1223,10 +1247,8 @@ class Configuration /** * Get an AutoCompleter service instance. - * - * @return AutoCompleter */ - public function getAutoCompleter() + public function getAutoCompleter(): AutoCompleter { if (!isset($this->autoCompleter)) { $this->autoCompleter = new AutoCompleter(); @@ -1237,10 +1259,8 @@ class Configuration /** * @deprecated Nothing should be using this anymore - * - * @return array */ - public function getTabCompletionMatchers() + public function getTabCompletionMatchers(): array { return []; } @@ -1335,7 +1355,7 @@ class Configuration * * @param string $filename */ - public function setManualDbFile($filename) + public function setManualDbFile(string $filename) { $this->manualDbFile = (string) $filename; } @@ -1343,7 +1363,7 @@ class Configuration /** * Get the current PHP manual database file. * - * @return string Default: '~/.local/share/psysh/php_manual.sqlite' + * @return string|null Default: '~/.local/share/psysh/php_manual.sqlite' */ public function getManualDbFile() { @@ -1365,13 +1385,13 @@ class Configuration /** * Get a PHP manual database connection. * - * @return \PDO + * @return \PDO|null */ public function getManualDb() { if (!isset($this->manualDb)) { $dbFile = $this->getManualDbFile(); - if (\is_file($dbFile)) { + if ($dbFile !== null && \is_file($dbFile)) { try { $this->manualDb = new \PDO('sqlite:'.$dbFile); } catch (\PDOException $e) { @@ -1399,10 +1419,8 @@ class Configuration /** * Get the Presenter service. - * - * @return Presenter */ - public function getPresenter() + public function getPresenter(): Presenter { if (!isset($this->presenter)) { $this->presenter = new Presenter($this->getOutput()->getFormatter(), $this->forceArrayIndexes()); @@ -1418,7 +1436,7 @@ class Configuration * * @param bool $warnOnMultipleConfigs */ - public function setWarnOnMultipleConfigs($warnOnMultipleConfigs) + public function setWarnOnMultipleConfigs(bool $warnOnMultipleConfigs) { $this->warnOnMultipleConfigs = (bool) $warnOnMultipleConfigs; } @@ -1432,10 +1450,8 @@ class Configuration * are found. * * This will default to true in a future release, but is false for now. - * - * @return bool */ - public function warnOnMultipleConfigs() + public function warnOnMultipleConfigs(): bool { return $this->warnOnMultipleConfigs; } @@ -1443,9 +1459,11 @@ class Configuration /** * Set the current color mode. * + * @throws \InvalidArgumentException if the color mode isn't auto, forced or disabled + * * @param string $colorMode */ - public function setColorMode($colorMode) + public function setColorMode(string $colorMode) { $validColorModes = [ self::COLOR_MODE_AUTO, @@ -1454,8 +1472,7 @@ class Configuration ]; if (!\in_array($colorMode, $validColorModes)) { - // @todo Fix capitalization for 0.11.0 - throw new \InvalidArgumentException('invalid color mode: '.$colorMode); + throw new \InvalidArgumentException('Invalid color mode: '.$colorMode); } $this->colorMode = $colorMode; @@ -1463,10 +1480,8 @@ class Configuration /** * Get the current color mode. - * - * @return string */ - public function colorMode() + public function colorMode(): string { return $this->colorMode; } @@ -1474,9 +1489,11 @@ class Configuration /** * Set the shell's interactive mode. * + * @throws \InvalidArgumentException if interactive mode isn't disabled, forced, or auto + * * @param string $interactiveMode */ - public function setInteractiveMode($interactiveMode) + public function setInteractiveMode(string $interactiveMode) { $validInteractiveModes = [ self::INTERACTIVE_MODE_AUTO, @@ -1493,10 +1510,8 @@ class Configuration /** * Get the current interactive mode. - * - * @return string */ - public function interactiveMode() + public function interactiveMode(): string { return $this->interactiveMode; } @@ -1515,10 +1530,8 @@ class Configuration * Get an update checker service instance. * * If none has been explicitly defined, this will create a new instance. - * - * @return Checker */ - public function getChecker() + public function getChecker(): Checker { if (!isset($this->checker)) { $interval = $this->getUpdateCheck(); @@ -1552,10 +1565,8 @@ class Configuration * * One of 'always', 'daily', 'weekly', 'monthly' or 'never'. If none is * explicitly set, default to 'weekly'. - * - * @return string */ - public function getUpdateCheck() + public function getUpdateCheck(): string { return isset($this->updateCheck) ? $this->updateCheck : Checker::WEEKLY; } @@ -1567,7 +1578,7 @@ class Configuration * * @param string $interval */ - public function setUpdateCheck($interval) + public function setUpdateCheck(string $interval) { $validIntervals = [ Checker::ALWAYS, @@ -1578,8 +1589,7 @@ class Configuration ]; if (!\in_array($interval, $validIntervals)) { - // @todo Fix capitalization for 0.11.0 - throw new \InvalidArgumentException('invalid update check interval: '.$interval); + throw new \InvalidArgumentException('Invalid update check interval: '.$interval); } $this->updateCheck = $interval; @@ -1600,7 +1610,7 @@ class Configuration * * @param string $message */ - public function setStartupMessage($message) + public function setStartupMessage(string $message) { $this->startupMessage = $message; } @@ -1620,7 +1630,7 @@ class Configuration * * @param string $prompt */ - public function setPrompt($prompt) + public function setPrompt(string $prompt) { $this->prompt = $prompt; } @@ -1628,7 +1638,7 @@ class Configuration /** * Get the prompt. * - * @return string + * @return string|null */ public function getPrompt() { @@ -1637,10 +1647,8 @@ class Configuration /** * Get the force array indexes. - * - * @return bool */ - public function forceArrayIndexes() + public function forceArrayIndexes(): bool { return $this->forceArrayIndexes; } @@ -1650,11 +1658,42 @@ class Configuration * * @param bool $forceArrayIndexes */ - public function setForceArrayIndexes($forceArrayIndexes) + public function setForceArrayIndexes(bool $forceArrayIndexes) { $this->forceArrayIndexes = $forceArrayIndexes; } + /** + * Set the current output Theme. + * + * @param Theme|string|array $theme Theme (or Theme config) + */ + public function setTheme($theme) + { + if (!$theme instanceof Theme) { + $theme = new Theme($theme); + } + + $this->theme = $theme; + + if (isset($this->output)) { + $this->output->setTheme($theme); + $this->applyFormatterStyles(); + } + } + + /** + * Get the current output Theme. + */ + public function theme(): Theme + { + if (!isset($this->theme)) { + $this->theme = new Theme(); + } + + return $this->theme; + } + /** * Set the shell output formatter styles. * @@ -1667,15 +1706,14 @@ class Configuration * * Foreground, background or options can be null, or even omitted entirely. * - * @see ShellOutput::initFormatters - * - * @param array $formatterStyles + * @deprecated The `formatterStyles` configuration has been replaced by Themes and support will + * eventually be removed. In the meantime, styles are applied first by the Theme, then + * overridden by any explicitly defined formatter styles. */ public function setFormatterStyles(array $formatterStyles) { foreach ($formatterStyles as $name => $style) { - list($fg, $bg, $opts) = \array_pad($style, 3, null); - $this->formatterStyles[$name] = new OutputFormatterStyle($fg ?: null, $bg ?: null, $opts ?: []); + $this->formatterStyles[$name] = new OutputFormatterStyle(...$style); } if (isset($this->output)) { @@ -1688,6 +1726,10 @@ class Configuration * * This is called on initialization of the shell output, and again if the * formatter styles config is updated. + * + * @deprecated The `formatterStyles` configuration has been replaced by Themes and support will + * eventually be removed. In the meantime, styles are applied first by the Theme, then + * overridden by any explicitly defined formatter styles. */ private function applyFormatterStyles() { @@ -1695,14 +1737,19 @@ class Configuration foreach ($this->formatterStyles as $name => $style) { $formatter->setStyle($name, $style); } + + $errorFormatter = $this->output->getErrorOutput()->getFormatter(); + foreach (Theme::ERROR_STYLES as $name) { + if (isset($this->formatterStyles[$name])) { + $errorFormatter->setStyle($name, $this->formatterStyles[$name]); + } + } } /** * Get the configured output verbosity. - * - * @return string */ - public function verbosity() + public function verbosity(): string { return $this->verbosity; } @@ -1712,9 +1759,11 @@ class Configuration * * Accepts OutputInterface verbosity constants. * + * @throws \InvalidArgumentException if verbosity level is invalid + * * @param string $verbosity */ - public function setVerbosity($verbosity) + public function setVerbosity(string $verbosity) { $validVerbosityLevels = [ self::VERBOSITY_QUIET, @@ -1740,7 +1789,7 @@ class Configuration * * @return int OutputInterface verbosity level */ - public function getOutputVerbosity() + public function getOutputVerbosity(): int { switch ($this->verbosity()) { case self::VERBOSITY_QUIET: @@ -1761,13 +1810,11 @@ class Configuration * Guess whether stdin is piped. * * This is mostly useful for deciding whether to use non-interactive mode. - * - * @return bool */ - public function inputIsPiped() + public function inputIsPiped(): bool { if ($this->pipedInput === null) { - $this->pipedInput = \defined('STDIN') && static::looksLikeAPipe(\STDIN); + $this->pipedInput = \defined('STDIN') && self::looksLikeAPipe(\STDIN); } return $this->pipedInput; @@ -1777,13 +1824,11 @@ class Configuration * Guess whether shell output is piped. * * This is mostly useful for deciding whether to use non-decorated output. - * - * @return bool */ - public function outputIsPiped() + public function outputIsPiped(): bool { if ($this->pipedOutput === null) { - $this->pipedOutput = static::looksLikeAPipe($this->getOutput()->getStream()); + $this->pipedOutput = self::looksLikeAPipe($this->getOutput()->getStream()); } return $this->pipedOutput; @@ -1793,10 +1838,8 @@ class Configuration * Guess whether an input or output stream is piped. * * @param resource|int $stream - * - * @return bool */ - private static function looksLikeAPipe($stream) + private static function looksLikeAPipe($stream): bool { if (\function_exists('posix_isatty')) { return !\posix_isatty($stream); diff --git a/vendor/psy/psysh/src/ConsoleColorFactory.php b/vendor/psy/psysh/src/ConsoleColorFactory.php deleted file mode 100644 index 9cfbf40e3..000000000 --- a/vendor/psy/psysh/src/ConsoleColorFactory.php +++ /dev/null @@ -1,39 +0,0 @@ -scopeVariables, $this->getSpecialVariables()); } /** * Get all defined magic variables: $_, $_e, $__out, $__class, $__file, etc. - * - * @return array */ - public function getSpecialVariables() + public function getSpecialVariables(): array { $vars = [ '_' => $this->returnValue, @@ -168,21 +164,21 @@ class Context } /** - * Set the most recent Exception. + * Set the most recent Exception or Error. * - * @param \Exception $e + * @param \Throwable $e */ - public function setLastException(\Exception $e) + public function setLastException(\Throwable $e) { $this->lastException = $e; } /** - * Get the most recent Exception. + * Get the most recent Exception or Error. * * @throws \InvalidArgumentException If no Exception has been caught * - * @return \Exception|null + * @return \Throwable|null */ public function getLastException() { @@ -198,7 +194,7 @@ class Context * * @param string $lastStdout */ - public function setLastStdout($lastStdout) + public function setLastStdout(string $lastStdout) { $this->lastStdout = $lastStdout; } @@ -285,10 +281,8 @@ class Context /** * Get command-scope magic variables: $__class, $__file, etc. - * - * @return array */ - public function getCommandScopeVariables() + public function getCommandScopeVariables(): array { return $this->commandScopeVariables; } @@ -301,7 +295,7 @@ class Context * * @return array Array of unused variable names */ - public function getUnusedCommandScopeVariableNames() + public function getUnusedCommandScopeVariableNames(): array { return \array_diff(self::$commandScopeNames, \array_keys($this->commandScopeVariables)); } @@ -310,10 +304,8 @@ class Context * Check whether a variable name is a magic variable. * * @param string $name - * - * @return bool */ - public static function isSpecialVariableName($name) + public static function isSpecialVariableName(string $name): bool { return \in_array($name, self::$specialNames) || \in_array($name, self::$commandScopeNames); } diff --git a/vendor/psy/psysh/src/ContextAware.php b/vendor/psy/psysh/src/ContextAware.php index 121d4db18..83979ae85 100644 --- a/vendor/psy/psysh/src/ContextAware.php +++ b/vendor/psy/psysh/src/ContextAware.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/EnvInterface.php b/vendor/psy/psysh/src/EnvInterface.php index 1f7b9fae8..31a738fc4 100644 --- a/vendor/psy/psysh/src/EnvInterface.php +++ b/vendor/psy/psysh/src/EnvInterface.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,5 +21,5 @@ interface EnvInterface * * @return string|null */ - public function get($key); + public function get(string $key); } diff --git a/vendor/psy/psysh/src/Exception/BreakException.php b/vendor/psy/psysh/src/Exception/BreakException.php index 6efc7acb7..4061442a8 100644 --- a/vendor/psy/psysh/src/Exception/BreakException.php +++ b/vendor/psy/psysh/src/Exception/BreakException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class BreakException extends \Exception implements Exception /** * {@inheritdoc} */ - public function __construct($message = '', $code = 0, \Exception $previous = null) + public function __construct($message = '', $code = 0, \Throwable $previous = null) { $this->rawMessage = $message; parent::__construct(\sprintf('Exit: %s', $message), $code, $previous); @@ -29,10 +29,8 @@ class BreakException extends \Exception implements Exception /** * Return a raw (unformatted) version of the error message. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->rawMessage; } diff --git a/vendor/psy/psysh/src/Exception/DeprecatedException.php b/vendor/psy/psysh/src/Exception/DeprecatedException.php index d06608ebb..f326b53bd 100644 --- a/vendor/psy/psysh/src/Exception/DeprecatedException.php +++ b/vendor/psy/psysh/src/Exception/DeprecatedException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Exception/ErrorException.php b/vendor/psy/psysh/src/Exception/ErrorException.php index 78ac9c569..54abcfd70 100644 --- a/vendor/psy/psysh/src/Exception/ErrorException.php +++ b/vendor/psy/psysh/src/Exception/ErrorException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,14 +21,14 @@ class ErrorException extends \ErrorException implements Exception /** * Construct a Psy ErrorException. * - * @param string $message (default: "") - * @param int $code (default: 0) - * @param int $severity (default: 1) - * @param string|null $filename (default: null) - * @param int|null $lineno (default: null) - * @param Exception|null $previous (default: null) + * @param string $message (default: "") + * @param int $code (default: 0) + * @param int $severity (default: 1) + * @param string|null $filename (default: null) + * @param int|null $lineno (default: null) + * @param \Throwable|null $previous (default: null) */ - public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null) + public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, \Throwable $previous = null) { $this->rawMessage = $message; @@ -73,10 +73,8 @@ class ErrorException extends \ErrorException implements Exception /** * Get the raw (unformatted) message for this error. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->rawMessage; } @@ -88,7 +86,7 @@ class ErrorException extends \ErrorException implements Exception * * set_error_handler([ErrorException::class, 'throwException']); * - * @throws ErrorException + * @throws self * * @param int $errno Error type * @param string $errstr Message @@ -103,11 +101,11 @@ class ErrorException extends \ErrorException implements Exception /** * Create an ErrorException from an Error. * - * @param \Error $e + * @deprecated psySH no longer wraps Errors * - * @return ErrorException + * @param \Error $e */ - public static function fromError(\Error $e) + public static function fromError(\Error $e): self { return new self($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e); } diff --git a/vendor/psy/psysh/src/Exception/Exception.php b/vendor/psy/psysh/src/Exception/Exception.php index 4b02d1326..db7906211 100644 --- a/vendor/psy/psysh/src/Exception/Exception.php +++ b/vendor/psy/psysh/src/Exception/Exception.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Exception/FatalErrorException.php b/vendor/psy/psysh/src/Exception/FatalErrorException.php index 6642264e2..21b223488 100644 --- a/vendor/psy/psysh/src/Exception/FatalErrorException.php +++ b/vendor/psy/psysh/src/Exception/FatalErrorException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,9 +26,9 @@ class FatalErrorException extends \ErrorException implements Exception * @param int $severity (default: 1) * @param string|null $filename (default: null) * @param int|null $lineno (default: null) - * @param \Exception|null $previous (default: null) + * @param \Throwable|null $previous (default: null) */ - public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null) + public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, \Throwable $previous = null) { // Since these are basically always PHP Parser Node line numbers, treat -1 as null. if ($lineno === -1) { @@ -42,10 +42,8 @@ class FatalErrorException extends \ErrorException implements Exception /** * Return a raw (unformatted) version of the error message. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->rawMessage; } diff --git a/vendor/psy/psysh/src/Exception/ParseErrorException.php b/vendor/psy/psysh/src/Exception/ParseErrorException.php index cfc5f70ca..8abfd12f8 100644 --- a/vendor/psy/psysh/src/Exception/ParseErrorException.php +++ b/vendor/psy/psysh/src/Exception/ParseErrorException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class ParseErrorException extends \PhpParser\Error implements Exception * @param string $message (default: "") * @param int $line (default: -1) */ - public function __construct($message = '', $line = -1) + public function __construct(string $message = '', int $line = -1) { $message = \sprintf('PHP Parse error: %s', $message); parent::__construct($message, $line); @@ -32,10 +32,8 @@ class ParseErrorException extends \PhpParser\Error implements Exception * Create a ParseErrorException from a PhpParser Error. * * @param \PhpParser\Error $e - * - * @return ParseErrorException */ - public static function fromParseError(\PhpParser\Error $e) + public static function fromParseError(\PhpParser\Error $e): self { return new self($e->getRawMessage(), $e->getStartLine()); } diff --git a/vendor/psy/psysh/src/Exception/RuntimeException.php b/vendor/psy/psysh/src/Exception/RuntimeException.php index 31890517e..6228813b0 100644 --- a/vendor/psy/psysh/src/Exception/RuntimeException.php +++ b/vendor/psy/psysh/src/Exception/RuntimeException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,9 +23,9 @@ class RuntimeException extends \RuntimeException implements Exception * * @param string $message (default: "") * @param int $code (default: 0) - * @param \Exception|null $previous (default: null) + * @param \Throwable|null $previous (default: null) */ - public function __construct($message = '', $code = 0, \Exception $previous = null) + public function __construct(string $message = '', int $code = 0, \Throwable $previous = null) { $this->rawMessage = $message; parent::__construct($message, $code, $previous); @@ -33,10 +33,8 @@ class RuntimeException extends \RuntimeException implements Exception /** * Return a raw (unformatted) version of the error message. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->rawMessage; } diff --git a/vendor/psy/psysh/src/Exception/ThrowUpException.php b/vendor/psy/psysh/src/Exception/ThrowUpException.php index 692c4a3c6..a01c39d25 100644 --- a/vendor/psy/psysh/src/Exception/ThrowUpException.php +++ b/vendor/psy/psysh/src/Exception/ThrowUpException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,18 +19,16 @@ class ThrowUpException extends \Exception implements Exception /** * {@inheritdoc} */ - public function __construct(\Exception $exception) + public function __construct(\Throwable $throwable) { - $message = \sprintf("Throwing %s with message '%s'", \get_class($exception), $exception->getMessage()); - parent::__construct($message, $exception->getCode(), $exception); + $message = \sprintf("Throwing %s with message '%s'", \get_class($throwable), $throwable->getMessage()); + parent::__construct($message, $throwable->getCode(), $throwable); } /** * Return a raw (unformatted) version of the error message. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->getPrevious()->getMessage(); } @@ -38,11 +36,11 @@ class ThrowUpException extends \Exception implements Exception /** * Create a ThrowUpException from a Throwable. * - * @param \Throwable $throwable + * @deprecated psySH no longer wraps Throwables * - * @return ThrowUpException + * @param \Throwable $throwable */ - public static function fromThrowable($throwable) + public static function fromThrowable($throwable): self { if ($throwable instanceof \Error) { $throwable = ErrorException::fromError($throwable); diff --git a/vendor/psy/psysh/src/Exception/TypeErrorException.php b/vendor/psy/psysh/src/Exception/TypeErrorException.php index 40dccf47e..d7151ead7 100644 --- a/vendor/psy/psysh/src/Exception/TypeErrorException.php +++ b/vendor/psy/psysh/src/Exception/TypeErrorException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,22 +21,23 @@ class TypeErrorException extends \Exception implements Exception /** * Constructor! * - * @param string $message (default: "") - * @param int $code (default: 0) + * @deprecated psySH no longer wraps TypeErrors + * + * @param string $message (default: "") + * @param int $code (default: 0) + * @param \Throwable|null $previous (default: null) */ - public function __construct($message = '', $code = 0) + public function __construct(string $message = '', int $code = 0, \Throwable $previous = null) { $this->rawMessage = $message; $message = \preg_replace('/, called in .*?: eval\\(\\)\'d code/', '', $message); - parent::__construct(\sprintf('TypeError: %s', $message), $code); + parent::__construct(\sprintf('TypeError: %s', $message), $code, $previous); } /** * Get the raw (unformatted) message for this error. - * - * @return string */ - public function getRawMessage() + public function getRawMessage(): string { return $this->rawMessage; } @@ -44,12 +45,12 @@ class TypeErrorException extends \Exception implements Exception /** * Create a TypeErrorException from a TypeError. * - * @param \TypeError $e + * @deprecated psySH no longer wraps TypeErrors * - * @return TypeErrorException + * @param \TypeError $e */ - public static function fromTypeError(\TypeError $e) + public static function fromTypeError(\TypeError $e): self { - return new self($e->getMessage(), $e->getCode()); + return new self($e->getMessage(), $e->getCode(), $e); } } diff --git a/vendor/psy/psysh/src/Exception/UnexpectedTargetException.php b/vendor/psy/psysh/src/Exception/UnexpectedTargetException.php index fd2330508..9d2b70d11 100644 --- a/vendor/psy/psysh/src/Exception/UnexpectedTargetException.php +++ b/vendor/psy/psysh/src/Exception/UnexpectedTargetException.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,9 +19,9 @@ class UnexpectedTargetException extends RuntimeException * @param mixed $target * @param string $message (default: "") * @param int $code (default: 0) - * @param \Exception|null $previous (default: null) + * @param \Throwable|null $previous (default: null) */ - public function __construct($target, $message = '', $code = 0, \Exception $previous = null) + public function __construct($target, string $message = '', int $code = 0, \Throwable $previous = null) { $this->target = $target; parent::__construct($message, $code, $previous); diff --git a/vendor/psy/psysh/src/ExecutionClosure.php b/vendor/psy/psysh/src/ExecutionClosure.php index bebec1349..837e931be 100644 --- a/vendor/psy/psysh/src/ExecutionClosure.php +++ b/vendor/psy/psysh/src/ExecutionClosure.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -44,13 +44,6 @@ class ExecutionClosure \ob_end_clean(); } - throw $_e; - } catch (\Exception $_e) { - // Clean up on our way out. - if (\ob_get_level() > 0) { - \ob_end_clean(); - } - throw $_e; } finally { // Won't be needing this anymore diff --git a/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php b/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php index 0bfa3fdf5..8230c5508 100644 --- a/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php +++ b/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -35,14 +35,14 @@ abstract class AbstractListener implements Listener /** * {@inheritdoc} */ - public function onInput(Shell $shell, $input) + public function onInput(Shell $shell, string $input) { } /** * {@inheritdoc} */ - public function onExecute(Shell $shell, $code) + public function onExecute(Shell $shell, string $code) { } diff --git a/vendor/psy/psysh/src/ExecutionLoop/Listener.php b/vendor/psy/psysh/src/ExecutionLoop/Listener.php index 5bc03c196..9f207f5b7 100644 --- a/vendor/psy/psysh/src/ExecutionLoop/Listener.php +++ b/vendor/psy/psysh/src/ExecutionLoop/Listener.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -20,10 +20,8 @@ interface Listener { /** * Determines whether this listener should be active. - * - * @return bool */ - public static function isSupported(); + public static function isSupported(): bool; /** * Called once before the REPL session starts. @@ -49,7 +47,7 @@ interface Listener * * @return string|null User input override */ - public function onInput(Shell $shell, $input); + public function onInput(Shell $shell, string $input); /** * Called before executing user code. @@ -65,7 +63,7 @@ interface Listener * * @return string|null User code override */ - public function onExecute(Shell $shell, $code); + public function onExecute(Shell $shell, string $code); /** * Called at the end of each loop. diff --git a/vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php b/vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php index 0bad66e0e..3d61693c4 100644 --- a/vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php +++ b/vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -41,10 +41,8 @@ class ProcessForker extends AbstractListener /** * Process forker is supported if pcntl and posix extensions are available. - * - * @return bool */ - public static function isSupported() + public static function isSupported(): bool { return self::isPcntlSupported() && !self::disabledPcntlFunctions() && self::isPosixSupported() && !self::disabledPosixFunctions(); } @@ -52,7 +50,7 @@ class ProcessForker extends AbstractListener /** * Verify that all required pcntl functions are, in fact, available. */ - public static function isPcntlSupported() + public static function isPcntlSupported(): bool { foreach (self::$pcntlFunctions as $func) { if (!\function_exists($func)) { @@ -74,7 +72,7 @@ class ProcessForker extends AbstractListener /** * Verify that all required posix functions are, in fact, available. */ - public static function isPosixSupported() + public static function isPosixSupported(): bool { foreach (self::$posixFunctions as $func) { if (!\function_exists($func)) { @@ -93,13 +91,13 @@ class ProcessForker extends AbstractListener return self::checkDisabledFunctions(self::$posixFunctions); } - private static function checkDisabledFunctions(array $functions) + private static function checkDisabledFunctions(array $functions): array { return \array_values(\array_intersect($functions, \array_map('strtolower', \array_map('trim', \explode(',', \ini_get('disable_functions')))))); } /** - * Forks into a master and a loop process. + * Forks into a main and a loop process. * * The loop process will handle the evaluation of all instructions, then * return its state via a socket upon completion. @@ -250,10 +248,8 @@ class ProcessForker extends AbstractListener * we can. * * @param array $return - * - * @return string */ - private function serializeReturn(array $return) + private function serializeReturn(array $return): string { $serializable = []; @@ -268,14 +264,19 @@ class ProcessForker extends AbstractListener continue; } + if (\version_compare(\PHP_VERSION, '8.1', '>=') && $value instanceof \UnitEnum) { + // Enums defined in the REPL session can't be unserialized. + $ref = new \ReflectionObject($value); + if (\strpos($ref->getFileName(), ": eval()'d code") !== false) { + continue; + } + } + try { @\serialize($value); $serializable[$key] = $value; } catch (\Throwable $e) { // we'll just ignore this one... - } catch (\Exception $e) { - // and this one too... - // @todo remove this once we don't support PHP 5.x anymore :) } } diff --git a/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php b/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php index e0375a2d8..74046a2e2 100644 --- a/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php +++ b/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,10 +25,8 @@ class RunkitReloader extends AbstractListener /** * Only enabled if Runkit is installed. - * - * @return bool */ - public static function isSupported() + public static function isSupported(): bool { // runkit_import was removed in runkit7-4.0.0a1 return \extension_loaded('runkit') || \extension_loaded('runkit7') && \function_exists('runkit_import'); @@ -51,7 +49,7 @@ class RunkitReloader extends AbstractListener * @param Shell $shell * @param string $input */ - public function onInput(Shell $shell, $input) + public function onInput(Shell $shell, string $input) { $this->reload($shell); } @@ -127,15 +125,13 @@ class RunkitReloader extends AbstractListener * Use PHP-Parser to ensure that the file is valid PHP. * * @param string $file - * - * @return bool */ - private function lintFile($file) + private function lintFile(string $file): bool { // first try to parse it try { $this->parser->parse(\file_get_contents($file)); - } catch (\Exception $e) { + } catch (\Throwable $e) { return false; } diff --git a/vendor/psy/psysh/src/ExecutionLoopClosure.php b/vendor/psy/psysh/src/ExecutionLoopClosure.php index aadef7337..78f7e5ea1 100644 --- a/vendor/psy/psysh/src/ExecutionLoopClosure.php +++ b/vendor/psy/psysh/src/ExecutionLoopClosure.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -12,9 +12,7 @@ namespace Psy; use Psy\Exception\BreakException; -use Psy\Exception\ErrorException; use Psy\Exception\ThrowUpException; -use Psy\Exception\TypeErrorException; /** * The Psy Shell's execution loop scope. @@ -59,13 +57,6 @@ class ExecutionLoopClosure extends ExecutionClosure \ob_end_clean(); } - throw $_e; - } catch (\Exception $_e) { - // Clean up on our way out. - if (\ob_get_level() > 0) { - \ob_end_clean(); - } - throw $_e; } finally { // Won't be needing this anymore @@ -87,11 +78,7 @@ class ExecutionLoopClosure extends ExecutionClosure $__psysh__->writeException($_e); throw $_e; - } catch (\TypeError $_e) { - $__psysh__->writeException(TypeErrorException::fromTypeError($_e)); - } catch (\Error $_e) { - $__psysh__->writeException(ErrorException::fromError($_e)); - } catch (\Exception $_e) { + } catch (\Throwable $_e) { $__psysh__->writeException($_e); } diff --git a/vendor/psy/psysh/src/Formatter/CodeFormatter.php b/vendor/psy/psysh/src/Formatter/CodeFormatter.php index 0dabc0642..43bb7fc08 100644 --- a/vendor/psy/psysh/src/Formatter/CodeFormatter.php +++ b/vendor/psy/psysh/src/Formatter/CodeFormatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -81,7 +81,7 @@ class CodeFormatter implements ReflectorFormatter * * @return string formatted code */ - public static function format(\Reflector $reflector, $colorMode = null) + public static function format(\Reflector $reflector, string $colorMode = null): string { if (self::isReflectable($reflector)) { if ($code = @\file_get_contents($reflector->getFileName())) { @@ -104,7 +104,7 @@ class CodeFormatter implements ReflectorFormatter * * @return string formatted code */ - public static function formatCode($code, $startLine = 1, $endLine = null, $markLine = null) + public static function formatCode(string $code, int $startLine = 1, int $endLine = null, int $markLine = null): string { $spans = self::tokenizeSpans($code); $lines = self::splitLines($spans, $startLine, $endLine); @@ -122,10 +122,8 @@ class CodeFormatter implements ReflectorFormatter * This is typehinted as \Reflector but we've narrowed the input via self::isReflectable already. * * @param \ReflectionClass|\ReflectionFunctionAbstract $reflector - * - * @return int */ - private static function getStartLine(\Reflector $reflector) + private static function getStartLine(\Reflector $reflector): int { $startLine = $reflector->getStartLine(); @@ -148,7 +146,7 @@ class CodeFormatter implements ReflectorFormatter * * @return \Generator [$spanType, $spanText] highlight spans */ - private static function tokenizeSpans($code) + private static function tokenizeSpans(string $code): \Generator { $spanType = null; $buffer = ''; @@ -209,7 +207,7 @@ class CodeFormatter implements ReflectorFormatter * * @return \Generator lines, each an array of [$spanType, $spanText] pairs */ - private static function splitLines(\Generator $spans, $startLine = 1, $endLine = null) + private static function splitLines(\Generator $spans, int $startLine = 1, int $endLine = null): \Generator { $lineNum = 1; $buffer = []; @@ -247,7 +245,7 @@ class CodeFormatter implements ReflectorFormatter * * @return \Generator Formatted lines */ - private static function formatLines(\Generator $spanLines) + private static function formatLines(\Generator $spanLines): \Generator { foreach ($spanLines as $lineNum => $spanLine) { $line = ''; @@ -276,7 +274,7 @@ class CodeFormatter implements ReflectorFormatter * * @return \Generator Numbered, formatted lines */ - private static function numberLines(\Generator $lines, $markLine = null) + private static function numberLines(\Generator $lines, int $markLine = null): \Generator { $lines = \iterator_to_array($lines); @@ -302,18 +300,18 @@ class CodeFormatter implements ReflectorFormatter $mark = ($markLine === $lineNum) ? self::LINE_MARKER : self::NO_LINE_MARKER; } - yield \sprintf("%s: %s", $mark, $lineNum, $line); + yield \sprintf("%s: %s", $mark, $lineNum, $line); } } /** * Check whether a Reflector instance is reflectable by this formatter. * - * @param \Reflector $reflector + * @phpstan-assert-if-true \ReflectionClass|\ReflectionFunctionAbstract $reflector * - * @return bool + * @param \Reflector $reflector */ - private static function isReflectable(\Reflector $reflector) + private static function isReflectable(\Reflector $reflector): bool { return ($reflector instanceof \ReflectionClass || $reflector instanceof \ReflectionFunctionAbstract) && \is_file($reflector->getFileName()); } diff --git a/vendor/psy/psysh/src/Formatter/DocblockFormatter.php b/vendor/psy/psysh/src/Formatter/DocblockFormatter.php index 3056967d2..282f463e2 100644 --- a/vendor/psy/psysh/src/Formatter/DocblockFormatter.php +++ b/vendor/psy/psysh/src/Formatter/DocblockFormatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class DocblockFormatter implements ReflectorFormatter * * @return string Formatted docblock */ - public static function format(\Reflector $reflector) + public static function format(\Reflector $reflector): string { $docblock = new Docblock($reflector); $chunks = []; @@ -68,10 +68,8 @@ class DocblockFormatter implements ReflectorFormatter * * @param array $vector * @param array $lines - * - * @return string */ - private static function formatVector(array $vector, array $lines) + private static function formatVector(array $vector, array $lines): string { $template = [' ']; foreach ($vector as $type) { @@ -109,7 +107,7 @@ class DocblockFormatter implements ReflectorFormatter * * @return string formatted tags */ - private static function formatTags(array $skip, array $tags) + private static function formatTags(array $skip, array $tags): string { $chunks = []; @@ -133,10 +131,8 @@ class DocblockFormatter implements ReflectorFormatter * * @param string $type Vector type * @param int $max Pad width - * - * @return string */ - private static function getVectorParamTemplate($type, $max) + private static function getVectorParamTemplate(string $type, int $max): string { if (!isset(self::$vectorParamTemplates[$type])) { return \sprintf('%%-%ds', $max); @@ -150,10 +146,8 @@ class DocblockFormatter implements ReflectorFormatter * * @param string $text String to indent * @param string $indent (default: ' ') - * - * @return string */ - private static function indent($text, $indent = ' ') + private static function indent(string $text, string $indent = ' '): string { return $indent.\str_replace("\n", "\n".$indent, $text); } @@ -162,10 +156,8 @@ class DocblockFormatter implements ReflectorFormatter * Convert underscored or whitespace separated words into sentence case. * * @param string $text - * - * @return string */ - private static function inflect($text) + private static function inflect(string $text): string { $words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text))); diff --git a/vendor/psy/psysh/src/Formatter/Formatter.php b/vendor/psy/psysh/src/Formatter/Formatter.php index 8800c1866..0f972a3f9 100644 --- a/vendor/psy/psysh/src/Formatter/Formatter.php +++ b/vendor/psy/psysh/src/Formatter/Formatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Formatter/ReflectorFormatter.php b/vendor/psy/psysh/src/Formatter/ReflectorFormatter.php index cf2f25340..02f426cdd 100644 --- a/vendor/psy/psysh/src/Formatter/ReflectorFormatter.php +++ b/vendor/psy/psysh/src/Formatter/ReflectorFormatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,8 +18,6 @@ interface ReflectorFormatter { /** * @param \Reflector $reflector - * - * @return string */ - public static function format(\Reflector $reflector); + public static function format(\Reflector $reflector): string; } diff --git a/vendor/psy/psysh/src/Formatter/SignatureFormatter.php b/vendor/psy/psysh/src/Formatter/SignatureFormatter.php index c706ec1e0..3c9c2625d 100644 --- a/vendor/psy/psysh/src/Formatter/SignatureFormatter.php +++ b/vendor/psy/psysh/src/Formatter/SignatureFormatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - public static function format(\Reflector $reflector) + public static function format(\Reflector $reflector): string { switch (true) { case $reflector instanceof \ReflectionFunction: @@ -63,11 +63,11 @@ class SignatureFormatter implements ReflectorFormatter /** * Print the signature name. * - * @param \Reflector $reflector + * @param \ReflectionClass|ReflectionClassConstant|\ReflectionClassConstant|\ReflectionFunctionAbstract $reflector * * @return string Formatted name */ - public static function formatName(\Reflector $reflector) + public static function formatName(\Reflector $reflector): string { return $reflector->getName(); } @@ -75,20 +75,12 @@ class SignatureFormatter implements ReflectorFormatter /** * Print the method, property or class modifiers. * - * @param \Reflector $reflector + * @param \ReflectionMethod|\ReflectionProperty|\ReflectionClass $reflector * * @return string Formatted modifiers */ - private static function formatModifiers(\Reflector $reflector) + private static function formatModifiers(\Reflector $reflector): string { - if ($reflector instanceof \ReflectionClass && $reflector->isTrait()) { - // For some reason, PHP 5.x returns `abstract public` modifiers for - // traits. Let's just ignore that business entirely. - if (\version_compare(\PHP_VERSION, '7.0.0', '<')) { - return ''; - } - } - return \implode(' ', \array_map(function ($modifier) { return \sprintf('%s', $modifier); }, \Reflection::getModifierNames($reflector->getModifiers()))); @@ -101,7 +93,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatClass(\ReflectionClass $reflector) + private static function formatClass(\ReflectionClass $reflector): string { $chunks = []; @@ -142,7 +134,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatClassConstant($reflector) + private static function formatClassConstant($reflector): string { $value = $reflector->getValue(); $style = self::getTypeStyle($value); @@ -163,7 +155,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatConstant($reflector) + private static function formatConstant(ReflectionConstant_ $reflector): string { $value = $reflector->getValue(); $style = self::getTypeStyle($value); @@ -181,10 +173,8 @@ class SignatureFormatter implements ReflectorFormatter * Helper for getting output style for a given value's type. * * @param mixed $value - * - * @return string */ - private static function getTypeStyle($value) + private static function getTypeStyle($value): string { if (\is_int($value) || \is_float($value)) { return 'number'; @@ -204,7 +194,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatProperty(\ReflectionProperty $reflector) + private static function formatProperty(\ReflectionProperty $reflector): string { return \sprintf( '%s $%s', @@ -220,7 +210,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatFunction(\ReflectionFunctionAbstract $reflector) + private static function formatFunction(\ReflectionFunctionAbstract $reflector): string { return \sprintf( 'function %s%s(%s)%s', @@ -238,7 +228,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted return type */ - private static function formatFunctionReturnType(\ReflectionFunctionAbstract $reflector) + private static function formatFunctionReturnType(\ReflectionFunctionAbstract $reflector): string { if (!\method_exists($reflector, 'hasReturnType') || !$reflector->hasReturnType()) { return ''; @@ -254,7 +244,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return string Formatted signature */ - private static function formatMethod(\ReflectionMethod $reflector) + private static function formatMethod(\ReflectionMethod $reflector): string { return \sprintf( '%s %s', @@ -270,7 +260,7 @@ class SignatureFormatter implements ReflectorFormatter * * @return array */ - private static function formatFunctionParams(\ReflectionFunctionAbstract $reflector) + private static function formatFunctionParams(\ReflectionFunctionAbstract $reflector): array { $params = []; foreach ($reflector->getParameters() as $param) { @@ -285,7 +275,7 @@ class SignatureFormatter implements ReflectorFormatter $hint = \sprintf('%s', $class->getName()); } } - } catch (\Exception $e) { + } catch (\Throwable $e) { // sometimes we just don't know... // bad class names, or autoloaded classes that haven't been loaded yet, or whathaveyou. // come to think of it, the only time I've seen this is with the intl extension. @@ -332,10 +322,8 @@ class SignatureFormatter implements ReflectorFormatter * Print function param or return type(s). * * @param \ReflectionType $type - * - * @return string */ - private static function formatReflectionType(\ReflectionType $type = null) + private static function formatReflectionType(\ReflectionType $type = null): string { if ($type === null) { return ''; diff --git a/vendor/psy/psysh/src/Formatter/TraceFormatter.php b/vendor/psy/psysh/src/Formatter/TraceFormatter.php index 7a638a519..f9859225b 100644 --- a/vendor/psy/psysh/src/Formatter/TraceFormatter.php +++ b/vendor/psy/psysh/src/Formatter/TraceFormatter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,10 +22,6 @@ class TraceFormatter /** * Format the trace of the given exception. * - * @throws \InvalidArgumentException if passed a non-Throwable value - * - * @todo type hint $throwable when we drop support for PHP 5.x - * * @param \Throwable $throwable The error or exception with a backtrace * @param FilterOptions $filter (default: null) * @param int $count (default: PHP_INT_MAX) @@ -33,12 +29,8 @@ class TraceFormatter * * @return string[] Formatted stacktrace lines */ - public static function formatTrace($throwable, FilterOptions $filter = null, $count = null, $includePsy = true) + public static function formatTrace(\Throwable $throwable, FilterOptions $filter = null, int $count = null, bool $includePsy = true): array { - if (!($throwable instanceof \Throwable || $throwable instanceof \Exception)) { - throw new \InvalidArgumentException('Unable to format non-throwable value'); - } - if ($cwd = \getcwd()) { $cwd = \rtrim($cwd, \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR; } diff --git a/vendor/psy/psysh/src/Input/CodeArgument.php b/vendor/psy/psysh/src/Input/CodeArgument.php index a2189af7f..c41534782 100644 --- a/vendor/psy/psysh/src/Input/CodeArgument.php +++ b/vendor/psy/psysh/src/Input/CodeArgument.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -39,7 +39,7 @@ class CodeArgument extends InputArgument * * @throws \InvalidArgumentException When argument mode is not valid */ - public function __construct($name, $mode = null, $description = '', $default = null) + public function __construct(string $name, int $mode = null, string $description = '', $default = null) { if ($mode & InputArgument::IS_ARRAY) { throw new \InvalidArgumentException('Argument mode IS_ARRAY is not valid'); diff --git a/vendor/psy/psysh/src/Input/FilterOptions.php b/vendor/psy/psysh/src/Input/FilterOptions.php index f2c1c629f..64eee3f80 100644 --- a/vendor/psy/psysh/src/Input/FilterOptions.php +++ b/vendor/psy/psysh/src/Input/FilterOptions.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class FilterOptions * * @return InputOption[] */ - public static function getOptions() + public static function getOptions(): array { return [ new InputOption('grep', 'G', InputOption::VALUE_REQUIRED, 'Limit to items matching the given pattern (string or regex).'), @@ -73,10 +73,8 @@ class FilterOptions /** * Check whether the bound input has filter options. - * - * @return bool */ - public function hasFilter() + public function hasFilter(): bool { return $this->filter; } @@ -86,10 +84,8 @@ class FilterOptions * * @param string $string * @param array $matches - * - * @return bool */ - public function match($string, array &$matches = null) + public function match(string $string, array &$matches = null): bool { return $this->filter === false || (\preg_match($this->pattern, $string, $matches) xor $this->invert); } @@ -116,10 +112,8 @@ class FilterOptions * Check whether a string appears to be a regular expression. * * @param string $string - * - * @return bool */ - private function stringIsRegex($string) + private function stringIsRegex(string $string): bool { return \substr($string, 0, 1) === '/' && \substr($string, -1) === '/' && \strlen($string) >= 3; } @@ -131,7 +125,7 @@ class FilterOptions * * @param string $pattern */ - private function validateRegex($pattern) + private function validateRegex(string $pattern) { \set_error_handler([ErrorException::class, 'throwException']); try { diff --git a/vendor/psy/psysh/src/Input/ShellInput.php b/vendor/psy/psysh/src/Input/ShellInput.php index 741e0a544..10ca2b5b0 100644 --- a/vendor/psy/psysh/src/Input/ShellInput.php +++ b/vendor/psy/psysh/src/Input/ShellInput.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,7 +33,7 @@ class ShellInput extends StringInput * * @param string $input An array of parameters from the CLI (in the argv format) */ - public function __construct($input) + public function __construct(string $input) { parent::__construct($input); @@ -81,7 +81,7 @@ class ShellInput extends StringInput * * @throws \InvalidArgumentException When unable to parse input (should never happen) */ - private function tokenize($input) + private function tokenize(string $input): array { $tokens = []; $length = \strlen($input); @@ -150,7 +150,7 @@ class ShellInput extends StringInput * * @throws \RuntimeException When too many arguments are given */ - private function parseShellArgument($token, $rest) + private function parseShellArgument(string $token, string $rest) { $c = \count($this->arguments); @@ -200,7 +200,7 @@ class ShellInput extends StringInput * * @param string $token The current token */ - private function parseShortOption($token) + private function parseShortOption(string $token) { $name = \substr($token, 1); @@ -223,7 +223,7 @@ class ShellInput extends StringInput * * @throws \RuntimeException When option given doesn't exist */ - private function parseShortOptionSet($name) + private function parseShortOptionSet(string $name) { $len = \strlen($name); for ($i = 0; $i < $len; $i++) { @@ -247,17 +247,12 @@ class ShellInput extends StringInput * * @param string $token The current token */ - private function parseLongOption($token) + private function parseLongOption(string $token) { $name = \substr($token, 2); if (false !== $pos = \strpos($name, '=')) { - if ('' === ($value = \substr($name, $pos + 1))) { - // if no value after "=" then substr() returns "" since php7 only, false before - // see http://php.net/manual/fr/migration70.incompatible.php#119151 - if (\PHP_VERSION_ID < 70000 && false === $value) { - $value = ''; - } + if (($value = \substr($name, $pos + 1)) === '') { \array_unshift($this->parsed, [$value, null]); } $this->addLongOption(\substr($name, 0, $pos), $value); @@ -274,7 +269,7 @@ class ShellInput extends StringInput * * @throws \RuntimeException When option given doesn't exist */ - private function addShortOption($shortcut, $value) + private function addShortOption(string $shortcut, $value) { if (!$this->definition->hasShortcut($shortcut)) { throw new \RuntimeException(\sprintf('The "-%s" option does not exist.', $shortcut)); @@ -291,7 +286,7 @@ class ShellInput extends StringInput * * @throws \RuntimeException When option given doesn't exist */ - private function addLongOption($name, $value) + private function addLongOption(string $name, $value) { if (!$this->definition->hasOption($name)) { throw new \RuntimeException(\sprintf('The "--%s" option does not exist.', $name)); diff --git a/vendor/psy/psysh/src/Input/SilentInput.php b/vendor/psy/psysh/src/Input/SilentInput.php index b4804c611..0c963f544 100644 --- a/vendor/psy/psysh/src/Input/SilentInput.php +++ b/vendor/psy/psysh/src/Input/SilentInput.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,17 +27,15 @@ class SilentInput * * @param string $inputString */ - public function __construct($inputString) + public function __construct(string $inputString) { $this->inputString = $inputString; } /** * To. String. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->inputString; } diff --git a/vendor/psy/psysh/src/Output/OutputPager.php b/vendor/psy/psysh/src/Output/OutputPager.php index b9dcdf82d..0652b70bf 100644 --- a/vendor/psy/psysh/src/Output/OutputPager.php +++ b/vendor/psy/psysh/src/Output/OutputPager.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Output/PassthruPager.php b/vendor/psy/psysh/src/Output/PassthruPager.php index 3eaa9cf78..6ad17b5b9 100644 --- a/vendor/psy/psysh/src/Output/PassthruPager.php +++ b/vendor/psy/psysh/src/Output/PassthruPager.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Output/ProcOutputPager.php b/vendor/psy/psysh/src/Output/ProcOutputPager.php index d31471ca0..aeaff3685 100644 --- a/vendor/psy/psysh/src/Output/ProcOutputPager.php +++ b/vendor/psy/psysh/src/Output/ProcOutputPager.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,9 +32,9 @@ class ProcOutputPager extends StreamOutput implements OutputPager * Constructor. * * @param StreamOutput $output - * @param string $cmd Pager process command (default: 'less -R -S -F -X') + * @param string $cmd Pager process command (default: 'less -R -F -X') */ - public function __construct(StreamOutput $output, $cmd = 'less -R -S -F -X') + public function __construct(StreamOutput $output, string $cmd = 'less -R -F -X') { $this->stream = $output->getStream(); $this->cmd = $cmd; @@ -54,6 +54,7 @@ class ProcOutputPager extends StreamOutput implements OutputPager if (false === @\fwrite($pipe, $message.($newline ? \PHP_EOL : ''))) { // @codeCoverageIgnoreStart // should never happen + $this->close(); throw new \RuntimeException('Unable to write output'); // @codeCoverageIgnoreEnd } diff --git a/vendor/psy/psysh/src/Output/ShellOutput.php b/vendor/psy/psysh/src/Output/ShellOutput.php index e23666029..543baccb2 100644 --- a/vendor/psy/psysh/src/Output/ShellOutput.php +++ b/vendor/psy/psysh/src/Output/ShellOutput.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,6 @@ namespace Psy\Output; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatterInterface; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Output\ConsoleOutput; /** @@ -24,8 +23,13 @@ class ShellOutput extends ConsoleOutput const NUMBER_LINES = 128; private $paging = 0; + + /** @var OutputPager */ private $pager; + /** @var Theme */ + private $theme; + /** * Construct a ShellOutput instance. * @@ -34,10 +38,11 @@ class ShellOutput extends ConsoleOutput * @param OutputFormatterInterface|null $formatter (default: null) * @param string|OutputPager|null $pager (default: null) */ - public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null, $pager = null) + public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null, $pager = null, $theme = null) { parent::__construct($verbosity, $decorated, $formatter); + $this->theme = $theme ?? new Theme('modern'); $this->initFormatters(); if ($pager === null) { @@ -64,7 +69,7 @@ class ShellOutput extends ConsoleOutput * @param string|array|\Closure $messages A string, array of strings or a callback * @param int $type (default: 0) */ - public function page($messages, $type = 0) + public function page($messages, int $type = 0) { if (\is_string($messages)) { $messages = (array) $messages; @@ -158,6 +163,15 @@ class ShellOutput extends ConsoleOutput } } + /** + * Set the output Theme. + */ + public function setTheme(Theme $theme) + { + $this->theme = $theme; + $this->initFormatters(); + } + /** * Flush and close the output pager. */ @@ -173,38 +187,22 @@ class ShellOutput extends ConsoleOutput */ private function initFormatters() { - $formatter = $this->getFormatter(); + $useGrayFallback = !$this->grayExists(); + $this->theme->applyStyles($this->getFormatter(), $useGrayFallback); + $this->theme->applyErrorStyles($this->getErrorOutput()->getFormatter(), $useGrayFallback); + } - $formatter->setStyle('warning', new OutputFormatterStyle('black', 'yellow')); - $formatter->setStyle('error', new OutputFormatterStyle('white', 'red', ['bold'])); - $formatter->setStyle('aside', new OutputFormatterStyle('blue')); - $formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold'])); - $formatter->setStyle('return', new OutputFormatterStyle('cyan')); - $formatter->setStyle('urgent', new OutputFormatterStyle('red')); - $formatter->setStyle('hidden', new OutputFormatterStyle('black')); + /** + * Checks if the "gray" color exists on the output. + */ + private function grayExists(): bool + { + try { + $this->write(''); + } catch (\InvalidArgumentException $e) { + return false; + } - // Visibility - $formatter->setStyle('public', new OutputFormatterStyle(null, null, ['bold'])); - $formatter->setStyle('protected', new OutputFormatterStyle('yellow')); - $formatter->setStyle('private', new OutputFormatterStyle('red')); - $formatter->setStyle('global', new OutputFormatterStyle('cyan', null, ['bold'])); - $formatter->setStyle('const', new OutputFormatterStyle('cyan')); - $formatter->setStyle('class', new OutputFormatterStyle('blue', null, ['underscore'])); - $formatter->setStyle('function', new OutputFormatterStyle(null)); - $formatter->setStyle('default', new OutputFormatterStyle(null)); - - // Types - $formatter->setStyle('number', new OutputFormatterStyle('magenta')); - $formatter->setStyle('integer', new OutputFormatterStyle('magenta')); - $formatter->setStyle('float', new OutputFormatterStyle('yellow')); - $formatter->setStyle('string', new OutputFormatterStyle('green')); - $formatter->setStyle('bool', new OutputFormatterStyle('cyan')); - $formatter->setStyle('keyword', new OutputFormatterStyle('yellow')); - $formatter->setStyle('comment', new OutputFormatterStyle('blue')); - $formatter->setStyle('object', new OutputFormatterStyle('blue')); - $formatter->setStyle('resource', new OutputFormatterStyle('yellow')); - - // Code-specific formatting - $formatter->setStyle('inline_html', new OutputFormatterStyle('cyan')); + return true; } } diff --git a/vendor/psy/psysh/src/Output/Theme.php b/vendor/psy/psysh/src/Output/Theme.php new file mode 100644 index 000000000..98a73e912 --- /dev/null +++ b/vendor/psy/psysh/src/Output/Theme.php @@ -0,0 +1,285 @@ + true, + ]; + + const CLASSIC_THEME = [ + 'compact' => true, + + 'prompt' => '>>> ', + 'bufferPrompt' => '... ', + 'replayPrompt' => '--> ', + 'returnValue' => '=> ', + ]; + + const DEFAULT_STYLES = [ + 'info' => ['white', 'blue', ['bold']], + 'warning' => ['black', 'yellow'], + 'error' => ['white', 'red', ['bold']], + 'whisper' => ['gray'], + + 'aside' => ['blue'], + 'strong' => [null, null, ['bold']], + 'return' => ['cyan'], + 'urgent' => ['red'], + 'hidden' => ['black'], + + // Visibility + 'public' => [null, null, ['bold']], + 'protected' => ['yellow'], + 'private' => ['red'], + 'global' => ['cyan', null, ['bold']], + 'const' => ['cyan'], + 'class' => ['blue', null, ['underscore']], + 'function' => [null], + 'default' => [null], + + // Types + 'number' => ['magenta'], + 'integer' => ['magenta'], + 'float' => ['yellow'], + 'string' => ['green'], + 'bool' => ['cyan'], + 'keyword' => ['yellow'], + 'comment' => ['blue'], + 'object' => ['blue'], + 'resource' => ['yellow'], + + // Code-specific formatting + 'inline_html' => ['cyan'], + ]; + + const ERROR_STYLES = ['info', 'warning', 'error', 'whisper']; + + private $compact = false; + + private $prompt = '> '; + private $bufferPrompt = '. '; + private $replayPrompt = '- '; + private $returnValue = '= '; + + private $grayFallback = 'blue'; + + private $styles = []; + + /** + * @param string|array $config theme name or config options + */ + public function __construct($config = 'modern') + { + if (\is_string($config)) { + switch ($config) { + case 'modern': + $config = static::MODERN_THEME; + break; + + case 'compact': + $config = static::COMPACT_THEME; + break; + + case 'classic': + $config = static::CLASSIC_THEME; + break; + + default: + \trigger_error(\sprintf('Unknown theme: %s', $config), \E_USER_NOTICE); + $config = static::MODERN_THEME; + break; + } + } + + if (!\is_array($config)) { + throw new \InvalidArgumentException('Invalid theme config'); + } + + foreach ($config as $name => $value) { + switch ($name) { + case 'compact': + $this->setCompact($value); + break; + + case 'prompt': + $this->setPrompt($value); + break; + + case 'bufferPrompt': + $this->setBufferPrompt($value); + break; + + case 'replayPrompt': + $this->setReplayPrompt($value); + break; + + case 'returnValue': + $this->setReturnValue($value); + break; + + case 'grayFallback': + $this->setGrayFallback($value); + break; + + case 'compact': + $this->setCompact($value); + break; + } + } + + $this->setStyles($config['styles'] ?? []); + } + + /** + * Enable or disable compact output. + */ + public function setCompact(bool $compact) + { + $this->compact = $compact; + } + + /** + * Get whether to use compact output. + */ + public function compact(): bool + { + return $this->compact; + } + + /** + * Set the prompt string. + */ + public function setPrompt(string $prompt) + { + $this->prompt = $prompt; + } + + /** + * Get the prompt string. + */ + public function prompt(): string + { + return $this->prompt; + } + + /** + * Set the buffer prompt string (used for multi-line input continuation). + */ + public function setBufferPrompt(string $bufferPrompt) + { + $this->bufferPrompt = $bufferPrompt; + } + + /** + * Get the buffer prompt string (used for multi-line input continuation). + */ + public function bufferPrompt(): string + { + return $this->bufferPrompt; + } + + /** + * Set the prompt string used when replaying history. + */ + public function setReplayPrompt(string $replayPrompt) + { + $this->replayPrompt = $replayPrompt; + } + + /** + * Get the prompt string used when replaying history. + */ + public function replayPrompt(): string + { + return $this->replayPrompt; + } + + /** + * Set the return value marker. + */ + public function setReturnValue(string $returnValue) + { + $this->returnValue = $returnValue; + } + + /** + * Get the return value marker. + */ + public function returnValue(): string + { + return $this->returnValue; + } + + /** + * Set the fallback color when "gray" is unavailable. + */ + public function setGrayFallback(string $grayFallback) + { + $this->grayFallback = $grayFallback; + } + + /** + * Set the shell output formatter styles. + * + * Accepts a map from style name to [fg, bg, options], for example: + * + * [ + * 'error' => ['white', 'red', ['bold']], + * 'warning' => ['black', 'yellow'], + * ] + * + * Foreground, background or options can be null, or even omitted entirely. + */ + public function setStyles(array $styles) + { + foreach (\array_keys(static::DEFAULT_STYLES) as $name) { + $this->styles[$name] = $styles[$name] ?? static::DEFAULT_STYLES[$name]; + } + } + + /** + * Apply the current output formatter styles. + */ + public function applyStyles(OutputFormatterInterface $formatter, bool $useGrayFallback) + { + foreach (\array_keys(static::DEFAULT_STYLES) as $name) { + $formatter->setStyle($name, new OutputFormatterStyle(...$this->getStyle($name, $useGrayFallback))); + } + } + + /** + * Apply the current output formatter error styles. + */ + public function applyErrorStyles(OutputFormatterInterface $errorFormatter, bool $useGrayFallback) + { + foreach (static::ERROR_STYLES as $name) { + $errorFormatter->setStyle($name, new OutputFormatterStyle(...$this->getStyle($name, $useGrayFallback))); + } + } + + private function getStyle(string $name, bool $useGrayFallback): array + { + return \array_map(function ($style) use ($useGrayFallback) { + return ($useGrayFallback && $style === 'gray') ? $this->grayFallback : $style; + }, $this->styles[$name]); + } +} diff --git a/vendor/psy/psysh/src/ParserFactory.php b/vendor/psy/psysh/src/ParserFactory.php index 90c75bc28..e7c15c5db 100644 --- a/vendor/psy/psysh/src/ParserFactory.php +++ b/vendor/psy/psysh/src/ParserFactory.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,7 +11,6 @@ namespace Psy; -use PhpParser\Lexer; use PhpParser\Parser; use PhpParser\ParserFactory as OriginalParserFactory; @@ -28,25 +27,13 @@ class ParserFactory /** * Possible kinds of parsers for the factory, from PHP parser library. * - * @return array + * @return string[] */ - public static function getPossibleKinds() + public static function getPossibleKinds(): array { return ['ONLY_PHP5', 'ONLY_PHP7', 'PREFER_PHP5', 'PREFER_PHP7']; } - /** - * Is this parser factory supports kinds? - * - * PHP parser < 2.0 doesn't support kinds, >= 2.0 — does. - * - * @return bool - */ - public function hasKindsSupport() - { - return \class_exists(OriginalParserFactory::class); - } - /** * Default kind (if supported, based on current interpreter's version). * @@ -54,38 +41,26 @@ class ParserFactory */ public function getDefaultKind() { - if ($this->hasKindsSupport()) { - return \version_compare(\PHP_VERSION, '7.0', '>=') ? static::ONLY_PHP7 : static::ONLY_PHP5; - } + return static::ONLY_PHP7; } /** * New parser instance with given kind. * * @param string|null $kind One of class constants (only for PHP parser 2.0 and above) - * - * @return Parser */ - public function createParser($kind = null) + public function createParser($kind = null): Parser { - if ($this->hasKindsSupport()) { - $originalFactory = new OriginalParserFactory(); + $originalFactory = new OriginalParserFactory(); - $kind = $kind ?: $this->getDefaultKind(); + $kind = $kind ?: $this->getDefaultKind(); - if (!\in_array($kind, static::getPossibleKinds())) { - throw new \InvalidArgumentException('Unknown parser kind'); - } - - $parser = $originalFactory->create(\constant(OriginalParserFactory::class.'::'.$kind)); - } else { - if ($kind !== null) { - throw new \InvalidArgumentException('Install PHP Parser v2.x to specify parser kind'); - } - - $parser = new Parser(new Lexer()); + if (!\in_array($kind, static::getPossibleKinds())) { + throw new \InvalidArgumentException('Unknown parser kind'); } + $parser = $originalFactory->create(\constant(OriginalParserFactory::class.'::'.$kind)); + return $parser; } } diff --git a/vendor/psy/psysh/src/Readline/GNUReadline.php b/vendor/psy/psysh/src/Readline/GNUReadline.php index 179cd29ae..877e1a309 100644 --- a/vendor/psy/psysh/src/Readline/GNUReadline.php +++ b/vendor/psy/psysh/src/Readline/GNUReadline.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -34,10 +34,8 @@ class GNUReadline implements Readline * * NOTE: As of PHP 7.4, PHP sometimes has history support in the Libedit * wrapper, so that will use the GNUReadline implementation as well! - * - * @return bool */ - public static function isSupported() + public static function isSupported(): bool { return \function_exists('readline') && \function_exists('readline_list_history'); } @@ -47,34 +45,24 @@ class GNUReadline implements Readline * * Currently, the GNU readline implementation does, but the libedit wrapper does not. */ - public static function supportsBracketedPaste() + public static function supportsBracketedPaste(): bool { - return self::isSupported() && \stripos(\readline_info('library_version'), 'editline') === false; + return self::isSupported() && \stripos(\readline_info('library_version') ?: '', 'editline') === false; } - /** - * GNU Readline constructor. - * - * @param string|false $historyFile - * @param int $historySize - * @param bool $eraseDups - */ public function __construct($historyFile = null, $historySize = 0, $eraseDups = false) { $this->historyFile = ($historyFile !== null) ? $historyFile : false; $this->historySize = $historySize; $this->eraseDups = $eraseDups; - // HHVM errors on this, so HHVM doesn't get a readline_name. - if (!\defined('HHVM_VERSION')) { - \readline_info('readline_name', 'psysh'); - } + \readline_info('readline_name', 'psysh'); } /** * {@inheritdoc} */ - public function addHistory($line) + public function addHistory(string $line): bool { if ($res = \readline_add_history($line)) { $this->writeHistory(); @@ -86,7 +74,7 @@ class GNUReadline implements Readline /** * {@inheritdoc} */ - public function clearHistory() + public function clearHistory(): bool { if ($res = \readline_clear_history()) { $this->writeHistory(); @@ -98,7 +86,7 @@ class GNUReadline implements Readline /** * {@inheritdoc} */ - public function listHistory() + public function listHistory(): array { return \readline_list_history(); } @@ -106,17 +94,9 @@ class GNUReadline implements Readline /** * {@inheritdoc} */ - public function readHistory() + public function readHistory(): bool { - // Workaround PHP bug #69054 - // - // If open_basedir is set, readline_read_history() segfaults. This was fixed in 5.6.7: - // - // https://github.com/php/php-src/blob/423a057023ef3c00d2ffc16a6b43ba01d0f71796/NEWS#L19-L21 - // - if (\version_compare(\PHP_VERSION, '5.6.7', '>=') || !\ini_get('open_basedir')) { - \readline_read_history(); - } + \readline_read_history(); \readline_clear_history(); return \readline_read_history($this->historyFile); @@ -125,7 +105,7 @@ class GNUReadline implements Readline /** * {@inheritdoc} */ - public function readline($prompt = null) + public function readline(string $prompt = null) { return \readline($prompt); } @@ -141,7 +121,7 @@ class GNUReadline implements Readline /** * {@inheritdoc} */ - public function writeHistory() + public function writeHistory(): bool { // We have to write history first, since it is used // by Libedit to list history diff --git a/vendor/psy/psysh/src/Readline/Hoa/Autocompleter.php b/vendor/psy/psysh/src/Readline/Hoa/Autocompleter.php new file mode 100644 index 000000000..6955de622 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Autocompleter.php @@ -0,0 +1,57 @@ +setAutocompleters($autocompleters); + + return; + } + + /** + * Complete a word. + * Returns null for no word, a full-word or an array of full-words. + */ + public function complete(&$prefix) + { + foreach ($this->getAutocompleters() as $autocompleter) { + $preg = \preg_match( + '#('.$autocompleter->getWordDefinition().')$#u', + $prefix, + $match + ); + + if (0 === $preg) { + continue; + } + + $_prefix = $match[0]; + + if (null === $out = $autocompleter->complete($_prefix)) { + continue; + } + + $prefix = $_prefix; + + return $out; + } + + return null; + } + + /** + * Set/initialize list of autocompleters. + */ + protected function setAutocompleters(array $autocompleters) + { + $old = $this->_autocompleters; + $this->_autocompleters = new \ArrayObject($autocompleters); + + return $old; + } + + /** + * Get list of autocompleters. + */ + public function getAutocompleters() + { + return $this->_autocompleters; + } + + /** + * Get definition of a word. + */ + public function getWordDefinition(): string + { + return '.*'; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/AutocompleterPath.php b/vendor/psy/psysh/src/Readline/Hoa/AutocompleterPath.php new file mode 100644 index 000000000..a922b7898 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/AutocompleterPath.php @@ -0,0 +1,194 @@ +setRoot($root); + } + + if (null !== $iteratorFactory) { + $this->setIteratorFactory($iteratorFactory); + } + } + + /** + * Complete a word. + * Returns null for no word, a full-word or an array of full-words. + */ + public function complete(&$prefix) + { + $root = $this->getRoot(); + + if (static::PWD === $root) { + $root = \getcwd(); + } + + $path = $root.\DIRECTORY_SEPARATOR.$prefix; + + if (!\is_dir($path)) { + $path = \dirname($path).\DIRECTORY_SEPARATOR; + $prefix = \basename($prefix); + } else { + $prefix = null; + } + + $iteratorFactory = $this->getIteratorFactory() ?: + static::getDefaultIteratorFactory(); + + try { + $iterator = $iteratorFactory($path); + $out = []; + $length = \mb_strlen($prefix); + + foreach ($iterator as $fileinfo) { + $filename = $fileinfo->getFilename(); + + if (null === $prefix || + (\mb_substr($filename, 0, $length) === $prefix)) { + if ($fileinfo->isDir()) { + $out[] = $filename.'/'; + } else { + $out[] = $filename; + } + } + } + } catch (\Exception $e) { + return null; + } + + $count = \count($out); + + if (1 === $count) { + return $out[0]; + } + + if (0 === $count) { + return null; + } + + return $out; + } + + /** + * Get definition of a word. + */ + public function getWordDefinition(): string + { + return '/?[\w\d\\_\-\.]+(/[\w\d\\_\-\.]*)*'; + } + + /** + * Set root. + */ + public function setRoot(string $root) + { + $old = $this->_root; + $this->_root = $root; + + return $old; + } + + /** + * Get root. + */ + public function getRoot() + { + return $this->_root; + } + + /** + * Set iterator factory (a finder). + */ + public function setIteratorFactory(\Closure $iteratorFactory) + { + $old = $this->_iteratorFactory; + $this->_iteratorFactory = $iteratorFactory; + + return $old; + } + + /** + * Get iterator factory. + */ + public function getIteratorFactory() + { + return $this->_iteratorFactory; + } + + /** + * Get default iterator factory (based on \DirectoryIterator). + */ + public static function getDefaultIteratorFactory() + { + return function ($path) { + return new \DirectoryIterator($path); + }; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/AutocompleterWord.php b/vendor/psy/psysh/src/Readline/Hoa/AutocompleterWord.php new file mode 100644 index 000000000..c60823eac --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/AutocompleterWord.php @@ -0,0 +1,119 @@ +setWords($words); + } + + /** + * Complete a word. + * Returns null for no word, a full-word or an array of full-words. + * + * @param string &$prefix Prefix to autocomplete + * + * @return mixed + */ + public function complete(&$prefix) + { + $out = []; + $length = \mb_strlen($prefix); + + foreach ($this->getWords() as $word) { + if (\mb_substr($word, 0, $length) === $prefix) { + $out[] = $word; + } + } + + if (empty($out)) { + return null; + } + + if (1 === \count($out)) { + return $out[0]; + } + + return $out; + } + + /** + * Get definition of a word. + */ + public function getWordDefinition(): string + { + return '\b\w+'; + } + + /** + * Set list of words. + * + * @param array $words words + * + * @return array + */ + public function setWords(array $words) + { + $old = $this->_words; + $this->_words = $words; + + return $old; + } + + /** + * Get list of words. + */ + public function getWords(): array + { + return $this->_words; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Console.php b/vendor/psy/psysh/src/Readline/Hoa/Console.php new file mode 100644 index 000000000..17b1fecc6 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Console.php @@ -0,0 +1,347 @@ + $repeat) { + return; + } elseif (1 === $repeat) { + $handle = \explode(' ', $steps); + } else { + $handle = \explode(' ', $steps, 1); + } + + $tput = Console::getTput(); + $output = Console::getOutput(); + + foreach ($handle as $step) { + switch ($step) { + case 'u': + case 'up': + case '↑': + $output->writeAll( + \str_replace( + '%p1%d', + $repeat, + $tput->get('parm_up_cursor') + ) + ); + + break; + + case 'U': + case 'UP': + static::moveTo(null, 1); + + break; + + case 'r': + case 'right': + case '→': + $output->writeAll( + \str_replace( + '%p1%d', + $repeat, + $tput->get('parm_right_cursor') + ) + ); + + break; + + case 'R': + case 'RIGHT': + static::moveTo(9999); + + break; + + case 'd': + case 'down': + case '↓': + $output->writeAll( + \str_replace( + '%p1%d', + $repeat, + $tput->get('parm_down_cursor') + ) + ); + + break; + + case 'D': + case 'DOWN': + static::moveTo(null, 9999); + + break; + + case 'l': + case 'left': + case '←': + $output->writeAll( + \str_replace( + '%p1%d', + $repeat, + $tput->get('parm_left_cursor') + ) + ); + + break; + + case 'L': + case 'LEFT': + static::moveTo(1); + + break; + } + } + } + + /** + * Move to the line X and the column Y. + * If null, use the current coordinate. + */ + public static function moveTo(int $x = null, int $y = null) + { + if (null === $x || null === $y) { + $position = static::getPosition(); + + if (null === $x) { + $x = $position['x']; + } + + if (null === $y) { + $y = $position['y']; + } + } + + Console::getOutput()->writeAll( + \str_replace( + ['%i%p1%d', '%p2%d'], + [$y, $x], + Console::getTput()->get('cursor_address') + ) + ); + } + + /** + * Get current position (x and y) of the cursor. + */ + public static function getPosition(): array + { + $tput = Console::getTput(); + $user7 = $tput->get('user7'); + + if (null === $user7) { + return [ + 'x' => 0, + 'y' => 0, + ]; + } + + Console::getOutput()->writeAll($user7); + + $input = Console::getInput(); + + // Read $tput->get('user6'). + $input->read(2); // skip \033 and [. + + $x = null; + $y = null; + $handle = &$y; + + while (true) { + $char = $input->readCharacter(); + + switch ($char) { + case ';': + $handle = &$x; + + break; + + case 'R': + break 2; + + default: + $handle .= $char; + } + } + + return [ + 'x' => (int) $x, + 'y' => (int) $y, + ]; + } + + /** + * Save current position. + */ + public static function save() + { + Console::getOutput()->writeAll( + Console::getTput()->get('save_cursor') + ); + } + + /** + * Restore cursor to the last saved position. + */ + public static function restore() + { + Console::getOutput()->writeAll( + Console::getTput()->get('restore_cursor') + ); + } + + /** + * Clear the screen. + * Part can be: + * • a, all, ↕ : clear entire screen and static::move(1, 1); + * • u, up, ↑ : clear from cursor to beginning of the screen; + * • r, right, → : clear from cursor to the end of the line; + * • d, down, ↓ : clear from cursor to end of the screen; + * • l, left, ← : clear from cursor to beginning of the screen; + * • line, ↔ : clear all the line and static::move(1). + * Parts can be concatenated by a single space. + */ + public static function clear(string $parts = 'all') + { + $tput = Console::getTput(); + $output = Console::getOutput(); + + foreach (\explode(' ', $parts) as $part) { + switch ($part) { + case 'a': + case 'all': + case '↕': + $output->writeAll($tput->get('clear_screen')); + static::moveTo(1, 1); + + break; + + case 'u': + case 'up': + case '↑': + $output->writeAll("\033[1J"); + + break; + + case 'r': + case 'right': + case '→': + $output->writeAll($tput->get('clr_eol')); + + break; + + case 'd': + case 'down': + case '↓': + $output->writeAll($tput->get('clr_eos')); + + break; + + case 'l': + case 'left': + case '←': + $output->writeAll($tput->get('clr_bol')); + + break; + + case 'line': + case '↔': + $output->writeAll("\r".$tput->get('clr_eol')); + + break; + } + } + } + + /** + * Hide the cursor. + */ + public static function hide() + { + Console::getOutput()->writeAll( + Console::getTput()->get('cursor_invisible') + ); + } + + /** + * Show the cursor. + */ + public static function show() + { + Console::getOutput()->writeAll( + Console::getTput()->get('cursor_visible') + ); + } + + /** + * Colorize cursor. + * Attributes can be: + * • n, normal : normal; + * • b, bold : bold; + * • u, underlined : underlined; + * • bl, blink : blink; + * • i, inverse : inverse; + * • !b, !bold : normal weight; + * • !u, !underlined : not underlined; + * • !bl, !blink : steady; + * • !i, !inverse : positive; + * • fg(color), foreground(color) : set foreground to “color”; + * • bg(color), background(color) : set background to “color”. + * “color” can be: + * • default; + * • black; + * • red; + * • green; + * • yellow; + * • blue; + * • magenta; + * • cyan; + * • white; + * • 0-256 (classic palette); + * • #hexa. + * Attributes can be concatenated by a single space. + */ + public static function colorize(string $attributes) + { + static $_rgbTo256 = null; + + if (null === $_rgbTo256) { + $_rgbTo256 = [ + '000000', '800000', '008000', '808000', '000080', '800080', + '008080', 'c0c0c0', '808080', 'ff0000', '00ff00', 'ffff00', + '0000ff', 'ff00ff', '00ffff', 'ffffff', '000000', '00005f', + '000087', '0000af', '0000d7', '0000ff', '005f00', '005f5f', + '005f87', '005faf', '005fd7', '005fff', '008700', '00875f', + '008787', '0087af', '0087d7', '0087ff', '00af00', '00af5f', + '00af87', '00afaf', '00afd7', '00afff', '00d700', '00d75f', + '00d787', '00d7af', '00d7d7', '00d7ff', '00ff00', '00ff5f', + '00ff87', '00ffaf', '00ffd7', '00ffff', '5f0000', '5f005f', + '5f0087', '5f00af', '5f00d7', '5f00ff', '5f5f00', '5f5f5f', + '5f5f87', '5f5faf', '5f5fd7', '5f5fff', '5f8700', '5f875f', + '5f8787', '5f87af', '5f87d7', '5f87ff', '5faf00', '5faf5f', + '5faf87', '5fafaf', '5fafd7', '5fafff', '5fd700', '5fd75f', + '5fd787', '5fd7af', '5fd7d7', '5fd7ff', '5fff00', '5fff5f', + '5fff87', '5fffaf', '5fffd7', '5fffff', '870000', '87005f', + '870087', '8700af', '8700d7', '8700ff', '875f00', '875f5f', + '875f87', '875faf', '875fd7', '875fff', '878700', '87875f', + '878787', '8787af', '8787d7', '8787ff', '87af00', '87af5f', + '87af87', '87afaf', '87afd7', '87afff', '87d700', '87d75f', + '87d787', '87d7af', '87d7d7', '87d7ff', '87ff00', '87ff5f', + '87ff87', '87ffaf', '87ffd7', '87ffff', 'af0000', 'af005f', + 'af0087', 'af00af', 'af00d7', 'af00ff', 'af5f00', 'af5f5f', + 'af5f87', 'af5faf', 'af5fd7', 'af5fff', 'af8700', 'af875f', + 'af8787', 'af87af', 'af87d7', 'af87ff', 'afaf00', 'afaf5f', + 'afaf87', 'afafaf', 'afafd7', 'afafff', 'afd700', 'afd75f', + 'afd787', 'afd7af', 'afd7d7', 'afd7ff', 'afff00', 'afff5f', + 'afff87', 'afffaf', 'afffd7', 'afffff', 'd70000', 'd7005f', + 'd70087', 'd700af', 'd700d7', 'd700ff', 'd75f00', 'd75f5f', + 'd75f87', 'd75faf', 'd75fd7', 'd75fff', 'd78700', 'd7875f', + 'd78787', 'd787af', 'd787d7', 'd787ff', 'd7af00', 'd7af5f', + 'd7af87', 'd7afaf', 'd7afd7', 'd7afff', 'd7d700', 'd7d75f', + 'd7d787', 'd7d7af', 'd7d7d7', 'd7d7ff', 'd7ff00', 'd7ff5f', + 'd7ff87', 'd7ffaf', 'd7ffd7', 'd7ffff', 'ff0000', 'ff005f', + 'ff0087', 'ff00af', 'ff00d7', 'ff00ff', 'ff5f00', 'ff5f5f', + 'ff5f87', 'ff5faf', 'ff5fd7', 'ff5fff', 'ff8700', 'ff875f', + 'ff8787', 'ff87af', 'ff87d7', 'ff87ff', 'ffaf00', 'ffaf5f', + 'ffaf87', 'ffafaf', 'ffafd7', 'ffafff', 'ffd700', 'ffd75f', + 'ffd787', 'ffd7af', 'ffd7d7', 'ffd7ff', 'ffff00', 'ffff5f', + 'ffff87', 'ffffaf', 'ffffd7', 'ffffff', '080808', '121212', + '1c1c1c', '262626', '303030', '3a3a3a', '444444', '4e4e4e', + '585858', '606060', '666666', '767676', '808080', '8a8a8a', + '949494', '9e9e9e', 'a8a8a8', 'b2b2b2', 'bcbcbc', 'c6c6c6', + 'd0d0d0', 'dadada', 'e4e4e4', 'eeeeee', + ]; + } + + $tput = Console::getTput(); + + if (1 >= $tput->count('max_colors')) { + return; + } + + $handle = []; + + foreach (\explode(' ', $attributes) as $attribute) { + switch ($attribute) { + case 'n': + case 'normal': + $handle[] = 0; + + break; + + case 'b': + case 'bold': + $handle[] = 1; + + break; + + case 'u': + case 'underlined': + $handle[] = 4; + + break; + + case 'bl': + case 'blink': + $handle[] = 5; + + break; + + case 'i': + case 'inverse': + $handle[] = 7; + + break; + + case '!b': + case '!bold': + $handle[] = 22; + + break; + + case '!u': + case '!underlined': + $handle[] = 24; + + break; + + case '!bl': + case '!blink': + $handle[] = 25; + + break; + + case '!i': + case '!inverse': + $handle[] = 27; + + break; + + default: + if (0 === \preg_match('#^([^\(]+)\(([^\)]+)\)$#', $attribute, $m)) { + break; + } + + $shift = 0; + + switch ($m[1]) { + case 'fg': + case 'foreground': + $shift = 0; + + break; + + case 'bg': + case 'background': + $shift = 10; + + break; + + default: + break 2; + } + + $_handle = 0; + $_keyword = true; + + switch ($m[2]) { + case 'black': + $_handle = 30; + + break; + + case 'red': + $_handle = 31; + + break; + + case 'green': + $_handle = 32; + + break; + + case 'yellow': + $_handle = 33; + + break; + + case 'blue': + $_handle = 34; + + break; + + case 'magenta': + $_handle = 35; + + break; + + case 'cyan': + $_handle = 36; + + break; + + case 'white': + $_handle = 37; + + break; + + case 'default': + $_handle = 39; + + break; + + default: + $_keyword = false; + + if (256 <= $tput->count('max_colors') && + '#' === $m[2][0]) { + $rgb = \hexdec(\substr($m[2], 1)); + $r = ($rgb >> 16) & 255; + $g = ($rgb >> 8) & 255; + $b = $rgb & 255; + $distance = null; + + foreach ($_rgbTo256 as $i => $_rgb) { + $_rgb = \hexdec($_rgb); + $_r = ($_rgb >> 16) & 255; + $_g = ($_rgb >> 8) & 255; + $_b = $_rgb & 255; + + $d = \sqrt( + ($_r - $r) ** 2 + + ($_g - $g) ** 2 + + ($_b - $b) ** 2 + ); + + if (null === $distance || + $d <= $distance) { + $distance = $d; + $_handle = $i; + } + } + } else { + $_handle = (int) ($m[2]); + } + } + + if (true === $_keyword) { + $handle[] = $_handle + $shift; + } else { + $handle[] = (38 + $shift).';5;'.$_handle; + } + } + } + + Console::getOutput()->writeAll("\033[".\implode(';', $handle).'m'); + + return; + } + + /** + * Change color number to a specific RGB color. + */ + public static function changeColor(int $fromCode, int $toColor) + { + $tput = Console::getTput(); + + if (true !== $tput->has('can_change')) { + return; + } + + $r = ($toColor >> 16) & 255; + $g = ($toColor >> 8) & 255; + $b = $toColor & 255; + + Console::getOutput()->writeAll( + \str_replace( + [ + '%p1%d', + 'rgb:', + '%p2%{255}%*%{1000}%/%2.2X/', + '%p3%{255}%*%{1000}%/%2.2X/', + '%p4%{255}%*%{1000}%/%2.2X', + ], + [ + $fromCode, + '', + \sprintf('%02x', $r), + \sprintf('%02x', $g), + \sprintf('%02x', $b), + ], + $tput->get('initialize_color') + ) + ); + + return; + } + + /** + * Set cursor style. + * Style can be: + * • b, block, ▋: block; + * • u, underline, _: underline; + * • v, vertical, |: vertical. + */ + public static function setStyle(string $style, bool $blink = true) + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + switch ($style) { + case 'u': + case 'underline': + case '_': + $_style = 2; + + break; + + case 'v': + case 'vertical': + case '|': + $_style = 5; + + break; + + case 'b': + case 'block': + case '▋': + default: + $_style = 1; + + break; + } + + if (false === $blink) { + ++$_style; + } + + // Not sure what tput entry we can use here… + Console::getOutput()->writeAll("\033[".$_style.' q'); + + return; + } + + /** + * Make a stupid “bip”. + */ + public static function bip() + { + Console::getOutput()->writeAll( + Console::getTput()->get('bell') + ); + } +} + +/* + * Advanced interaction. + */ +Console::advancedInteraction(); diff --git a/vendor/psy/psysh/src/Readline/Hoa/ConsoleException.php b/vendor/psy/psysh/src/Readline/Hoa/ConsoleException.php new file mode 100644 index 000000000..17e6f607b --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ConsoleException.php @@ -0,0 +1,46 @@ +_input = $input; + + return; + } + + /** + * Get underlying stream. + */ + public function getStream(): StreamIn + { + return $this->_input; + } + + /** + * Test for end-of-file. + */ + public function eof(): bool + { + return $this->_input->eof(); + } + + /** + * Read n characters. + */ + public function read(int $length) + { + return $this->_input->read($length); + } + + /** + * Alias of $this->read(). + */ + public function readString(int $length) + { + return $this->_input->readString($length); + } + + /** + * Read a character. + */ + public function readCharacter() + { + return $this->_input->readCharacter(); + } + + /** + * Read a boolean. + */ + public function readBoolean() + { + return $this->_input->readBoolean(); + } + + /** + * Read an integer. + */ + public function readInteger(int $length = 1) + { + return $this->_input->readInteger($length); + } + + /** + * Read a float. + */ + public function readFloat(int $length = 1) + { + return $this->_input->readFloat($length); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + */ + public function readArray($argument = null) + { + return $this->_input->readArray($argument); + } + + /** + * Read a line. + */ + public function readLine() + { + return $this->_input->readLine(); + } + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = 0) + { + return $this->_input->readAll($offset); + } + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format): array + { + return $this->_input->scanf($format); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ConsoleOutput.php b/vendor/psy/psysh/src/Readline/Hoa/ConsoleOutput.php new file mode 100644 index 000000000..fbba894c9 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ConsoleOutput.php @@ -0,0 +1,208 @@ +_output = $output; + + return; + } + + /** + * Get the real output stream. + */ + public function getStream(): StreamOut + { + return $this->_output; + } + + /** + * Write n characters. + */ + public function write(string $string, int $length) + { + if (0 > $length) { + throw new ConsoleException('Length must be greater than 0, given %d.', 0, $length); + } + + $out = \substr($string, 0, $length); + + if (true === $this->isMultiplexerConsidered()) { + if (true === Console::isTmuxRunning()) { + $out = + "\033Ptmux;". + \str_replace("\033", "\033\033", $out). + "\033\\"; + } + + $length = \strlen($out); + } + + if (null === $this->_output) { + echo $out; + } else { + $this->_output->write($out, $length); + } + } + + /** + * Write a string. + */ + public function writeString(string $string) + { + $string = (string) $string; + + return $this->write($string, \strlen($string)); + } + + /** + * Write a character. + */ + public function writeCharacter(string $character) + { + return $this->write((string) $character[0], 1); + } + + /** + * Write a boolean. + */ + public function writeBoolean(bool $boolean) + { + return $this->write(((bool) $boolean) ? '1' : '0', 1); + } + + /** + * Write an integer. + */ + public function writeInteger(int $integer) + { + $integer = (string) (int) $integer; + + return $this->write($integer, \strlen($integer)); + } + + /** + * Write a float. + */ + public function writeFloat(float $float) + { + $float = (string) (float) $float; + + return $this->write($float, \strlen($float)); + } + + /** + * Write an array. + */ + public function writeArray(array $array) + { + $array = \var_export($array, true); + + return $this->write($array, \strlen($array)); + } + + /** + * Write a line. + */ + public function writeLine(string $line) + { + if (false === $n = \strpos($line, "\n")) { + return $this->write($line."\n", \strlen($line) + 1); + } + + ++$n; + + return $this->write(\substr($line, 0, $n), $n); + } + + /** + * Write all, i.e. as much as possible. + */ + public function writeAll(string $string) + { + return $this->write($string ?? '', \strlen($string ?? '')); + } + + /** + * Truncate a stream to a given length. + */ + public function truncate(int $size): bool + { + return false; + } + + /** + * Consider the multiplexer (if running) while writing on the output. + */ + public function considerMultiplexer(bool $consider): bool + { + $old = $this->_considerMultiplexer; + $this->_considerMultiplexer = $consider; + + return $old; + } + + /** + * Check whether the multiplexer must be considered or not. + */ + public function isMultiplexerConsidered(): bool + { + return $this->_considerMultiplexer; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ConsoleProcessus.php b/vendor/psy/psysh/src/Readline/Hoa/ConsoleProcessus.php new file mode 100644 index 000000000..69bf1ddb1 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ConsoleProcessus.php @@ -0,0 +1,892 @@ + value, or input). + */ + protected $_options = []; + + /** + * Current working directory. + */ + protected $_cwd = null; + + /** + * Environment. + */ + protected $_environment = null; + + /** + * Timeout. + */ + protected $_timeout = 30; + + /** + * Descriptor. + */ + protected $_descriptors = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + + /** + * Pipe descriptors of the processus. + */ + protected $_pipes = null; + + /** + * Seekability of pipes. + */ + protected $_seekable = []; + + /** + * Start a processus. + */ + public function __construct( + string $command, + array $options = null, + array $descriptors = null, + string $cwd = null, + array $environment = null, + int $timeout = 30 + ) { + $this->setCommand($command); + + if (null !== $options) { + $this->setOptions($options); + } + + if (null !== $descriptors) { + $this->_descriptors = []; + + foreach ($descriptors as $descriptor => $nature) { + if (isset($this->_descriptors[$descriptor])) { + throw new ConsoleException('Pipe descriptor %d already exists, cannot '.'redefine it.', 0, $descriptor); + } + + $this->_descriptors[$descriptor] = $nature; + } + } + + $this->setCwd($cwd ?: \getcwd()); + + if (null !== $environment) { + $this->setEnvironment($environment); + } + + $this->setTimeout($timeout); + parent::__construct($this->getCommandLine(), null, true); + $this->getListener()->addIds(['input', 'output', 'timeout', 'start', 'stop']); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + $out = @\proc_open( + $streamName, + $this->_descriptors, + $this->_pipes, + $this->getCwd(), + $this->getEnvironment() + ); + + if (false === $out) { + throw new ConsoleException('Something wrong happen when running %s.', 1, $streamName); + } + + return $out; + } + + /** + * Close the current stream. + */ + protected function _close(): bool + { + foreach ($this->_pipes as $pipe) { + @\fclose($pipe); + } + + return (bool) @\proc_close($this->getStream()); + } + + /** + * Run the process and fire events (amongst start, stop, input, output and + * timeout). + * If an event returns false, it will close the current pipe. + * For a simple run without firing events, use the $this->open() method. + */ + public function run() + { + if (false === $this->isOpened()) { + $this->open(); + } else { + $this->_close(); + $this->_setStream($this->_open( + $this->getStreamName(), + $this->getStreamContext() + )); + } + + $this->getListener()->fire('start', new EventBucket()); + + $_read = []; + $_write = []; + $_except = []; + + foreach ($this->_pipes as $p => $pipe) { + switch ($this->_descriptors[$p][1]) { + case 'r': + \stream_set_blocking($pipe, false); + $_write[] = $pipe; + + break; + + case 'w': + case 'a': + \stream_set_blocking($pipe, true); + $_read[] = $pipe; + + break; + } + } + + while (true) { + foreach ($_read as $i => $r) { + if (false === \is_resource($r)) { + unset($_read[$i]); + } + } + + foreach ($_write as $i => $w) { + if (false === \is_resource($w)) { + unset($_write[$i]); + } + } + + foreach ($_except as $i => $e) { + if (false === \is_resource($e)) { + unset($_except[$i]); + } + } + + if (empty($_read) && empty($_write) && empty($_except)) { + break; + } + + $read = $_read; + $write = $_write; + $except = $_except; + $select = \stream_select($read, $write, $except, $this->getTimeout()); + + if (0 === $select) { + $this->getListener()->fire('timeout', new EventBucket()); + + break; + } + + foreach ($read as $i => $_r) { + $pipe = \array_search($_r, $this->_pipes); + $line = $this->readLine($pipe); + + if (false === $line) { + $result = [false]; + } else { + $result = $this->getListener()->fire( + 'output', + new EventBucket([ + 'pipe' => $pipe, + 'line' => $line, + ]) + ); + } + + if (true === \feof($_r) || \in_array(false, $result, true)) { + \fclose($_r); + unset($_read[$i]); + + break; + } + } + + foreach ($write as $j => $_w) { + $result = $this->getListener()->fire( + 'input', + new EventBucket([ + 'pipe' => \array_search($_w, $this->_pipes), + ]) + ); + + if (true === \feof($_w) || \in_array(false, $result, true)) { + \fclose($_w); + unset($_write[$j]); + } + } + + if (empty($_read)) { + break; + } + } + + $this->getListener()->fire('stop', new EventBucket()); + + return; + } + + /** + * Get pipe resource. + */ + protected function getPipe(int $pipe) + { + if (!isset($this->_pipes[$pipe])) { + throw new ConsoleException('Pipe descriptor %d does not exist, cannot read from it.', 2, $pipe); + } + + return $this->_pipes[$pipe]; + } + + /** + * Check if a pipe is seekable or not. + */ + protected function isPipeSeekable(int $pipe): bool + { + if (!isset($this->_seekable[$pipe])) { + $_pipe = $this->getPipe($pipe); + $data = \stream_get_meta_data($_pipe); + $this->_seekable[$pipe] = $data['seekable']; + } + + return $this->_seekable[$pipe]; + } + + /** + * Test for end-of-file. + */ + public function eof(int $pipe = 1): bool + { + return \feof($this->getPipe($pipe)); + } + + /** + * Read n characters. + */ + public function read(int $length, int $pipe = 1) + { + if (0 > $length) { + throw new ConsoleException('Length must be greater than 0, given %d.', 3, $length); + } + + return \fread($this->getPipe($pipe), $length); + } + + /** + * Alias of $this->read(). + */ + public function readString(int $length, int $pipe = 1) + { + return $this->read($length, $pipe); + } + + /** + * Read a character. + */ + public function readCharacter(int $pipe = 1) + { + return \fgetc($this->getPipe($pipe)); + } + + /** + * Read a boolean. + */ + public function readBoolean(int $pipe = 1) + { + return (bool) $this->read(1, $pipe); + } + + /** + * Read an integer. + */ + public function readInteger(int $length = 1, int $pipe = 1) + { + return (int) $this->read($length, $pipe); + } + + /** + * Read a float. + */ + public function readFloat(int $length = 1, int $pipe = 1) + { + return (float) $this->read($length, $pipe); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + */ + public function readArray(string $format = null, int $pipe = 1) + { + return $this->scanf($format, $pipe); + } + + /** + * Read a line. + */ + public function readLine(int $pipe = 1) + { + return \stream_get_line($this->getPipe($pipe), 1 << 15, "\n"); + } + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = -1, int $pipe = 1) + { + $_pipe = $this->getPipe($pipe); + + if (true === $this->isPipeSeekable($pipe)) { + $offset += \ftell($_pipe); + } else { + $offset = -1; + } + + return \stream_get_contents($_pipe, -1, $offset); + } + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format, int $pipe = 1): array + { + return \fscanf($this->getPipe($pipe), $format); + } + + /** + * Write n characters. + */ + public function write(string $string, int $length, int $pipe = 0) + { + if (0 > $length) { + throw new ConsoleException('Length must be greater than 0, given %d.', 4, $length); + } + + return \fwrite($this->getPipe($pipe), $string, $length); + } + + /** + * Write a string. + */ + public function writeString(string $string, int $pipe = 0) + { + $string = (string) $string; + + return $this->write($string, \strlen($string), $pipe); + } + + /** + * Write a character. + */ + public function writeCharacter(string $char, int $pipe = 0) + { + return $this->write((string) $char[0], 1, $pipe); + } + + /** + * Write a boolean. + */ + public function writeBoolean(bool $boolean, int $pipe = 0) + { + return $this->write((string) (bool) $boolean, 1, $pipe); + } + + /** + * Write an integer. + */ + public function writeInteger(int $integer, int $pipe = 0) + { + $integer = (string) (int) $integer; + + return $this->write($integer, \strlen($integer), $pipe); + } + + /** + * Write a float. + */ + public function writeFloat(float $float, int $pipe = 0) + { + $float = (string) (float) $float; + + return $this->write($float, \strlen($float), $pipe); + } + + /** + * Write an array. + */ + public function writeArray(array $array, int $pipe = 0) + { + $array = \var_export($array, true); + + return $this->write($array, \strlen($array), $pipe); + } + + /** + * Write a line. + */ + public function writeLine(string $line, int $pipe = 0) + { + if (false === $n = \strpos($line, "\n")) { + return $this->write($line."\n", \strlen($line) + 1, $pipe); + } + + ++$n; + + return $this->write(\substr($line, 0, $n), $n, $pipe); + } + + /** + * Write all, i.e. as much as possible. + */ + public function writeAll(string $string, int $pipe = 0) + { + return $this->write($string, \strlen($string), $pipe); + } + + /** + * Truncate a file to a given length. + */ + public function truncate(int $size, int $pipe = 0): bool + { + return \ftruncate($this->getPipe($pipe), $size); + } + + /** + * Get filename component of path. + */ + public function getBasename(): string + { + return \basename($this->getCommand()); + } + + /** + * Get directory name component of path. + */ + public function getDirname(): string + { + return \dirname($this->getCommand()); + } + + /** + * Get status. + */ + public function getStatus(): array + { + return \proc_get_status($this->getStream()); + } + + /** + * Get exit code (alias of $this->getStatus()['exitcode']);. + */ + public function getExitCode(): int + { + $handle = $this->getStatus(); + + return $handle['exitcode']; + } + + /** + * Whether the processus have ended successfully. + * + * @return bool + */ + public function isSuccessful(): bool + { + return 0 === $this->getExitCode(); + } + + /** + * Terminate the process. + * + * Valid signals are self::SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGKILL, + * SIGALRM and SIGTERM. + */ + public function terminate(int $signal = self::SIGTERM): bool + { + return \proc_terminate($this->getStream(), $signal); + } + + /** + * Set command name. + */ + protected function setCommand(string $command) + { + $old = $this->_command; + $this->_command = \escapeshellcmd($command); + + return $old; + } + + /** + * Get command name. + */ + public function getCommand() + { + return $this->_command; + } + + /** + * Set command options. + */ + protected function setOptions(array $options): array + { + foreach ($options as &$option) { + $option = \escapeshellarg($option); + } + + $old = $this->_options; + $this->_options = $options; + + return $old; + } + + /** + * Get options. + */ + public function getOptions(): array + { + return $this->_options; + } + + /** + * Get command-line. + */ + public function getCommandLine(): string + { + $out = $this->getCommand(); + + foreach ($this->getOptions() as $key => $value) { + if (!\is_int($key)) { + $out .= ' '.$key.'='.$value; + } else { + $out .= ' '.$value; + } + } + + return $out; + } + + /** + * Set current working directory of the process. + */ + protected function setCwd(string $cwd) + { + $old = $this->_cwd; + $this->_cwd = $cwd; + + return $old; + } + + /** + * Get current working directory of the process. + */ + public function getCwd(): string + { + return $this->_cwd; + } + + /** + * Set environment of the process. + */ + protected function setEnvironment(array $environment) + { + $old = $this->_environment; + $this->_environment = $environment; + + return $old; + } + + /** + * Get environment of the process. + */ + public function getEnvironment() + { + return $this->_environment; + } + + /** + * Set timeout of the process. + */ + public function setTimeout(int $timeout) + { + $old = $this->_timeout; + $this->_timeout = $timeout; + + return $old; + } + + /** + * Get timeout of the process. + */ + public function getTimeout(): int + { + return $this->_timeout; + } + + /** + * Set process title. + */ + public static function setTitle(string $title) + { + \cli_set_process_title($title); + } + + /** + * Get process title. + */ + public static function getTitle() + { + return \cli_get_process_title(); + } + + /** + * Found the place of a binary. + */ + public static function locate(string $binary) + { + if (isset($_ENV['PATH'])) { + $separator = ':'; + $path = &$_ENV['PATH']; + } elseif (isset($_SERVER['PATH'])) { + $separator = ':'; + $path = &$_SERVER['PATH']; + } elseif (isset($_SERVER['Path'])) { + $separator = ';'; + $path = &$_SERVER['Path']; + } else { + return null; + } + + foreach (\explode($separator, $path) as $directory) { + if (true === \file_exists($out = $directory.\DIRECTORY_SEPARATOR.$binary)) { + return $out; + } + } + + return null; + } + + /** + * Quick process execution. + * Returns only the STDOUT. + */ + public static function execute(string $commandLine, bool $escape = true): string + { + if (true === $escape) { + $commandLine = \escapeshellcmd($commandLine); + } + + return \rtrim(\shell_exec($commandLine) ?? ''); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ConsoleTput.php b/vendor/psy/psysh/src/Readline/Hoa/ConsoleTput.php new file mode 100644 index 000000000..ba627e379 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ConsoleTput.php @@ -0,0 +1,841 @@ +parse($terminfo); + + return; + } + + /** + * Parse. + */ + protected function parse(string $terminfo): array + { + if (!\file_exists($terminfo)) { + throw new ConsoleException('Terminfo file %s does not exist.', 0, $terminfo); + } + + $data = \file_get_contents($terminfo); + $length = \strlen($data); + $out = ['file' => $terminfo]; + + $headers = [ + 'data_size' => $length, + 'header_size' => 12, + 'magic_number' => (\ord($data[1]) << 8) | \ord($data[0]), + 'names_size' => (\ord($data[3]) << 8) | \ord($data[2]), + 'bool_count' => (\ord($data[5]) << 8) | \ord($data[4]), + 'number_count' => (\ord($data[7]) << 8) | \ord($data[6]), + 'string_count' => (\ord($data[9]) << 8) | \ord($data[8]), + 'string_table_size' => (\ord($data[11]) << 8) | \ord($data[10]), + ]; + $out['headers'] = $headers; + + // Names. + $i = $headers['header_size']; + $nameAndDescription = \explode('|', \substr($data, $i, $headers['names_size'] - 1)); + $out['name'] = $nameAndDescription[0]; + $out['description'] = $nameAndDescription[1]; + + // Booleans. + $i += $headers['names_size']; + $booleans = []; + $booleanNames = &static::$_booleans; + + for ( + $e = 0, $max = $i + $headers['bool_count']; + $i < $max; + ++$e, ++$i + ) { + $booleans[$booleanNames[$e]] = 1 === \ord($data[$i]); + } + + $out['booleans'] = $booleans; + + // Numbers. + if (1 === ($i % 2)) { + ++$i; + } + + $numbers = []; + $numberNames = &static::$_numbers; + + for ( + $e = 0, $max = $i + $headers['number_count'] * 2; + $i < $max; + ++$e, $i += 2 + ) { + $name = $numberNames[$e]; + $data_i0 = \ord($data[$i]); + $data_i1 = \ord($data[$i + 1]); + + if ($data_i1 === 255 && $data_i0 === 255) { + $numbers[$name] = -1; + } else { + $numbers[$name] = ($data_i1 << 8) | $data_i0; + } + } + + $out['numbers'] = $numbers; + + // Strings. + $strings = []; + $stringNames = &static::$_strings; + $ii = $i + $headers['string_count'] * 2; + + for ( + $e = 0, $max = $ii; + $i < $max; + ++$e, $i += 2 + ) { + $name = $stringNames[$e]; + $data_i0 = \ord($data[$i]); + $data_i1 = \ord($data[$i + 1]); + + if ($data_i1 === 255 && $data_i0 === 255) { + continue; + } + + $a = ($data_i1 << 8) | $data_i0; + $strings[$name] = $a; + + if (65534 === $a) { + continue; + } + + $b = $ii + $a; + $c = $b; + + while ($c < $length && \ord($data[$c])) { + $c++; + } + + $value = \substr($data, $b, $c - $b); + $strings[$name] = false !== $value ? $value : null; + } + + $out['strings'] = $strings; + + return $this->_informations = $out; + } + + /** + * Get all informations. + */ + public function getInformations(): array + { + return $this->_informations; + } + + /** + * Get a boolean value. + */ + public function has(string $boolean): bool + { + if (!isset($this->_informations['booleans'][$boolean])) { + return false; + } + + return $this->_informations['booleans'][$boolean]; + } + + /** + * Get a number value. + */ + public function count(string $number): int + { + if (!isset($this->_informations['numbers'][$number])) { + return 0; + } + + return $this->_informations['numbers'][$number]; + } + + /** + * Get a string value. + */ + public function get(string $string) + { + if (!isset($this->_informations['strings'][$string])) { + return null; + } + + return $this->_informations['strings'][$string]; + } + + /** + * Get current term profile. + */ + public static function getTerm(): string + { + return + isset($_SERVER['TERM']) && !empty($_SERVER['TERM']) + ? $_SERVER['TERM'] + : (\defined('PHP_WINDOWS_VERSION_PLATFORM') ? 'windows-ansi' : 'xterm'); + } + + /** + * Get pathname to the current terminfo. + */ + public static function getTerminfo($term = null): string + { + $paths = []; + + if (isset($_SERVER['TERMINFO'])) { + $paths[] = $_SERVER['TERMINFO']; + } + + if (isset($_SERVER['HOME'])) { + $paths[] = $_SERVER['HOME'].\DIRECTORY_SEPARATOR.'.terminfo'; + } + + if (isset($_SERVER['TERMINFO_DIRS'])) { + foreach (\explode(':', $_SERVER['TERMINFO_DIRS']) as $path) { + $paths[] = $path; + } + } + + $paths[] = '/usr/share/terminfo'; + $paths[] = '/usr/share/lib/terminfo'; + $paths[] = '/lib/terminfo'; + $paths[] = '/usr/lib/terminfo'; + $paths[] = '/usr/local/share/terminfo'; + $paths[] = '/usr/local/share/lib/terminfo'; + $paths[] = '/usr/local/lib/terminfo'; + $paths[] = '/usr/local/ncurses/lib/terminfo'; + $paths[] = 'hoa://Library/Terminfo'; + + $term = $term ?: static::getTerm(); + $fileHexa = \dechex(\ord($term[0])).\DIRECTORY_SEPARATOR.$term; + $fileAlpha = $term[0].\DIRECTORY_SEPARATOR.$term; + $pathname = null; + + foreach ($paths as $path) { + if (\file_exists($_ = $path.\DIRECTORY_SEPARATOR.$fileHexa) || + \file_exists($_ = $path.\DIRECTORY_SEPARATOR.$fileAlpha)) { + $pathname = $_; + + break; + } + } + + if (null === $pathname && 'xterm' !== $term) { + return static::getTerminfo('xterm'); + } + + return $pathname ?? ''; + } + + /** + * Check whether all required terminfo capabilities are defined. + */ + public static function isSupported(): bool + { + if (static::getTerminfo() === '') { + return false; + } + + $requiredVars = [ + 'clear_screen', + 'clr_bol', + 'clr_eol', + 'clr_eos', + 'initialize_color', + 'parm_down_cursor', + 'parm_index', + 'parm_left_cursor', + 'parm_right_cursor', + 'parm_rindex', + 'parm_up_cursor', + 'user6', + 'user7', + ]; + + $tput = new self(); + + foreach ($requiredVars as $var) { + if ($tput->get($var) === null) { + return false; + } + } + + return true; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ConsoleWindow.php b/vendor/psy/psysh/src/Readline/Hoa/ConsoleWindow.php new file mode 100644 index 000000000..fe77e05de --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ConsoleWindow.php @@ -0,0 +1,529 @@ +writeAll("\033[8;".$y.';'.$x.'t'); + + return; + } + + /** + * Get current size (x and y) of the window. + */ + public static function getSize(): array + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + $modecon = \explode("\n", \ltrim(ConsoleProcessus::execute('mode con'))); + + $_y = \trim($modecon[2]); + \preg_match('#[^:]+:\s*([0-9]+)#', $_y, $matches); + $y = (int) $matches[1]; + + $_x = \trim($modecon[3]); + \preg_match('#[^:]+:\s*([0-9]+)#', $_x, $matches); + $x = (int) $matches[1]; + + return [ + 'x' => $x, + 'y' => $y, + ]; + } + + $term = ''; + + if (isset($_SERVER['TERM'])) { + $term = 'TERM="'.$_SERVER['TERM'].'" '; + } + + $command = $term.'tput cols && '.$term.'tput lines'; + $tput = ConsoleProcessus::execute($command, false); + + if (!empty($tput)) { + list($x, $y) = \explode("\n", $tput); + + return [ + 'x' => (int) $x, + 'y' => (int) $y, + ]; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[18t"); + + $input = Console::getInput(); + + // Read \033[8;y;xt. + $input->read(4); // skip \033, [, 8 and ;. + + $x = null; + $y = null; + $handle = &$y; + + while (true) { + $char = $input->readCharacter(); + + switch ($char) { + case ';': + $handle = &$x; + + break; + + case 't': + break 2; + + default: + if (false === \ctype_digit($char)) { + break 2; + } + + $handle .= $char; + } + } + + if (null === $x || null === $y) { + return [ + 'x' => 0, + 'y' => 0, + ]; + } + + return [ + 'x' => (int) $x, + 'y' => (int) $y, + ]; + } + + /** + * Move to X and Y (in pixels). + */ + public static function moveTo(int $x, int $y) + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[3;".$x.';'.$y.'t'); + + return; + } + + /** + * Get current position (x and y) of the window (in pixels). + */ + public static function getPosition(): array + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return ['x' => 0, 'y' => 0]; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[13t"); + + $input = Console::getInput(); + + // Read \033[3;x;yt. + $input->read(4); // skip \033, [, 3 and ;. + + $x = null; + $y = null; + $handle = &$x; + + while (true) { + $char = $input->readCharacter(); + + switch ($char) { + case ';': + $handle = &$y; + + break; + + case 't': + break 2; + + default: + $handle .= $char; + } + } + + return [ + 'x' => (int) $x, + 'y' => (int) $y, + ]; + } + + /** + * Scroll whole page. + * Directions can be: + * • u, up, ↑ : scroll whole page up; + * • d, down, ↓ : scroll whole page down. + * Directions can be concatenated by a single space. + */ + public static function scroll(string $directions, int $repeat = 1) + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + if (1 > $repeat) { + return; + } elseif (1 === $repeat) { + $handle = \explode(' ', $directions); + } else { + $handle = \explode(' ', $directions, 1); + } + + $tput = Console::getTput(); + $count = ['up' => 0, 'down' => 0]; + + foreach ($handle as $direction) { + switch ($direction) { + case 'u': + case 'up': + case '↑': + ++$count['up']; + + break; + + case 'd': + case 'down': + case '↓': + ++$count['down']; + + break; + } + } + + $output = Console::getOutput(); + + if (0 < $count['up']) { + $output->writeAll( + \str_replace( + '%p1%d', + $count['up'] * $repeat, + $tput->get('parm_index') + ) + ); + } + + if (0 < $count['down']) { + $output->writeAll( + \str_replace( + '%p1%d', + $count['down'] * $repeat, + $tput->get('parm_rindex') + ) + ); + } + + return; + } + + /** + * Minimize the window. + */ + public static function minimize() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[2t"); + + return; + } + + /** + * Restore the window (de-minimize). + */ + public static function restore() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + Console::getOutput()->writeAll("\033[1t"); + + return; + } + + /** + * Raise the window to the front of the stacking order. + */ + public static function raise() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + Console::getOutput()->writeAll("\033[5t"); + + return; + } + + /** + * Lower the window to the bottom of the stacking order. + */ + public static function lower() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + Console::getOutput()->writeAll("\033[6t"); + + return; + } + + /** + * Set title. + */ + public static function setTitle(string $title) + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033]0;".$title."\033\\"); + + return; + } + + /** + * Get title. + */ + public static function getTitle() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return null; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[21t"); + + $input = Console::getInput(); + $read = [$input->getStream()->getStream()]; + $write = []; + $except = []; + $out = null; + + if (0 === \stream_select($read, $write, $except, 0, 50000)) { + return $out; + } + + // Read \033]l\033\ + $input->read(3); // skip \033, ] and l. + + while (true) { + $char = $input->readCharacter(); + + if ("\033" === $char) { + $chaar = $input->readCharacter(); + + if ('\\' === $chaar) { + break; + } + + $char .= $chaar; + } + + $out .= $char; + } + + return $out; + } + + /** + * Get label. + */ + public static function getLabel() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return null; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[20t"); + + $input = Console::getInput(); + $read = [$input->getStream()->getStream()]; + $write = []; + $except = []; + $out = null; + + if (0 === \stream_select($read, $write, $except, 0, 50000)) { + return $out; + } + + // Read \033]L<label>\033\ + $input->read(3); // skip \033, ] and L. + + while (true) { + $char = $input->readCharacter(); + + if ("\033" === $char) { + $chaar = $input->readCharacter(); + + if ('\\' === $chaar) { + break; + } + + $char .= $chaar; + } + + $out .= $char; + } + + return $out; + } + + /** + * Refresh the window. + */ + public static function refresh() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + // DECSLPP. + Console::getOutput()->writeAll("\033[7t"); + + return; + } + + /** + * Set clipboard value. + */ + public static function copy(string $data) + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + $out = "\033]52;;".\base64_encode($data)."\033\\"; + $output = Console::getOutput(); + $considerMultiplexer = $output->considerMultiplexer(true); + + $output->writeAll($out); + $output->considerMultiplexer($considerMultiplexer); + + return; + } +} + +/* + * Advanced interaction. + */ +Console::advancedInteraction(); + +/* + * Event. + */ +if (\function_exists('pcntl_signal')) { + ConsoleWindow::getInstance(); + \pcntl_signal( + \SIGWINCH, + function () { + static $_window = null; + + if (null === $_window) { + $_window = ConsoleWindow::getInstance(); + } + + Event::notify( + 'hoa://Event/Console/Window:resize', + $_window, + new EventBucket([ + 'size' => ConsoleWindow::getSize(), + ]) + ); + } + ); +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Event.php b/vendor/psy/psysh/src/Readline/Hoa/Event.php new file mode 100644 index 000000000..bb08f328a --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Event.php @@ -0,0 +1,193 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Events are asynchronous at registration, anonymous at use (until we + * receive a bucket) and useful to largely spread data through components + * without any known connection between them. + */ +class Event +{ + /** + * Event ID key. + */ + const KEY_EVENT = 0; + + /** + * Source object key. + */ + const KEY_SOURCE = 1; + + /** + * Static register of all observable objects, i.e. `Hoa\Event\Source` + * object, i.e. object that can send event. + */ + private static $_register = []; + + /** + * Collection of callables, i.e. observer objects. + */ + protected $_callable = []; + + /** + * Privatize the constructor. + */ + private function __construct() + { + return; + } + + /** + * Manage multiton of events, with the principle of asynchronous + * attachments. + */ + public static function getEvent(string $eventId): self + { + if (!isset(self::$_register[$eventId][self::KEY_EVENT])) { + self::$_register[$eventId] = [ + self::KEY_EVENT => new self(), + self::KEY_SOURCE => null, + ]; + } + + return self::$_register[$eventId][self::KEY_EVENT]; + } + + /** + * Declares a new object in the observable collection. + * Note: Hoa's libraries use `hoa://Event/anID` for their observable objects. + */ + public static function register(string $eventId, /* Source|string */ $source) + { + if (true === self::eventExists($eventId)) { + throw new EventException('Cannot redeclare an event with the same ID, i.e. the event '.'ID %s already exists.', 0, $eventId); + } + + if (\is_object($source) && !($source instanceof EventSource)) { + throw new EventException('The source must implement \Hoa\Event\Source '.'interface; given %s.', 1, \get_class($source)); + } else { + $reflection = new \ReflectionClass($source); + + if (false === $reflection->implementsInterface('\Psy\Readline\Hoa\EventSource')) { + throw new EventException('The source must implement \Hoa\Event\Source '.'interface; given %s.', 2, $source); + } + } + + if (!isset(self::$_register[$eventId][self::KEY_EVENT])) { + self::$_register[$eventId][self::KEY_EVENT] = new self(); + } + + self::$_register[$eventId][self::KEY_SOURCE] = $source; + } + + /** + * Undeclares an object in the observable collection. + * + * If `$hard` is set to `true, then the source and its attached callables + * will be deleted. + */ + public static function unregister(string $eventId, bool $hard = false) + { + if (false !== $hard) { + unset(self::$_register[$eventId]); + } else { + self::$_register[$eventId][self::KEY_SOURCE] = null; + } + } + + /** + * Attach an object to an event. + * + * It can be a callable or an accepted callable form (please, see the + * `Hoa\Consistency\Xcallable` class). + */ + public function attach($callable): self + { + $callable = Xcallable::from($callable); + $this->_callable[$callable->getHash()] = $callable; + + return $this; + } + + /** + * Detaches an object to an event. + * + * Please see `self::attach` method. + */ + public function detach($callable): self + { + unset($this->_callable[Xcallable::from($callable)->getHash()]); + + return $this; + } + + /** + * Checks if at least one callable is attached to an event. + */ + public function isListened(): bool + { + return !empty($this->_callable); + } + + /** + * Notifies, i.e. send data to observers. + */ + public static function notify(string $eventId, EventSource $source, EventBucket $data) + { + if (false === self::eventExists($eventId)) { + throw new EventException('Event ID %s does not exist, cannot send notification.', 3, $eventId); + } + + $data->setSource($source); + $event = self::getEvent($eventId); + + foreach ($event->_callable as $callable) { + $callable($data); + } + } + + /** + * Checks whether an event exists. + */ + public static function eventExists(string $eventId): bool + { + return + \array_key_exists($eventId, self::$_register) && + self::$_register[$eventId][self::KEY_SOURCE] !== null; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventBucket.php b/vendor/psy/psysh/src/Readline/Hoa/EventBucket.php new file mode 100644 index 000000000..37d3ca15a --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventBucket.php @@ -0,0 +1,109 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * This class is the object which is transmit through event channels. + */ +class EventBucket +{ + /** + * The source object (must be of kind `Hoa\Event\Source`). + */ + protected $_source = null; + + /** + * Data attached to the bucket. + */ + protected $_data = null; + + /** + * Allocates a new bucket with various data attached to it. + */ + public function __construct($data = null) + { + $this->setData($data); + + return; + } + + /** + * Sends this object on the event channel. + */ + public function send(string $eventId, EventSource $source) + { + return Event::notify($eventId, $source, $this); + } + + /** + * Sets a new source. + */ + public function setSource(EventSource $source) + { + $old = $this->_source; + $this->_source = $source; + + return $old; + } + + /** + * Returns the source. + */ + public function getSource() + { + return $this->_source; + } + + /** + * Sets new data. + */ + public function setData($data) + { + $old = $this->_data; + $this->_data = $data; + + return $old; + } + + /** + * Returns the data. + */ + public function getData() + { + return $this->_data; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventException.php b/vendor/psy/psysh/src/Readline/Hoa/EventException.php new file mode 100644 index 000000000..9517d9c96 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventException.php @@ -0,0 +1,44 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Extending the `Hoa\Exception\Exception` class. + */ +class EventException extends Exception +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventListenable.php b/vendor/psy/psysh/src/Readline/Hoa/EventListenable.php new file mode 100644 index 000000000..cefd3e6aa --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventListenable.php @@ -0,0 +1,48 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Each object which is listenable must implement this interface. + */ +interface EventListenable extends EventSource +{ + /** + * Attaches a callable to a listenable component. + */ + public function on(string $listenerId, $callable): self; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventListener.php b/vendor/psy/psysh/src/Readline/Hoa/EventListener.php new file mode 100644 index 000000000..8e877e610 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventListener.php @@ -0,0 +1,137 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * A contrario of events, listeners are synchronous, identified at use and + * useful for close interactions between one or some components. + */ +class EventListener +{ + /** + * Source of listener (for `Hoa\Event\Bucket`). + */ + protected $_source = null; + + /** + * All listener IDs and associated listeners. + */ + protected $_callables = []; + + /** + * Build a listener. + */ + public function __construct(EventListenable $source, array $ids) + { + $this->_source = $source; + $this->addIds($ids); + + return; + } + + /** + * Adds acceptable ID (or reset). + */ + public function addIds(array $ids) + { + foreach ($ids as $id) { + $this->_callables[$id] = []; + } + } + + /** + * Attaches a callable to a listenable component. + */ + public function attach(string $listenerId, $callable): self + { + if (false === $this->listenerExists($listenerId)) { + throw new EventException('Cannot listen %s because it is not defined.', 0, $listenerId); + } + + $callable = Xcallable::from($callable); + $this->_callables[$listenerId][$callable->getHash()] = $callable; + + return $this; + } + + /** + * Detaches a callable from a listenable component. + */ + public function detach(string $listenerId, $callable): self + { + unset($this->_callables[$listenerId][Xcallable::from($callable)->getHash()]); + + return $this; + } + + /** + * Detaches all callables from a listenable component. + */ + public function detachAll(string $listenerId): self + { + unset($this->_callables[$listenerId]); + + return $this; + } + + /** + * Checks if a listener exists. + */ + public function listenerExists(string $listenerId): bool + { + return \array_key_exists($listenerId, $this->_callables); + } + + /** + * Sends/fires a bucket to a listener. + */ + public function fire(string $listenerId, EventBucket $data): array + { + if (false === $this->listenerExists($listenerId)) { + throw new EventException('Cannot fire on %s because it is not defined.', 1, $listenerId); + } + + $data->setSource($this->_source); + $out = []; + + foreach ($this->_callables[$listenerId] as $callable) { + $out[] = $callable($data); + } + + return $out; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventListens.php b/vendor/psy/psysh/src/Readline/Hoa/EventListens.php new file mode 100644 index 000000000..41f1172b5 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventListens.php @@ -0,0 +1,83 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Implementation of a listener. + */ +trait EventListens +{ + /** + * Listener instance of type `Hoa\Event\Listener`. + */ + protected $_listener = null; + + /** + * Attaches a callable to a listenable component. + */ + public function on(string $listenerId, $callable): EventListenable + { + $listener = $this->getListener(); + + if (null === $listener) { + throw new EventException('Cannot attach a callable to the listener %s because '.'it has not been initialized yet.', 0, static::class); + } + + $listener->attach($listenerId, $callable); + + return $this; + } + + /** + * Sets a new listener. + */ + protected function setListener(EventListener $listener) + { + $old = $this->_listener; + $this->_listener = $listener; + + return $old; + } + + /** + * Returns the listener. + */ + protected function getListener() + { + return $this->_listener; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/EventSource.php b/vendor/psy/psysh/src/Readline/Hoa/EventSource.php new file mode 100644 index 000000000..3a495d4b6 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/EventSource.php @@ -0,0 +1,44 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Each object which is listenable must implement this interface. + */ +interface EventSource +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Exception.php b/vendor/psy/psysh/src/Readline/Hoa/Exception.php new file mode 100644 index 000000000..e0b8bc8ca --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Exception.php @@ -0,0 +1,79 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Each exception must extend `Hoa\Exception\Exception`. + */ +class Exception extends ExceptionIdle implements EventSource +{ + /** + * Allocates a new exception. + * + * An exception is built with a formatted message, a code (an ID), and an + * array that contains the list of formatted string for the message. If + * chaining, a previous exception can be added. + */ + public function __construct( + string $message, + int $code = 0, + $arguments = [], + \Throwable $previous = null + ) { + parent::__construct($message, $code, $arguments, $previous); + + if (false === Event::eventExists('hoa://Event/Exception')) { + Event::register('hoa://Event/Exception', __CLASS__); + } + + $this->send(); + + return; + } + + /** + * Sends the exception on `hoa://Event/Exception`. + */ + public function send() + { + Event::notify( + 'hoa://Event/Exception', + $this, + new EventBucket($this) + ); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ExceptionIdle.php b/vendor/psy/psysh/src/Readline/Hoa/ExceptionIdle.php new file mode 100644 index 000000000..1d44c4350 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ExceptionIdle.php @@ -0,0 +1,267 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * `Hoa\Exception\Idle` is the mother exception class of libraries. The only + * difference between `Hoa\Exception\Idle` and its direct children + * `Hoa\Exception` is that the latter fires events after beeing constructed. + */ +class ExceptionIdle extends \Exception +{ + /** + * Delay processing on arguments. + */ + protected $_tmpArguments = null; + + /** + * List of arguments to format message. + */ + protected $_arguments = null; + + /** + * Backtrace. + */ + protected $_trace = null; + + /** + * Previous exception if any. + */ + protected $_previous = null; + + /** + * Original exception message. + */ + protected $_rawMessage = null; + + /** + * Allocates a new exception. + * + * An exception is built with a formatted message, a code (an ID) and an + * array that contains the list of formatted strings for the message. If + * chaining, we can add a previous exception. + */ + public function __construct( + string $message, + int $code = 0, + $arguments = [], + \Exception $previous = null + ) { + $this->_tmpArguments = $arguments; + parent::__construct($message, $code, $previous); + $this->_rawMessage = $message; + $this->message = @\vsprintf($message, $this->getArguments()); + + return; + } + + /** + * Returns the backtrace. + * + * Do not use `Exception::getTrace` any more. + */ + public function getBacktrace() + { + if (null === $this->_trace) { + $this->_trace = $this->getTrace(); + } + + return $this->_trace; + } + + /** + * Returns the previous exception if any. + * + * Do not use `Exception::getPrevious` any more. + */ + public function getPreviousThrow() + { + if (null === $this->_previous) { + $this->_previous = $this->getPrevious(); + } + + return $this->_previous; + } + + /** + * Returns the arguments of the message. + */ + public function getArguments() + { + if (null === $this->_arguments) { + $arguments = $this->_tmpArguments; + + if (!\is_array($arguments)) { + $arguments = [$arguments]; + } + + foreach ($arguments as &$value) { + if (null === $value) { + $value = '(null)'; + } + } + + $this->_arguments = $arguments; + unset($this->_tmpArguments); + } + + return $this->_arguments; + } + + /** + * Returns the raw message. + */ + public function getRawMessage(): string + { + return $this->_rawMessage; + } + + /** + * Returns the message already formatted. + */ + public function getFormattedMessage(): string + { + return $this->getMessage(); + } + + /** + * Returns the source of the exception (class, method, function, main etc.). + */ + public function getFrom(): string + { + $trace = $this->getBacktrace(); + $from = '{main}'; + + if (!empty($trace)) { + $t = $trace[0]; + $from = ''; + + if (isset($t['class'])) { + $from .= $t['class'].'::'; + } + + if (isset($t['function'])) { + $from .= $t['function'].'()'; + } + } + + return $from; + } + + /** + * Raises an exception as a string. + */ + public function raise(bool $includePrevious = false): string + { + $message = $this->getFormattedMessage(); + $trace = $this->getBacktrace(); + $file = '/dev/null'; + $line = -1; + $pre = $this->getFrom(); + + if (!empty($trace)) { + $file = $trace['file'] ?? null; + $line = $trace['line'] ?? null; + } + + $pre .= ': '; + + try { + $out = + $pre.'('.$this->getCode().') '.$message."\n". + 'in '.$this->getFile().' at line '. + $this->getLine().'.'; + } catch (\Exception $e) { + $out = + $pre.'('.$this->getCode().') '.$message."\n". + 'in '.$file.' around line '.$line.'.'; + } + + if (true === $includePrevious && + null !== $previous = $this->getPreviousThrow()) { + $out .= + "\n\n".' ⬇'."\n\n". + 'Nested exception ('.\get_class($previous).'):'."\n". + ($previous instanceof self + ? $previous->raise(true) + : $previous->getMessage()); + } + + return $out; + } + + /** + * Catches uncaught exception (only `Hoa\Exception\Idle` and children). + */ + public static function uncaught(\Throwable $exception) + { + if (!($exception instanceof self)) { + throw $exception; + } + + while (0 < \ob_get_level()) { + \ob_end_flush(); + } + + echo 'Uncaught exception ('.\get_class($exception).'):'."\n". + $exception->raise(true); + } + + /** + * String representation of object. + */ + public function __toString(): string + { + return $this->raise(); + } + + /** + * Enables uncaught exception handler. + * + * This is restricted to Hoa's exceptions only. + */ + public static function enableUncaughtHandler(bool $enable = true) + { + if (false === $enable) { + return \restore_exception_handler(); + } + + return \set_exception_handler(function ($exception) { + return self::uncaught($exception); + }); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/File.php b/vendor/psy/psysh/src/Readline/Hoa/File.php new file mode 100644 index 000000000..bdfd94789 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/File.php @@ -0,0 +1,278 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File. + * + * File handler. + */ +abstract class File extends FileGeneric implements StreamBufferable, StreamLockable, StreamPointable +{ + /** + * Open for reading only; place the file pointer at the beginning of the + * file. + */ + const MODE_READ = 'rb'; + + /** + * Open for reading and writing; place the file pointer at the beginning of + * the file. + */ + const MODE_READ_WRITE = 'r+b'; + + /** + * Open for writing only; place the file pointer at the beginning of the + * file and truncate the file to zero length. If the file does not exist, + * attempt to create it. + */ + const MODE_TRUNCATE_WRITE = 'wb'; + + /** + * Open for reading and writing; place the file pointer at the beginning of + * the file and truncate the file to zero length. If the file does not + * exist, attempt to create it. + */ + const MODE_TRUNCATE_READ_WRITE = 'w+b'; + + /** + * Open for writing only; place the file pointer at the end of the file. If + * the file does not exist, attempt to create it. + */ + const MODE_APPEND_WRITE = 'ab'; + + /** + * Open for reading and writing; place the file pointer at the end of the + * file. If the file does not exist, attempt to create it. + */ + const MODE_APPEND_READ_WRITE = 'a+b'; + + /** + * Create and open for writing only; place the file pointer at the beginning + * of the file. If the file already exits, the fopen() call with fail by + * returning false and generating an error of level E_WARNING. If the file + * does not exist, attempt to create it. This is equivalent to specifying + * O_EXCL | O_CREAT flags for the underlying open(2) system call. + */ + const MODE_CREATE_WRITE = 'xb'; + + /** + * Create and open for reading and writing; place the file pointer at the + * beginning of the file. If the file already exists, the fopen() call with + * fail by returning false and generating an error of level E_WARNING. If + * the file does not exist, attempt to create it. This is equivalent to + * specifying O_EXCL | O_CREAT flags for the underlying open(2) system call. + */ + const MODE_CREATE_READ_WRITE = 'x+b'; + + /** + * Open a file. + */ + public function __construct( + string $streamName, + string $mode, + string $context = null, + bool $wait = false + ) { + $this->setMode($mode); + + switch ($streamName) { + case '0': + $streamName = 'php://stdin'; + + break; + + case '1': + $streamName = 'php://stdout'; + + break; + + case '2': + $streamName = 'php://stderr'; + + break; + + default: + if (true === \ctype_digit($streamName)) { + if (\PHP_VERSION_ID >= 50306) { + $streamName = 'php://fd/'.$streamName; + } else { + throw new FileException('You need PHP5.3.6 to use a file descriptor '.'other than 0, 1 or 2 (tried %d with PHP%s).', 0, [$streamName, \PHP_VERSION]); + } + } + } + + parent::__construct($streamName, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + if (\substr($streamName, 0, 4) === 'file' && + false === \is_dir(\dirname($streamName))) { + throw new FileException('Directory %s does not exist. Could not open file %s.', 1, [\dirname($streamName), \basename($streamName)]); + } + + if (null === $context) { + if (false === $out = @\fopen($streamName, $this->getMode(), true)) { + throw new FileException('Failed to open stream %s.', 2, $streamName); + } + + return $out; + } + + $out = @\fopen( + $streamName, + $this->getMode(), + true, + $context->getContext() + ); + + if (false === $out) { + throw new FileException('Failed to open stream %s.', 3, $streamName); + } + + return $out; + } + + /** + * Close the current stream. + */ + protected function _close(): bool + { + return @\fclose($this->getStream()); + } + + /** + * Start a new buffer. + * The callable acts like a light filter. + */ + public function newBuffer($callable = null, int $size = null): int + { + $this->setStreamBuffer($size); + + // @TODO manage $callable as a filter? + + return 1; + } + + /** + * Flush the output to a stream. + */ + public function flush(): bool + { + return \fflush($this->getStream()); + } + + /** + * Delete buffer. + */ + public function deleteBuffer(): bool + { + return $this->disableStreamBuffer(); + } + + /** + * Get bufffer level. + */ + public function getBufferLevel(): int + { + return 1; + } + + /** + * Get buffer size. + */ + public function getBufferSize(): int + { + return $this->getStreamBufferSize(); + } + + /** + * Portable advisory locking. + */ + public function lock(int $operation): bool + { + return \flock($this->getStream(), $operation); + } + + /** + * Rewind the position of a stream pointer. + */ + public function rewind(): bool + { + return \rewind($this->getStream()); + } + + /** + * Seek on a stream pointer. + */ + public function seek(int $offset, int $whence = StreamPointable::SEEK_SET): int + { + return \fseek($this->getStream(), $offset, $whence); + } + + /** + * Get the current position of the stream pointer. + */ + public function tell(): int + { + $stream = $this->getStream(); + + if (null === $stream) { + return 0; + } + + return \ftell($stream); + } + + /** + * Create a file. + */ + public static function create(string $name) + { + if (\file_exists($name)) { + return true; + } + + return \touch($name); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileDirectory.php b/vendor/psy/psysh/src/Readline/Hoa/FileDirectory.php new file mode 100644 index 000000000..e7191410e --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileDirectory.php @@ -0,0 +1,221 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Directory. + * + * Directory handler. + */ +class FileDirectory extends FileGeneric +{ + /** + * Open for reading. + */ + const MODE_READ = 'rb'; + + /** + * Open for reading and writing. If the directory does not exist, attempt to + * create it. + */ + const MODE_CREATE = 'xb'; + + /** + * Open for reading and writing. If the directory does not exist, attempt to + * create it recursively. + */ + const MODE_CREATE_RECURSIVE = 'xrb'; + + /** + * Open a directory. + */ + public function __construct( + string $streamName, + string $mode = self::MODE_READ, + string $context = null, + bool $wait = false + ) { + $this->setMode($mode); + parent::__construct($streamName, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + if (false === \is_dir($streamName)) { + if ($this->getMode() === self::MODE_READ) { + throw new FileDoesNotExistException('Directory %s does not exist.', 0, $streamName); + } else { + self::create( + $streamName, + $this->getMode(), + null !== $context + ? $context->getContext() + : null + ); + } + } + + $out = null; + + return $out; + } + + /** + * Close the current stream. + */ + protected function _close(): bool + { + return true; + } + + /** + * Recursive copy of a directory. + */ + public function copy(string $to, bool $force = StreamTouchable::DO_NOT_OVERWRITE): bool + { + if (empty($to)) { + throw new FileException('The destination path (to copy) is empty.', 1); + } + + $from = $this->getStreamName(); + $fromLength = \strlen($from) + 1; + $finder = new FileFinder(); + $finder->in($from); + + self::create($to, self::MODE_CREATE_RECURSIVE); + + foreach ($finder as $file) { + $relative = \substr($file->getPathname(), $fromLength); + $_to = $to.\DIRECTORY_SEPARATOR.$relative; + + if (true === $file->isDir()) { + self::create($_to, self::MODE_CREATE); + + continue; + } + + // This is not possible to do `$file->open()->copy(); + // $file->close();` because the file will be opened in read and + // write mode. In a PHAR for instance, this operation is + // forbidden. So a special care must be taken to open file in read + // only mode. + $handle = null; + + if (true === $file->isFile()) { + $handle = new FileRead($file->getPathname()); + } elseif (true === $file->isDir()) { + $handle = new self($file->getPathName()); + } elseif (true === $file->isLink()) { + $handle = new FileLinkRead($file->getPathName()); + } + + if (null !== $handle) { + $handle->copy($_to, $force); + $handle->close(); + } + } + + return true; + } + + /** + * Delete a directory. + */ + public function delete(): bool + { + $from = $this->getStreamName(); + $finder = new FileFinder(); + $finder->in($from) + ->childFirst(); + + foreach ($finder as $file) { + $file->open()->delete(); + $file->close(); + } + + if (null === $this->getStreamContext()) { + return @\rmdir($from); + } + + return @\rmdir($from, $this->getStreamContext()->getContext()); + } + + /** + * Create a directory. + */ + public static function create( + string $name, + string $mode = self::MODE_CREATE_RECURSIVE, + string $context = null + ): bool { + if (true === \is_dir($name)) { + return true; + } + + if (empty($name)) { + return false; + } + + if (null !== $context) { + if (false === StreamContext::contextExists($context)) { + throw new FileException('Context %s was not previously declared, cannot retrieve '.'this context.', 2, $context); + } else { + $context = StreamContext::getInstance($context); + } + } + + if (null === $context) { + return @\mkdir( + $name, + 0755, + self::MODE_CREATE_RECURSIVE === $mode + ); + } + + return @\mkdir( + $name, + 0755, + self::MODE_CREATE_RECURSIVE === $mode, + $context->getContext() + ); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileDoesNotExistException.php b/vendor/psy/psysh/src/Readline/Hoa/FileDoesNotExistException.php new file mode 100644 index 000000000..81599a5de --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileDoesNotExistException.php @@ -0,0 +1,48 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Exception\FileDoesNotExist. + * + * Extending the \Hoa\File\Exception class. + * + * @license New BSD License + */ +class FileDoesNotExistException extends FileException +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileException.php b/vendor/psy/psysh/src/Readline/Hoa/FileException.php new file mode 100644 index 000000000..0e224c252 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileException.php @@ -0,0 +1,48 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Exception. + * + * Extending the \Hoa\Exception\Exception class. + * + * @license New BSD License + */ +class FileException extends Exception +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileFinder.php b/vendor/psy/psysh/src/Readline/Hoa/FileFinder.php new file mode 100644 index 000000000..1523b366b --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileFinder.php @@ -0,0 +1,658 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Finder. + * + * This class allows to find files easily by using filters and flags. + */ +class FileFinder implements \IteratorAggregate +{ + /** + * SplFileInfo classname. + */ + protected $_splFileInfo = \SplFileInfo::class; + + /** + * Paths where to look for. + */ + protected $_paths = []; + + /** + * Max depth in recursion. + */ + protected $_maxDepth = -1; + + /** + * Filters. + */ + protected $_filters = []; + + /** + * Flags. + */ + protected $_flags = -1; + + /** + * Types of files to handle. + */ + protected $_types = []; + + /** + * What comes first: parent or child? + */ + protected $_first = -1; + + /** + * Sorts. + */ + protected $_sorts = []; + + /** + * Initialize. + */ + public function __construct() + { + $this->_flags = IteratorFileSystem::KEY_AS_PATHNAME + | IteratorFileSystem::CURRENT_AS_FILEINFO + | IteratorFileSystem::SKIP_DOTS; + $this->_first = \RecursiveIteratorIterator::SELF_FIRST; + + return; + } + + /** + * Select a directory to scan. + */ + public function in($paths): self + { + if (!\is_array($paths)) { + $paths = [$paths]; + } + + foreach ($paths as $path) { + if (1 === \preg_match('/[\*\?\[\]]/', $path)) { + $iterator = new \CallbackFilterIterator( + new \GlobIterator(\rtrim($path, \DIRECTORY_SEPARATOR)), + function ($current) { + return $current->isDir(); + } + ); + + foreach ($iterator as $fileInfo) { + $this->_paths[] = $fileInfo->getPathname(); + } + } else { + $this->_paths[] = $path; + } + } + + return $this; + } + + /** + * Set max depth for recursion. + */ + public function maxDepth(int $depth): self + { + $this->_maxDepth = $depth; + + return $this; + } + + /** + * Include files in the result. + */ + public function files(): self + { + $this->_types[] = 'file'; + + return $this; + } + + /** + * Include directories in the result. + */ + public function directories(): self + { + $this->_types[] = 'dir'; + + return $this; + } + + /** + * Include links in the result. + */ + public function links(): self + { + $this->_types[] = 'link'; + + return $this; + } + + /** + * Follow symbolink links. + */ + public function followSymlinks(bool $flag = true): self + { + if (true === $flag) { + $this->_flags ^= IteratorFileSystem::FOLLOW_SYMLINKS; + } else { + $this->_flags |= IteratorFileSystem::FOLLOW_SYMLINKS; + } + + return $this; + } + + /** + * Include files that match a regex. + * Example: + * $this->name('#\.php$#');. + */ + public function name(string $regex): self + { + $this->_filters[] = function (\SplFileInfo $current) use ($regex) { + return 0 !== \preg_match($regex, $current->getBasename()); + }; + + return $this; + } + + /** + * Exclude directories that match a regex. + * Example: + * $this->notIn('#^\.(git|hg)$#');. + */ + public function notIn(string $regex): self + { + $this->_filters[] = function (\SplFileInfo $current) use ($regex) { + foreach (\explode(\DIRECTORY_SEPARATOR, $current->getPathname()) as $part) { + if (0 !== \preg_match($regex, $part)) { + return false; + } + } + + return true; + }; + + return $this; + } + + /** + * Include files that respect a certain size. + * The size is a string of the form: + * operator number unit + * where + * • operator could be: <, <=, >, >= or =; + * • number is a positive integer; + * • unit could be: b (default), Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb. + * Example: + * $this->size('>= 12Kb');. + */ + public function size(string $size): self + { + if (0 === \preg_match('#^(<|<=|>|>=|=)\s*(\d+)\s*((?:[KMGTPEZY])b)?$#', $size, $matches)) { + return $this; + } + + $number = (float) ($matches[2]); + $unit = $matches[3] ?? 'b'; + $operator = $matches[1]; + + switch ($unit) { + case 'b': + break; + + // kilo + case 'Kb': + $number <<= 10; + + break; + + // mega. + case 'Mb': + $number <<= 20; + + break; + + // giga. + case 'Gb': + $number <<= 30; + + break; + + // tera. + case 'Tb': + $number *= 1099511627776; + + break; + + // peta. + case 'Pb': + $number *= 1024 ** 5; + + break; + + // exa. + case 'Eb': + $number *= 1024 ** 6; + + break; + + // zetta. + case 'Zb': + $number *= 1024 ** 7; + + break; + + // yota. + case 'Yb': + $number *= 1024 ** 8; + + break; + } + + $filter = null; + + switch ($operator) { + case '<': + $filter = function (\SplFileInfo $current) use ($number) { + return $current->getSize() < $number; + }; + + break; + + case '<=': + $filter = function (\SplFileInfo $current) use ($number) { + return $current->getSize() <= $number; + }; + + break; + + case '>': + $filter = function (\SplFileInfo $current) use ($number) { + return $current->getSize() > $number; + }; + + break; + + case '>=': + $filter = function (\SplFileInfo $current) use ($number) { + return $current->getSize() >= $number; + }; + + break; + + case '=': + $filter = function (\SplFileInfo $current) use ($number) { + return $current->getSize() === $number; + }; + + break; + } + + $this->_filters[] = $filter; + + return $this; + } + + /** + * Whether we should include dots or not (respectively . and ..). + */ + public function dots(bool $flag = true): self + { + if (true === $flag) { + $this->_flags ^= IteratorFileSystem::SKIP_DOTS; + } else { + $this->_flags |= IteratorFileSystem::SKIP_DOTS; + } + + return $this; + } + + /** + * Include files that are owned by a certain owner. + */ + public function owner(int $owner): self + { + $this->_filters[] = function (\SplFileInfo $current) use ($owner) { + return $current->getOwner() === $owner; + }; + + return $this; + } + + /** + * Format date. + * Date can have the following syntax: + * date + * since date + * until date + * If the date does not have the “ago” keyword, it will be added. + * Example: “42 hours” is equivalent to “since 42 hours” which is equivalent + * to “since 42 hours ago”. + */ + protected function formatDate(string $date, &$operator): int + { + $operator = -1; + + if (0 === \preg_match('#\bago\b#', $date)) { + $date .= ' ago'; + } + + if (0 !== \preg_match('#^(since|until)\b(.+)$#', $date, $matches)) { + $time = \strtotime($matches[2]); + + if ('until' === $matches[1]) { + $operator = 1; + } + } else { + $time = \strtotime($date); + } + + return $time; + } + + /** + * Include files that have been changed from a certain date. + * Example: + * $this->changed('since 13 days');. + */ + public function changed(string $date): self + { + $time = $this->formatDate($date, $operator); + + if (-1 === $operator) { + $this->_filters[] = function (\SplFileInfo $current) use ($time) { + return $current->getCTime() >= $time; + }; + } else { + $this->_filters[] = function (\SplFileInfo $current) use ($time) { + return $current->getCTime() < $time; + }; + } + + return $this; + } + + /** + * Include files that have been modified from a certain date. + * Example: + * $this->modified('since 13 days');. + */ + public function modified(string $date): self + { + $time = $this->formatDate($date, $operator); + + if (-1 === $operator) { + $this->_filters[] = function (\SplFileInfo $current) use ($time) { + return $current->getMTime() >= $time; + }; + } else { + $this->_filters[] = function (\SplFileInfo $current) use ($time) { + return $current->getMTime() < $time; + }; + } + + return $this; + } + + /** + * Add your own filter. + * The callback will receive 3 arguments: $current, $key and $iterator. It + * must return a boolean: true to include the file, false to exclude it. + * Example: + * // Include files that are readable + * $this->filter(function ($current) { + * return $current->isReadable(); + * });. + */ + public function filter($callback): self + { + $this->_filters[] = $callback; + + return $this; + } + + /** + * Sort result by name. + * If \Collator exists (from ext/intl), the $locale argument will be used + * for its constructor. Else, strcmp() will be used. + * Example: + * $this->sortByName('fr_FR');. + */ + public function sortByName(string $locale = 'root'): self + { + if (true === \class_exists('Collator', false)) { + $collator = new \Collator($locale); + + $this->_sorts[] = function (\SplFileInfo $a, \SplFileInfo $b) use ($collator) { + return $collator->compare($a->getPathname(), $b->getPathname()); + }; + } else { + $this->_sorts[] = function (\SplFileInfo $a, \SplFileInfo $b) { + return \strcmp($a->getPathname(), $b->getPathname()); + }; + } + + return $this; + } + + /** + * Sort result by size. + * Example: + * $this->sortBySize();. + */ + public function sortBySize(): self + { + $this->_sorts[] = function (\SplFileInfo $a, \SplFileInfo $b) { + return $a->getSize() < $b->getSize(); + }; + + return $this; + } + + /** + * Add your own sort. + * The callback will receive 2 arguments: $a and $b. Please see the uasort() + * function. + * Example: + * // Sort files by their modified time. + * $this->sort(function ($a, $b) { + * return $a->getMTime() < $b->getMTime(); + * });. + */ + public function sort($callable): self + { + $this->_sorts[] = $callable; + + return $this; + } + + /** + * Child comes first when iterating. + */ + public function childFirst(): self + { + $this->_first = \RecursiveIteratorIterator::CHILD_FIRST; + + return $this; + } + + /** + * Get the iterator. + */ + public function getIterator() + { + $_iterator = new \AppendIterator(); + $types = $this->getTypes(); + + if (!empty($types)) { + $this->_filters[] = function (\SplFileInfo $current) use ($types) { + return \in_array($current->getType(), $types); + }; + } + + $maxDepth = $this->getMaxDepth(); + $splFileInfo = $this->getSplFileInfo(); + + foreach ($this->getPaths() as $path) { + if (1 === $maxDepth) { + $iterator = new \IteratorIterator( + new IteratorRecursiveDirectory( + $path, + $this->getFlags(), + $splFileInfo + ), + $this->getFirst() + ); + } else { + $iterator = new \RecursiveIteratorIterator( + new IteratorRecursiveDirectory( + $path, + $this->getFlags(), + $splFileInfo + ), + $this->getFirst() + ); + + if (1 < $maxDepth) { + $iterator->setMaxDepth($maxDepth - 1); + } + } + + $_iterator->append($iterator); + } + + foreach ($this->getFilters() as $filter) { + $_iterator = new \CallbackFilterIterator( + $_iterator, + $filter + ); + } + + $sorts = $this->getSorts(); + + if (empty($sorts)) { + return $_iterator; + } + + $array = \iterator_to_array($_iterator); + + foreach ($sorts as $sort) { + \uasort($array, $sort); + } + + return new \ArrayIterator($array); + } + + /** + * Set SplFileInfo classname. + */ + public function setSplFileInfo(string $splFileInfo): string + { + $old = $this->_splFileInfo; + $this->_splFileInfo = $splFileInfo; + + return $old; + } + + /** + * Get SplFileInfo classname. + */ + public function getSplFileInfo(): string + { + return $this->_splFileInfo; + } + + /** + * Get all paths. + */ + protected function getPaths(): array + { + return $this->_paths; + } + + /** + * Get max depth. + */ + public function getMaxDepth(): int + { + return $this->_maxDepth; + } + + /** + * Get types. + */ + public function getTypes(): array + { + return $this->_types; + } + + /** + * Get filters. + */ + protected function getFilters(): array + { + return $this->_filters; + } + + /** + * Get sorts. + */ + protected function getSorts(): array + { + return $this->_sorts; + } + + /** + * Get flags. + */ + public function getFlags(): int + { + return $this->_flags; + } + + /** + * Get first. + */ + public function getFirst(): int + { + return $this->_first; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileGeneric.php b/vendor/psy/psysh/src/Readline/Hoa/FileGeneric.php new file mode 100644 index 000000000..aa3b70cf7 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileGeneric.php @@ -0,0 +1,487 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Generic. + * + * Describe a super-file. + */ +abstract class FileGeneric extends Stream implements StreamPathable, StreamStatable, StreamTouchable +{ + /** + * Mode. + */ + protected $_mode = null; + + /** + * Get filename component of path. + */ + public function getBasename(): string + { + return \basename($this->getStreamName()); + } + + /** + * Get directory name component of path. + */ + public function getDirname(): string + { + return \dirname($this->getStreamName()); + } + + /** + * Get size. + */ + public function getSize(): int + { + if (false === $this->getStatistic()) { + return false; + } + + return \filesize($this->getStreamName()); + } + + /** + * Get informations about a file. + */ + public function getStatistic(): array + { + return \fstat($this->getStream()); + } + + /** + * Get last access time of file. + */ + public function getATime(): int + { + return \fileatime($this->getStreamName()); + } + + /** + * Get inode change time of file. + */ + public function getCTime(): int + { + return \filectime($this->getStreamName()); + } + + /** + * Get file modification time. + */ + public function getMTime(): int + { + return \filemtime($this->getStreamName()); + } + + /** + * Get file group. + */ + public function getGroup(): int + { + return \filegroup($this->getStreamName()); + } + + /** + * Get file owner. + */ + public function getOwner(): int + { + return \fileowner($this->getStreamName()); + } + + /** + * Get file permissions. + */ + public function getPermissions(): int + { + return \fileperms($this->getStreamName()); + } + + /** + * Get file permissions as a string. + * Result sould be interpreted like this: + * * s: socket; + * * l: symbolic link; + * * -: regular; + * * b: block special; + * * d: directory; + * * c: character special; + * * p: FIFO pipe; + * * u: unknown. + */ + public function getReadablePermissions(): string + { + $p = $this->getPermissions(); + + if (($p & 0xC000) === 0xC000) { + $out = 's'; + } elseif (($p & 0xA000) === 0xA000) { + $out = 'l'; + } elseif (($p & 0x8000) === 0x8000) { + $out = '-'; + } elseif (($p & 0x6000) === 0x6000) { + $out = 'b'; + } elseif (($p & 0x4000) === 0x4000) { + $out = 'd'; + } elseif (($p & 0x2000) === 0x2000) { + $out = 'c'; + } elseif (($p & 0x1000) === 0x1000) { + $out = 'p'; + } else { + $out = 'u'; + } + + $out .= + (($p & 0x0100) ? 'r' : '-'). + (($p & 0x0080) ? 'w' : '-'). + (($p & 0x0040) ? + (($p & 0x0800) ? 's' : 'x') : + (($p & 0x0800) ? 'S' : '-')). + (($p & 0x0020) ? 'r' : '-'). + (($p & 0x0010) ? 'w' : '-'). + (($p & 0x0008) ? + (($p & 0x0400) ? 's' : 'x') : + (($p & 0x0400) ? 'S' : '-')). + (($p & 0x0004) ? 'r' : '-'). + (($p & 0x0002) ? 'w' : '-'). + (($p & 0x0001) ? + (($p & 0x0200) ? 't' : 'x') : + (($p & 0x0200) ? 'T' : '-')); + + return $out; + } + + /** + * Check if the file is readable. + */ + public function isReadable(): bool + { + return \is_readable($this->getStreamName()); + } + + /** + * Check if the file is writable. + */ + public function isWritable(): bool + { + return \is_writable($this->getStreamName()); + } + + /** + * Check if the file is executable. + */ + public function isExecutable(): bool + { + return \is_executable($this->getStreamName()); + } + + /** + * Clear file status cache. + */ + public function clearStatisticCache() + { + \clearstatcache(true, $this->getStreamName()); + } + + /** + * Clear all files status cache. + */ + public static function clearAllStatisticCaches() + { + \clearstatcache(); + } + + /** + * Set access and modification time of file. + */ + public function touch(int $time = null, int $atime = null): bool + { + if (null === $time) { + $time = \time(); + } + + if (null === $atime) { + $atime = $time; + } + + return \touch($this->getStreamName(), $time, $atime); + } + + /** + * Copy file. + * Return the destination file path if succeed, false otherwise. + */ + public function copy(string $to, bool $force = StreamTouchable::DO_NOT_OVERWRITE): bool + { + $from = $this->getStreamName(); + + if ($force === StreamTouchable::DO_NOT_OVERWRITE && + true === \file_exists($to)) { + return true; + } + + if (null === $this->getStreamContext()) { + return @\copy($from, $to); + } + + return @\copy($from, $to, $this->getStreamContext()->getContext()); + } + + /** + * Move a file. + */ + public function move( + string $name, + bool $force = StreamTouchable::DO_NOT_OVERWRITE, + bool $mkdir = StreamTouchable::DO_NOT_MAKE_DIRECTORY + ): bool { + $from = $this->getStreamName(); + + if ($force === StreamTouchable::DO_NOT_OVERWRITE && + true === \file_exists($name)) { + return false; + } + + if (StreamTouchable::MAKE_DIRECTORY === $mkdir) { + FileDirectory::create( + \dirname($name), + FileDirectory::MODE_CREATE_RECURSIVE + ); + } + + if (null === $this->getStreamContext()) { + return @\rename($from, $name); + } + + return @\rename($from, $name, $this->getStreamContext()->getContext()); + } + + /** + * Delete a file. + */ + public function delete(): bool + { + if (null === $this->getStreamContext()) { + return @\unlink($this->getStreamName()); + } + + return @\unlink( + $this->getStreamName(), + $this->getStreamContext()->getContext() + ); + } + + /** + * Change file group. + */ + public function changeGroup($group): bool + { + return \chgrp($this->getStreamName(), $group); + } + + /** + * Change file mode. + */ + public function changeMode(int $mode): bool + { + return \chmod($this->getStreamName(), $mode); + } + + /** + * Change file owner. + */ + public function changeOwner($user): bool + { + return \chown($this->getStreamName(), $user); + } + + /** + * Change the current umask. + */ + public static function umask(int $umask = null): int + { + if (null === $umask) { + return \umask(); + } + + return \umask($umask); + } + + /** + * Check if it is a file. + */ + public function isFile(): bool + { + return \is_file($this->getStreamName()); + } + + /** + * Check if it is a link. + */ + public function isLink(): bool + { + return \is_link($this->getStreamName()); + } + + /** + * Check if it is a directory. + */ + public function isDirectory(): bool + { + return \is_dir($this->getStreamName()); + } + + /** + * Check if it is a socket. + */ + public function isSocket(): bool + { + return \filetype($this->getStreamName()) === 'socket'; + } + + /** + * Check if it is a FIFO pipe. + */ + public function isFIFOPipe(): bool + { + return \filetype($this->getStreamName()) === 'fifo'; + } + + /** + * Check if it is character special file. + */ + public function isCharacterSpecial(): bool + { + return \filetype($this->getStreamName()) === 'char'; + } + + /** + * Check if it is block special. + */ + public function isBlockSpecial(): bool + { + return \filetype($this->getStreamName()) === 'block'; + } + + /** + * Check if it is an unknown type. + */ + public function isUnknown(): bool + { + return \filetype($this->getStreamName()) === 'unknown'; + } + + /** + * Set the open mode. + */ + protected function setMode(string $mode) + { + $old = $this->_mode; + $this->_mode = $mode; + + return $old; + } + + /** + * Get the open mode. + */ + public function getMode() + { + return $this->_mode; + } + + /** + * Get inode. + */ + public function getINode(): int + { + return \fileinode($this->getStreamName()); + } + + /** + * Check if the system is case sensitive or not. + */ + public static function isCaseSensitive(): bool + { + return !( + \file_exists(\mb_strtolower(__FILE__)) && + \file_exists(\mb_strtoupper(__FILE__)) + ); + } + + /** + * Get a canonicalized absolute pathname. + */ + public function getRealPath(): string + { + if (false === $out = \realpath($this->getStreamName())) { + return $this->getStreamName(); + } + + return $out; + } + + /** + * Get file extension (if exists). + */ + public function getExtension(): string + { + return \pathinfo( + $this->getStreamName(), + \PATHINFO_EXTENSION + ); + } + + /** + * Get filename without extension. + */ + public function getFilename(): string + { + $file = \basename($this->getStreamName()); + + if (\defined('PATHINFO_FILENAME')) { + return \pathinfo($file, \PATHINFO_FILENAME); + } + + if (\strstr($file, '.')) { + return \substr($file, 0, \strrpos($file, '.')); + } + + return $file; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileLink.php b/vendor/psy/psysh/src/Readline/Hoa/FileLink.php new file mode 100644 index 000000000..21a4485f9 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileLink.php @@ -0,0 +1,149 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Link. + * + * Link handler. + */ +class FileLink extends File +{ + /** + * Open a link. + */ + public function __construct( + string $streamName, + string $mode, + string $context = null, + bool $wait = false + ) { + if (!\is_link($streamName)) { + throw new FileException('File %s is not a link.', 0, $streamName); + } + + parent::__construct($streamName, $mode, $context, $wait); + + return; + } + + /** + * Get informations about a link. + */ + public function getStatistic(): array + { + return \lstat($this->getStreamName()); + } + + /** + * Change file group. + */ + public function changeGroup($group): bool + { + return \lchgrp($this->getStreamName(), $group); + } + + /** + * Change file owner. + */ + public function changeOwner($user): bool + { + return \lchown($this->getStreamName(), $user); + } + + /** + * Get file permissions. + */ + public function getPermissions(): int + { + return 41453; // i.e. lrwxr-xr-x + } + + /** + * Get the target of a symbolic link. + */ + public function getTarget(): FileGeneric + { + $target = \dirname($this->getStreamName()).\DIRECTORY_SEPARATOR. + $this->getTargetName(); + $context = null !== $this->getStreamContext() + ? $this->getStreamContext()->getCurrentId() + : null; + + if (true === \is_link($target)) { + return new FileLinkReadWrite( + $target, + File::MODE_APPEND_READ_WRITE, + $context + ); + } elseif (true === \is_file($target)) { + return new FileReadWrite( + $target, + File::MODE_APPEND_READ_WRITE, + $context + ); + } elseif (true === \is_dir($target)) { + return new FileDirectory( + $target, + File::MODE_READ, + $context + ); + } + + throw new FileException('Cannot find an appropriated object that matches with '.'path %s when defining it.', 1, $target); + } + + /** + * Get the target name of a symbolic link. + */ + public function getTargetName(): string + { + return \readlink($this->getStreamName()); + } + + /** + * Create a link. + */ + public static function create(string $name, string $target): bool + { + if (false !== \linkinfo($name)) { + return true; + } + + return \symlink($target, $name); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileLinkRead.php b/vendor/psy/psysh/src/Readline/Hoa/FileLinkRead.php new file mode 100644 index 000000000..37bb514cb --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileLinkRead.php @@ -0,0 +1,231 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Link\Read. + * + * File handler. + * + * @license New BSD License + */ +class FileLinkRead extends FileLink implements StreamIn +{ + /** + * Open a file. + * + * @param string $streamName stream name + * @param string $mode open mode, see the parent::MODE_* constants + * @param string $context context ID (please, see the + * \Hoa\Stream\Context class) + * @param bool $wait differ opening or not + */ + public function __construct( + string $streamName, + string $mode = parent::MODE_READ, + string $context = null, + bool $wait = false + ) { + parent::__construct($streamName, $mode, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + * + * @param string $streamName Stream name (e.g. path or URL). + * @param \Hoa\Stream\Context $context context + * + * @return resource + * + * @throws \Hoa\File\Exception\FileDoesNotExist + * @throws \Hoa\File\Exception + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + static $createModes = [ + parent::MODE_READ, + ]; + + if (!\in_array($this->getMode(), $createModes)) { + throw new FileException('Open mode are not supported; given %d. Only %s are supported.', 0, [$this->getMode(), \implode(', ', $createModes)]); + } + + \preg_match('#^(\w+)://#', $streamName, $match); + + if (((isset($match[1]) && $match[1] === 'file') || !isset($match[1])) && + !\file_exists($streamName)) { + throw new FileDoesNotExistException('File %s does not exist.', 1, $streamName); + } + + $out = parent::_open($streamName, $context); + + return $out; + } + + /** + * Test for end-of-file. + * + * @return bool + */ + public function eof(): bool + { + return \feof($this->getStream()); + } + + /** + * Read n characters. + * + * @param int $length length + * + * @return string + * + * @throws \Hoa\File\Exception + */ + public function read(int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 2, $length); + } + + return \fread($this->getStream(), $length); + } + + /** + * Alias of $this->read(). + * + * @param int $length length + * + * @return string + */ + public function readString(int $length) + { + return $this->read($length); + } + + /** + * Read a character. + * + * @return string + */ + public function readCharacter() + { + return \fgetc($this->getStream()); + } + + /** + * Read a boolean. + * + * @return bool + */ + public function readBoolean() + { + return (bool) $this->read(1); + } + + /** + * Read an integer. + * + * @param int $length length + * + * @return int + */ + public function readInteger(int $length = 1) + { + return (int) $this->read($length); + } + + /** + * Read a float. + * + * @param int $length length + * + * @return float + */ + public function readFloat(int $length = 1) + { + return (float) $this->read($length); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + * + * @param string $format format (see printf's formats) + * + * @return array + */ + public function readArray(string $format = null) + { + return $this->scanf($format); + } + + /** + * Read a line. + * + * @return string + */ + public function readLine() + { + return \fgets($this->getStream()); + } + + /** + * Read all, i.e. read as much as possible. + * + * @param int $offset offset + * + * @return string + */ + public function readAll(int $offset = 0) + { + return \stream_get_contents($this->getStream(), -1, $offset); + } + + /** + * Parse input from a stream according to a format. + * + * @param string $format format (see printf's formats) + * + * @return array + */ + public function scanf(string $format): array + { + return \fscanf($this->getStream(), $format); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileLinkReadWrite.php b/vendor/psy/psysh/src/Readline/Hoa/FileLinkReadWrite.php new file mode 100644 index 000000000..0d16585cf --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileLinkReadWrite.php @@ -0,0 +1,279 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Link\ReadWrite. + * + * File handler. + */ +class FileLinkReadWrite extends FileLink implements StreamIn, StreamOut +{ + /** + * Open a file. + */ + public function __construct( + string $streamName, + string $mode = parent::MODE_APPEND_READ_WRITE, + string $context = null, + bool $wait = false + ) { + parent::__construct($streamName, $mode, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + static $createModes = [ + parent::MODE_READ_WRITE, + parent::MODE_TRUNCATE_READ_WRITE, + parent::MODE_APPEND_READ_WRITE, + parent::MODE_CREATE_READ_WRITE, + ]; + + if (!\in_array($this->getMode(), $createModes)) { + throw new FileException('Open mode are not supported; given %d. Only %s are supported.', 0, [$this->getMode(), \implode(', ', $createModes)]); + } + + \preg_match('#^(\w+)://#', $streamName, $match); + + if (((isset($match[1]) && $match[1] === 'file') || !isset($match[1])) && + !\file_exists($streamName) && + parent::MODE_READ_WRITE === $this->getMode()) { + throw new FileDoesNotExistException('File %s does not exist.', 1, $streamName); + } + + $out = parent::_open($streamName, $context); + + return $out; + } + + /** + * Test for end-of-file. + */ + public function eof(): bool + { + return \feof($this->getStream()); + } + + /** + * Read n characters. + */ + public function read(int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 2, $length); + } + + return \fread($this->getStream(), $length); + } + + /** + * Alias of $this->read(). + */ + public function readString(int $length) + { + return $this->read($length); + } + + /** + * Read a character. + */ + public function readCharacter() + { + return \fgetc($this->getStream()); + } + + /** + * Read a boolean. + */ + public function readBoolean() + { + return (bool) $this->read(1); + } + + /** + * Read an integer. + */ + public function readInteger(int $length = 1) + { + return (int) $this->read($length); + } + + /** + * Read a float. + */ + public function readFloat(int $length = 1) + { + return (float) $this->read($length); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + */ + public function readArray(string $format = null) + { + return $this->scanf($format); + } + + /** + * Read a line. + */ + public function readLine() + { + return \fgets($this->getStream()); + } + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = 0) + { + return \stream_get_contents($this->getStream(), -1, $offset); + } + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format): array + { + return \fscanf($this->getStream(), $format); + } + + /** + * Write n characters. + */ + public function write(string $string, int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 3, $length); + } + + return \fwrite($this->getStream(), $string, $length); + } + + /** + * Write a string. + */ + public function writeString(string $string) + { + $string = (string) $string; + + return $this->write($string, \strlen($string)); + } + + /** + * Write a character. + */ + public function writeCharacter(string $char) + { + return $this->write((string) $char[0], 1); + } + + /** + * Write a boolean. + */ + public function writeBoolean(bool $boolean) + { + return $this->write((string) (bool) $boolean, 1); + } + + /** + * Write an integer. + */ + public function writeInteger(int $integer) + { + $integer = (string) (int) $integer; + + return $this->write($integer, \strlen($integer)); + } + + /** + * Write a float. + */ + public function writeFloat(float $float) + { + $float = (string) (float) $float; + + return $this->write($float, \strlen($float)); + } + + /** + * Write an array. + */ + public function writeArray(array $array) + { + $array = \var_export($array, true); + + return $this->write($array, \strlen($array)); + } + + /** + * Write a line. + */ + public function writeLine(string $line) + { + if (false === $n = \strpos($line, "\n")) { + return $this->write($line."\n", \strlen($line) + 1); + } + + ++$n; + + return $this->write(\substr($line, 0, $n), $n); + } + + /** + * Write all, i.e. as much as possible. + */ + public function writeAll(string $string) + { + return $this->write($string, \strlen($string)); + } + + /** + * Truncate a file to a given length. + */ + public function truncate(int $size): bool + { + return \ftruncate($this->getStream(), $size); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileRead.php b/vendor/psy/psysh/src/Readline/Hoa/FileRead.php new file mode 100644 index 000000000..9e10fe692 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileRead.php @@ -0,0 +1,177 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\Read. + * + * File handler. + */ +class FileRead extends File implements StreamIn +{ + /** + * Open a file. + */ + public function __construct( + string $streamName, + string $mode = parent::MODE_READ, + string $context = null, + bool $wait = false + ) { + parent::__construct($streamName, $mode, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + static $createModes = [ + parent::MODE_READ, + ]; + + if (!\in_array($this->getMode(), $createModes)) { + throw new FileException('Open mode are not supported; given %d. Only %s are supported.', 0, [$this->getMode(), \implode(', ', $createModes)]); + } + + \preg_match('#^(\w+)://#', $streamName, $match); + + if (((isset($match[1]) && $match[1] === 'file') || !isset($match[1])) && + !\file_exists($streamName)) { + throw new FileDoesNotExistException('File %s does not exist.', 1, $streamName); + } + + $out = parent::_open($streamName, $context); + + return $out; + } + + /** + * Test for end-of-file. + */ + public function eof(): bool + { + return \feof($this->getStream()); + } + + /** + * Read n characters. + */ + public function read(int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 2, $length); + } + + return \fread($this->getStream(), $length); + } + + /** + * Alias of $this->read(). + */ + public function readString(int $length) + { + return $this->read($length); + } + + /** + * Read a character. + */ + public function readCharacter() + { + return \fgetc($this->getStream()); + } + + /** + * Read a boolean. + */ + public function readBoolean() + { + return (bool) $this->read(1); + } + + /** + * Read an integer. + */ + public function readInteger(int $length = 1) + { + return (int) $this->read($length); + } + + /** + * Read a float. + */ + public function readFloat(int $length = 1) + { + return (float) $this->read($length); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + */ + public function readArray(string $format = null) + { + return $this->scanf($format); + } + + /** + * Read a line. + */ + public function readLine() + { + return \fgets($this->getStream()); + } + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = 0) + { + return \stream_get_contents($this->getStream(), -1, $offset); + } + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format): array + { + return \fscanf($this->getStream(), $format); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/FileReadWrite.php b/vendor/psy/psysh/src/Readline/Hoa/FileReadWrite.php new file mode 100644 index 000000000..406b6aa73 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/FileReadWrite.php @@ -0,0 +1,279 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\File\ReadWrite. + * + * File handler. + */ +class FileReadWrite extends File implements StreamIn, StreamOut +{ + /** + * Open a file. + */ + public function __construct( + string $streamName, + string $mode = parent::MODE_APPEND_READ_WRITE, + string $context = null, + bool $wait = false + ) { + parent::__construct($streamName, $mode, $context, $wait); + + return; + } + + /** + * Open the stream and return the associated resource. + */ + protected function &_open(string $streamName, StreamContext $context = null) + { + static $createModes = [ + parent::MODE_READ_WRITE, + parent::MODE_TRUNCATE_READ_WRITE, + parent::MODE_APPEND_READ_WRITE, + parent::MODE_CREATE_READ_WRITE, + ]; + + if (!\in_array($this->getMode(), $createModes)) { + throw new FileException('Open mode are not supported; given %d. Only %s are supported.', 0, [$this->getMode(), \implode(', ', $createModes)]); + } + + \preg_match('#^(\w+)://#', $streamName, $match); + + if (((isset($match[1]) && $match[1] === 'file') || !isset($match[1])) && + !\file_exists($streamName) && + parent::MODE_READ_WRITE === $this->getMode()) { + throw new FileDoesNotExistException('File %s does not exist.', 1, $streamName); + } + + $out = parent::_open($streamName, $context); + + return $out; + } + + /** + * Test for end-of-file. + */ + public function eof(): bool + { + return \feof($this->getStream()); + } + + /** + * Read n characters. + */ + public function read(int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 2, $length); + } + + return \fread($this->getStream(), $length); + } + + /** + * Alias of $this->read(). + */ + public function readString(int $length) + { + return $this->read($length); + } + + /** + * Read a character. + */ + public function readCharacter() + { + return \fgetc($this->getStream()); + } + + /** + * Read a boolean. + */ + public function readBoolean() + { + return (bool) $this->read(1); + } + + /** + * Read an integer. + */ + public function readInteger(int $length = 1) + { + return (int) $this->read($length); + } + + /** + * Read a float. + */ + public function readFloat(int $length = 1) + { + return (float) $this->read($length); + } + + /** + * Read an array. + * Alias of the $this->scanf() method. + */ + public function readArray(string $format = null) + { + return $this->scanf($format); + } + + /** + * Read a line. + */ + public function readLine() + { + return \fgets($this->getStream()); + } + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = 0) + { + return \stream_get_contents($this->getStream(), -1, $offset); + } + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format): array + { + return \fscanf($this->getStream(), $format); + } + + /** + * Write n characters. + */ + public function write(string $string, int $length) + { + if (0 > $length) { + throw new FileException('Length must be greater than 0, given %d.', 3, $length); + } + + return \fwrite($this->getStream(), $string, $length); + } + + /** + * Write a string. + */ + public function writeString(string $string) + { + $string = (string) $string; + + return $this->write($string, \strlen($string)); + } + + /** + * Write a character. + */ + public function writeCharacter(string $char) + { + return $this->write((string) $char[0], 1); + } + + /** + * Write a boolean. + */ + public function writeBoolean(bool $boolean) + { + return $this->write((string) (bool) $boolean, 1); + } + + /** + * Write an integer. + */ + public function writeInteger(int $integer) + { + $integer = (string) (int) $integer; + + return $this->write($integer, \strlen($integer)); + } + + /** + * Write a float. + */ + public function writeFloat(float $float) + { + $float = (string) (float) $float; + + return $this->write($float, \strlen($float)); + } + + /** + * Write an array. + */ + public function writeArray(array $array) + { + $array = \var_export($array, true); + + return $this->write($array, \strlen($array)); + } + + /** + * Write a line. + */ + public function writeLine(string $line) + { + if (false === $n = \strpos($line, "\n")) { + return $this->write($line."\n", \strlen($line) + 1); + } + + ++$n; + + return $this->write(\substr($line, 0, $n), $n); + } + + /** + * Write all, i.e. as much as possible. + */ + public function writeAll(string $string) + { + return $this->write($string, \strlen($string)); + } + + /** + * Truncate a file to a given length. + */ + public function truncate(int $size): bool + { + return \ftruncate($this->getStream(), $size); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/IStream.php b/vendor/psy/psysh/src/Readline/Hoa/IStream.php new file mode 100644 index 000000000..9b9949a24 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/IStream.php @@ -0,0 +1,50 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Stream. + * + * Interface for all streams. + */ +interface IStream +{ + /** + * Get the current stream. + */ + public function getStream(); +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/IteratorFileSystem.php b/vendor/psy/psysh/src/Readline/Hoa/IteratorFileSystem.php new file mode 100644 index 000000000..f0fc5c575 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/IteratorFileSystem.php @@ -0,0 +1,86 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Iterator\FileSystem. + * + * Extending the SPL FileSystemIterator class. + */ +class IteratorFileSystem extends \FilesystemIterator +{ + /** + * SplFileInfo classname. + */ + protected $_splFileInfoClass = null; + + /** + * Constructor. + * Please, see \FileSystemIterator::__construct() method. + * We add the $splFileInfoClass parameter. + */ + public function __construct(string $path, int $flags = null, string $splFileInfoClass = null) + { + $this->_splFileInfoClass = $splFileInfoClass; + + if (null === $flags) { + parent::__construct($path); + } else { + parent::__construct($path, $flags); + } + + return; + } + + /** + * Current. + * Please, see \FileSystemIterator::current() method. + */ + #[\ReturnTypeWillChange] + public function current() + { + $out = parent::current(); + + if (null !== $this->_splFileInfoClass && + $out instanceof \SplFileInfo) { + $out->setInfoClass($this->_splFileInfoClass); + $out = $out->getFileInfo(); + } + + return $out; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/IteratorRecursiveDirectory.php b/vendor/psy/psysh/src/Readline/Hoa/IteratorRecursiveDirectory.php new file mode 100644 index 000000000..ad6951233 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/IteratorRecursiveDirectory.php @@ -0,0 +1,126 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Iterator\Recursive\Directory. + * + * Extending the SPL RecursiveDirectoryIterator class. + */ +class IteratorRecursiveDirectory extends \RecursiveDirectoryIterator +{ + /** + * SplFileInfo classname. + */ + protected $_splFileInfoClass = null; + + /** + * Relative path. + */ + protected $_relativePath = null; + + /** + * Constructor. + * Please, see \RecursiveDirectoryIterator::__construct() method. + * We add the $splFileInfoClass parameter. + */ + public function __construct(string $path, int $flags = null, string $splFileInfoClass = null) + { + if (null === $flags) { + parent::__construct($path); + } else { + parent::__construct($path, $flags); + } + + $this->_relativePath = $path; + $this->setSplFileInfoClass($splFileInfoClass); + + return; + } + + /** + * Current. + * Please, see \RecursiveDirectoryIterator::current() method. + */ + #[\ReturnTypeWillChange] + public function current() + { + $out = parent::current(); + + if (null !== $this->_splFileInfoClass && + $out instanceof \SplFileInfo) { + $out->setInfoClass($this->_splFileInfoClass); + $out = $out->getFileInfo(); + + if ($out instanceof IteratorSplFileInfo) { + $out->setRelativePath($this->getRelativePath()); + } + } + + return $out; + } + + /** + * Get children. + * Please, see \RecursiveDirectoryIterator::getChildren() method. + */ + #[\ReturnTypeWillChange] + public function getChildren() + { + $out = parent::getChildren(); + $out->_relativePath = $this->getRelativePath(); + $out->setSplFileInfoClass($this->_splFileInfoClass); + + return $out; + } + + /** + * Set SplFileInfo classname. + */ + public function setSplFileInfoClass($splFileInfoClass) + { + $this->_splFileInfoClass = $splFileInfoClass; + } + + /** + * Get relative path (if given). + */ + public function getRelativePath(): string + { + return $this->_relativePath; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/IteratorSplFileInfo.php b/vendor/psy/psysh/src/Readline/Hoa/IteratorSplFileInfo.php new file mode 100644 index 000000000..3cf54b845 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/IteratorSplFileInfo.php @@ -0,0 +1,122 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Iterator\SplFileInfo. + * + * Enhance SplFileInfo implementation. + */ +class IteratorSplFileInfo extends \SplFileInfo +{ + /** + * Hash. + */ + protected $_hash = null; + + /** + * Relative path. + */ + protected $_relativePath = null; + + /** + * Construct. + */ + public function __construct(string $filename, string $relativePath = null) + { + parent::__construct($filename); + + if (-1 !== $mtime = $this->getMTime()) { + $this->_hash = \md5($this->getPathname().$mtime); + } + + $this->_relativePath = $relativePath; + + return; + } + + /** + * Get the hash. + */ + public function getHash(): string + { + return $this->_hash; + } + + /** + * Get the MTime. + */ + public function getMTime(): int + { + try { + return parent::getMTime(); + } catch (\RuntimeException $e) { + return -1; + } + } + + /** + * Set relative path. + */ + public function setRelativePath(string $relativePath) + { + $old = $this->_relativePath; + $this->_relativePath = $relativePath; + + return $old; + } + + /** + * Get relative path (if given). + */ + public function getRelativePath() + { + return $this->_relativePath; + } + + /** + * Get relative pathname (if possible). + */ + public function getRelativePathname(): string + { + if (null === $relative = $this->getRelativePath()) { + return $this->getPathname(); + } + + return \substr($this->getPathname(), \strlen($relative)); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Protocol.php b/vendor/psy/psysh/src/Readline/Hoa/Protocol.php new file mode 100644 index 000000000..51d064e02 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Protocol.php @@ -0,0 +1,223 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Root of the `hoa://` protocol. + */ +class Protocol extends ProtocolNode +{ + /** + * No resolution value. + * + * @const string + */ + const NO_RESOLUTION = '/hoa/flatland'; + + /** + * Singleton. + */ + private static $_instance = null; + + /** + * Cache of resolver. + */ + private static $_cache = []; + + /** + * Initialize the protocol. + */ + public function __construct() + { + $this->initialize(); + + return; + } + + /** + * Singleton. + * To use the `hoa://` protocol shared by everyone. + */ + public static function getInstance(): self + { + if (null === static::$_instance) { + static::$_instance = new self(); + } + + return static::$_instance; + } + + /** + * Initialize the protocol. + */ + protected function initialize() + { + $root = \dirname(__DIR__, 3); + $argv0 = \realpath($_SERVER['argv'][0]); + + $cwd = + 'cli' === \PHP_SAPI + ? false !== $argv0 ? \dirname($argv0) : '' + : \getcwd(); + + $this[] = new ProtocolNode( + 'Application', + $cwd.\DIRECTORY_SEPARATOR, + [ + new ProtocolNode('Public', 'Public'.\DIRECTORY_SEPARATOR), + ] + ); + + $this[] = new ProtocolNode( + 'Data', + \dirname($cwd).\DIRECTORY_SEPARATOR, + [ + new ProtocolNode( + 'Etc', + 'Etc'.\DIRECTORY_SEPARATOR, + [ + new ProtocolNode('Configuration', 'Configuration'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Locale', 'Locale'.\DIRECTORY_SEPARATOR), + ] + ), + new ProtocolNode('Lost+found', 'Lost+found'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Temporary', 'Temporary'.\DIRECTORY_SEPARATOR), + new ProtocolNode( + 'Variable', + 'Variable'.\DIRECTORY_SEPARATOR, + [ + new ProtocolNode('Cache', 'Cache'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Database', 'Database'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Log', 'Log'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Private', 'Private'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Run', 'Run'.\DIRECTORY_SEPARATOR), + new ProtocolNode('Test', 'Test'.\DIRECTORY_SEPARATOR), + ] + ), + ] + ); + + $this[] = new ProtocolNodeLibrary( + 'Library', + $root.\DIRECTORY_SEPARATOR.'Hoathis'.\DIRECTORY_SEPARATOR.';'. + $root.\DIRECTORY_SEPARATOR.'Hoa'.\DIRECTORY_SEPARATOR + ); + } + + /** + * Resolve (unfold) an `hoa://` path to its real resource. + * + * If `$exists` is set to `true`, try to find the first that exists, + * otherwise returns the first solution. If `$unfold` is set to `true`, + * it returns all the paths. + */ + public function resolve(string $path, bool $exists = true, bool $unfold = false) + { + if (\substr($path, 0, 6) !== 'hoa://') { + if (true === \is_dir($path)) { + $path = \rtrim($path, '/\\'); + + if ('' === $path) { + $path = '/'; + } + } + + return $path; + } + + if (isset(self::$_cache[$path])) { + $handle = self::$_cache[$path]; + } else { + $out = $this->_resolve($path, $handle); + + // Not a path but a resource. + if (!\is_array($handle)) { + return $out; + } + + $handle = \array_values(\array_unique($handle, \SORT_REGULAR)); + + foreach ($handle as &$entry) { + if (true === \is_dir($entry)) { + $entry = \rtrim($entry, '/\\'); + + if ('' === $entry) { + $entry = '/'; + } + } + } + + self::$_cache[$path] = $handle; + } + + if (true === $unfold) { + if (true !== $exists) { + return $handle; + } + + $out = []; + + foreach ($handle as $solution) { + if (\file_exists($solution)) { + $out[] = $solution; + } + } + + return $out; + } + + if (true !== $exists) { + return $handle[0]; + } + + foreach ($handle as $solution) { + if (\file_exists($solution)) { + return $solution; + } + } + + return static::NO_RESOLUTION; + } + + /** + * Clear the cache. + */ + public static function clearCache() + { + self::$_cache = []; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ProtocolException.php b/vendor/psy/psysh/src/Readline/Hoa/ProtocolException.php new file mode 100644 index 000000000..6b624bb9e --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ProtocolException.php @@ -0,0 +1,44 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Extends the `Hoa\Exception\Exception` class. + */ +class ProtocolException extends Exception +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ProtocolNode.php b/vendor/psy/psysh/src/Readline/Hoa/ProtocolNode.php new file mode 100644 index 000000000..78812d7ec --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ProtocolNode.php @@ -0,0 +1,323 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Abstract class for all `hoa://`'s nodes. + */ +class ProtocolNode implements \ArrayAccess, \IteratorAggregate +{ + /** + * Node's name. + */ + protected $_name = null; + + /** + * Path for the `reach` method. + */ + protected $_reach = null; + + /** + * Children of the node. + */ + private $_children = []; + + /** + * Construct a protocol's node. + * If it is not a data object (i.e. if it does not extend this class to + * overload the `$_name` attribute), we can set the `$_name` attribute + * dynamically. This is useful to create a node on-the-fly. + */ + public function __construct(string $name = null, string $reach = null, array $children = []) + { + if (null !== $name) { + $this->_name = $name; + } + + if (null !== $reach) { + $this->_reach = $reach; + } + + foreach ($children as $child) { + $this[] = $child; + } + + return; + } + + /** + * Add a node. + */ + #[\ReturnTypeWillChange] + public function offsetSet($name, $node) + { + if (!($node instanceof self)) { + throw new ProtocolException('Protocol node must extend %s.', 0, __CLASS__); + } + + if (empty($name)) { + $name = $node->getName(); + } + + if (empty($name)) { + throw new ProtocolException('Cannot add a node to the `hoa://` protocol without a name.', 1); + } + + $this->_children[$name] = $node; + } + + /** + * Get a specific node. + */ + public function offsetGet($name): self + { + if (!isset($this[$name])) { + throw new ProtocolException('Node %s does not exist.', 2, $name); + } + + return $this->_children[$name]; + } + + /** + * Check if a node exists. + */ + public function offsetExists($name): bool + { + return true === \array_key_exists($name, $this->_children); + } + + /** + * Remove a node. + */ + #[\ReturnTypeWillChange] + public function offsetUnset($name) + { + unset($this->_children[$name]); + } + + /** + * Resolve a path, i.e. iterate the nodes tree and reach the queue of + * the path. + */ + protected function _resolve(string $path, &$accumulator, string $id = null) + { + if (\substr($path, 0, 6) === 'hoa://') { + $path = \substr($path, 6); + } + + if (empty($path)) { + return null; + } + + if (null === $accumulator) { + $accumulator = []; + $posId = \strpos($path, '#'); + + if (false !== $posId) { + $id = \substr($path, $posId + 1); + $path = \substr($path, 0, $posId); + } else { + $id = null; + } + } + + $path = \trim($path, '/'); + $pos = \strpos($path, '/'); + + if (false !== $pos) { + $next = \substr($path, 0, $pos); + } else { + $next = $path; + } + + if (isset($this[$next])) { + if (false === $pos) { + if (null === $id) { + $this->_resolveChoice($this[$next]->reach(), $accumulator); + + return true; + } + + $accumulator = null; + + return $this[$next]->reachId($id); + } + + $tnext = $this[$next]; + $this->_resolveChoice($tnext->reach(), $accumulator); + + return $tnext->_resolve(\substr($path, $pos + 1), $accumulator, $id); + } + + $this->_resolveChoice($this->reach($path), $accumulator); + + return true; + } + + /** + * Resolve choices, i.e. a reach value has a “;”. + */ + protected function _resolveChoice($reach, &$accumulator) + { + if (null === $reach) { + $reach = ''; + } + + if (empty($accumulator)) { + $accumulator = \explode(';', $reach); + + return; + } + + if (false === \strpos($reach, ';')) { + if (false !== $pos = \strrpos($reach, "\r")) { + $reach = \substr($reach, $pos + 1); + + foreach ($accumulator as &$entry) { + $entry = null; + } + } + + foreach ($accumulator as &$entry) { + $entry .= $reach; + } + + return; + } + + $choices = \explode(';', $reach); + $ref = $accumulator; + $accumulator = []; + + foreach ($choices as $choice) { + if (false !== $pos = \strrpos($choice, "\r")) { + $choice = \substr($choice, $pos + 1); + + foreach ($ref as $entry) { + $accumulator[] = $choice; + } + } else { + foreach ($ref as $entry) { + $accumulator[] = $entry.$choice; + } + } + } + + unset($ref); + + return; + } + + /** + * Queue of the node. + * Generic one. Must be overrided in children classes. + */ + public function reach(string $queue = null) + { + return empty($queue) ? $this->_reach : $queue; + } + + /** + * ID of the component. + * Generic one. Should be overrided in children classes. + */ + public function reachId(string $id) + { + throw new ProtocolException('The node %s has no ID support (tried to reach #%s).', 4, [$this->getName(), $id]); + } + + /** + * Set a new reach value. + */ + public function setReach(string $reach) + { + $old = $this->_reach; + $this->_reach = $reach; + + return $old; + } + + /** + * Get node's name. + */ + public function getName() + { + return $this->_name; + } + + /** + * Get reach's root. + */ + protected function getReach() + { + return $this->_reach; + } + + /** + * Get an iterator. + */ + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator($this->_children); + } + + /** + * Get root the protocol. + */ + public static function getRoot(): Protocol + { + return Protocol::getInstance(); + } + + /** + * Print a tree of component. + */ + public function __toString(): string + { + static $i = 0; + + $out = \str_repeat(' ', $i).$this->getName()."\n"; + + foreach ($this as $node) { + ++$i; + $out .= $node; + --$i; + } + + return $out; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php b/vendor/psy/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php new file mode 100644 index 000000000..dfb0cb206 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ProtocolNodeLibrary.php @@ -0,0 +1,90 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * The `hoa://Library/` node. + */ +class ProtocolNodeLibrary extends ProtocolNode +{ + /** + * Queue of the component. + */ + public function reach(string $queue = null) + { + $withComposer = \class_exists('Composer\Autoload\ClassLoader', false) || + ('cli' === \PHP_SAPI && \file_exists(__DIR__.DS.'..'.DS.'..'.DS.'..'.DS.'..'.DS.'autoload.php')); + + if ($withComposer) { + return parent::reach($queue); + } + + if (!empty($queue)) { + $head = $queue; + + if (false !== $pos = \strpos($queue, '/')) { + $head = \substr($head, 0, $pos); + $queue = \DIRECTORY_SEPARATOR.\substr($queue, $pos + 1); + } else { + $queue = null; + } + + $out = []; + + foreach (\explode(';', $this->_reach) as $part) { + $out[] = "\r".$part.\strtolower($head).$queue; + } + + $out[] = "\r".\dirname(__DIR__, 5).$queue; + + return \implode(';', $out); + } + + $out = []; + + foreach (\explode(';', $this->_reach) as $part) { + $pos = \strrpos(\rtrim($part, \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR) + 1; + $head = \substr($part, 0, $pos); + $tail = \substr($part, $pos); + $out[] = $head.\strtolower($tail); + } + + $this->_reach = \implode(';', $out); + + return parent::reach($queue); + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/ProtocolWrapper.php b/vendor/psy/psysh/src/Readline/Hoa/ProtocolWrapper.php new file mode 100644 index 000000000..8d525e7ef --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/ProtocolWrapper.php @@ -0,0 +1,473 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Stream wrapper for the `hoa://` protocol. + */ +class ProtocolWrapper +{ + /** + * Opened stream as a resource. + */ + private $_stream = null; + + /** + * Stream name (filename). + */ + private $_streamName = null; + + /** + * Stream context (given by the streamWrapper class) as a resource. + */ + public $context = null; + + /** + * Get the real path of the given URL. + * Could return false if the path cannot be reached. + */ + public static function realPath(string $path, bool $exists = true) + { + return ProtocolNode::getRoot()->resolve($path, $exists); + } + + /** + * Retrieve the underlying resource. + * + * `$castAs` can be `STREAM_CAST_FOR_SELECT` when `stream_select` is + * calling `stream_cast` or `STREAM_CAST_AS_STREAM` when `stream_cast` is + * called for other uses. + */ + public function stream_cast(int $castAs) + { + return null; + } + + /** + * Closes a resource. + * This method is called in response to `fclose`. + * All resources that were locked, or allocated, by the wrapper should be + * released. + */ + public function stream_close() + { + if (true === @\fclose($this->getStream())) { + $this->_stream = null; + $this->_streamName = null; + } + } + + /** + * Tests for end-of-file on a file pointer. + * This method is called in response to feof(). + */ + public function stream_eof(): bool + { + return \feof($this->getStream()); + } + + /** + * Flush the output. + * This method is called in respond to fflush(). + * If we have cached data in our stream but not yet stored it into the + * underlying storage, we should do so now. + */ + public function stream_flush(): bool + { + return \fflush($this->getStream()); + } + + /** + * Advisory file locking. + * This method is called in response to flock(), when file_put_contents() + * (when flags contains LOCK_EX), stream_set_blocking() and when closing the + * stream (LOCK_UN). + * + * Operation is one the following: + * * LOCK_SH to acquire a shared lock (reader) ; + * * LOCK_EX to acquire an exclusive lock (writer) ; + * * LOCK_UN to release a lock (shared or exclusive) ; + * * LOCK_NB if we don't want flock() to + * block while locking (not supported on + * Windows). + */ + public function stream_lock(int $operation): bool + { + return \flock($this->getStream(), $operation); + } + + /** + * Change stream options. + * This method is called to set metadata on the stream. It is called when + * one of the following functions is called on a stream URL: touch, chmod, + * chown or chgrp. + * + * Option must be one of the following constant: + * * STREAM_META_TOUCH, + * * STREAM_META_OWNER_NAME, + * * STREAM_META_OWNER, + * * STREAM_META_GROUP_NAME, + * * STREAM_META_GROUP, + * * STREAM_META_ACCESS. + * + * Values are arguments of `touch`, `chmod`, `chown`, and `chgrp`. + */ + public function stream_metadata(string $path, int $option, $values): bool + { + $path = static::realPath($path, false); + + switch ($option) { + case \STREAM_META_TOUCH: + $arity = \count($values); + + if (0 === $arity) { + $out = \touch($path); + } elseif (1 === $arity) { + $out = \touch($path, $values[0]); + } else { + $out = \touch($path, $values[0], $values[1]); + } + + break; + + case \STREAM_META_OWNER_NAME: + case \STREAM_META_OWNER: + $out = \chown($path, $values); + + break; + + case \STREAM_META_GROUP_NAME: + case \STREAM_META_GROUP: + $out = \chgrp($path, $values); + + break; + + case \STREAM_META_ACCESS: + $out = \chmod($path, $values); + + break; + + default: + $out = false; + } + + return $out; + } + + /** + * Open file or URL. + * This method is called immediately after the wrapper is initialized (f.e. + * by fopen() and file_get_contents()). + */ + public function stream_open(string $path, string $mode, int $options, &$openedPath): bool + { + $path = static::realPath($path, 'r' === $mode[0]); + + if (Protocol::NO_RESOLUTION === $path) { + return false; + } + + if (null === $this->context) { + $openedPath = \fopen($path, $mode, $options & \STREAM_USE_PATH); + } else { + $openedPath = \fopen( + $path, + $mode, + (bool) ($options & \STREAM_USE_PATH), + $this->context + ); + } + + if (false === \is_resource($openedPath)) { + return false; + } + + $this->_stream = $openedPath; + $this->_streamName = $path; + + return true; + } + + /** + * Read from stream. + * This method is called in response to fread() and fgets(). + */ + public function stream_read(int $size): string + { + return \fread($this->getStream(), $size); + } + + /** + * Seek to specific location in a stream. + * This method is called in response to fseek(). + * The read/write position of the stream should be updated according to the + * $offset and $whence. + * + * The possible values for `$whence` are: + * * SEEK_SET to set position equal to $offset bytes, + * * SEEK_CUR to set position to current location plus `$offset`, + * * SEEK_END to set position to end-of-file plus `$offset`. + */ + public function stream_seek(int $offset, int $whence = \SEEK_SET): bool + { + return 0 === \fseek($this->getStream(), $offset, $whence); + } + + /** + * Retrieve information about a file resource. + * This method is called in response to fstat(). + */ + public function stream_stat(): array + { + return \fstat($this->getStream()); + } + + /** + * Retrieve the current position of a stream. + * This method is called in response to ftell(). + */ + public function stream_tell(): int + { + return \ftell($this->getStream()); + } + + /** + * Truncate a stream to a given length. + */ + public function stream_truncate(int $size): bool + { + return \ftruncate($this->getStream(), $size); + } + + /** + * Write to stream. + * This method is called in response to fwrite(). + */ + public function stream_write(string $data): int + { + return \fwrite($this->getStream(), $data); + } + + /** + * Close directory handle. + * This method is called in to closedir(). + * Any resources which were locked, or allocated, during opening and use of + * the directory stream should be released. + */ + public function dir_closedir() + { + \closedir($this->getStream()); + $this->_stream = null; + $this->_streamName = null; + } + + /** + * Open directory handle. + * This method is called in response to opendir(). + * + * The `$options` input represents whether or not to enforce safe_mode + * (0x04). It is not used here. + */ + public function dir_opendir(string $path, int $options): bool + { + $path = static::realPath($path); + $handle = null; + + if (null === $this->context) { + $handle = @\opendir($path); + } else { + $handle = @\opendir($path, $this->context); + } + + if (false === $handle) { + return false; + } + + $this->_stream = $handle; + $this->_streamName = $path; + + return true; + } + + /** + * Read entry from directory handle. + * This method is called in response to readdir(). + * + * @return mixed + */ + public function dir_readdir() + { + return \readdir($this->getStream()); + } + + /** + * Rewind directory handle. + * This method is called in response to rewinddir(). + * Should reset the output generated by self::dir_readdir, i.e. the next + * call to self::dir_readdir should return the first entry in the location + * returned by self::dir_opendir. + */ + public function dir_rewinddir() + { + \rewinddir($this->getStream()); + } + + /** + * Create a directory. + * This method is called in response to mkdir(). + */ + public function mkdir(string $path, int $mode, int $options): bool + { + if (null === $this->context) { + return \mkdir( + static::realPath($path, false), + $mode, + $options | \STREAM_MKDIR_RECURSIVE + ); + } + + return \mkdir( + static::realPath($path, false), + $mode, + (bool) ($options | \STREAM_MKDIR_RECURSIVE), + $this->context + ); + } + + /** + * Rename a file or directory. + * This method is called in response to rename(). + * Should attempt to rename $from to $to. + */ + public function rename(string $from, string $to): bool + { + if (null === $this->context) { + return \rename(static::realPath($from), static::realPath($to, false)); + } + + return \rename( + static::realPath($from), + static::realPath($to, false), + $this->context + ); + } + + /** + * Remove a directory. + * This method is called in response to rmdir(). + * The `$options` input is a bitwise mask of values. It is not used here. + */ + public function rmdir(string $path, int $options): bool + { + if (null === $this->context) { + return \rmdir(static::realPath($path)); + } + + return \rmdir(static::realPath($path), $this->context); + } + + /** + * Delete a file. + * This method is called in response to unlink(). + */ + public function unlink(string $path): bool + { + if (null === $this->context) { + return \unlink(static::realPath($path)); + } + + return \unlink(static::realPath($path), $this->context); + } + + /** + * Retrieve information about a file. + * This method is called in response to all stat() related functions. + * The `$flags` input holds additional flags set by the streams API. It + * can hold one or more of the following values OR'd together. + * STREAM_URL_STAT_LINK: for resource with the ability to link to other + * resource (such as an HTTP location: forward, or a filesystem + * symlink). This flag specified that only information about the link + * itself should be returned, not the resource pointed to by the + * link. This flag is set in response to calls to lstat(), is_link(), or + * filetype(). STREAM_URL_STAT_QUIET: if this flag is set, our wrapper + * should not raise any errors. If this flag is not set, we are + * responsible for reporting errors using the trigger_error() function + * during stating of the path. + */ + public function url_stat(string $path, int $flags) + { + $path = static::realPath($path); + + if (Protocol::NO_RESOLUTION === $path) { + if ($flags & \STREAM_URL_STAT_QUIET) { + return 0; + } else { + return \trigger_error( + 'Path '.$path.' cannot be resolved.', + \E_WARNING + ); + } + } + + if ($flags & \STREAM_URL_STAT_LINK) { + return @\lstat($path); + } + + return @\stat($path); + } + + /** + * Get stream resource. + */ + public function getStream() + { + return $this->_stream; + } + + /** + * Get stream name. + */ + public function getStreamName() + { + return $this->_streamName; + } +} + +/* + * Register the `hoa://` protocol. + */ +\stream_wrapper_register('hoa', ProtocolWrapper::class); diff --git a/vendor/psy/psysh/src/Readline/Hoa/Readline.php b/vendor/psy/psysh/src/Readline/Hoa/Readline.php new file mode 100644 index 000000000..0338c9026 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Readline.php @@ -0,0 +1,1032 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Console\Readline. + * + * Read, edit, bind… a line from the input. + */ +class Readline +{ + /** + * State: continue to read. + */ + const STATE_CONTINUE = 1; + + /** + * State: stop to read. + */ + const STATE_BREAK = 2; + + /** + * State: no output the current buffer. + */ + const STATE_NO_ECHO = 4; + + /** + * Current editing line. + */ + protected $_line = null; + + /** + * Current editing line seek. + */ + protected $_lineCurrent = 0; + + /** + * Current editing line length. + */ + protected $_lineLength = 0; + + /** + * Current buffer (most of the time, a char). + */ + protected $_buffer = null; + + /** + * Mapping. + */ + protected $_mapping = []; + + /** + * History. + */ + protected $_history = []; + + /** + * History current position. + */ + protected $_historyCurrent = 0; + + /** + * History size. + */ + protected $_historySize = 0; + + /** + * Prefix. + */ + protected $_prefix = null; + + /** + * Autocompleter. + */ + protected $_autocompleter = null; + + /** + * Initialize the readline editor. + */ + public function __construct() + { + if (\defined('PHP_WINDOWS_VERSION_PLATFORM')) { + return; + } + + $this->_mapping["\033[A"] = [$this, '_bindArrowUp']; + $this->_mapping["\033[B"] = [$this, '_bindArrowDown']; + $this->_mapping["\033[C"] = [$this, '_bindArrowRight']; + $this->_mapping["\033[D"] = [$this, '_bindArrowLeft']; + $this->_mapping["\001"] = [$this, '_bindControlA']; + $this->_mapping["\002"] = [$this, '_bindControlB']; + $this->_mapping["\005"] = [$this, '_bindControlE']; + $this->_mapping["\006"] = [$this, '_bindControlF']; + $this->_mapping["\010"] = + $this->_mapping["\177"] = [$this, '_bindBackspace']; + $this->_mapping["\027"] = [$this, '_bindControlW']; + $this->_mapping["\n"] = [$this, '_bindNewline']; + $this->_mapping["\t"] = [$this, '_bindTab']; + + return; + } + + /** + * Read a line from the input. + */ + public function readLine(string $prefix = null) + { + $input = Console::getInput(); + + if (true === $input->eof()) { + return false; + } + + $direct = Console::isDirect($input->getStream()->getStream()); + $output = Console::getOutput(); + + if (false === $direct || \defined('PHP_WINDOWS_VERSION_PLATFORM')) { + $out = $input->readLine(); + + if (false === $out) { + return false; + } + + $out = \substr($out, 0, -1); + + if (true === $direct) { + $output->writeAll($prefix); + } else { + $output->writeAll($prefix.$out."\n"); + } + + return $out; + } + + $this->resetLine(); + $this->setPrefix($prefix); + $read = [$input->getStream()->getStream()]; + $write = $except = []; + $output->writeAll($prefix); + + while (true) { + @\stream_select($read, $write, $except, 30, 0); + + if (empty($read)) { + $read = [$input->getStream()->getStream()]; + + continue; + } + + $char = $this->_read(); + $this->_buffer = $char; + $return = $this->_readLine($char); + + if (0 === ($return & self::STATE_NO_ECHO)) { + $output->writeAll($this->_buffer); + } + + if (0 !== ($return & self::STATE_BREAK)) { + break; + } + } + + return $this->getLine(); + } + + /** + * Readline core. + */ + public function _readLine(string $char) + { + if (isset($this->_mapping[$char]) && + \is_callable($this->_mapping[$char])) { + $mapping = $this->_mapping[$char]; + + return $mapping($this); + } + + if (isset($this->_mapping[$char])) { + $this->_buffer = $this->_mapping[$char]; + } elseif (false === Ustring::isCharPrintable($char)) { + ConsoleCursor::bip(); + + return static::STATE_CONTINUE | static::STATE_NO_ECHO; + } + + if ($this->getLineLength() === $this->getLineCurrent()) { + $this->appendLine($this->_buffer); + + return static::STATE_CONTINUE; + } + + $this->insertLine($this->_buffer); + $tail = \mb_substr( + $this->getLine(), + $this->getLineCurrent() - 1 + ); + $this->_buffer = "\033[K".$tail.\str_repeat( + "\033[D", + \mb_strlen($tail) - 1 + ); + + return static::STATE_CONTINUE; + } + + /** + * Add mappings. + */ + public function addMappings(array $mappings) + { + foreach ($mappings as $key => $mapping) { + $this->addMapping($key, $mapping); + } + } + + /** + * Add a mapping. + * Supported key: + * • \e[… for \033[…; + * • \C-… for Ctrl-…; + * • abc for a simple mapping. + * A mapping is a callable that has only one parameter of type + * Hoa\Console\Readline and that returns a self::STATE_* constant. + */ + public function addMapping(string $key, $mapping) + { + if ('\e[' === \substr($key, 0, 3)) { + $this->_mapping["\033[".\substr($key, 3)] = $mapping; + } elseif ('\C-' === \substr($key, 0, 3)) { + $_key = \ord(\strtolower(\substr($key, 3))) - 96; + $this->_mapping[\chr($_key)] = $mapping; + } else { + $this->_mapping[$key] = $mapping; + } + } + + /** + * Add an entry in the history. + */ + public function addHistory(string $line = null) + { + if (empty($line)) { + return; + } + + $this->_history[] = $line; + $this->_historyCurrent = $this->_historySize++; + } + + /** + * Clear history. + */ + public function clearHistory() + { + unset($this->_history); + $this->_history = []; + $this->_historyCurrent = 0; + $this->_historySize = 1; + } + + /** + * Get an entry in the history. + */ + public function getHistory(int $i = null) + { + if (null === $i) { + $i = $this->_historyCurrent; + } + + if (!isset($this->_history[$i])) { + return null; + } + + return $this->_history[$i]; + } + + /** + * Go backward in the history. + */ + public function previousHistory() + { + if (0 >= $this->_historyCurrent) { + return $this->getHistory(0); + } + + return $this->getHistory($this->_historyCurrent--); + } + + /** + * Go forward in the history. + */ + public function nextHistory() + { + if ($this->_historyCurrent + 1 >= $this->_historySize) { + return $this->getLine(); + } + + return $this->getHistory(++$this->_historyCurrent); + } + + /** + * Get current line. + */ + public function getLine() + { + return $this->_line; + } + + /** + * Append to current line. + */ + public function appendLine(string $append) + { + $this->_line .= $append; + $this->_lineLength = \mb_strlen($this->_line); + $this->_lineCurrent = $this->_lineLength; + } + + /** + * Insert into current line at the current seek. + */ + public function insertLine(string $insert) + { + if ($this->_lineLength === $this->_lineCurrent) { + return $this->appendLine($insert); + } + + $this->_line = \mb_substr($this->_line, 0, $this->_lineCurrent). + $insert. + \mb_substr($this->_line, $this->_lineCurrent); + $this->_lineLength = \mb_strlen($this->_line); + $this->_lineCurrent += \mb_strlen($insert); + + return; + } + + /** + * Reset current line. + */ + protected function resetLine() + { + $this->_line = null; + $this->_lineCurrent = 0; + $this->_lineLength = 0; + } + + /** + * Get current line seek. + */ + public function getLineCurrent(): int + { + return $this->_lineCurrent; + } + + /** + * Get current line length. + * + * @return int + */ + public function getLineLength(): int + { + return $this->_lineLength; + } + + /** + * Set prefix. + */ + public function setPrefix(string $prefix) + { + $this->_prefix = $prefix; + } + + /** + * Get prefix. + */ + public function getPrefix() + { + return $this->_prefix; + } + + /** + * Get buffer. Not for user. + */ + public function getBuffer() + { + return $this->_buffer; + } + + /** + * Set an autocompleter. + */ + public function setAutocompleter(Autocompleter $autocompleter) + { + $old = $this->_autocompleter; + $this->_autocompleter = $autocompleter; + + return $old; + } + + /** + * Get the autocompleter. + * + * @return ?Autocompleter + */ + public function getAutocompleter() + { + return $this->_autocompleter; + } + + /** + * Read on input. Not for user. + */ + public function _read(int $length = 512): string + { + return Console::getInput()->read($length); + } + + /** + * Set current line. Not for user. + */ + public function setLine(string $line) + { + $this->_line = $line; + $this->_lineLength = \mb_strlen($this->_line ?: ''); + $this->_lineCurrent = $this->_lineLength; + } + + /** + * Set current line seek. Not for user. + */ + public function setLineCurrent(int $current) + { + $this->_lineCurrent = $current; + } + + /** + * Set line length. Not for user. + */ + public function setLineLength(int $length) + { + $this->_lineLength = $length; + } + + /** + * Set buffer. Not for user. + */ + public function setBuffer(string $buffer) + { + $this->_buffer = $buffer; + } + + /** + * Up arrow binding. + * Go backward in the history. + */ + public function _bindArrowUp(self $self): int + { + if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) { + ConsoleCursor::clear('↔'); + Console::getOutput()->writeAll($self->getPrefix()); + } + $buffer = $self->previousHistory() ?? ''; + $self->setBuffer($buffer); + $self->setLine($buffer); + + return static::STATE_CONTINUE; + } + + /** + * Down arrow binding. + * Go forward in the history. + */ + public function _bindArrowDown(self $self): int + { + if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) { + ConsoleCursor::clear('↔'); + Console::getOutput()->writeAll($self->getPrefix()); + } + + $self->setBuffer($buffer = $self->nextHistory()); + $self->setLine($buffer); + + return static::STATE_CONTINUE; + } + + /** + * Right arrow binding. + * Move cursor to the right. + */ + public function _bindArrowRight(self $self): int + { + if ($self->getLineLength() > $self->getLineCurrent()) { + if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) { + ConsoleCursor::move('→'); + } + + $self->setLineCurrent($self->getLineCurrent() + 1); + } + + $self->setBuffer(''); + + return static::STATE_CONTINUE; + } + + /** + * Left arrow binding. + * Move cursor to the left. + */ + public function _bindArrowLeft(self $self): int + { + if (0 < $self->getLineCurrent()) { + if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) { + ConsoleCursor::move('←'); + } + + $self->setLineCurrent($self->getLineCurrent() - 1); + } + + $self->setBuffer(''); + + return static::STATE_CONTINUE; + } + + /** + * Backspace and Control-H binding. + * Delete the first character at the right of the cursor. + */ + public function _bindBackspace(self $self): int + { + $buffer = ''; + + if (0 < $self->getLineCurrent()) { + if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) { + ConsoleCursor::move('←'); + ConsoleCursor::clear('→'); + } + + if ($self->getLineLength() === $current = $self->getLineCurrent()) { + $self->setLine(\mb_substr($self->getLine(), 0, -1)); + } else { + $line = $self->getLine(); + $current = $self->getLineCurrent(); + $tail = \mb_substr($line, $current); + $buffer = $tail.\str_repeat("\033[D", \mb_strlen($tail)); + $self->setLine(\mb_substr($line, 0, $current - 1).$tail); + $self->setLineCurrent($current - 1); + } + } + + $self->setBuffer($buffer); + + return static::STATE_CONTINUE; + } + + /** + * Control-A binding. + * Move cursor to beginning of line. + */ + public function _bindControlA(self $self): int + { + for ($i = $self->getLineCurrent() - 1; 0 <= $i; --$i) { + $self->_bindArrowLeft($self); + } + + return static::STATE_CONTINUE; + } + + /** + * Control-B binding. + * Move cursor backward one word. + */ + public function _bindControlB(self $self): int + { + $current = $self->getLineCurrent(); + + if (0 === $current) { + return static::STATE_CONTINUE; + } + + $words = \preg_split( + '#\b#u', + $self->getLine(), + -1, + \PREG_SPLIT_OFFSET_CAPTURE | \PREG_SPLIT_NO_EMPTY + ); + + for ( + $i = 0, $max = \count($words) - 1; + $i < $max && $words[$i + 1][1] < $current; + ++$i + ) { + } + + for ($j = $words[$i][1] + 1; $current >= $j; ++$j) { + $self->_bindArrowLeft($self); + } + + return static::STATE_CONTINUE; + } + + /** + * Control-E binding. + * Move cursor to end of line. + */ + public function _bindControlE(self $self): int + { + for ( + $i = $self->getLineCurrent(), $max = $self->getLineLength(); + $i < $max; + ++$i + ) { + $self->_bindArrowRight($self); + } + + return static::STATE_CONTINUE; + } + + /** + * Control-F binding. + * Move cursor forward one word. + */ + public function _bindControlF(self $self): int + { + $current = $self->getLineCurrent(); + + if ($self->getLineLength() === $current) { + return static::STATE_CONTINUE; + } + + $words = \preg_split( + '#\b#u', + $self->getLine(), + -1, + \PREG_SPLIT_OFFSET_CAPTURE | \PREG_SPLIT_NO_EMPTY + ); + + for ( + $i = 0, $max = \count($words) - 1; + $i < $max && $words[$i][1] < $current; + ++$i + ) { + } + + if (!isset($words[$i + 1])) { + $words[$i + 1] = [1 => $self->getLineLength()]; + } + + for ($j = $words[$i + 1][1]; $j > $current; --$j) { + $self->_bindArrowRight($self); + } + + return static::STATE_CONTINUE; + } + + /** + * Control-W binding. + * Delete first backward word. + */ + public function _bindControlW(self $self): int + { + $current = $self->getLineCurrent(); + + if (0 === $current) { + return static::STATE_CONTINUE; + } + + $words = \preg_split( + '#\b#u', + $self->getLine(), + -1, + \PREG_SPLIT_OFFSET_CAPTURE | \PREG_SPLIT_NO_EMPTY + ); + + for ( + $i = 0, $max = \count($words) - 1; + $i < $max && $words[$i + 1][1] < $current; + ++$i + ) { + } + + for ($j = $words[$i][1] + 1; $current >= $j; ++$j) { + $self->_bindBackspace($self); + } + + return static::STATE_CONTINUE; + } + + /** + * Newline binding. + */ + public function _bindNewline(self $self): int + { + $self->addHistory($self->getLine()); + + return static::STATE_BREAK; + } + + /** + * Tab binding. + */ + public function _bindTab(self $self): int + { + $output = Console::getOutput(); + $autocompleter = $self->getAutocompleter(); + $state = static::STATE_CONTINUE | static::STATE_NO_ECHO; + + if (null === $autocompleter) { + return $state; + } + + $current = $self->getLineCurrent(); + $line = $self->getLine(); + + if (0 === $current) { + return $state; + } + + $matches = \preg_match_all( + '#'.$autocompleter->getWordDefinition().'$#u', + \mb_substr($line, 0, $current), + $words + ); + + if (0 === $matches) { + return $state; + } + + $word = $words[0][0]; + + if ('' === \trim($word)) { + return $state; + } + + $solution = $autocompleter->complete($word); + $length = \mb_strlen($word); + + if (null === $solution) { + return $state; + } + + if (\is_array($solution)) { + $_solution = $solution; + $count = \count($_solution) - 1; + $cWidth = 0; + $window = ConsoleWindow::getSize(); + $wWidth = $window['x']; + $cursor = ConsoleCursor::getPosition(); + + \array_walk($_solution, function (&$value) use (&$cWidth) { + $handle = \mb_strlen($value); + + if ($handle > $cWidth) { + $cWidth = $handle; + } + + return; + }); + \array_walk($_solution, function (&$value) use (&$cWidth) { + $handle = \mb_strlen($value); + + if ($handle >= $cWidth) { + return; + } + + $value .= \str_repeat(' ', $cWidth - $handle); + + return; + }); + + $mColumns = (int) \floor($wWidth / ($cWidth + 2)); + $mLines = (int) \ceil(($count + 1) / $mColumns); + --$mColumns; + $i = 0; + + if (0 > $window['y'] - $cursor['y'] - $mLines) { + ConsoleWindow::scroll('↑', $mLines); + ConsoleCursor::move('↑', $mLines); + } + + ConsoleCursor::save(); + ConsoleCursor::hide(); + ConsoleCursor::move('↓ LEFT'); + ConsoleCursor::clear('↓'); + + foreach ($_solution as $j => $s) { + $output->writeAll("\033[0m".$s."\033[0m"); + + if ($i++ < $mColumns) { + $output->writeAll(' '); + } else { + $i = 0; + + if (isset($_solution[$j + 1])) { + $output->writeAll("\n"); + } + } + } + + ConsoleCursor::restore(); + ConsoleCursor::show(); + + ++$mColumns; + $input = Console::getInput(); + $read = [$input->getStream()->getStream()]; + $write = $except = []; + $mColumn = -1; + $mLine = -1; + $coord = -1; + $unselect = function () use ( + &$mColumn, + &$mLine, + &$coord, + &$_solution, + &$cWidth, + $output + ) { + ConsoleCursor::save(); + ConsoleCursor::hide(); + ConsoleCursor::move('↓ LEFT'); + ConsoleCursor::move('→', $mColumn * ($cWidth + 2)); + ConsoleCursor::move('↓', $mLine); + $output->writeAll("\033[0m".$_solution[$coord]."\033[0m"); + ConsoleCursor::restore(); + ConsoleCursor::show(); + + return; + }; + $select = function () use ( + &$mColumn, + &$mLine, + &$coord, + &$_solution, + &$cWidth, + $output + ) { + ConsoleCursor::save(); + ConsoleCursor::hide(); + ConsoleCursor::move('↓ LEFT'); + ConsoleCursor::move('→', $mColumn * ($cWidth + 2)); + ConsoleCursor::move('↓', $mLine); + $output->writeAll("\033[7m".$_solution[$coord]."\033[0m"); + ConsoleCursor::restore(); + ConsoleCursor::show(); + + return; + }; + $init = function () use ( + &$mColumn, + &$mLine, + &$coord, + &$select + ) { + $mColumn = 0; + $mLine = 0; + $coord = 0; + $select(); + + return; + }; + + while (true) { + @\stream_select($read, $write, $except, 30, 0); + + if (empty($read)) { + $read = [$input->getStream()->getStream()]; + + continue; + } + + switch ($char = $self->_read()) { + case "\033[A": + if (-1 === $mColumn && -1 === $mLine) { + $init(); + + break; + } + + $unselect(); + $coord = \max(0, $coord - $mColumns); + $mLine = (int) \floor($coord / $mColumns); + $mColumn = $coord % $mColumns; + $select(); + + break; + + case "\033[B": + if (-1 === $mColumn && -1 === $mLine) { + $init(); + + break; + } + + $unselect(); + $coord = \min($count, $coord + $mColumns); + $mLine = (int) \floor($coord / $mColumns); + $mColumn = $coord % $mColumns; + $select(); + + break; + + case "\t": + case "\033[C": + if (-1 === $mColumn && -1 === $mLine) { + $init(); + + break; + } + + $unselect(); + $coord = \min($count, $coord + 1); + $mLine = (int) \floor($coord / $mColumns); + $mColumn = $coord % $mColumns; + $select(); + + break; + + case "\033[D": + if (-1 === $mColumn && -1 === $mLine) { + $init(); + + break; + } + + $unselect(); + $coord = \max(0, $coord - 1); + $mLine = (int) \floor($coord / $mColumns); + $mColumn = $coord % $mColumns; + $select(); + + break; + + case "\n": + if (-1 !== $mColumn && -1 !== $mLine) { + $tail = \mb_substr($line, $current); + $current -= $length; + $self->setLine( + \mb_substr($line, 0, $current). + $solution[$coord]. + $tail + ); + $self->setLineCurrent( + $current + \mb_strlen($solution[$coord]) + ); + + ConsoleCursor::move('←', $length); + $output->writeAll($solution[$coord]); + ConsoleCursor::clear('→'); + $output->writeAll($tail); + ConsoleCursor::move('←', \mb_strlen($tail)); + } + + // no break + default: + $mColumn = -1; + $mLine = -1; + $coord = -1; + ConsoleCursor::save(); + ConsoleCursor::move('↓ LEFT'); + ConsoleCursor::clear('↓'); + ConsoleCursor::restore(); + + if ("\033" !== $char && "\n" !== $char) { + $self->setBuffer($char); + + return $self->_readLine($char); + } + + break 2; + } + } + + return $state; + } + + $tail = \mb_substr($line, $current); + $current -= $length; + $self->setLine( + \mb_substr($line, 0, $current). + $solution. + $tail + ); + $self->setLineCurrent( + $current + \mb_strlen($solution) + ); + + ConsoleCursor::move('←', $length); + $output->writeAll($solution); + ConsoleCursor::clear('→'); + $output->writeAll($tail); + ConsoleCursor::move('←', \mb_strlen($tail)); + + return $state; + } +} + +/* + * Advanced interaction. + */ +Console::advancedInteraction(); diff --git a/vendor/psy/psysh/src/Readline/Hoa/Stream.php b/vendor/psy/psysh/src/Readline/Hoa/Stream.php new file mode 100644 index 000000000..62e56ce3f --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Stream.php @@ -0,0 +1,571 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Stream. + * + * Static register for all streams (files, sockets etc.). + */ +abstract class Stream implements IStream, EventListenable +{ + use EventListens; + + /** + * Name index in the stream bucket. + */ + const NAME = 0; + + /** + * Handler index in the stream bucket. + */ + const HANDLER = 1; + + /** + * Resource index in the stream bucket. + */ + const RESOURCE = 2; + + /** + * Context index in the stream bucket. + */ + const CONTEXT = 3; + + /** + * Default buffer size. + */ + const DEFAULT_BUFFER_SIZE = 8192; + + /** + * Current stream bucket. + */ + protected $_bucket = []; + + /** + * Static stream register. + */ + private static $_register = []; + + /** + * Buffer size (default is 8Ko). + */ + protected $_bufferSize = self::DEFAULT_BUFFER_SIZE; + + /** + * Original stream name, given to the stream constructor. + */ + protected $_streamName = null; + + /** + * Context name. + */ + protected $_context = null; + + /** + * Whether the opening has been deferred. + */ + protected $_hasBeenDeferred = false; + + /** + * Whether this stream is already opened by another handler. + */ + protected $_borrowing = false; + + /** + * Set the current stream. + * If not exists in the register, try to call the + * `$this->_open()` method. Please, see the `self::_getStream()` method. + */ + public function __construct(string $streamName, string $context = null, bool $wait = false) + { + $this->_streamName = $streamName; + $this->_context = $context; + $this->_hasBeenDeferred = $wait; + $this->setListener( + new EventListener( + $this, + [ + 'authrequire', + 'authresult', + 'complete', + 'connect', + 'failure', + 'mimetype', + 'progress', + 'redirect', + 'resolve', + 'size', + ] + ) + ); + + if (true === $wait) { + return; + } + + $this->open(); + + return; + } + + /** + * Get a stream in the register. + * If the stream does not exist, try to open it by calling the + * $handler->_open() method. + */ + private static function &_getStream( + string $streamName, + self $handler, + string $context = null + ): array { + $name = \md5($streamName); + + if (null !== $context) { + if (false === StreamContext::contextExists($context)) { + throw new StreamException('Context %s was not previously declared, cannot retrieve '.'this context.', 0, $context); + } + + $context = StreamContext::getInstance($context); + } + + if (!isset(self::$_register[$name])) { + self::$_register[$name] = [ + self::NAME => $streamName, + self::HANDLER => $handler, + self::RESOURCE => $handler->_open($streamName, $context), + self::CONTEXT => $context, + ]; + Event::register( + 'hoa://Event/Stream/'.$streamName, + $handler + ); + // Add :open-ready? + Event::register( + 'hoa://Event/Stream/'.$streamName.':close-before', + $handler + ); + } else { + $handler->_borrowing = true; + } + + if (null === self::$_register[$name][self::RESOURCE]) { + self::$_register[$name][self::RESOURCE] + = $handler->_open($streamName, $context); + } + + return self::$_register[$name]; + } + + /** + * Open the stream and return the associated resource. + * Note: This method is protected, but do not forget that it could be + * overloaded into a public context. + */ + abstract protected function &_open(string $streamName, StreamContext $context = null); + + /** + * Close the current stream. + * Note: this method is protected, but do not forget that it could be + * overloaded into a public context. + */ + abstract protected function _close(): bool; + + /** + * Open the stream. + */ + final public function open(): self + { + $context = $this->_context; + + if (true === $this->hasBeenDeferred()) { + if (null === $context) { + $handle = StreamContext::getInstance(\uniqid()); + $handle->setParameters([ + 'notification' => [$this, '_notify'], + ]); + $context = $handle->getId(); + } elseif (true === StreamContext::contextExists($context)) { + $handle = StreamContext::getInstance($context); + $parameters = $handle->getParameters(); + + if (!isset($parameters['notification'])) { + $handle->setParameters([ + 'notification' => [$this, '_notify'], + ]); + } + } + } + + $this->_bufferSize = self::DEFAULT_BUFFER_SIZE; + $this->_bucket = self::_getStream( + $this->_streamName, + $this, + $context + ); + + return $this; + } + + /** + * Close the current stream. + */ + final public function close() + { + $streamName = $this->getStreamName(); + + if (null === $streamName) { + return; + } + + $name = \md5($streamName); + + if (!isset(self::$_register[$name])) { + return; + } + + Event::notify( + 'hoa://Event/Stream/'.$streamName.':close-before', + $this, + new EventBucket() + ); + + if (false === $this->_close()) { + return; + } + + unset(self::$_register[$name]); + $this->_bucket[self::HANDLER] = null; + Event::unregister( + 'hoa://Event/Stream/'.$streamName + ); + Event::unregister( + 'hoa://Event/Stream/'.$streamName.':close-before' + ); + + return; + } + + /** + * Get the current stream name. + */ + public function getStreamName() + { + if (empty($this->_bucket)) { + return null; + } + + return $this->_bucket[self::NAME]; + } + + /** + * Get the current stream. + */ + public function getStream() + { + if (empty($this->_bucket)) { + return null; + } + + return $this->_bucket[self::RESOURCE]; + } + + /** + * Get the current stream context. + */ + public function getStreamContext() + { + if (empty($this->_bucket)) { + return null; + } + + return $this->_bucket[self::CONTEXT]; + } + + /** + * Get stream handler according to its name. + */ + public static function getStreamHandler(string $streamName) + { + $name = \md5($streamName); + + if (!isset(self::$_register[$name])) { + return null; + } + + return self::$_register[$name][self::HANDLER]; + } + + /** + * Set the current stream. Useful to manage a stack of streams (e.g. socket + * and select). Notice that it could be unsafe to use this method without + * taking time to think about it two minutes. Resource of type “Unknown” is + * considered as valid. + */ + public function _setStream($stream) + { + if (false === \is_resource($stream) && + ('resource' !== \gettype($stream) || + 'Unknown' !== \get_resource_type($stream))) { + throw new StreamException('Try to change the stream resource with an invalid one; '.'given %s.', 1, \gettype($stream)); + } + + $old = $this->_bucket[self::RESOURCE]; + $this->_bucket[self::RESOURCE] = $stream; + + return $old; + } + + /** + * Check if the stream is opened. + */ + public function isOpened(): bool + { + return \is_resource($this->getStream()); + } + + /** + * Set the timeout period. + */ + public function setStreamTimeout(int $seconds, int $microseconds = 0): bool + { + return \stream_set_timeout($this->getStream(), $seconds, $microseconds); + } + + /** + * Whether the opening of the stream has been deferred. + */ + protected function hasBeenDeferred() + { + return $this->_hasBeenDeferred; + } + + /** + * Check whether the connection has timed out or not. + * This is basically a shortcut of `getStreamMetaData` + the `timed_out` + * index, but the resulting code is more readable. + */ + public function hasTimedOut(): bool + { + $metaData = $this->getStreamMetaData(); + + return true === $metaData['timed_out']; + } + + /** + * Set blocking/non-blocking mode. + */ + public function setStreamBlocking(bool $mode): bool + { + return \stream_set_blocking($this->getStream(), $mode); + } + + /** + * Set stream buffer. + * Output using fwrite() (or similar function) is normally buffered at 8 Ko. + * This means that if there are two processes wanting to write to the same + * output stream, each is paused after 8 Ko of data to allow the other to + * write. + */ + public function setStreamBuffer(int $buffer): bool + { + // Zero means success. + $out = 0 === \stream_set_write_buffer($this->getStream(), $buffer); + + if (true === $out) { + $this->_bufferSize = $buffer; + } + + return $out; + } + + /** + * Disable stream buffering. + * Alias of $this->setBuffer(0). + */ + public function disableStreamBuffer(): bool + { + return $this->setStreamBuffer(0); + } + + /** + * Get stream buffer size. + */ + public function getStreamBufferSize(): int + { + return $this->_bufferSize; + } + + /** + * Get stream wrapper name. + */ + public function getStreamWrapperName(): string + { + if (false === $pos = \strpos($this->getStreamName(), '://')) { + return 'file'; + } + + return \substr($this->getStreamName(), 0, $pos); + } + + /** + * Get stream meta data. + */ + public function getStreamMetaData(): array + { + return \stream_get_meta_data($this->getStream()); + } + + /** + * Whether this stream is already opened by another handler. + */ + public function isBorrowing(): bool + { + return $this->_borrowing; + } + + /** + * Notification callback. + */ + public function _notify( + int $ncode, + int $severity, + $message, + $code, + $transferred, + $max + ) { + static $_map = [ + \STREAM_NOTIFY_AUTH_REQUIRED => 'authrequire', + \STREAM_NOTIFY_AUTH_RESULT => 'authresult', + \STREAM_NOTIFY_COMPLETED => 'complete', + \STREAM_NOTIFY_CONNECT => 'connect', + \STREAM_NOTIFY_FAILURE => 'failure', + \STREAM_NOTIFY_MIME_TYPE_IS => 'mimetype', + \STREAM_NOTIFY_PROGRESS => 'progress', + \STREAM_NOTIFY_REDIRECTED => 'redirect', + \STREAM_NOTIFY_RESOLVE => 'resolve', + \STREAM_NOTIFY_FILE_SIZE_IS => 'size', + ]; + + $this->getListener()->fire($_map[$ncode], new EventBucket([ + 'code' => $code, + 'severity' => $severity, + 'message' => $message, + 'transferred' => $transferred, + 'max' => $max, + ])); + } + + /** + * Call the $handler->close() method on each stream in the static stream + * register. + * This method does not check the return value of $handler->close(). Thus, + * if a stream is persistent, the $handler->close() should do anything. It + * is a very generic method. + */ + final public static function _Hoa_Stream() + { + foreach (self::$_register as $entry) { + $entry[self::HANDLER]->close(); + } + + return; + } + + /** + * Transform object to string. + */ + public function __toString(): string + { + return $this->getStreamName(); + } + + /** + * Close the stream when destructing. + */ + public function __destruct() + { + if (false === $this->isOpened()) { + return; + } + + $this->close(); + + return; + } +} + +/** + * Class \Hoa\Stream\_Protocol. + * + * The `hoa://Library/Stream` node. + * + * @license New BSD License + */ +class _Protocol extends ProtocolNode +{ + /** + * Component's name. + * + * @var string + */ + protected $_name = 'Stream'; + + /** + * ID of the component. + * + * @param string $id ID of the component + * + * @return mixed + */ + public function reachId(string $id) + { + return Stream::getStreamHandler($id); + } +} + +/* + * Shutdown method. + */ +\register_shutdown_function([Stream::class, '_Hoa_Stream']); + +/** + * Add the `hoa://Library/Stream` node. Should be use to reach/get an entry + * in the stream register. + */ +$protocol = Protocol::getInstance(); +$protocol['Library'][] = new _Protocol(); diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamBufferable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamBufferable.php new file mode 100644 index 000000000..e431021a8 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamBufferable.php @@ -0,0 +1,73 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Bufferable. + * + * Interface for bufferable streams. It's complementary to native buffer support + * of Hoa\Stream (please, see *StreamBuffer*() methods). Classes implementing + * this interface are able to create nested buffers, flush them etc. + */ +interface StreamBufferable extends IStream +{ + /** + * Start a new buffer. + * The callable acts like a light filter. + */ + public function newBuffer($callable = null, int $size = null): int; + + /** + * Flush the buffer. + */ + public function flush(); + + /** + * Delete buffer. + */ + public function deleteBuffer(): bool; + + /** + * Get bufffer level. + */ + public function getBufferLevel(): int; + + /** + * Get buffer size. + */ + public function getBufferSize(): int; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamContext.php b/vendor/psy/psysh/src/Readline/Hoa/StreamContext.php new file mode 100644 index 000000000..f7ec2f1dd --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamContext.php @@ -0,0 +1,141 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Stream\Context. + * + * Make a multiton of stream contexts. + */ +class StreamContext +{ + /** + * Context ID. + */ + protected $_id = null; + + /** + * @var resource + */ + protected $_context; + + /** + * Multiton. + */ + protected static $_instances = []; + + /** + * Construct a context. + */ + protected function __construct($id) + { + $this->_id = $id; + $this->_context = \stream_context_create(); + + return; + } + + /** + * Multiton. + */ + public static function getInstance(string $id): self + { + if (false === static::contextExists($id)) { + static::$_instances[$id] = new self($id); + } + + return static::$_instances[$id]; + } + + /** + * Get context ID. + */ + public function getId(): string + { + return $this->_id; + } + + /** + * Check if a context exists. + */ + public static function contextExists(string $id): bool + { + return \array_key_exists($id, static::$_instances); + } + + /** + * Set options. + * Please, see http://php.net/context. + */ + public function setOptions(array $options): bool + { + return \stream_context_set_option($this->getContext(), $options); + } + + /** + * Set parameters. + * Please, see http://php.net/context.params. + */ + public function setParameters(array $parameters): bool + { + return \stream_context_set_params($this->getContext(), $parameters); + } + + /** + * Get options. + */ + public function getOptions(): array + { + return \stream_context_get_options($this->getContext()); + } + + /** + * Get parameters. + */ + public function getParameters(): array + { + return \stream_context_get_params($this->getContext()); + } + + /** + * Get context as a resource. + */ + public function getContext() + { + return $this->_context; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamException.php b/vendor/psy/psysh/src/Readline/Hoa/StreamException.php new file mode 100644 index 000000000..21da03cfb --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamException.php @@ -0,0 +1,46 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Class \Hoa\Stream\Exception. + * + * Extending the \Hoa\Exception\Exception class. + */ +class StreamException extends Exception +{ +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamIn.php b/vendor/psy/psysh/src/Readline/Hoa/StreamIn.php new file mode 100644 index 000000000..1ced9135b --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamIn.php @@ -0,0 +1,102 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\In. + * + * Interface for input. + */ +interface StreamIn extends IStream +{ + /** + * Test for end-of-stream. + */ + public function eof(): bool; + + /** + * Read n characters. + */ + public function read(int $length); + + /** + * Alias of $this->read(). + */ + public function readString(int $length); + + /** + * Read a character. + * It could be equivalent to $this->read(1). + */ + public function readCharacter(); + + /** + * Read a boolean. + */ + public function readBoolean(); + + /** + * Read an integer. + */ + public function readInteger(int $length = 1); + + /** + * Read a float. + */ + public function readFloat(int $length = 1); + + /** + * Read an array. + * In most cases, it could be an alias to the $this->scanf() method. + */ + public function readArray(); + + /** + * Read a line. + */ + public function readLine(); + + /** + * Read all, i.e. read as much as possible. + */ + public function readAll(int $offset = 0); + + /** + * Parse input from a stream according to a format. + */ + public function scanf(string $format): array; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamLockable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamLockable.php new file mode 100644 index 000000000..c19c4dba0 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamLockable.php @@ -0,0 +1,85 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Lockable. + * + * Interface for lockable input/output. + * + * @license New BSD License + */ +interface StreamLockable extends IStream +{ + /** + * Acquire a shared lock (reader). + * + * @const int + */ + const LOCK_SHARED = \LOCK_SH; + + /** + * Acquire an exclusive lock (writer). + * + * @const int + */ + const LOCK_EXCLUSIVE = \LOCK_EX; + + /** + * Release a lock (shared or exclusive). + * + * @const int + */ + const LOCK_RELEASE = \LOCK_UN; + + /** + * If we do not want $this->lock() to block while locking. + * + * @const int + */ + const LOCK_NO_BLOCK = \LOCK_NB; + + /** + * Portable advisory locking. + * Should take a look at stream_supports_lock(). + * + * @param int $operation operation, use the self::LOCK_* constants + * + * @return bool + */ + public function lock(int $operation): bool; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamOut.php b/vendor/psy/psysh/src/Readline/Hoa/StreamOut.php new file mode 100644 index 000000000..e4bb925e1 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamOut.php @@ -0,0 +1,95 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Out. + * + * Interface for output. + */ +interface StreamOut extends IStream +{ + /** + * Write n characters. + */ + public function write(string $string, int $length); + + /** + * Write a string. + */ + public function writeString(string $string); + + /** + * Write a character. + */ + public function writeCharacter(string $character); + + /** + * Write a boolean. + */ + public function writeBoolean(bool $boolean); + + /** + * Write an integer. + */ + public function writeInteger(int $integer); + + /** + * Write a float. + */ + public function writeFloat(float $float); + + /** + * Write an array. + */ + public function writeArray(array $array); + + /** + * Write a line. + */ + public function writeLine(string $line); + + /** + * Write all, i.e. as much as possible. + */ + public function writeAll(string $string); + + /** + * Truncate a stream to a given length. + */ + public function truncate(int $size): bool; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamPathable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamPathable.php new file mode 100644 index 000000000..558684aed --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamPathable.php @@ -0,0 +1,55 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Pathable. + * + * Interface for pathable input/output. + */ +interface StreamPathable extends IStream +{ + /** + * Get filename component of path. + */ + public function getBasename(): string; + + /** + * Get directory name component of path. + */ + public function getDirname(): string; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamPointable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamPointable.php new file mode 100644 index 000000000..4030acbd3 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamPointable.php @@ -0,0 +1,75 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Pointable. + * + * Interface for pointable input/output. + */ +interface StreamPointable extends IStream +{ + /** + * Set position equal to $offset bytes. + */ + const SEEK_SET = \SEEK_SET; + + /** + * Set position to current location plus $offset. + */ + const SEEK_CURRENT = \SEEK_CUR; + + /** + * Set position to end-of-file plus $offset. + */ + const SEEK_END = \SEEK_END; + + /** + * Rewind the position of a stream pointer. + */ + public function rewind(): bool; + + /** + * Seek on a stream pointer. + */ + public function seek(int $offset, int $whence = self::SEEK_SET): int; + + /** + * Get the current position of the stream pointer. + */ + public function tell(): int; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamStatable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamStatable.php new file mode 100644 index 000000000..9b83696db --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamStatable.php @@ -0,0 +1,115 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Statable. + * + * Interface for statable input/output. + */ +interface StreamStatable extends IStream +{ + /** + * Size is undefined. + */ + const SIZE_UNDEFINED = -1; + + /** + * Get size. + */ + public function getSize(): int; + + /** + * Get informations about a file. + */ + public function getStatistic(): array; + + /** + * Get last access time of file. + */ + public function getATime(): int; + + /** + * Get inode change time of file. + */ + public function getCTime(): int; + + /** + * Get file modification time. + */ + public function getMTime(): int; + + /** + * Get file group. + */ + public function getGroup(): int; + + /** + * Get file owner. + */ + public function getOwner(): int; + + /** + * Get file permissions. + */ + public function getPermissions(): int; + + /** + * Check if the file is readable. + */ + public function isReadable(): bool; + + /** + * Check if the file is writable. + */ + public function isWritable(): bool; + + /** + * Check if the file is executable. + */ + public function isExecutable(): bool; + + /** + * Clear file status cache. + */ + public function clearStatisticCache(); + + /** + * Clear all files status cache. + */ + public static function clearAllStatisticCaches(); +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/StreamTouchable.php b/vendor/psy/psysh/src/Readline/Hoa/StreamTouchable.php new file mode 100644 index 000000000..08b75255f --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/StreamTouchable.php @@ -0,0 +1,110 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Interface \Hoa\Stream\IStream\Touchable. + * + * Interface for touchable input/output. + */ +interface StreamTouchable extends IStream +{ + /** + * Overwrite file if already exists. + */ + const OVERWRITE = true; + + /** + * Do not overwrite file if already exists. + */ + const DO_NOT_OVERWRITE = false; + + /** + * Make directory if does not exist. + */ + const MAKE_DIRECTORY = true; + + /** + * Do not make directory if does not exist. + */ + const DO_NOT_MAKE_DIRECTORY = false; + + /** + * Set access and modification time of file. + */ + public function touch(int $time = -1, int $atime = -1): bool; + + /** + * Copy file. + * Return the destination file path if succeed, false otherwise. + */ + public function copy(string $to, bool $force = self::DO_NOT_OVERWRITE): bool; + + /** + * Move a file. + */ + public function move( + string $name, + bool $force = self::DO_NOT_OVERWRITE, + bool $mkdir = self::DO_NOT_MAKE_DIRECTORY + ): bool; + + /** + * Delete a file. + */ + public function delete(): bool; + + /** + * Change file group. + */ + public function changeGroup($group): bool; + + /** + * Change file mode. + */ + public function changeMode(int $mode): bool; + + /** + * Change file owner. + */ + public function changeOwner($user): bool; + + /** + * Change the current umask. + */ + public static function umask(int $umask = null): int; +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Terminfo/77/windows-ansi b/vendor/psy/psysh/src/Readline/Hoa/Terminfo/77/windows-ansi new file mode 100644 index 0000000000000000000000000000000000000000..50864235f466bd89a7022f880fb565e26ca7e298 GIT binary patch literal 1481 zcmds%O=uHQ5Xa}O#Rf~ELJzHx(#vYJjb@Y07po@KfK^in+CyoOnr4e#ZPJ)TTWwSD z<k5qOg7x4*!GmB?FJAm;y?GVXf*uq+`gzcc@jv^K&A|$u1Q-4@zc({)-rM(*-6VXp zg*vDvQc|v1G3MFqEam;xiE^PgKV2y0s>b-#MDL7Ioy2%*x=bX<eS|Y`yqyvm@=zDm zfAe@KN$XJ7LhF(DP&;*^ax-`<#b_6N(wvuq9fZ=9F~`F+N@FH*QypYbkt#Gx=jnnS zzetxF70%LE5V_VAz23x5jq7jFP2_LeHFs>k^v5~%`UB)2(lR}#7xacc&?ovql4ui7 z-%imjdK#m8JqX?nCB$Xet4$ea2Kz<CSJ%ij*Zp7o_AlS~z4$1;iB_pi`giBhDfQT^ z`=ov;AgOEYB_{2WyxCD|#joC*4IYOX^kxsj9fH`)hFnr)eZPyETnftiAOd?K_9<u| zGyr9wAxKdQuwgbP#h9WEqcWMDN4O%u!+>UaW>y-1S$B~%*j=dIn>~Vn*@2fdVaNgA zm>Eer&?x3MW{P{6z&kf#*a3bI)qn{b#F;!71m!uUCi`W5oXf0J(P;w)yl*+dg;gyo zYm7mlYGKHYs=%-njQ|x3qrjMjagHL4x94*`Kz$wk8~t57x&y1nT5?ObzWYB<-aYZ^ z<fEzAg~!Eb(+j1QQ!C|_%2;*z^!+nWW}eR8JNxzAm$`TIFKdenKha_oQur>hV_lQ= z!@x)pCLw3FfD#O;;Yc(VKbl8~6^d(WoDV-_9to4`kPpYY4cZR%LG~T<rCDEFf$u2O HzzF>Ui1R$S literal 0 HcmV?d00001 diff --git a/vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm b/vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm new file mode 100644 index 0000000000000000000000000000000000000000..fec988defd5735515fd25e59255bdc6cb14f33c8 GIT binary patch literal 3258 zcmcguYlu}<6khx8GiimDl~mryu{vr(Hs^gW$GZ8RN$1XObaL`WIXUAv&Yedy<9kNJ zis(TQ21Vr$6U2}(2rH3(Sb>m8P!I(@{E_%W=mjA`ar@R@``$q+5Q;9dzi;jJt-aPh zd+&2*&s0q`hpwi5s?xB1tY>6k++ZV{eS=+<#-4#Km9DX&k;ZwQjcfY`yN9+luHG>^ z)-!MikurZwFbuL$`(rQc5>2HWsrom+sdO&_9J&k<H_<Ja$9!6V$UNOgtEfb4VLwP4 zftzWNw$r%D@;E(7&(I6Tewkhe@27)wnBJyi^Z|X0{%QJ*zNBwWM78>p<&3IUFGJ(s zRPZ!wSF6+243$;0)NN|6x>E%zuL^3JYJpxvYgcR4Lu$S1g*~W7)Xw@i$yLKW>N%sl zr1q(U>WF$@olu{s&(+uJtR3-#`bAxU{ky6f&-BdonOT`zGq-2vW_Dz%)p4}R-|l*E z53Ki0?|9}!-8&h{*2&DNe^4%tySVqM8S_Pb<Tsh`Gv`h37vOK!PkM6H6g^E}r)TQf zdY-;ZC%T|l=r+ApKcai}klv~%^ppBIy;r}c59q`C9erGXq)+M3^jG?fKBs@w7j#um zajtf5aArAkodr(hEOeGQE1lI&+1cRqJEP7n=LzRo=SAlgXR_+0So@qq&Rfn==U9E* zhtAZ7OBwm^V~Vy;d&5KjOT~>1eGS?2I+{Y$C|h>>++ok{PTgVO?H++6=mj)q%l>`f zm1xX1YQ>}}1DfdyxSG)lepJD$2*dL$rn?E9C1{JpnfeiXN@%T=o!1181^^yI!D|Zh zEQbs^b|rNP*)p^2#K6VevgP`y3Xfv&%?RH_7ottKFZ7z4?z#uLF|llU_Asm<4KX*g zd*E4RrW@?0Y#Va6@x*+Od-tQYqpgO=i{L4HiNTz~Jfq(PY-?tVjioSR_H%d}Ked<o z$jXH0Z<95Ux&?1j_HIac=D<wc82sGk8F?PYXssEX$9V3o89X!NSyeN50>;C&jj^U? zaP2;{kRbwW0RLq<a&X#R?xt+Q``Suw!5z-KW7sXX2dnO;*>V&6Vs|X{+>}ipW+<lT z4hQZy`ib;In30$X%$%EI)0*jWtj981zrL$$<Hp|JzP`<y`}-@Efq}unp`qd7#~vFQ z866!P+p=Zr)@|FiZ{M+F=gwWb#>XcncJunKLn|b_ScL@J+O`~x7b-}3A9%UpVKQ4& zcbff?UQ~DTQu)09Wk0lodGRqACx8iufJx4Q9hO+mS<ValO_mXFGTI6Gp^Zx;$sI}V zNODIuw>@R4aL#gG7`ct#_bdmNLt!tCC3h^jW62%c+~!<*Nh+MPoEJuJ<411cz;Y<; zrGexQBzGXW1Do5d9&!ukEa!!hTUHlI?3xINHZBb%cPP0-lbb&|IEeTnb#p%+1Qf8U zd}_G``83S)+aK`p^W0tDgnPF;7P>vA7nojbd!gxhwilaTAiZvL9LwQ<lEoZB^V;#u z!kUE>I$&-%c^aiRG77f|!gu#7nn5?yZMd;`l%oPIr&d}+WqOqQXqdLqZhDHIr@izl z?WaR@gx)oGlT)~vd_`yI9Q{DQ((k0z6>7S=5qFO{xOs#sRf}=&DB;HOu<Eh52Ck=Z zN4k=(LCu*o3svXQo#azO3u!SmQxTQd(R$pJDl~$7(gf|Hr&0YydYSgo0eTblkJ52E zK_}@neU2G?M`!6g{Y)3=56t0mHBDWsZcsO?*_g+CwLtlbUq`dk_}=oy+w*FVR*=fq zwDy4v<U1J(MMAMqA{59=9STK4u}~ru@C)yyp-?0g3nfgxJ%lnP-@ZcjwAZE-@P`6f zgd(9>C}D~vODtJp$r4MJSh7SC5=lrTA(4bc^+NpdK_Q_?C>BbD_#X#C0-;bS5{iYA zMYO1sI$NoK>5_mUWQZ7Ih6GUL#$u7hB8x>9ix8I;mqGzT0zv~q1VU|YYlRAg3WN%T z3WVCi6<fGs3s-F6iY;7m)$%n^fRKRDfDnODi=C_jp#q@-p#q_n+8=-lgbIWTgbIY( q-oj&nP=Qc^P=Qc8O5708QG(u4g4|Jp+EIeo<x~Ho9vbuwKK%&`scDx0 literal 0 HcmV?d00001 diff --git a/vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm-256color b/vendor/psy/psysh/src/Readline/Hoa/Terminfo/78/xterm-256color new file mode 100644 index 0000000000000000000000000000000000000000..d3be7ef31385b9ca2fc4ec194dbba933ee99a17f GIT binary patch literal 3322 zcmbtWYlu}<6khx8GpUh@m}TC|$vj$;de8gbj&<`rQ_h{6I%(b>>dZKf^K6`a&7)9* z$_jcwQTZbTQ6vh&N~9lFAS4nfL_rUKB>oV32qA%S`_^9P-a%3^y3GE*wb!@S+WYLY z&z?P5*)*NT(H?c6W@~?IU)L-*2%CF4d-?`Vw{}Z=|At!lYK?OfkurZwFbuN6f7KrB zB8{d=RKCoQRQXvVi>^b&t#k)QpGmV3nWKkjDe_jrevH-wH&Qokr9o5WIod@p(yPXP zi{1mjPy6T~eME=pbNUMX6LgZkqn}Jfx%_*=DOE0ChsM9r;IWBaE{|6eRa#9^cc~d_ zmhx0i<<%lp550i4Os!Opt2L?(cDL$N+pBp}tAab!Zlk=Z_Naa8L-m<Ds=ijI)DP-R zlJToLuP(s8sLIAOK6O)SN@{9qT53jWTdG_hL>u`HS9?2PeQJ6~Qb()akw~_VrH)@g zxis$5-Zv)a+iK>Isb5m(Oz%AKuf$J!Bx{r&t0(Bm`c8efo}(k3*GqJxUa6nbZMsKq z)<b%i-mTxz@9Mq!p#E4N(O>H0`lS9|pVnvfZ~B5R>rvJ?>lSN@HN%>11=d_^f%UMp z+$vekR)@988nAX+FIlfyZ(AdyUW>KI+HZYe9kLE1?~DJKdoA^^7E@az>a?2X#JXDa z|JU}`?5jzaR?{dNOX-r`ZudHNOKkVLc1s@|UK^k;U2-1+Ka9qlL@gOHC83V4hpP@P z?*^Ut6k#}Sr|E7$X93zgamH@Io+4TUrSHywgD!x>kaseEj%A-A%dV&jK3is%tB^RK zTe?)u>f|g2*JQXRIv;G9HrL5y<~)Gfm{_`WXD=)-_AxiK2jE$1rt1w;x)C)Sd19`^ zy+_cNp)H5U3E(L?k-@CN9HW~7HrBDl#zGh&`#HRkpW2CCRAs{RH_95wxOrzo`hG}w zX3tFA82sGk8F?PYXs8%m$9NvB7(6rMSz0l80>;B*8)HSq;IZ4$e1-tf4F1=0WZ_KS zatoy+ey<H==k4B{-H*3rw_?@pI9<xHFSPq($Bx-_Vftb^cCTj-q8~}$hZ%?&!OYq* zURoWE!FnvBHEY(cUBAAqt-XEY#*U88&aSTR?w+3B-lw1L>)W)czyFzMHgDdtW$V^$ z+qQ2X7#JKJ8XD&HU5%EHc(L*kUTfoGG+rn#=J&wM4G)ufHC3m1Khg`TPF^aP-+#&V zlVo0eBx46KVG}UPK1kA{gtH0fgxyTSh&L6J3Aug}7Y9;1klKON4wBl*E{lb;3Fm}S z+xT54VJ~4{*oi}_9ZKy`YKKW}voD<}7S1M|6Gm<0M{Qv*VPDvZJ*n+UZBJ@@No})w zs4bjLI46wSvbrdetckFn#KpeU_NBIOYV(nUjffMeh5KPQAdgk$UCYhO#eNPO=?OnJ z`#kPzTX!Gt!vQx4hU}U40KWUokUhtCXS=KB@SePq;$L1#KaOF{*N6S>*aO)id#>H@ znbGW4<8ngd%T@GQc8lHW;l0V6%uX-y=TS}fFO%+MDgh?nzce4)yNf7=YtenQnf9lY zxr-3a?Hg$#-9~re#^X?y^0b&5Xa$vM9ko+0ZJ}X$o?fOm=pA~W_S1*-iMiVx$Ia$@ zI!$NkSNfAKl2+HN@oEz8F4J*y@l~wm<K9xljpa$zn%p|dWg?9`))=~h#?#G|rdqP; z9^AA%jC?=Mr#dQN?A5decdbt9!%b_LcG3&<3cXHm(H`1M2QY&}bcBx5F*-q~Fo&P% z44tDt=mPzXS&UKR)CA1qb~P1usC!igbIB_Hq|I)@na!Ig+4ITv^kO-YD~GHnXRR+3 z2!%qCkS7O&FBAxcLXnWihlUgTLV-{y6fwEUMwThL$!C~+F_kHKeAu9hP#_cvMNFYo z38hLXRYIu}N|iuD0tpEuB#@AxIuIXV7)U4(3WXve{^x@bPskSvghHWc9?e@tOER=5 zL(4PNv2cOM;4=gaAwvWxaAUE+Vu8g1iv@^_3JakCApxNQAp)V+H8wy6LIpwvLIpyt z=Mn39#CjgFo=2?b5tlAr0R;#N2n`4k2(_?^RUlL#R3KC!)Z(&7p#q@-p#q@-p)RZE oTp&~+R3KC!)TSag1T+<)Hx(f_6`?j2A+B|)W1WKrz1gLI0AtO0NdN!< literal 0 HcmV?d00001 diff --git a/vendor/psy/psysh/src/Readline/Hoa/Ustring.php b/vendor/psy/psysh/src/Readline/Hoa/Ustring.php new file mode 100644 index 000000000..8d7312b9b --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Ustring.php @@ -0,0 +1,143 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * This class represents a UTF-8 string. + * Please, see: + * * http://www.ietf.org/rfc/rfc3454.txt, + * * http://unicode.org/reports/tr9/, + * * http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt. + */ +class Ustring +{ + /** + * Check if ext/mbstring is available. + */ + public static function checkMbString(): bool + { + return \function_exists('mb_substr'); + } + + /** + * Get the number of column positions of a wide-character. + * + * This is a PHP implementation of wcwidth() and wcswidth() (defined in IEEE + * Std 1002.1-2001) for Unicode, by Markus Kuhn. Please, see + * http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c. + * + * The wcwidth(wc) function shall either return 0 (if wc is a null + * wide-character code), or return the number of column positions to be + * occupied by the wide-character code wc, or return -1 (if wc does not + * correspond to a printable wide-character code). + */ + public static function getCharWidth(string $char): int + { + $char = (string) $char; + $c = static::toCode($char); + + // Test for 8-bit control characters. + if (0x0 === $c) { + return 0; + } + + if (0x20 > $c || (0x7F <= $c && $c < 0xA0)) { + return -1; + } + + // Non-spacing characters. + if (0xAD !== $c && + 0 !== \preg_match('#^[\p{Mn}\p{Me}\p{Cf}\x{1160}-\x{11ff}\x{200b}]#u', $char)) { + return 0; + } + + // If we arrive here, $c is not a combining C0/C1 control character. + return 1 + + (0x1100 <= $c && + (0x115F >= $c || // Hangul Jamo init. consonants + 0x2329 === $c || 0x232A === $c || + (0x2E80 <= $c && 0xA4CF >= $c && + 0x303F !== $c) || // CJK…Yi + (0xAC00 <= $c && 0xD7A3 >= $c) || // Hangul Syllables + (0xF900 <= $c && 0xFAFF >= $c) || // CJK Compatibility Ideographs + (0xFE10 <= $c && 0xFE19 >= $c) || // Vertical forms + (0xFE30 <= $c && 0xFE6F >= $c) || // CJK Compatibility Forms + (0xFF00 <= $c && 0xFF60 >= $c) || // Fullwidth Forms + (0xFFE0 <= $c && 0xFFE6 >= $c) || + (0x20000 <= $c && 0x2FFFD >= $c) || + (0x30000 <= $c && 0x3FFFD >= $c))); + } + + /** + * Check whether the character is printable or not. + */ + public static function isCharPrintable(string $char): bool + { + return 1 <= static::getCharWidth($char); + } + + /** + * Get a decimal code representation of a specific character. + */ + public static function toCode(string $char): int + { + $char = (string) $char; + $code = \ord($char[0]); + $bytes = 1; + + if (!($code & 0x80)) { // 0xxxxxxx + return $code; + } + + if (($code & 0xE0) === 0xC0) { // 110xxxxx + $bytes = 2; + $code = $code & ~0xC0; + } elseif (($code & 0xF0) === 0xE0) { // 1110xxxx + $bytes = 3; + $code = $code & ~0xE0; + } elseif (($code & 0xF8) === 0xF0) { // 11110xxx + $bytes = 4; + $code = $code & ~0xF0; + } + + for ($i = 2; $i <= $bytes; $i++) { // 10xxxxxx + $code = ($code << 6) + (\ord($char[$i - 1]) & ~0x80); + } + + return $code; + } +} diff --git a/vendor/psy/psysh/src/Readline/Hoa/Xcallable.php b/vendor/psy/psysh/src/Readline/Hoa/Xcallable.php new file mode 100644 index 000000000..e1160a556 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Hoa/Xcallable.php @@ -0,0 +1,256 @@ +<?php + +/** + * Hoa + * + * + * @license + * + * New BSD License + * + * Copyright © 2007-2017, Hoa community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Hoa nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +namespace Psy\Readline\Hoa; + +/** + * Build a callable object, i.e. `function`, `class::method`, `object->method` or + * closure. They all have the same behaviour. This callable is an extension of + * native PHP callable (aka callback) to integrate Hoa's structures. + */ +class Xcallable +{ + /** + * Callback with the PHP format. + */ + protected $_callback = null; + + /** + * Callable hash. + */ + protected $_hash = null; + + /** + * Allocates a xcallable based on a callback. + * + * Accepted forms: + * * `'function'`, + * * `'class::method'`, + * * `'class', 'method'`, + * * `$object, 'method'`, + * * `$object, ''`, + * * `function (…) { … }`, + * * `['class', 'method']`, + * * `[$object, 'method']`. + * + * # Examples + * + * ```php + * $toUpper = new Hoa\Consistency\Xcallable('strtoupper'); + * assert('FOO' === $toUpper('foo')); + * ``` + * + * # Exceptions + * + * A `Hoa\Consistency\Exception` exception is thrown if the callback form + * is invalid. + * + * ```php,must_throw(Hoa\Consistency\Exception) + * new Hoa\Consistency\Xcallable('Foo:'); + * ``` + */ + public function __construct($call, $able = '') + { + if ($call instanceof \Closure) { + $this->_callback = $call; + + return; + } + + if (!\is_string($able)) { + throw new Exception('Bad callback form; the able part must be a string.', 0); + } + + if ('' === $able) { + if (\is_string($call)) { + if (false === \strpos($call, '::')) { + if (!\function_exists($call)) { + throw new Exception('Bad callback form; function %s does not exist.', 1, $call); + } + + $this->_callback = $call; + + return; + } + + list($call, $able) = \explode('::', $call); + } elseif (\is_object($call)) { + if ($call instanceof StreamOut) { + $able = null; + } elseif (\method_exists($call, '__invoke')) { + $able = '__invoke'; + } else { + throw new Exception('Bad callback form; an object but without a known '.'method.', 2); + } + } elseif (\is_array($call) && isset($call[0])) { + if (!isset($call[1])) { + $this->__construct($call[0]); + return; + } + + $this->__construct($call[0], $call[1]); + return; + } else { + throw new Exception('Bad callback form.', 3); + } + } + + $this->_callback = [$call, $able]; + + return; + } + + /** + * Calls the callable. + */ + public function __invoke(...$arguments) + { + $callback = $this->getValidCallback($arguments); + + return $callback(...$arguments); + } + + /** + * Returns a valid PHP callback. + */ + public function getValidCallback(array &$arguments = []) + { + $callback = $this->_callback; + $head = null; + + if (isset($arguments[0])) { + $head = &$arguments[0]; + } + + // If method is undetermined, we find it (we understand event bucket and + // stream). + if (null !== $head && + \is_array($callback) && + null === $callback[1]) { + if ($head instanceof EventBucket) { + $head = $head->getData(); + } + + switch ($type = \gettype($head)) { + case 'string': + if (1 === \strlen($head)) { + $method = 'writeCharacter'; + } else { + $method = 'writeString'; + } + + break; + + case 'boolean': + case 'integer': + case 'array': + $method = 'write'.\ucfirst($type); + + break; + + case 'double': + $method = 'writeFloat'; + + break; + + default: + $method = 'writeAll'; + $head = $head."\n"; + } + + $callback[1] = $method; + } + + return $callback; + } + + /** + * Computes the hash of this callable. + * + * Will produce: + * * `function#…`, + * * `class#…::…`, + * * `object(…)#…::…`, + * * `closure(…)`. + */ + public function getHash(): string + { + if (null !== $this->_hash) { + return $this->_hash; + } + + $_ = &$this->_callback; + + if (\is_string($_)) { + return $this->_hash = 'function#'.$_; + } + + if (\is_array($_)) { + return + $this->_hash = + (\is_object($_[0]) + ? 'object('.\spl_object_hash($_[0]).')'. + '#'.\get_class($_[0]) + : 'class#'.$_[0]). + '::'. + (null !== $_[1] + ? $_[1] + : '???'); + } + + return $this->_hash = 'closure('.\spl_object_hash($_).')'; + } + + /** + * The string representation of a callable is its hash. + */ + public function __toString(): string + { + return $this->getHash(); + } + + /** + * Hoa's xcallable() helper. + */ + public static function from($call, $able = '') + { + if ($call instanceof self) { + return $call; + } + + return new self($call, $able); + } +} diff --git a/vendor/psy/psysh/src/Readline/HoaConsole.php b/vendor/psy/psysh/src/Readline/HoaConsole.php index bd4d9d541..74febb6f7 100644 --- a/vendor/psy/psysh/src/Readline/HoaConsole.php +++ b/vendor/psy/psysh/src/Readline/HoaConsole.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,111 +11,11 @@ namespace Psy\Readline; -use Hoa\Console\Console; -use Hoa\Console\Cursor; -use Hoa\Console\Readline\Readline as HoaReadline; -use Psy\Exception\BreakException; - /** * Hoa\Console Readline implementation. + * + * @deprecated, use Userland readline */ -class HoaConsole implements Readline +class HoaConsole extends Userland { - /** @var HoaReadline */ - private $hoaReadline; - - /** @var string|null */ - private $lastPrompt; - - /** - * @return bool - */ - public static function isSupported() - { - return \class_exists(Console::class, true); - } - - public function __construct() - { - $this->hoaReadline = new HoaReadline(); - $this->hoaReadline->addMapping('\C-l', function () { - $this->redisplay(); - - return HoaReadline::STATE_NO_ECHO; - }); - } - - /** - * {@inheritdoc} - */ - public function addHistory($line) - { - $this->hoaReadline->addHistory($line); - - return true; - } - - /** - * {@inheritdoc} - */ - public function clearHistory() - { - $this->hoaReadline->clearHistory(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function listHistory() - { - $i = 0; - $list = []; - while (($item = $this->hoaReadline->getHistory($i++)) !== null) { - $list[] = $item; - } - - return $list; - } - - /** - * {@inheritdoc} - */ - public function readHistory() - { - return true; - } - - /** - * {@inheritdoc} - * - * @throws BreakException if user hits Ctrl+D - * - * @return string - */ - public function readline($prompt = null) - { - $this->lastPrompt = $prompt; - - return $this->hoaReadline->readLine($prompt); - } - - /** - * {@inheritdoc} - */ - public function redisplay() - { - $currentLine = $this->hoaReadline->getLine(); - Cursor::clear('all'); - echo $this->lastPrompt, $currentLine; - } - - /** - * {@inheritdoc} - */ - public function writeHistory() - { - return true; - } } diff --git a/vendor/psy/psysh/src/Readline/Libedit.php b/vendor/psy/psysh/src/Readline/Libedit.php index 6c788d901..953ed2afd 100644 --- a/vendor/psy/psysh/src/Readline/Libedit.php +++ b/vendor/psy/psysh/src/Readline/Libedit.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -29,10 +29,8 @@ class Libedit extends GNUReadline /** * Let's emulate GNU Readline by manually reading and parsing the history file! - * - * @return bool */ - public static function isSupported() + public static function isSupported(): bool { return \function_exists('readline') && !\function_exists('readline_list_history'); } @@ -40,7 +38,15 @@ class Libedit extends GNUReadline /** * {@inheritdoc} */ - public function listHistory() + public static function supportsBracketedPaste(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function listHistory(): array { $history = \file_get_contents($this->historyFile); if (!$history) { @@ -64,7 +70,7 @@ class Libedit extends GNUReadline /** * {@inheritdoc} */ - public function writeHistory() + public function writeHistory(): bool { $res = parent::writeHistory(); @@ -93,7 +99,7 @@ class Libedit extends GNUReadline * * @return string|null */ - protected function parseHistoryLine($line) + protected function parseHistoryLine(string $line) { // empty line, comment or timestamp if (!$line || $line[0] === "\0") { diff --git a/vendor/psy/psysh/src/Readline/Readline.php b/vendor/psy/psysh/src/Readline/Readline.php index 7e404dccc..e9b45b3c7 100644 --- a/vendor/psy/psysh/src/Readline/Readline.php +++ b/vendor/psy/psysh/src/Readline/Readline.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -17,11 +17,21 @@ namespace Psy\Readline; interface Readline { /** - * Check whether this Readline class is supported by the current system. - * - * @return bool + * @param string|false $historyFile + * @param int|null $historySize + * @param bool|null $eraseDups */ - public static function isSupported(); + public function __construct($historyFile = null, $historySize = 0, $eraseDups = false); + + /** + * Check whether this Readline class is supported by the current system. + */ + public static function isSupported(): bool; + + /** + * Check whether this Readline class supports bracketed paste. + */ + public static function supportsBracketedPaste(): bool; /** * Add a line to the command history. @@ -30,28 +40,28 @@ interface Readline * * @return bool Success */ - public function addHistory($line); + public function addHistory(string $line): bool; /** * Clear the command history. * * @return bool Success */ - public function clearHistory(); + public function clearHistory(): bool; /** * List the command history. * - * @return array + * @return string[] */ - public function listHistory(); + public function listHistory(): array; /** * Read the command history. * * @return bool Success */ - public function readHistory(); + public function readHistory(): bool; /** * Read a single line of input from the user. @@ -60,7 +70,7 @@ interface Readline * * @return false|string */ - public function readline($prompt = null); + public function readline(string $prompt = null); /** * Redraw readline to redraw the display. @@ -72,5 +82,5 @@ interface Readline * * @return bool Success */ - public function writeHistory(); + public function writeHistory(): bool; } diff --git a/vendor/psy/psysh/src/Readline/Transient.php b/vendor/psy/psysh/src/Readline/Transient.php index 884354dbd..43eb28519 100644 --- a/vendor/psy/psysh/src/Readline/Transient.php +++ b/vendor/psy/psysh/src/Readline/Transient.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,11 +28,19 @@ class Transient implements Readline * * {@inheritdoc} */ - public static function isSupported() + public static function isSupported(): bool { return true; } + /** + * {@inheritdoc} + */ + public static function supportsBracketedPaste(): bool + { + return false; + } + /** * Transient Readline constructor. */ @@ -47,7 +55,7 @@ class Transient implements Readline /** * {@inheritdoc} */ - public function addHistory($line) + public function addHistory(string $line): bool { if ($this->eraseDups) { if (($key = \array_search($line, $this->history)) !== false) { @@ -72,7 +80,7 @@ class Transient implements Readline /** * {@inheritdoc} */ - public function clearHistory() + public function clearHistory(): bool { $this->history = []; @@ -82,7 +90,7 @@ class Transient implements Readline /** * {@inheritdoc} */ - public function listHistory() + public function listHistory(): array { return $this->history; } @@ -90,7 +98,7 @@ class Transient implements Readline /** * {@inheritdoc} */ - public function readHistory() + public function readHistory(): bool { return true; } @@ -100,9 +108,9 @@ class Transient implements Readline * * @throws BreakException if user hits Ctrl+D * - * @return string + * @return false|string */ - public function readline($prompt = null) + public function readline(string $prompt = null) { echo $prompt; @@ -120,7 +128,7 @@ class Transient implements Readline /** * {@inheritdoc} */ - public function writeHistory() + public function writeHistory(): bool { return true; } diff --git a/vendor/psy/psysh/src/Readline/Userland.php b/vendor/psy/psysh/src/Readline/Userland.php new file mode 100644 index 000000000..62018b770 --- /dev/null +++ b/vendor/psy/psysh/src/Readline/Userland.php @@ -0,0 +1,165 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\Readline; + +use Psy\Exception\BreakException; +use Psy\Readline\Hoa\Console as HoaConsole; +use Psy\Readline\Hoa\ConsoleCursor as HoaConsoleCursor; +use Psy\Readline\Hoa\ConsoleInput as HoaConsoleInput; +use Psy\Readline\Hoa\ConsoleOutput as HoaConsoleOutput; +use Psy\Readline\Hoa\ConsoleTput as HoaConsoleTput; +use Psy\Readline\Hoa\Readline as HoaReadline; +use Psy\Readline\Hoa\Ustring as HoaUstring; + +/** + * Userland Readline implementation. + */ +class Userland implements Readline +{ + /** @var HoaReadline */ + private $hoaReadline; + + /** @var string|null */ + private $lastPrompt; + + private $tput; + private $input; + private $output; + + public static function isSupported(): bool + { + static::bootstrapHoa(); + + return HoaUstring::checkMbString() && HoaConsoleTput::isSupported(); + } + + /** + * {@inheritdoc} + */ + public static function supportsBracketedPaste(): bool + { + return false; + } + + /** + * Doesn't (currently) support history file, size or erase dupes configs. + */ + public function __construct($historyFile = null, $historySize = 0, $eraseDups = false) + { + static::bootstrapHoa(true); + + $this->hoaReadline = new HoaReadline(); + $this->hoaReadline->addMapping('\C-l', function () { + $this->redisplay(); + + return HoaReadline::STATE_NO_ECHO; + }); + + $this->tput = new HoaConsoleTput(); + HoaConsole::setTput($this->tput); + + $this->input = new HoaConsoleInput(); + HoaConsole::setInput($this->input); + + $this->output = new HoaConsoleOutput(); + HoaConsole::setOutput($this->output); + } + + /** + * Bootstrap some things that Hoa used to do itself. + */ + public static function bootstrapHoa(bool $withTerminalResize = false) + { + // A side effect registers hoa:// stream wrapper + \class_exists('Psy\Readline\Hoa\ProtocolWrapper'); + + // A side effect registers hoa://Library/Stream + \class_exists('Psy\Readline\Hoa\Stream'); + + // A side effect binds terminal resize + $withTerminalResize && \class_exists('Psy\Readline\Hoa\ConsoleWindow'); + } + + /** + * {@inheritdoc} + */ + public function addHistory(string $line): bool + { + $this->hoaReadline->addHistory($line); + + return true; + } + + /** + * {@inheritdoc} + */ + public function clearHistory(): bool + { + $this->hoaReadline->clearHistory(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function listHistory(): array + { + $i = 0; + $list = []; + while (($item = $this->hoaReadline->getHistory($i++)) !== null) { + $list[] = $item; + } + + return $list; + } + + /** + * {@inheritdoc} + */ + public function readHistory(): bool + { + return true; + } + + /** + * {@inheritdoc} + * + * @throws BreakException if user hits Ctrl+D + * + * @return string + */ + public function readline(string $prompt = null) + { + $this->lastPrompt = $prompt; + + return $this->hoaReadline->readLine($prompt); + } + + /** + * {@inheritdoc} + */ + public function redisplay() + { + $currentLine = $this->hoaReadline->getLine(); + HoaConsoleCursor::clear('all'); + echo $this->lastPrompt, $currentLine; + } + + /** + * {@inheritdoc} + */ + public function writeHistory(): bool + { + return true; + } +} diff --git a/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php b/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php index 527308dfd..1d6999c9b 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,7 +28,7 @@ class ReflectionClassConstant implements \Reflector * @param string|object $class * @param string $name */ - public function __construct($class, $name) + public function __construct($class, string $name) { if (!$class instanceof \ReflectionClass) { $class = new \ReflectionClass($class); @@ -54,7 +54,7 @@ class ReflectionClassConstant implements \Reflector * * @return string|null */ - public static function export($class, $name, $return = false) + public static function export($class, string $name, bool $return = false) { $refl = new self($class, $name); $value = $refl->getValue(); @@ -70,10 +70,8 @@ class ReflectionClassConstant implements \Reflector /** * Gets the declaring class. - * - * @return \ReflectionClass */ - public function getDeclaringClass() + public function getDeclaringClass(): \ReflectionClass { $parent = $this->class; @@ -95,7 +93,7 @@ class ReflectionClassConstant implements \Reflector * * @return false */ - public function getDocComment() + public function getDocComment(): bool { return false; } @@ -106,20 +104,16 @@ class ReflectionClassConstant implements \Reflector * Since this is only used for PHP < 7.1, we can just return "public". All * the fancier modifiers are only available on PHP versions which have their * own ReflectionClassConstant class :) - * - * @return int */ - public function getModifiers() + public function getModifiers(): int { return \ReflectionMethod::IS_PUBLIC; } /** * Gets the constant name. - * - * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -139,7 +133,7 @@ class ReflectionClassConstant implements \Reflector * * @return bool false */ - public function isPrivate() + public function isPrivate(): bool { return false; } @@ -149,7 +143,7 @@ class ReflectionClassConstant implements \Reflector * * @return bool false */ - public function isProtected() + public function isProtected(): bool { return false; } @@ -159,17 +153,15 @@ class ReflectionClassConstant implements \Reflector * * @return bool true */ - public function isPublic() + public function isPublic(): bool { return true; } /** * To string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } @@ -217,7 +209,7 @@ class ReflectionClassConstant implements \Reflector * * @return ReflectionClassConstant|\ReflectionClassConstant */ - public static function create($class, $name) + public static function create($class, string $name) { if (\class_exists(\ReflectionClassConstant::class)) { return new \ReflectionClassConstant($class, $name); diff --git a/vendor/psy/psysh/src/Reflection/ReflectionConstant.php b/vendor/psy/psysh/src/Reflection/ReflectionConstant.php index cac76e764..b67b4ac26 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionConstant.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionConstant.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/Reflection/ReflectionConstant_.php b/vendor/psy/psysh/src/Reflection/ReflectionConstant_.php index 56c11ad01..07f81d157 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionConstant_.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionConstant_.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -42,7 +42,7 @@ class ReflectionConstant_ implements \Reflector * * @param string $name */ - public function __construct($name) + public function __construct(string $name) { $this->name = $name; @@ -63,7 +63,7 @@ class ReflectionConstant_ implements \Reflector * * @return string|null */ - public static function export($name, $return = false) + public static function export(string $name, bool $return = false) { $refl = new self($name); $value = $refl->getValue(); @@ -87,17 +87,15 @@ class ReflectionConstant_ implements \Reflector * * @return false */ - public function getDocComment() + public function getDocComment(): bool { return false; } /** * Gets the constant name. - * - * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -106,10 +104,8 @@ class ReflectionConstant_ implements \Reflector * Gets the namespace name. * * Returns '' when the constant is not namespaced. - * - * @return string */ - public function getNamespaceName() + public function getNamespaceName(): string { if (!$this->inNamespace()) { return ''; @@ -130,20 +126,16 @@ class ReflectionConstant_ implements \Reflector /** * Checks if this constant is defined in a namespace. - * - * @return bool */ - public function inNamespace() + public function inNamespace(): bool { return \strpos($this->name, '\\') !== false; } /** * To string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } diff --git a/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php index 64f7f6d1c..890221469 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -74,7 +74,7 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract * * @param string $keyword */ - public function __construct($keyword) + public function __construct(string $keyword) { if (!self::isLanguageConstruct($keyword)) { throw new \InvalidArgumentException('Unknown language construct: '.$keyword); @@ -95,20 +95,16 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract /** * Get language construct name. - * - * @return string */ - public function getName() + public function getName(): string { return $this->keyword; } /** * None of these return references. - * - * @return bool */ - public function returnsReference() + public function returnsReference(): bool { return false; } @@ -118,7 +114,7 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract * * @return array */ - public function getParameters() + public function getParameters(): array { $params = []; foreach (self::$languageConstructs[$this->keyword] as $parameter => $opts) { @@ -133,8 +129,11 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract * * (Hint: it always returns false) * - * @return bool false + * @todo remove \ReturnTypeWillChange attribute after dropping support for PHP 7.x (when we can use union types) + * + * @return string|false (false) */ + #[\ReturnTypeWillChange] public function getFileName() { return false; @@ -142,10 +141,8 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract /** * To string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } @@ -154,10 +151,8 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract * Check whether keyword is a (known) language construct. * * @param string $keyword - * - * @return bool */ - public static function isLanguageConstruct($keyword) + public static function isLanguageConstruct(string $keyword): bool { return \array_key_exists($keyword, self::$languageConstructs); } diff --git a/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php index 895fc2bb8..6f6335241 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,10 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter /** * No class here. + * + * @todo remove \ReturnTypeWillChange attribute after dropping support for PHP 7.0 (when we can use nullable types) */ + #[\ReturnTypeWillChange] public function getClass() { return; @@ -42,7 +45,7 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter * * @return bool */ - public function isArray() + public function isArray(): bool { return \array_key_exists('isArray', $this->opts) && $this->opts['isArray']; } @@ -50,13 +53,18 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter /** * Get param default value. * + * @todo remove \ReturnTypeWillChange attribute after dropping support for PHP 7.x (when we can use mixed type) + * * @return mixed */ + #[\ReturnTypeWillChange] public function getDefaultValue() { if ($this->isDefaultValueAvailable()) { return $this->opts['defaultValue']; } + + return null; } /** @@ -64,7 +72,7 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter * * @return string */ - public function getName() + public function getName(): string { return $this->parameter; } @@ -74,7 +82,7 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter * * @return bool */ - public function isOptional() + public function isOptional(): bool { return \array_key_exists('isOptional', $this->opts) && $this->opts['isOptional']; } @@ -84,7 +92,7 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter * * @return bool */ - public function isDefaultValueAvailable() + public function isDefaultValueAvailable(): bool { return \array_key_exists('defaultValue', $this->opts); } @@ -96,7 +104,7 @@ class ReflectionLanguageConstructParameter extends \ReflectionParameter * * @return bool */ - public function isPassedByReference() + public function isPassedByReference(): bool { return \array_key_exists('isPassedByReference', $this->opts) && $this->opts['isPassedByReference']; } diff --git a/vendor/psy/psysh/src/Reflection/ReflectionNamespace.php b/vendor/psy/psysh/src/Reflection/ReflectionNamespace.php index f50a322a8..3c8b330c0 100644 --- a/vendor/psy/psysh/src/Reflection/ReflectionNamespace.php +++ b/vendor/psy/psysh/src/Reflection/ReflectionNamespace.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class ReflectionNamespace implements \Reflector * * @param string $name */ - public function __construct($name) + public function __construct(string $name) { $this->name = $name; } @@ -33,7 +33,7 @@ class ReflectionNamespace implements \Reflector * * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -53,7 +53,7 @@ class ReflectionNamespace implements \Reflector * * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } diff --git a/vendor/psy/psysh/src/Shell.php b/vendor/psy/psysh/src/Shell.php index af4c5c8d5..98379cfd6 100644 --- a/vendor/psy/psysh/src/Shell.php +++ b/vendor/psy/psysh/src/Shell.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -15,13 +15,14 @@ use Psy\CodeCleaner\NoReturnValue; use Psy\Exception\BreakException; use Psy\Exception\ErrorException; use Psy\Exception\Exception as PsyException; +use Psy\Exception\RuntimeException; use Psy\Exception\ThrowUpException; -use Psy\Exception\TypeErrorException; use Psy\ExecutionLoop\ProcessForker; use Psy\ExecutionLoop\RunkitReloader; use Psy\Formatter\TraceFormatter; use Psy\Input\ShellInput; use Psy\Input\SilentInput; +use Psy\Output\ShellOutput; use Psy\TabCompletion\Matcher; use Psy\VarDumper\PresenterAware; use Symfony\Component\Console\Application; @@ -48,11 +49,15 @@ use Symfony\Component\Console\Output\OutputInterface; */ class Shell extends Application { - const VERSION = 'v0.10.12'; + const VERSION = 'v0.11.12'; + /** @deprecated */ const PROMPT = '>>> '; + /** @deprecated */ const BUFF_PROMPT = '... '; + /** @deprecated */ const REPLAY = '--> '; + /** @deprecated */ const RETVAL = '=> '; private $config; @@ -75,6 +80,7 @@ class Shell extends Application private $commandsMatcher; private $lastExecSuccess = true; private $nonInteractive = false; + private $errorReporting; /** * Create a new Psy Shell. @@ -107,7 +113,7 @@ class Shell extends Application * This is used by the psysh bin to decide whether to start a shell on boot, * or to simply autoload the library. */ - public static function isIncluded(array $trace) + public static function isIncluded(array $trace): bool { $isIncluded = isset($trace[0]['function']) && \in_array($trace[0]['function'], ['require', 'include', 'require_once', 'include_once']); @@ -123,6 +129,14 @@ class Shell extends Application return $isIncluded; } + /** + * Check if the currently running PsySH bin is a phar archive. + */ + public static function isPhar(): bool + { + return \class_exists("\Phar") && \Phar::running() !== '' && \strpos(__FILE__, \Phar::running(true)) === 0; + } + /** * Invoke a Psy Shell from the current context. * @@ -134,7 +148,7 @@ class Shell extends Application * * @return array Scope variables from the debugger session */ - public static function debug(array $vars = [], $bindTo = null) + public static function debug(array $vars = [], $bindTo = null): array { return \Psy\debug($vars, $bindTo); } @@ -148,7 +162,7 @@ class Shell extends Application * * @return BaseCommand The registered command */ - public function add(BaseCommand $command) + public function add(BaseCommand $command): BaseCommand { if ($ret = parent::add($command)) { if ($ret instanceof ContextAware) { @@ -172,7 +186,7 @@ class Shell extends Application * * @return InputDefinition An InputDefinition instance */ - protected function getDefaultInputDefinition() + protected function getDefaultInputDefinition(): InputDefinition { return new InputDefinition([ new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), @@ -185,7 +199,7 @@ class Shell extends Application * * @return array An array of default Command instances */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { $sudo = new Command\SudoCommand(); $sudo->setReadline($this->readline); @@ -215,9 +229,9 @@ class Shell extends Application } /** - * @return array + * @return Matcher\AbstractMatcher[] */ - protected function getDefaultMatchers() + protected function getDefaultMatchers(): array { // Store the Commands Matcher for later. If more commands are added, // we'll update the Commands Matcher too. @@ -253,7 +267,7 @@ class Shell extends Application * * @return array An array of Execution Loop Listener instances */ - protected function getDefaultLoopListeners() + protected function getDefaultLoopListeners(): array { $listeners = []; @@ -311,7 +325,7 @@ class Shell extends Application * * @return int 0 if everything went fine, or an error code */ - public function run(InputInterface $input = null, OutputInterface $output = null) + public function run(InputInterface $input = null, OutputInterface $output = null): int { // We'll just ignore the input passed in, and set up our own! $input = new ArrayInput([]); @@ -325,7 +339,7 @@ class Shell extends Application try { return parent::run($input, $output); - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->writeException($e); } @@ -335,14 +349,14 @@ class Shell extends Application /** * Runs PsySH. * - * @throws \Exception if thrown via the `throw-up` command + * @throws \Throwable if thrown via the `throw-up` command * * @param InputInterface $input An Input instance * @param OutputInterface $output An Output instance * * @return int 0 if everything went fine, or an error code */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { $this->setOutput($output); $this->resetCodeBuffer(); @@ -361,11 +375,11 @@ class Shell extends Application * Initializes tab completion and readline history, then spins up the * execution loop. * - * @throws \Exception if thrown via the `throw-up` command + * @throws \Throwable if thrown via the `throw-up` command * * @return int 0 if everything went fine, or an error code */ - private function doInteractiveRun() + private function doInteractiveRun(): int { $this->initializeTabCompletion(); $this->readline->readHistory(); @@ -399,7 +413,7 @@ class Shell extends Application * * @return int 0 if everything went fine, or an error code */ - private function doNonInteractiveRun($rawOutput) + private function doNonInteractiveRun(bool $rawOutput): int { $this->nonInteractive = true; @@ -457,8 +471,6 @@ class Shell extends Application foreach ($__psysh__->getIncludes() as $__psysh_include__) { try { include_once $__psysh_include__; - } catch (\Error $_e) { - $__psysh__->writeException(ErrorException::fromError($_e)); } catch (\Exception $_e) { $__psysh__->writeException($_e); } @@ -486,7 +498,7 @@ class Shell extends Application * * @param bool $interactive */ - public function getInput($interactive = true) + public function getInput(bool $interactive = true) { $this->codeBufferOpen = false; @@ -543,7 +555,7 @@ class Shell extends Application * * @return bool true if the input is in an open string or comment */ - private function inputInOpenStringOrComment($input) + private function inputInOpenStringOrComment(string $input): bool { if (!$this->hasCode()) { return false; @@ -582,10 +594,8 @@ class Shell extends Application * Run execution loop listeners on user input. * * @param string $input - * - * @return string */ - public function onInput($input) + public function onInput(string $input): string { foreach ($this->loopListeners as $listeners) { if (($return = $listeners->onInput($this, $input)) !== null) { @@ -600,11 +610,11 @@ class Shell extends Application * Run execution loop listeners on code to be executed. * * @param string $code - * - * @return string */ - public function onExecute($code) + public function onExecute(string $code): string { + $this->errorReporting = \error_reporting(); + foreach ($this->loopListeners as $listener) { if (($return = $listener->onExecute($this, $code)) !== null) { $code = $return; @@ -660,7 +670,7 @@ class Shell extends Application * * @return array Associative array of scope variables */ - public function getScopeVariables($includeBoundObject = true) + public function getScopeVariables(bool $includeBoundObject = true): array { $vars = $this->context->getAll(); @@ -680,7 +690,7 @@ class Shell extends Application * * @return array Associative array of magic scope variables */ - public function getSpecialScopeVariables($includeBoundObject = true) + public function getSpecialScopeVariables(bool $includeBoundObject = true): array { $vars = $this->context->getSpecialVariables(); @@ -702,7 +712,7 @@ class Shell extends Application * * @return array Associative array of scope variables which differ from $currentVars */ - public function getScopeVariablesDiff(array $currentVars) + public function getScopeVariablesDiff(array $currentVars): array { $newVars = []; @@ -720,7 +730,7 @@ class Shell extends Application * * @return array Array of unused variable names */ - public function getUnusedCommandScopeVariableNames() + public function getUnusedCommandScopeVariableNames(): array { return $this->context->getUnusedCommandScopeVariableNames(); } @@ -730,7 +740,7 @@ class Shell extends Application * * @return array Array of variable names */ - public function getScopeVariableNames() + public function getScopeVariableNames(): array { return \array_keys($this->context->getAll()); } @@ -742,7 +752,7 @@ class Shell extends Application * * @return mixed */ - public function getScopeVariable($name) + public function getScopeVariable(string $name) { return $this->context->get($name); } @@ -800,9 +810,9 @@ class Shell extends Application /** * Get PHP files to be parsed and executed before running the interactive shell. * - * @return array + * @return string[] */ - public function getIncludes() + public function getIncludes(): array { return \array_merge($this->config->getDefaultIncludes(), $this->includes); } @@ -812,7 +822,7 @@ class Shell extends Application * * @return bool True if the code buffer contains code */ - public function hasCode() + public function hasCode(): bool { return !empty($this->codeBuffer); } @@ -824,7 +834,7 @@ class Shell extends Application * * @return bool True if the code buffer content is valid */ - protected function hasValidCode() + protected function hasValidCode(): bool { return !$this->codeBufferOpen && $this->code !== false; } @@ -835,7 +845,7 @@ class Shell extends Application * @param string $code * @param bool $silent */ - public function addCode($code, $silent = false) + public function addCode(string $code, bool $silent = false) { try { // Code lines ending in \ keep the buffer open @@ -848,7 +858,7 @@ class Shell extends Application $this->codeBuffer[] = $silent ? new SilentInput($code) : $code; $this->code = $this->cleaner->clean($this->codeBuffer, $this->config->requireSemicolons()); - } catch (\Exception $e) { + } catch (\Throwable $e) { // Add failed code blocks to the readline history. $this->addCodeBufferToHistory(); @@ -868,7 +878,7 @@ class Shell extends Application * @param string $code * @param bool $silent */ - private function setCode($code, $silent = false) + private function setCode(string $code, bool $silent = false) { if ($this->hasCode()) { $this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code]; @@ -880,10 +890,6 @@ class Shell extends Application } catch (\Throwable $e) { $this->popCodeStack(); - throw $e; - } catch (\Exception $e) { - $this->popCodeStack(); - throw $e; } @@ -899,9 +905,9 @@ class Shell extends Application * * This is useful for commands which manipulate the buffer. * - * @return array + * @return string[] */ - public function getCodeBuffer() + public function getCodeBuffer(): array { return $this->codeBuffer; } @@ -915,7 +921,7 @@ class Shell extends Application * * @return mixed Who knows? */ - protected function runCommand($input) + protected function runCommand(string $input) { $command = $this->getCommand($input); @@ -927,6 +933,9 @@ class Shell extends Application if ($input->hasParameterOption(['--help', '-h'])) { $helpCommand = $this->get('help'); + if (!$helpCommand instanceof Command\HelpCommand) { + throw new RuntimeException('Invalid help command instance'); + } $helpCommand->setCommand($command); return $helpCommand->run(new StringInput(''), $this->output); @@ -955,7 +964,7 @@ class Shell extends Application * @param string|array $input * @param bool $silent */ - public function addInput($input, $silent = false) + public function addInput($input, bool $silent = false) { foreach ((array) $input as $line) { $this->inputBuffer[] = $silent ? new SilentInput($line) : $line; @@ -968,7 +977,7 @@ class Shell extends Application * If the code buffer is valid, resets the code buffer and returns the * current code. * - * @return string PHP code buffer contents + * @return string|null PHP code buffer contents */ public function flushCode() { @@ -1040,7 +1049,7 @@ class Shell extends Application * * @see CodeCleaner::getNamespace * - * @return string Current code namespace + * @return string|null Current code namespace */ public function getNamespace() { @@ -1057,8 +1066,14 @@ class Shell extends Application * @param string $out * @param int $phase Output buffering phase */ - public function writeStdout($out, $phase = \PHP_OUTPUT_HANDLER_END) + public function writeStdout(string $out, int $phase = \PHP_OUTPUT_HANDLER_END) { + if ($phase & \PHP_OUTPUT_HANDLER_START) { + if ($this->output instanceof ShellOutput) { + $this->output->startPaging(); + } + } + $isCleaning = $phase & \PHP_OUTPUT_HANDLER_CLEAN; // Incremental flush @@ -1073,7 +1088,7 @@ class Shell extends Application // Write an extra newline if stdout didn't end with one if ($this->outputWantsNewline) { if (!$this->config->rawOutput() && !$this->config->outputIsPiped()) { - $this->output->writeln(\sprintf('<aside>%s</aside>', $this->config->useUnicode() ? '⏎' : '\\n')); + $this->output->writeln(\sprintf('<whisper>%s</whisper>', $this->config->useUnicode() ? '⏎' : '\\n')); } else { $this->output->writeln(''); } @@ -1085,6 +1100,10 @@ class Shell extends Application $this->context->setLastStdout($this->stdoutBuffer); $this->stdoutBuffer = ''; } + + if ($this->output instanceof ShellOutput) { + $this->output->stopPaging(); + } } } @@ -1099,7 +1118,7 @@ class Shell extends Application * @param mixed $ret * @param bool $rawOutput Write raw var_export-style values */ - public function writeReturnValue($ret, $rawOutput = false) + public function writeReturnValue($ret, bool $rawOutput = false) { $this->lastExecSuccess = true; @@ -1112,25 +1131,32 @@ class Shell extends Application if ($rawOutput) { $formatted = \var_export($ret, true); } else { - $indent = \str_repeat(' ', \strlen(static::RETVAL)); + $prompt = $this->config->theme()->returnValue(); + $indent = \str_repeat(' ', \strlen($prompt)); $formatted = $this->presentValue($ret); - $formatted = static::RETVAL.\str_replace(\PHP_EOL, \PHP_EOL.$indent, $formatted); + $formattedRetValue = \sprintf('<whisper>%s</whisper>', $prompt); + + $formatted = $formattedRetValue.\str_replace(\PHP_EOL, \PHP_EOL.$indent, $formatted); } - $this->output->writeln($formatted); + if ($this->output instanceof ShellOutput) { + $this->output->page($formatted.\PHP_EOL); + } else { + $this->output->writeln($formatted); + } } /** - * Renders a caught Exception. + * Renders a caught Exception or Error. * * Exceptions are formatted according to severity. ErrorExceptions which were * warnings or Strict errors aren't rendered as harshly as real errors. * * Stores $e as the last Exception in the Shell Context. * - * @param \Exception $e An exception instance + * @param \Throwable $e An exception or error instance */ - public function writeException(\Exception $e) + public function writeException(\Throwable $e) { // No need to write the break exception during a non-interactive run. if ($e instanceof BreakException && $this->nonInteractive) { @@ -1149,8 +1175,17 @@ class Shell extends Application if ($output instanceof ConsoleOutput) { $output = $output->getErrorOutput(); } + + if (!$this->config->theme()->compact()) { + $output->writeln(''); + } + $output->writeln($this->formatException($e)); + if (!$this->config->theme()->compact()) { + $output->writeln(''); + } + // Include an exception trace (as long as this isn't a BreakException). if (!$e instanceof BreakException && $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $trace = TraceFormatter::formatTrace($e); @@ -1168,32 +1203,34 @@ class Shell extends Application * Check whether the last exec was successful. * * Returns true if a return value was logged rather than an exception. - * - * @return bool */ - public function getLastExecSuccess() + public function getLastExecSuccess(): bool { return $this->lastExecSuccess; } /** - * Helper for formatting an exception for writeException(). + * Helper for formatting an exception or error for writeException(). * * @todo extract this to somewhere it makes more sense * - * @param \Exception $e - * - * @return string + * @param \Throwable $e */ - public function formatException(\Exception $e) + public function formatException(\Throwable $e): string { - $message = $e->getMessage(); - if (!$e instanceof PsyException) { - if ($message === '') { - $message = \get_class($e); - } else { - $message = \sprintf('%s with message \'%s\'', \get_class($e), $message); - } + $indent = $this->config->theme()->compact() ? '' : ' '; + + if ($e instanceof BreakException) { + return \sprintf('%s<info> INFO </info> %s.', $indent, \rtrim($e->getRawMessage(), '.')); + } elseif ($e instanceof PsyException) { + $message = $e->getLine() > 1 + ? \sprintf('%s in %s on line %d', $e->getRawMessage(), $e->getFile(), $e->getLine()) + : \sprintf('%s in %s', $e->getRawMessage(), $e->getFile()); + + $messageLabel = \strtoupper($this->getMessageLabel($e)); + } else { + $message = $e->getMessage(); + $messageLabel = $this->getMessageLabel($e); } $message = \preg_replace( @@ -1202,21 +1239,28 @@ class Shell extends Application $message ); - $message = \str_replace(" in eval()'d code", ' in Psy Shell code', $message); + $message = \str_replace(" in eval()'d code", '', $message); + $message = \trim($message); + + // Ensures the given string ends with punctuation... + if (!empty($message) && !\in_array(\substr($message, -1), ['.', '?', '!', ':'])) { + $message = "$message."; + } + + // Ensures the given message only contains relative paths... + $message = \str_replace(\getcwd().\DIRECTORY_SEPARATOR, '', $message); $severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error'; - return \sprintf('<%s>%s</%s>', $severity, OutputFormatter::escape($message), $severity); + return \sprintf('%s<%s> %s </%s> %s', $indent, $severity, $messageLabel, $severity, OutputFormatter::escape($message)); } /** * Helper for getting an output style for the given ErrorException's level. * * @param \ErrorException $e - * - * @return string */ - protected function getSeverity(\ErrorException $e) + protected function getSeverity(\ErrorException $e): string { $severity = $e->getSeverity(); if ($severity & \error_reporting()) { @@ -1227,6 +1271,8 @@ class Shell extends Application case \E_COMPILE_WARNING: case \E_USER_WARNING: case \E_USER_NOTICE: + case \E_USER_DEPRECATED: + case \E_DEPRECATED: case \E_STRICT: return 'warning'; @@ -1239,6 +1285,51 @@ class Shell extends Application } } + /** + * Helper for getting an output style for the given ErrorException's level. + * + * @param \Throwable $e + */ + protected function getMessageLabel(\Throwable $e): string + { + if ($e instanceof \ErrorException) { + $severity = $e->getSeverity(); + + if ($severity & \error_reporting()) { + switch ($severity) { + case \E_WARNING: + return 'Warning'; + case \E_NOTICE: + return 'Notice'; + case \E_CORE_WARNING: + return 'Core Warning'; + case \E_COMPILE_WARNING: + return 'Compile Warning'; + case \E_USER_WARNING: + return 'User Warning'; + case \E_USER_NOTICE: + return 'User Notice'; + case \E_USER_DEPRECATED: + return 'User Deprecated'; + case \E_DEPRECATED: + return 'Deprecated'; + case \E_STRICT: + return 'Strict'; + } + } + } + + if ($e instanceof PsyException) { + $exceptionShortName = (new \ReflectionClass($e))->getShortName(); + $typeParts = \preg_split('/(?=[A-Z])/', $exceptionShortName); + \array_pop($typeParts); // Removes "Exception" + + return \trim(\strtoupper(\implode(' ', $typeParts))); + } + + return \get_class($e); + } + /** * Execute code in the shell execution context. * @@ -1247,7 +1338,7 @@ class Shell extends Application * * @return mixed */ - public function execute($code, $throwExceptions = false) + public function execute(string $code, bool $throwExceptions = false) { $this->setCode($code, true); $closure = new ExecutionClosure($this); @@ -1258,11 +1349,7 @@ class Shell extends Application try { return $closure->execute(); - } catch (\TypeError $_e) { - $this->writeException(TypeErrorException::fromTypeError($_e)); - } catch (\Error $_e) { - $this->writeException(ErrorException::fromError($_e)); - } catch (\Exception $_e) { + } catch (\Throwable $_e) { $this->writeException($_e); } } @@ -1302,8 +1389,12 @@ class Shell extends Application ErrorException::throwException($errno, $errstr, $errfile, $errline); } + // When errors are suppressed, the error_reporting value will differ + // from when we started executing. In that case, we won't log errors. + $errorsSuppressed = $this->errorReporting !== null && $this->errorReporting !== \error_reporting(); + // Otherwise log it and continue. - if ($errno & \error_reporting() || $errno & $this->config->errorLoggingLevel()) { + if ($errno & \error_reporting() || (!$errorsSuppressed && ($errno & $this->config->errorLoggingLevel()))) { $this->writeException(new ErrorException($errstr, 0, $errno, $errfile, $errline)); } } @@ -1317,7 +1408,7 @@ class Shell extends Application * * @return string Formatted value */ - protected function presentValue($val) + protected function presentValue($val): string { return $this->config->getPresenter()->present($val); } @@ -1329,7 +1420,7 @@ class Shell extends Application * * @return BaseCommand|null */ - protected function getCommand($input) + protected function getCommand(string $input) { $input = new StringInput($input); if ($name = $input->getFirstArgument()) { @@ -1344,7 +1435,7 @@ class Shell extends Application * * @return bool True if the shell has a command for the given input */ - protected function hasCommand($input) + protected function hasCommand(string $input): bool { if (\preg_match('/([^\s]+?)(?:\s|$)/A', \ltrim($input), $match)) { return $this->has($match[1]); @@ -1364,11 +1455,13 @@ class Shell extends Application return null; } + $theme = $this->config->theme(); + if ($this->hasCode()) { - return static::BUFF_PROMPT; + return $theme->bufferPrompt(); } - return $this->config->getPrompt() ?: static::PROMPT; + return $theme->prompt(); } /** @@ -1382,14 +1475,16 @@ class Shell extends Application * * @param bool $interactive * - * @return string One line of user input + * @return string|false One line of user input */ - protected function readline($interactive = true) + protected function readline(bool $interactive = true) { + $prompt = $this->config->theme()->replayPrompt(); + if (!empty($this->inputBuffer)) { $line = \array_shift($this->inputBuffer); if (!$line instanceof SilentInput) { - $this->output->writeln(\sprintf('<aside>%s %s</aside>', static::REPLAY, OutputFormatter::escape($line))); + $this->output->writeln(\sprintf('<whisper>%s</whisper><aside>%s</aside>', $prompt, OutputFormatter::escape($line))); } return $line; @@ -1412,22 +1507,18 @@ class Shell extends Application /** * Get the shell output header. - * - * @return string */ - protected function getHeader() + protected function getHeader(): string { - return \sprintf('<aside>%s by Justin Hileman</aside>', $this->getVersion()); + return \sprintf('<whisper>%s by Justin Hileman</whisper>', $this->getVersion()); } /** * Get the current version of Psy Shell. * * @deprecated call self::getVersionHeader instead - * - * @return string */ - public function getVersion() + public function getVersion(): string { return self::getVersionHeader($this->config->useUnicode()); } @@ -1436,10 +1527,8 @@ class Shell extends Application * Get a pretty header including the current version of Psy Shell. * * @param bool $useUnicode - * - * @return string */ - public static function getVersionHeader($useUnicode = false) + public static function getVersionHeader(bool $useUnicode = false): string { $separator = $useUnicode ? '—' : '-'; @@ -1502,7 +1591,6 @@ class Shell extends Application } /** - * @todo Implement self-update * @todo Implement prompt to start update * * @return void|string @@ -1516,7 +1604,7 @@ class Shell extends Application try { $client = $this->config->getChecker(); if (!$client->isLatest()) { - $this->output->writeln(\sprintf('New version is available (current: %s, latest: %s)', self::VERSION, $client->getLatest())); + $this->output->writeln(\sprintf('<whisper>New version is available at psysh.org/psysh (current: %s, latest: %s)</whisper>', self::VERSION, $client->getLatest())); } } catch (\InvalidArgumentException $e) { $this->output->writeln($e->getMessage()); diff --git a/vendor/psy/psysh/src/Sudo.php b/vendor/psy/psysh/src/Sudo.php index 8c9e5a150..0015cbc76 100644 --- a/vendor/psy/psysh/src/Sudo.php +++ b/vendor/psy/psysh/src/Sudo.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,9 +25,9 @@ class Sudo * * @return mixed Value of $object->property */ - public static function fetchProperty($object, $property) + public static function fetchProperty($object, string $property) { - $prop = static::getProperty(new \ReflectionObject($object), $property); + $prop = self::getProperty(new \ReflectionObject($object), $property); return $prop->getValue($object); } @@ -41,9 +41,9 @@ class Sudo * * @return mixed Value of $object->property */ - public static function assignProperty($object, $property, $value) + public static function assignProperty($object, string $property, $value) { - $prop = static::getProperty(new \ReflectionObject($object), $property); + $prop = self::getProperty(new \ReflectionObject($object), $property); $prop->setValue($object, $value); return $value; @@ -58,12 +58,8 @@ class Sudo * * @return mixed */ - public static function callMethod($object, $method, $args = null) + public static function callMethod($object, string $method, ...$args) { - $args = \func_get_args(); - $object = \array_shift($args); - $method = \array_shift($args); - $refl = new \ReflectionObject($object); $reflMethod = $refl->getMethod($method); $reflMethod->setAccessible(true); @@ -79,9 +75,9 @@ class Sudo * * @return mixed Value of $class::$property */ - public static function fetchStaticProperty($class, $property) + public static function fetchStaticProperty($class, string $property) { - $prop = static::getProperty(new \ReflectionClass($class), $property); + $prop = self::getProperty(new \ReflectionClass($class), $property); $prop->setAccessible(true); return $prop->getValue(); @@ -96,9 +92,9 @@ class Sudo * * @return mixed Value of $class::$property */ - public static function assignStaticProperty($class, $property, $value) + public static function assignStaticProperty($class, string $property, $value) { - $prop = static::getProperty(new \ReflectionClass($class), $property); + $prop = self::getProperty(new \ReflectionClass($class), $property); $prop->setValue($value); return $value; @@ -113,12 +109,8 @@ class Sudo * * @return mixed */ - public static function callStatic($class, $method, $args = null) + public static function callStatic($class, string $method, ...$args) { - $args = \func_get_args(); - $class = \array_shift($args); - $method = \array_shift($args); - $refl = new \ReflectionClass($class); $reflMethod = $refl->getMethod($method); $reflMethod->setAccessible(true); @@ -134,7 +126,7 @@ class Sudo * * @return mixed */ - public static function fetchClassConst($class, $const) + public static function fetchClassConst($class, string $const) { $refl = new \ReflectionClass($class); @@ -149,6 +141,24 @@ class Sudo return false; } + /** + * Construct an instance of a class, bypassing private constructors. + * + * @param string $class class name + * @param mixed $args... + */ + public static function newInstance(string $class, ...$args) + { + $refl = new \ReflectionClass($class); + $instance = $refl->newInstanceWithoutConstructor(); + + $constructor = $refl->getConstructor(); + $constructor->setAccessible(true); + $constructor->invokeArgs($instance, $args); + + return $instance; + } + /** * Get a ReflectionProperty from an object (or its parent classes). * @@ -159,7 +169,7 @@ class Sudo * * @return \ReflectionProperty */ - private static function getProperty(\ReflectionClass $refl, $property) + private static function getProperty(\ReflectionClass $refl, string $property): \ReflectionProperty { $firstException = null; do { diff --git a/vendor/psy/psysh/src/Sudo/SudoVisitor.php b/vendor/psy/psysh/src/Sudo/SudoVisitor.php index 7fbe2012c..151dc527c 100644 --- a/vendor/psy/psysh/src/Sudo/SudoVisitor.php +++ b/vendor/psy/psysh/src/Sudo/SudoVisitor.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,6 +16,7 @@ use PhpParser\Node\Arg; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\StaticPropertyFetch; @@ -41,9 +42,12 @@ class SudoVisitor extends NodeVisitorAbstract const STATIC_PROPERTY_ASSIGN = 'assignStaticProperty'; const STATIC_CALL = 'callStatic'; const CLASS_CONST_FETCH = 'fetchClassConst'; + const NEW_INSTANCE = 'newInstance'; /** * {@inheritdoc} + * + * @return int|Node|null Replacement node (or special return value) */ public function enterNode(Node $node) { @@ -111,10 +115,17 @@ class SudoVisitor extends NodeVisitorAbstract ]; return $this->prepareCall(self::CLASS_CONST_FETCH, $args); + } elseif ($node instanceof New_) { + $args = $node->args; + $class = $node->class instanceof Name ? $node->class->toString() : $node->class; + \array_unshift($args, new Arg(\is_string($class) ? new String_($class) : $class)); + + // not using prepareCall because the $node->args we started with are already Arg instances + return new StaticCall(new FullyQualifiedName(Sudo::class), self::NEW_INSTANCE, $args); } } - private function prepareCall($method, $args) + private function prepareCall(string $method, array $args): StaticCall { return new StaticCall(new FullyQualifiedName(Sudo::class), $method, \array_map(function ($arg) { return new Arg($arg); diff --git a/vendor/psy/psysh/src/SuperglobalsEnv.php b/vendor/psy/psysh/src/SuperglobalsEnv.php index 7f522f936..d3369c6ab 100644 --- a/vendor/psy/psysh/src/SuperglobalsEnv.php +++ b/vendor/psy/psysh/src/SuperglobalsEnv.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class SuperglobalsEnv implements EnvInterface * * @return string|null */ - public function get($key) + public function get(string $key) { if (isset($_SERVER[$key]) && $_SERVER[$key]) { return $_SERVER[$key]; diff --git a/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php b/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php index 13fcd39ac..400b797ab 100644 --- a/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php +++ b/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -50,7 +50,7 @@ class AutoCompleter * * @return array */ - public function processCallback($input, $index, $info = []) + public function processCallback(string $input, int $index, array $info = []): array { // Some (Windows?) systems provide incomplete `readline_info`, so let's // try to work around it. @@ -68,6 +68,8 @@ class AutoCompleter $tokens = \array_filter($tokens, function ($token) { return !AbstractMatcher::tokenIs($token, AbstractMatcher::T_WHITESPACE); }); + // reset index from 0 to remove missing index number + $tokens = \array_values($tokens); $matches = []; foreach ($this->matchers as $matcher) { @@ -91,7 +93,7 @@ class AutoCompleter * * @return array */ - public function callback($input, $index) + public function callback(string $input, int $index): array { return $this->processCallback($input, $index, \readline_info()); } diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php index f7da443b9..bc39e6047 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -48,7 +48,7 @@ abstract class AbstractContextAwareMatcher extends AbstractMatcher implements Co * * @return mixed */ - protected function getVariable($var) + protected function getVariable(string $var) { return $this->context->get($var); } @@ -58,7 +58,7 @@ abstract class AbstractContextAwareMatcher extends AbstractMatcher implements Co * * @return array */ - protected function getVariables() + protected function getVariables(): array { return $this->context->getAll(); } diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php index c80b0068a..0887333a3 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,7 +18,7 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc * * @return array */ - public function getDefaultParameterCompletion(array $reflectionParameters) + public function getDefaultParameterCompletion(array $reflectionParameters): array { $parametersProcessed = []; @@ -29,7 +29,7 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc $defaultValue = $this->valueToShortString($parameter->getDefaultValue()); - $parametersProcessed[] = "\${$parameter->getName()} = $defaultValue"; + $parametersProcessed[] = \sprintf('$%s = %s', $parameter->getName(), $defaultValue); } if (empty($parametersProcessed)) { @@ -45,10 +45,8 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc * This is not 100% true to the original (newlines are inlined, for example). * * @param mixed $value - * - * @return string */ - private function valueToShortString($value) + private function valueToShortString($value): string { if (!\is_array($value)) { return \json_encode($value); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php index bdb25deed..209cae2f6 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -48,9 +48,9 @@ abstract class AbstractMatcher * * @param array $tokens Tokenized readline input * - * @return bool + * @return false */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { return false; } @@ -59,10 +59,8 @@ abstract class AbstractMatcher * Get current readline input word. * * @param array $tokens Tokenized readline input (see token_get_all) - * - * @return string */ - protected function getInput(array $tokens) + protected function getInput(array $tokens): string { $var = ''; $firstToken = \array_pop($tokens); @@ -77,10 +75,8 @@ abstract class AbstractMatcher * Get current namespace and class (if any) from readline input. * * @param array $tokens Tokenized readline input (see token_get_all) - * - * @return string */ - protected function getNamespaceAndClass($tokens) + protected function getNamespaceAndClass(array $tokens): string { $class = ''; while (self::hasToken( @@ -105,17 +101,15 @@ abstract class AbstractMatcher * * @return array The matches resulting from the query */ - abstract public function getMatches(array $tokens, array $info = []); + abstract public function getMatches(array $tokens, array $info = []): array; /** * Check whether $word starts with $prefix. * * @param string $prefix * @param string $word - * - * @return bool */ - public static function startsWith($prefix, $word) + public static function startsWith(string $prefix, string $word): bool { return \preg_match(\sprintf('#^%s#', $prefix), $word); } @@ -125,10 +119,8 @@ abstract class AbstractMatcher * * @param mixed $token A PHP token (see token_get_all) * @param string $syntax A syntax pattern (default: variable pattern) - * - * @return bool */ - public static function hasSyntax($token, $syntax = self::VAR_SYNTAX) + public static function hasSyntax($token, string $syntax = self::VAR_SYNTAX): bool { if (!\is_array($token)) { return false; @@ -144,10 +136,8 @@ abstract class AbstractMatcher * * @param mixed $token A PHP token (see token_get_all) * @param string $which A PHP token type - * - * @return bool */ - public static function tokenIs($token, $which) + public static function tokenIs($token, string $which): bool { if (!\is_array($token)) { return false; @@ -160,10 +150,8 @@ abstract class AbstractMatcher * Check whether $token is an operator. * * @param mixed $token A PHP token (see token_get_all) - * - * @return bool */ - public static function isOperator($token) + public static function isOperator($token): bool { if (!\is_string($token)) { return false; @@ -172,7 +160,7 @@ abstract class AbstractMatcher return \strpos(self::MISC_OPERATORS, $token) !== false; } - public static function needCompleteClass($token) + public static function needCompleteClass($token): bool { return \in_array($token[1], ['doc', 'ls', 'show']); } @@ -182,10 +170,8 @@ abstract class AbstractMatcher * * @param array $coll A list of token types * @param mixed $token A PHP token (see token_get_all) - * - * @return bool */ - public static function hasToken(array $coll, $token) + public static function hasToken(array $coll, $token): bool { if (!\is_array($token)) { return false; diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php index 5ecd4cf8b..0503d71db 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class ClassAttributesMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -71,7 +71,7 @@ class ClassAttributesMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php index d88cb69b6..118740ef2 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher; class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher { - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $openBracket = \array_pop($tokens); $functionName = \array_pop($tokens); @@ -39,7 +39,7 @@ class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatch return []; } - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $openBracket = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php index d980766dd..a526e1ec3 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class ClassMethodsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -68,7 +68,7 @@ class ClassMethodsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php index 83d6c8a79..ca2515d6c 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class ClassNamesMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $class = $this->getNamespaceAndClass($tokens); if ($class !== '' && $class[0] === '\\') { @@ -36,7 +36,7 @@ class ClassNamesMatcher extends AbstractMatcher // get the number of namespace separators $nsPos = \substr_count($class, '\\'); $pieces = \explode('\\', $className); - //$methods = Mirror::get($class); + // $methods = Mirror::get($class); return \implode('\\', \array_slice($pieces, $nsPos, \count($pieces))); }, \array_filter( @@ -51,18 +51,18 @@ class ClassNamesMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); - $blacklistedTokens = [ + $ignoredTokens = [ self::T_INCLUDE, self::T_INCLUDE_ONCE, self::T_REQUIRE, self::T_REQUIRE_ONCE, ]; switch (true) { - case self::hasToken([$blacklistedTokens], $token): - case self::hasToken([$blacklistedTokens], $prevToken): + case self::hasToken([$ignoredTokens], $token): + case self::hasToken([$ignoredTokens], $prevToken): case \is_string($token) && $token === '$': return false; case self::hasToken([self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR, self::T_STRING], $prevToken): diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php index bdeb45d4c..5f712daaa 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -55,10 +55,8 @@ class CommandsMatcher extends AbstractMatcher * Check whether a command $name is defined. * * @param string $name - * - * @return bool */ - protected function isCommand($name) + protected function isCommand(string $name): bool { return \in_array($name, $this->commands); } @@ -67,10 +65,8 @@ class CommandsMatcher extends AbstractMatcher * Check whether input matches a defined command. * * @param string $name - * - * @return bool */ - protected function matchCommand($name) + protected function matchCommand(string $name): bool { foreach ($this->commands as $cmd) { if ($this->startsWith($name, $cmd)) { @@ -84,7 +80,7 @@ class CommandsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -96,7 +92,7 @@ class CommandsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { /* $openTag */ \array_shift($tokens); $command = \array_shift($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php index 178adf8c2..cad81a53e 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class ConstantsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $const = $this->getInput($tokens); @@ -35,7 +35,7 @@ class ConstantsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php index e1277c2ee..2bbf12627 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher; class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher { - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { \array_pop($tokens); // open bracket @@ -30,7 +30,7 @@ class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher return $this->getDefaultParameterCompletion($parameters); } - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $openBracket = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php index 1f6e6dbb5..964565997 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class FunctionsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $func = $this->getInput($tokens); @@ -38,7 +38,7 @@ class FunctionsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php index 393674c62..6333269de 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,9 +32,9 @@ class KeywordsMatcher extends AbstractMatcher /** * Get all (completable) PHP keywords. * - * @return array + * @return string[] */ - public function getKeywords() + public function getKeywords(): array { return $this->keywords; } @@ -43,10 +43,8 @@ class KeywordsMatcher extends AbstractMatcher * Check whether $keyword is a (completable) PHP keyword. * * @param string $keyword - * - * @return bool */ - public function isKeyword($keyword) + public function isKeyword(string $keyword): bool { return \in_array($keyword, $this->keywords); } @@ -54,7 +52,7 @@ class KeywordsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -66,7 +64,7 @@ class KeywordsMatcher extends AbstractMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php index f38836d02..3c70ee095 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class MongoClientMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -55,7 +55,7 @@ class MongoClientMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php index a0d4d49c7..7cea95f49 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class MongoDatabaseMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -51,7 +51,7 @@ class MongoDatabaseMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php index 8b3d29057..e0e96679e 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class ObjectAttributesMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -62,7 +62,7 @@ class ObjectAttributesMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php index 08bab8bc9..73221fd37 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher; class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher { - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $openBracket = \array_pop($tokens); $functionName = \array_pop($tokens); @@ -46,7 +46,7 @@ class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatc return []; } - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $openBracket = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php index 2a1d22407..4f10b0796 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class ObjectMethodsMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $input = $this->getInput($tokens); @@ -64,7 +64,7 @@ class ObjectMethodsMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); $prevToken = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php index f2438d3d1..6a5167f7c 100644 --- a/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php +++ b/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class VariablesMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function getMatches(array $tokens, array $info = []) + public function getMatches(array $tokens, array $info = []): array { $var = \str_replace('$', '', $this->getInput($tokens)); @@ -35,7 +35,7 @@ class VariablesMatcher extends AbstractContextAwareMatcher /** * {@inheritdoc} */ - public function hasMatched(array $tokens) + public function hasMatched(array $tokens): bool { $token = \array_pop($tokens); diff --git a/vendor/psy/psysh/src/Util/Docblock.php b/vendor/psy/psysh/src/Util/Docblock.php index 132d15d5f..416be0ee2 100644 --- a/vendor/psy/psysh/src/Util/Docblock.php +++ b/vendor/psy/psysh/src/Util/Docblock.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -74,7 +74,10 @@ class Docblock public function __construct(\Reflector $reflector) { $this->reflector = $reflector; - $this->setComment($reflector->getDocComment()); + + if ($reflector instanceof \ReflectionClass || $reflector instanceof \ReflectionClassConstant || $reflector instanceof \ReflectionFunctionAbstract || $reflector instanceof \ReflectionProperty) { + $this->setComment($reflector->getDocComment()); + } } /** @@ -82,7 +85,7 @@ class Docblock * * @param string $comment The docblock */ - protected function setComment($comment) + protected function setComment(string $comment) { $this->desc = ''; $this->tags = []; @@ -98,7 +101,7 @@ class Docblock * * @return int Prefix length */ - protected static function prefixLength(array $lines) + protected static function prefixLength(array $lines): int { // find only lines with interesting things $lines = \array_filter($lines, function ($line) { @@ -132,7 +135,7 @@ class Docblock * * @param string $comment The docblock */ - protected function parseComment($comment) + protected function parseComment(string $comment) { // Strip the opening and closing tags of the docblock $comment = \substr($comment, 3, -2); @@ -198,10 +201,8 @@ class Docblock * Whether or not a docblock contains a given @tag. * * @param string $tag The name of the @tag to check for - * - * @return bool */ - public function hasTag($tag) + public function hasTag(string $tag): bool { return \is_array($this->tags) && \array_key_exists($tag, $this->tags); } @@ -211,10 +212,12 @@ class Docblock * * @param string $tag * - * @return array + * @return array|null */ - public function tag($tag) + public function tag(string $tag) { + // TODO: Add proper null-type return values once the lowest PHP version supported is 7.1 + return $this->hasTag($tag) ? $this->tags[$tag] : null; } @@ -222,10 +225,8 @@ class Docblock * Whether or not a string begins with a @tag. * * @param string $str - * - * @return bool */ - public static function isTagged($str) + public static function isTagged(string $str): bool { return isset($str[1]) && $str[0] === '@' && !\preg_match('/[^A-Za-z]/', $str[1]); } @@ -237,7 +238,7 @@ class Docblock * * @return string|null */ - public static function strTag($str) + public static function strTag(string $str) { if (\preg_match('/^@[a-z0-9_]+/', $str, $matches)) { return $matches[0]; diff --git a/vendor/psy/psysh/src/Util/Json.php b/vendor/psy/psysh/src/Util/Json.php index d3884c27c..a7eebca95 100644 --- a/vendor/psy/psysh/src/Util/Json.php +++ b/vendor/psy/psysh/src/Util/Json.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,10 +21,8 @@ class Json * * @param mixed $val * @param int $opt - * - * @return string */ - public static function encode($val, $opt = 0) + public static function encode($val, int $opt = 0): string { $opt |= \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE; diff --git a/vendor/psy/psysh/src/Util/Mirror.php b/vendor/psy/psysh/src/Util/Mirror.php index 268a28d61..c151c06f2 100644 --- a/vendor/psy/psysh/src/Util/Mirror.php +++ b/vendor/psy/psysh/src/Util/Mirror.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -43,7 +43,7 @@ class Mirror * * @return \Reflector */ - public static function get($value, $member = null, $filter = 15) + public static function get($value, string $member = null, int $filter = 15): \Reflector { if ($member === null && \is_string($value)) { if (\function_exists($value)) { @@ -104,7 +104,7 @@ class Mirror /** * Check declared namespaces for a given namespace. */ - private static function namespaceExists($value) + private static function namespaceExists(string $value): bool { return \in_array(\strtolower($value), self::getDeclaredNamespaces()); } @@ -115,7 +115,7 @@ class Mirror * Note that this relies on at least one function, class, interface, trait * or constant to have been declared in that namespace. */ - private static function getDeclaredNamespaces() + private static function getDeclaredNamespaces(): array { $functions = \get_defined_functions(); diff --git a/vendor/psy/psysh/src/Util/Str.php b/vendor/psy/psysh/src/Util/Str.php index 8fc0abc1a..032520dcf 100644 --- a/vendor/psy/psysh/src/Util/Str.php +++ b/vendor/psy/psysh/src/Util/Str.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -56,12 +56,10 @@ EOS; * except for the \s sequence (ASCII space). * * @param string $input The string to decode - * - * @return string */ - public static function unvis($input) + public static function unvis(string $input): string { - $output = \preg_replace_callback(self::UNVIS_RX, 'self::unvisReplace', $input); + $output = \preg_replace_callback(self::UNVIS_RX, [self::class, 'unvisReplace'], $input); // other escapes & octal are handled by stripcslashes return \stripcslashes($output); } @@ -70,10 +68,8 @@ EOS; * Callback for Str::unvis. * * @param array $match The matches passed by preg_replace_callback - * - * @return string */ - protected static function unvisReplace($match) + protected static function unvisReplace(array $match): string { // \040, \s if (!empty($match[1])) { diff --git a/vendor/psy/psysh/src/VarDumper/Cloner.php b/vendor/psy/psysh/src/VarDumper/Cloner.php index bbb658f82..e0aaab972 100644 --- a/vendor/psy/psysh/src/VarDumper/Cloner.php +++ b/vendor/psy/psysh/src/VarDumper/Cloner.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -12,6 +12,7 @@ namespace Psy\VarDumper; use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Cloner\Stub; use Symfony\Component\VarDumper\Cloner\VarCloner; @@ -25,7 +26,7 @@ class Cloner extends VarCloner /** * {@inheritdoc} */ - public function cloneVar($var, $filter = 0) + public function cloneVar($var, $filter = 0): Data { $this->filter = $filter; @@ -35,7 +36,7 @@ class Cloner extends VarCloner /** * {@inheritdoc} */ - protected function castResource(Stub $stub, $isNested) + protected function castResource(Stub $stub, $isNested): array { return Caster::EXCLUDE_VERBOSE & $this->filter ? [] : parent::castResource($stub, $isNested); } diff --git a/vendor/psy/psysh/src/VarDumper/Dumper.php b/vendor/psy/psysh/src/VarDumper/Dumper.php index 9ee3ef862..96c127e07 100644 --- a/vendor/psy/psysh/src/VarDumper/Dumper.php +++ b/vendor/psy/psysh/src/VarDumper/Dumper.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -64,7 +64,7 @@ class Dumper extends CliDumper } } - protected function style($style, $value, $attr = []) + protected function style($style, $value, $attr = []): string { if ('ref' === $style) { $value = \strtr($value, '@', '#'); diff --git a/vendor/psy/psysh/src/VarDumper/Presenter.php b/vendor/psy/psysh/src/VarDumper/Presenter.php index 2e294ac1e..7e54dac05 100644 --- a/vendor/psy/psysh/src/VarDumper/Presenter.php +++ b/vendor/psy/psysh/src/VarDumper/Presenter.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -63,7 +63,7 @@ class Presenter $this->cloner = new Cloner(); $this->cloner->addCasters(['*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) { if ($filter || $isNested) { - if ($obj instanceof \Exception) { + if ($obj instanceof \Throwable) { $a = Caster::filter($a, Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, $this->exceptionsImportants); } else { $a = Caster::filter($a, Caster::EXCLUDE_PROTECTED | Caster::EXCLUDE_PRIVATE); @@ -90,10 +90,8 @@ class Presenter * Present a reference to the value. * * @param mixed $value - * - * @return string */ - public function presentRef($value) + public function presentRef($value): string { return $this->present($value, 0); } @@ -106,10 +104,8 @@ class Presenter * @param mixed $value * @param int $depth (default: null) * @param int $options One of Presenter constants - * - * @return string */ - public function present($value, $depth = null, $options = 0) + public function present($value, int $depth = null, int $options = 0): string { $data = $this->cloner->cloneVar($value, !($options & self::VERBOSE) ? Caster::EXCLUDE_VERBOSE : 0); diff --git a/vendor/psy/psysh/src/VarDumper/PresenterAware.php b/vendor/psy/psysh/src/VarDumper/PresenterAware.php index d0c02ae33..47590fb3a 100644 --- a/vendor/psy/psysh/src/VarDumper/PresenterAware.php +++ b/vendor/psy/psysh/src/VarDumper/PresenterAware.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/vendor/psy/psysh/src/VersionUpdater/Checker.php b/vendor/psy/psysh/src/VersionUpdater/Checker.php index 5278d0217..4de48013f 100644 --- a/vendor/psy/psysh/src/VersionUpdater/Checker.php +++ b/vendor/psy/psysh/src/VersionUpdater/Checker.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,13 +19,7 @@ interface Checker const MONTHLY = 'monthly'; const NEVER = 'never'; - /** - * @return bool - */ - public function isLatest(); + public function isLatest(): bool; - /** - * @return string - */ - public function getLatest(); + public function getLatest(): string; } diff --git a/vendor/psy/psysh/src/VersionUpdater/Downloader.php b/vendor/psy/psysh/src/VersionUpdater/Downloader.php new file mode 100644 index 000000000..233db318b --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/Downloader.php @@ -0,0 +1,43 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater; + +use Psy\Exception\ErrorException; + +interface Downloader +{ + /** + * Set the directory where the download will be written to. + * + * @param string $tempDir + */ + public function setTempDir(string $tempDir); + + /** + * @param string $url + * + * @throws ErrorException on failure + */ + public function download(string $url): bool; + + /** + * Get the temporary file name the download was written to. + */ + public function getFilename(): string; + + /** + * Delete the downloaded file if it exists. + * + * @return void + */ + public function cleanup(); +} diff --git a/vendor/psy/psysh/src/VersionUpdater/Downloader/CurlDownloader.php b/vendor/psy/psysh/src/VersionUpdater/Downloader/CurlDownloader.php new file mode 100644 index 000000000..14ca1d875 --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/Downloader/CurlDownloader.php @@ -0,0 +1,84 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater\Downloader; + +use Psy\Exception\ErrorException; +use Psy\Shell; +use Psy\VersionUpdater\Downloader; + +class CurlDownloader implements Downloader +{ + private $tempDir = null; + private $outputFile = null; + + /** {@inheritDoc} */ + public function setTempDir(string $tempDir) + { + $this->tempDir = $tempDir; + } + + /** {@inheritDoc} */ + public function download(string $url): bool + { + $tempDir = $this->tempDir ?: \sys_get_temp_dir(); + $this->outputFile = \tempnam($tempDir, 'psysh-archive-'); + $targetName = $this->outputFile.'.tar.gz'; + + if (!\rename($this->outputFile, $targetName)) { + return false; + } + + $this->outputFile = $targetName; + + $outputHandle = \fopen($this->outputFile, 'w'); + if (!$outputHandle) { + return false; + } + $curl = \curl_init(); + \curl_setopt_array($curl, [ + \CURLOPT_FAILONERROR => true, + \CURLOPT_HEADER => 0, + \CURLOPT_FOLLOWLOCATION => true, + \CURLOPT_TIMEOUT => 10, + \CURLOPT_FILE => $outputHandle, + \CURLOPT_HTTPHEADER => [ + 'User-Agent' => 'PsySH/'.Shell::VERSION, + ], + ]); + \curl_setopt($curl, \CURLOPT_URL, $url); + $result = \curl_exec($curl); + $error = \curl_error($curl); + \curl_close($curl); + + \fclose($outputHandle); + + if (!$result) { + throw new ErrorException('cURL Error: '.$error); + } + + return (bool) $result; + } + + /** {@inheritDoc} */ + public function getFilename(): string + { + return $this->outputFile; + } + + /** {@inheritDoc} */ + public function cleanup() + { + if (\file_exists($this->outputFile)) { + \unlink($this->outputFile); + } + } +} diff --git a/vendor/psy/psysh/src/VersionUpdater/Downloader/Factory.php b/vendor/psy/psysh/src/VersionUpdater/Downloader/Factory.php new file mode 100644 index 000000000..e1cfd8465 --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/Downloader/Factory.php @@ -0,0 +1,31 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater\Downloader; + +use Psy\Exception\ErrorException; +use Psy\VersionUpdater\Downloader; + +class Factory +{ + /** + * @throws ErrorException If no downloaders can be used + */ + public static function getDownloader(): Downloader + { + if (\extension_loaded('curl')) { + return new CurlDownloader(); + } elseif (\ini_get('allow_url_fopen')) { + return new FileDownloader(); + } + throw new ErrorException('No downloader available.'); + } +} diff --git a/vendor/psy/psysh/src/VersionUpdater/Downloader/FileDownloader.php b/vendor/psy/psysh/src/VersionUpdater/Downloader/FileDownloader.php new file mode 100644 index 000000000..4bf381167 --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/Downloader/FileDownloader.php @@ -0,0 +1,56 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater\Downloader; + +use Psy\VersionUpdater\Downloader; + +class FileDownloader implements Downloader +{ + private $tempDir = null; + private $outputFile = null; + + /** {@inheritDoc} */ + public function setTempDir(string $tempDir) + { + $this->tempDir = $tempDir; + } + + /** {@inheritDoc} */ + public function download(string $url): bool + { + $tempDir = $this->tempDir ?: \sys_get_temp_dir(); + $this->outputFile = \tempnam($tempDir, 'psysh-archive-'); + $targetName = $this->outputFile.'.tar.gz'; + + if (!\rename($this->outputFile, $targetName)) { + return false; + } + + $this->outputFile = $targetName; + + return (bool) \file_put_contents($this->outputFile, \file_get_contents($url)); + } + + /** {@inheritDoc} */ + public function getFilename(): string + { + return $this->outputFile; + } + + /** {@inheritDoc} */ + public function cleanup() + { + if (\file_exists($this->outputFile)) { + \unlink($this->outputFile); + } + } +} diff --git a/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php b/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php index 470cecad5..e1fc7cea7 100644 --- a/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php +++ b/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,10 +19,7 @@ class GitHubChecker implements Checker private $latest; - /** - * @return bool - */ - public function isLatest() + public function isLatest(): bool { // version_compare doesn't handle semver completely; // strip pre-release and build metadata before comparing @@ -31,10 +28,7 @@ class GitHubChecker implements Checker return \version_compare($version, $this->getLatest(), '>='); } - /** - * @return string - */ - public function getLatest() + public function getLatest(): string { if (!isset($this->latest)) { $this->setLatest($this->getVersionFromTag()); @@ -46,7 +40,7 @@ class GitHubChecker implements Checker /** * @param string $version */ - public function setLatest($version) + public function setLatest(string $version) { $this->latest = $version; } @@ -75,7 +69,7 @@ class GitHubChecker implements Checker $context = \stream_context_create([ 'http' => [ 'user_agent' => 'PsySH/'.Shell::VERSION, - 'timeout' => 3, + 'timeout' => 1.0, ], ]); diff --git a/vendor/psy/psysh/src/VersionUpdater/Installer.php b/vendor/psy/psysh/src/VersionUpdater/Installer.php new file mode 100644 index 000000000..eb20cb865 --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/Installer.php @@ -0,0 +1,143 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater; + +use Psy\Exception\ErrorException; + +class Installer +{ + /** + * @var string + */ + protected $installLocation; + + /** + * @var string + */ + protected $tempDirectory; + + public function __construct(string $tempDirectory = null) + { + $this->tempDirectory = $tempDirectory ?: \sys_get_temp_dir(); + $this->installLocation = \Phar::running(false); + } + + /** + * Public to allow the Downloader to use the temporary directory if it's been set. + */ + public function getTempDirectory(): string + { + return $this->tempDirectory; + } + + /** + * Verify the currently installed PsySH phar is writable so it can be replaced. + */ + public function isInstallLocationWritable(): bool + { + return \is_writable($this->installLocation); + } + + /** + * Verify the temporary directory is writable so downloads and backups can be saved there. + */ + public function isTempDirectoryWritable(): bool + { + return \is_writable($this->tempDirectory); + } + + /** + * Verifies the downloaded archive can be extracted with \PharData. + * + * @param string $sourceArchive + */ + public function isValidSource(string $sourceArchive): bool + { + if (!\class_exists('\PharData')) { + return false; + } + $pharArchive = new \PharData($sourceArchive); + + return $pharArchive->valid(); + } + + /** + * Extract the "psysh" phar from the archive and move it, replacing the currently installed phar. + * + * @param string $sourceArchive + */ + public function install(string $sourceArchive): bool + { + $pharArchive = new \PharData($sourceArchive); + $outputDirectory = \tempnam($this->tempDirectory, 'psysh-'); + + // remove the temp file, and replace it with a sub-directory + if (!\unlink($outputDirectory) || !\mkdir($outputDirectory, 0700)) { + return false; + } + + $pharArchive->extractTo($outputDirectory, ['psysh'], true); + + $renamed = \rename($outputDirectory.'/psysh', $this->installLocation); + + // Remove the sub-directory created to extract the psysh binary/phar + \rmdir($outputDirectory); + + return $renamed; + } + + /** + * Create a backup of the currently installed PsySH phar in the temporary directory with a version number postfix. + * + * @param string $version + */ + public function createBackup(string $version): bool + { + $backupFilename = $this->getBackupFilename($version); + + if (\file_exists($backupFilename) && !\is_writable($backupFilename)) { + return false; + } + + return \rename($this->installLocation, $backupFilename); + } + + /** + * Restore the backup file to the original PsySH install location. + * + * @param string $version + * + * @throws ErrorException If the backup file could not be found + */ + public function restoreFromBackup(string $version): bool + { + $backupFilename = $this->getBackupFilename($version); + + if (!\file_exists($backupFilename)) { + throw new ErrorException("Cannot restore from backup. File not found! [{$backupFilename}]"); + } + + return \rename($backupFilename, $this->installLocation); + } + + /** + * Get the full path for the backup target file location. + * + * @param string $version + */ + public function getBackupFilename(string $version): string + { + $installFilename = \basename($this->installLocation); + + return \sprintf('%s/%s.%s', $this->tempDirectory, $installFilename, $version); + } +} diff --git a/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php b/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php index 5c43b29d5..06a67775a 100644 --- a/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php +++ b/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -43,7 +43,10 @@ class IntervalChecker extends GitHubChecker return $release; } - private function getDateInterval() + /** + * @throws \RuntimeException if interval passed to constructor is not supported + */ + private function getDateInterval(): \DateInterval { switch ($this->interval) { case Checker::DAILY: @@ -53,6 +56,8 @@ class IntervalChecker extends GitHubChecker case Checker::MONTHLY: return new \DateInterval('P1M'); } + + throw new \RuntimeException('Invalid interval configured'); } private function updateCache($release) diff --git a/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php b/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php index 22340f763..2c8240e65 100644 --- a/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php +++ b/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,22 +14,16 @@ namespace Psy\VersionUpdater; use Psy\Shell; /** - * A version checker stub which always thinks the current verion is up to date. + * A version checker stub which always thinks the current version is up to date. */ class NoopChecker implements Checker { - /** - * @return bool - */ - public function isLatest() + public function isLatest(): bool { return true; } - /** - * @return string - */ - public function getLatest() + public function getLatest(): string { return Shell::VERSION; } diff --git a/vendor/psy/psysh/src/VersionUpdater/SelfUpdate.php b/vendor/psy/psysh/src/VersionUpdater/SelfUpdate.php new file mode 100644 index 000000000..dbda8716c --- /dev/null +++ b/vendor/psy/psysh/src/VersionUpdater/SelfUpdate.php @@ -0,0 +1,186 @@ +<?php + +/* + * This file is part of Psy Shell. + * + * (c) 2012-2023 Justin Hileman + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Psy\VersionUpdater; + +use Psy\Exception\ErrorException; +use Psy\Shell; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Self update command. + * + * If a new version is available, this command will download it and replace the currently installed version + */ +class SelfUpdate +{ + const URL_PREFIX = 'https://github.com/bobthecow/psysh/releases/download'; + const SUCCESS = 0; + const FAILURE = 1; + + /** @var Checker */ + private $checker; + + /** @var Installer */ + private $installer; + + /** @var Downloader */ + private $downloader; + + public function __construct(Checker $checker, Installer $installer) + { + $this->checker = $checker; + $this->installer = $installer; + } + + /** + * Allow the downloader to be injected for testing. + * + * @param Downloader $downloader + * + * @return void + */ + public function setDownloader(Downloader $downloader) + { + $this->downloader = $downloader; + } + + /** + * Get the currently set Downloader or create one based on the capabilities of the php environment. + * + * @throws ErrorException if a downloader cannot be created for the php environment + */ + private function getDownloader(): Downloader + { + if (!isset($this->downloader)) { + return Downloader\Factory::getDownloader(); + } + + return $this->downloader; + } + + /** + * Build the download URL for the latest release. + * + * The file name used in the URL will include the flavour postfix extracted from the current version + * if it's present + * + * @param string $latestVersion + */ + private function getAssetUrl(string $latestVersion): string + { + $versionPostfix = ''; + if (\strpos(Shell::VERSION, '+')) { + $versionPostfix = '-'.\substr(Shell::VERSION, \strpos(Shell::VERSION, '+') + 1); + } + $downloadFilename = \sprintf('psysh-%s%s.tar.gz', $latestVersion, $versionPostfix); + + // check if latest release data contains an asset matching the filename? + + return \sprintf('%s/%s/%s', self::URL_PREFIX, $latestVersion, $downloadFilename); + } + + /** + * Execute the self-update process. + * + * @param InputInterface $input + * @param OutputInterface $output + * + * @throws ErrorException if the current version is not restored when installation fails + */ + public function run(InputInterface $input, OutputInterface $output): int + { + $currentVersion = Shell::VERSION; + + // already have the latest version? + if ($this->checker->isLatest()) { + // current version is latest version... + $output->writeln('<info>Current version is up-to-date.</info>'); + + return self::SUCCESS; + } + + // can overwrite current version? + if (!$this->installer->isInstallLocationWritable()) { + $output->writeln('<error>Installed version is not writable.</error>'); + + return self::FAILURE; + } + // can download to, and create a backup in the temp directory? + if (!$this->installer->isTempDirectoryWritable()) { + $output->writeln('<error>Temporary directory is not writable.</error>'); + + return self::FAILURE; + } + + $latestVersion = $this->checker->getLatest(); + $downloadUrl = $this->getAssetUrl($latestVersion); + + $output->write("Downloading PsySH $latestVersion ..."); + + try { + $downloader = $this->getDownloader(); + $downloader->setTempDir($this->installer->getTempDirectory()); + $downloaded = $downloader->download($downloadUrl); + } catch (ErrorException $e) { + $output->write(' <error>Failed.</error>'); + $output->writeln(\sprintf('<error>%s</error>', $e->getMessage())); + + return self::FAILURE; + } + + if (!$downloaded) { + $output->writeln('<error>Download failed.</error>'); + $downloader->cleanup(); + + return self::FAILURE; + } else { + $output->write(' <info>OK</info>'.\PHP_EOL); + } + + $downloadedFile = $downloader->getFilename(); + + if (!$this->installer->isValidSource($downloadedFile)) { + $downloader->cleanup(); + $output->writeln('<error>Downloaded file is not a valid archive.</error>'); + + return self::FAILURE; + } + + // create backup as bin.old-version in the temporary directory + $backupCreated = $this->installer->createBackup($currentVersion); + if (!$backupCreated) { + $downloader->cleanup(); + $output->writeln('<error>Failed to create a backup of the current version.</error>'); + + return self::FAILURE; + } elseif ($input->getOption('verbose')) { + $backupFilename = $this->installer->getBackupFilename($currentVersion); + $output->writeln('Created backup of current version: '.$backupFilename); + } + + if (!$this->installer->install($downloadedFile)) { + $this->installer->restoreFromBackup($currentVersion); + $downloader->cleanup(); + $output->writeln("<error>Failed to install new PsySH version $latestVersion.</error>"); + + return self::FAILURE; + } + + // Remove the downloaded archive file from the temporary directory + $downloader->cleanup(); + + $output->writeln("Updated PsySH from $currentVersion to <info>$latestVersion</info>"); + + return self::SUCCESS; + } +} diff --git a/vendor/psy/psysh/src/functions.php b/vendor/psy/psysh/src/functions.php index 0f78d04ae..7445bf81c 100644 --- a/vendor/psy/psysh/src/functions.php +++ b/vendor/psy/psysh/src/functions.php @@ -3,7 +3,7 @@ /* * This file is part of Psy Shell. * - * (c) 2012-2020 Justin Hileman + * (c) 2012-2023 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,6 +13,8 @@ namespace Psy; use Psy\ExecutionLoop\ProcessForker; use Psy\VersionUpdater\GitHubChecker; +use Psy\VersionUpdater\Installer; +use Psy\VersionUpdater\SelfUpdate; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; @@ -23,10 +25,8 @@ if (!\function_exists('Psy\\sh')) { * Command to return the eval-able code to startup PsySH. * * eval(\Psy\sh()); - * - * @return string */ - function sh() + function sh(): string { if (\version_compare(\PHP_VERSION, '8.0', '<')) { return '\extract(\Psy\debug(\get_defined_vars(), isset($this) ? $this : @\get_called_class()));'; @@ -90,7 +90,7 @@ if (!\function_exists('Psy\\debug')) { * * @return array Scope variables from the debugger session */ - function debug(array $vars = [], $bindTo = null) + function debug(array $vars = [], $bindTo = null): array { echo \PHP_EOL; @@ -183,7 +183,7 @@ if (!\function_exists('Psy\\info')) { try { $updateAvailable = !$checker->isLatest(); $latest = $checker->getLatest(); - } catch (\Exception $e) { + } catch (\Throwable $e) { } $updates = [ @@ -225,6 +225,7 @@ if (!\function_exists('Psy\\info')) { 'color mode' => $config->colorMode(), 'output decorated' => $config->getOutputDecorated(), 'output verbosity' => $config->verbosity(), + 'output pager' => $config->getPager(), ]; $pcntl = [ @@ -327,27 +328,17 @@ if (!\function_exists('Psy\\bin')) { * * @return \Closure */ - function bin() + function bin(): \Closure { return function () { if (!isset($_SERVER['PSYSH_IGNORE_ENV']) || !$_SERVER['PSYSH_IGNORE_ENV']) { - if (\defined('HHVM_VERSION_ID') && HHVM_VERSION_ID < 31800) { - \fwrite(\STDERR, 'HHVM 3.18 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); + if (\defined('HHVM_VERSION_ID')) { + \fwrite(\STDERR, 'PsySH v0.11 and higher does not support HHVM. Install an older version, or set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } - if (\defined('HHVM_VERSION_ID') && HHVM_VERSION_ID > 39999) { - \fwrite(\STDERR, 'HHVM 4 or higher is not supported. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); - exit(1); - } - - if (\PHP_VERSION_ID < 50509) { - \fwrite(\STDERR, 'PHP 5.5.9 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); - exit(1); - } - - if (\PHP_VERSION_ID < 50600 && \Phar::running()) { - \fwrite(\STDERR, 'PHP 5.6.0 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); + if (\PHP_VERSION_ID < 70000) { + \fwrite(\STDERR, 'PHP 7.0.0 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } @@ -368,12 +359,14 @@ if (!\function_exists('Psy\\bin')) { } $usageException = null; + $shellIsPhar = Shell::isPhar(); $input = new ArgvInput(); try { $input->bind(new InputDefinition(\array_merge(Configuration::getInputOptions(), [ new InputOption('help', 'h', InputOption::VALUE_NONE), new InputOption('version', 'V', InputOption::VALUE_NONE), + new InputOption('self-update', 'u', InputOption::VALUE_NONE), new InputArgument('include', InputArgument::IS_ARRAY), ]))); @@ -408,16 +401,27 @@ Options: -c, --config FILE Use an alternate PsySH config file location. --cwd PATH Use an alternate working directory. -V, --version Display the PsySH version. + +EOL; + if ($shellIsPhar) { + echo <<<EOL + -u, --self-update Install a newer version if available. + +EOL; + } + echo <<<EOL --color Force colors in output. --no-color Disable colors in output. -i, --interactive Force PsySH to run in interactive mode. -n, --no-interactive Run PsySH without interactive input. Requires input from stdin. -r, --raw-output Print var_export-style return values (for non-interactive input) + --compact Run PsySH with compact output. -q, --quiet Shhhhhh. -v|vv|vvv, --verbose Increase the verbosity of messages. --yolo Run PsySH without input validation. You don't want this. EOL; + exit($usageException === null ? 0 : 1); } @@ -427,6 +431,17 @@ EOL; exit(0); } + // Handle --self-update + if ($input->getOption('self-update')) { + if (!$shellIsPhar) { + \fwrite(\STDERR, 'The --self-update option can only be used with with a phar based install.'.\PHP_EOL); + exit(1); + } + $selfUpdate = new SelfUpdate(new GitHubChecker(), new Installer()); + $result = $selfUpdate->run($input, $config->getOutput()); + exit($result); + } + $shell = new Shell($config); // Pass additional arguments to Shell as 'includes' @@ -435,7 +450,7 @@ EOL; try { // And go! $shell->run(); - } catch (\Exception $e) { + } catch (\Throwable $e) { \fwrite(\STDERR, $e->getMessage().\PHP_EOL); // @todo this triggers the "exited unexpectedly" logic in the diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 000000000..be5540c2a --- /dev/null +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +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/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 000000000..9430d76bb --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 000000000..de8ce62e4 --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 000000000..c7285a5ba --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ +<?php + +if (!function_exists('getallheaders')) { + + /** + * Get all HTTP header key/values as an associative array for the current request. + * + * @return string[string] The HTTP header key/value pairs. + */ + function getallheaders() + { + $headers = array(); + + $copy_server = array( + 'CONTENT_TYPE' => 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +} diff --git a/vendor/ramsey/uuid/README.md b/vendor/ramsey/uuid/README.md index 544df1aa3..491429df9 100644 --- a/vendor/ramsey/uuid/README.md +++ b/vendor/ramsey/uuid/README.md @@ -175,7 +175,7 @@ information. [badge-upgrade]: https://img.shields.io/packagist/v/ramsey/uuid.svg?style=flat-square&label=upgrade&colorB=darkred [badge-license]: https://img.shields.io/packagist/l/ramsey/uuid.svg?style=flat-square&colorB=darkcyan [badge-php]: https://img.shields.io/packagist/php-v/ramsey/uuid/3.x-dev.svg?style=flat-square&colorB=%238892BF -[badge-build]: https://img.shields.io/github/workflow/status/ramsey/uuid/build/3.x.svg?logo=github&style=flat-square +[badge-build]: https://img.shields.io/github/actions/workflow/status/ramsey/uuid/continuous-integration.yml?branch=3.x&logo=github&style=flat-square [badge-coverage]: https://img.shields.io/codecov/c/gh/ramsey/uuid/3.x.svg?style=flat-square&logo=codecov [source]: https://github.com/ramsey/uuid/tree/3.x diff --git a/vendor/ramsey/uuid/composer.json b/vendor/ramsey/uuid/composer.json index a6185952d..8f5505d9f 100644 --- a/vendor/ramsey/uuid/composer.json +++ b/vendor/ramsey/uuid/composer.json @@ -51,11 +51,12 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter" }, "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" + "sort-packages": true, + "allow-plugins": { + "phpstan/extension-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true, + "captainhook/plugin-composer": true } }, "replace": { diff --git a/vendor/ramsey/uuid/src/Uuid.php b/vendor/ramsey/uuid/src/Uuid.php index d51e0e1ad..1744d28dd 100644 --- a/vendor/ramsey/uuid/src/Uuid.php +++ b/vendor/ramsey/uuid/src/Uuid.php @@ -213,6 +213,7 @@ class Uuid implements UuidInterface * @return string * @link http://php.net/manual/en/class.jsonserializable.php */ + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->toString(); diff --git a/vendor/symfony/css-selector/CssSelectorConverter.php b/vendor/symfony/css-selector/CssSelectorConverter.php index d1aeb7eb1..bbb6afe21 100644 --- a/vendor/symfony/css-selector/CssSelectorConverter.php +++ b/vendor/symfony/css-selector/CssSelectorConverter.php @@ -27,6 +27,10 @@ use Symfony\Component\CssSelector\XPath\Translator; class CssSelectorConverter { private $translator; + private $cache; + + private static $xmlCache = []; + private static $htmlCache = []; /** * @param bool $html Whether HTML support should be enabled. Disable it for XML documents @@ -37,6 +41,9 @@ class CssSelectorConverter if ($html) { $this->translator->registerExtension(new HtmlExtension($this->translator)); + $this->cache = &self::$htmlCache; + } else { + $this->cache = &self::$xmlCache; } $this->translator @@ -53,13 +60,10 @@ class CssSelectorConverter * Optionally, a prefix can be added to the resulting XPath * expression with the $prefix parameter. * - * @param string $cssExpr The CSS expression - * @param string $prefix An optional prefix for the XPath expression - * * @return string */ - public function toXPath($cssExpr, $prefix = 'descendant-or-self::') + public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::') { - return $this->translator->cssToXPath($cssExpr, $prefix); + return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix); } } diff --git a/vendor/symfony/css-selector/Exception/SyntaxErrorException.php b/vendor/symfony/css-selector/Exception/SyntaxErrorException.php index 1200c979e..7deacf9c5 100644 --- a/vendor/symfony/css-selector/Exception/SyntaxErrorException.php +++ b/vendor/symfony/css-selector/Exception/SyntaxErrorException.php @@ -24,32 +24,25 @@ use Symfony\Component\CssSelector\Parser\Token; class SyntaxErrorException extends ParseException { /** - * @param string $expectedValue - * * @return self */ - public static function unexpectedToken($expectedValue, Token $foundToken) + public static function unexpectedToken(string $expectedValue, Token $foundToken) { return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken)); } /** - * @param string $pseudoElement - * @param string $unexpectedLocation - * * @return self */ - public static function pseudoElementFound($pseudoElement, $unexpectedLocation) + public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation) { return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation)); } /** - * @param int $position - * * @return self */ - public static function unclosedString($position) + public static function unclosedString(int $position) { return new self(sprintf('Unclosed/invalid string at %s.', $position)); } diff --git a/vendor/symfony/css-selector/LICENSE b/vendor/symfony/css-selector/LICENSE index 88bf75bb4..008370457 100644 --- a/vendor/symfony/css-selector/LICENSE +++ b/vendor/symfony/css-selector/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/css-selector/Parser/TokenStream.php b/vendor/symfony/css-selector/Parser/TokenStream.php index f4c2585aa..2085f2dd7 100644 --- a/vendor/symfony/css-selector/Parser/TokenStream.php +++ b/vendor/symfony/css-selector/Parser/TokenStream.php @@ -118,9 +118,7 @@ class TokenStream } /** - * Returns nex identifier token. - * - * @return string The identifier token value + * Returns next identifier token. * * @throws SyntaxErrorException If next token is not an identifier */ @@ -136,9 +134,7 @@ class TokenStream } /** - * Returns nex identifier or star delimiter token. - * - * @return string|null The identifier token value or null if star found + * Returns next identifier or null if star delimiter token is found. * * @throws SyntaxErrorException If next token is not an identifier or a star delimiter */ diff --git a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php index 5f16ac48f..2e78a1c4d 100644 --- a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php +++ b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php @@ -49,22 +49,22 @@ class TokenizerPatterns $this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*'; $this->hashPattern = '#((?:'.$this->nmCharPattern.')+)'; $this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)'; - $this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*'; + $this->quotedStringPattern = '([^\n\r\f\\\\%s]|'.$this->stringEscapePattern.')*'; } public function getNewLineEscapePattern(): string { - return '~^'.$this->newLineEscapePattern.'~'; + return '~'.$this->newLineEscapePattern.'~'; } public function getSimpleEscapePattern(): string { - return '~^'.$this->simpleEscapePattern.'~'; + return '~'.$this->simpleEscapePattern.'~'; } public function getUnicodeEscapePattern(): string { - return '~^'.$this->unicodeEscapePattern.'~i'; + return '~'.$this->unicodeEscapePattern.'~i'; } public function getIdentifierPattern(): string diff --git a/vendor/symfony/css-selector/XPath/Translator.php b/vendor/symfony/css-selector/XPath/Translator.php index 782aef458..8ce473036 100644 --- a/vendor/symfony/css-selector/XPath/Translator.php +++ b/vendor/symfony/css-selector/XPath/Translator.php @@ -203,7 +203,7 @@ class Translator implements TranslatorInterface /** * @throws ExpressionErrorException */ - public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value): XPathExpr + public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, ?string $value): XPathExpr { if (!isset($this->attributeMatchingTranslators[$operator])) { throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator)); diff --git a/vendor/symfony/css-selector/XPath/XPathExpr.php b/vendor/symfony/css-selector/XPath/XPathExpr.php index 638cbd0fe..e45ce7d8c 100644 --- a/vendor/symfony/css-selector/XPath/XPathExpr.php +++ b/vendor/symfony/css-selector/XPath/XPathExpr.php @@ -43,6 +43,9 @@ class XPathExpr return $this->element; } + /** + * @return $this + */ public function addCondition(string $condition): self { $this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition; @@ -55,6 +58,9 @@ class XPathExpr return $this->condition; } + /** + * @return $this + */ public function addNameTest(): self { if ('*' !== $this->element) { @@ -65,6 +71,9 @@ class XPathExpr return $this; } + /** + * @return $this + */ public function addStarPrefix(): self { $this->path .= '*/'; diff --git a/vendor/symfony/css-selector/composer.json b/vendor/symfony/css-selector/composer.json index e8ecfee7a..f0b712495 100644 --- a/vendor/symfony/css-selector/composer.json +++ b/vendor/symfony/css-selector/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-php80": "^1.16" }, "autoload": { diff --git a/vendor/symfony/deprecation-contracts/.gitignore b/vendor/symfony/deprecation-contracts/.gitignore new file mode 100644 index 000000000..c49a5d8df --- /dev/null +++ b/vendor/symfony/deprecation-contracts/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/deprecation-contracts/CHANGELOG.md b/vendor/symfony/deprecation-contracts/CHANGELOG.md new file mode 100644 index 000000000..7932e2613 --- /dev/null +++ b/vendor/symfony/deprecation-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/deprecation-contracts/LICENSE b/vendor/symfony/deprecation-contracts/LICENSE new file mode 100644 index 000000000..406242ff2 --- /dev/null +++ b/vendor/symfony/deprecation-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020-2022 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/deprecation-contracts/README.md b/vendor/symfony/deprecation-contracts/README.md new file mode 100644 index 000000000..4957933a6 --- /dev/null +++ b/vendor/symfony/deprecation-contracts/README.md @@ -0,0 +1,26 @@ +Symfony Deprecation Contracts +============================= + +A generic function and convention to trigger deprecation notices. + +This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. + +By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, +the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. + +The function requires at least 3 arguments: + - the name of the Composer package that is triggering the deprecation + - the version of the package that introduced the deprecation + - the message of the deprecation + - more arguments can be provided: they will be inserted in the message using `printf()` formatting + +Example: +```php +trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); +``` + +This will generate the following message: +`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` + +While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty +`function trigger_deprecation() {}` in your application. diff --git a/vendor/symfony/deprecation-contracts/composer.json b/vendor/symfony/deprecation-contracts/composer.json new file mode 100644 index 000000000..cc7cc1237 --- /dev/null +++ b/vendor/symfony/deprecation-contracts/composer.json @@ -0,0 +1,35 @@ +{ + "name": "symfony/deprecation-contracts", + "type": "library", + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.1" + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/vendor/symfony/deprecation-contracts/function.php b/vendor/symfony/deprecation-contracts/function.php new file mode 100644 index 000000000..d4371504a --- /dev/null +++ b/vendor/symfony/deprecation-contracts/function.php @@ -0,0 +1,27 @@ +<?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. + */ + +if (!function_exists('trigger_deprecation')) { + /** + * Triggers a silenced deprecation notice. + * + * @param string $package The name of the Composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string $message The message of the deprecation + * @param mixed ...$args Values to insert in the message using printf() formatting + * + * @author Nicolas Grekas <p@tchwork.com> + */ + function trigger_deprecation(string $package, string $version, string $message, ...$args): void + { + @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); + } +} diff --git a/vendor/symfony/http-client-contracts/CHANGELOG.md b/vendor/symfony/http-client-contracts/CHANGELOG.md new file mode 100644 index 000000000..7932e2613 --- /dev/null +++ b/vendor/symfony/http-client-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/http-client-contracts/ChunkInterface.php b/vendor/symfony/http-client-contracts/ChunkInterface.php index ad5efca9e..0800cb366 100644 --- a/vendor/symfony/http-client-contracts/ChunkInterface.php +++ b/vendor/symfony/http-client-contracts/ChunkInterface.php @@ -21,8 +21,6 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; * MUST be thrown by the destructor unless one was already thrown by another method. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface ChunkInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php index 5b5fa5084..22d2b456a 100644 --- a/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * When a 4xx response is returned. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface ClientExceptionInterface extends HttpExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php index 709db2189..971a7a29b 100644 --- a/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * When a content-type cannot be decoded to the expected representation. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface DecodingExceptionInterface extends ExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php index 6d59715f7..e553b47a1 100644 --- a/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * The base interface for all exceptions in the contract. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface ExceptionInterface extends \Throwable { diff --git a/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php index 0e9f39f6e..17865ed36 100644 --- a/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php @@ -17,8 +17,6 @@ use Symfony\Contracts\HttpClient\ResponseInterface; * Base interface for HTTP-related exceptions. * * @author Anton Chernikov <anton_ch1989@mail.ru> - * - * @experimental in 1.1 */ interface HttpExceptionInterface extends ExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php index 8cdd3e70d..edd9b8a9b 100644 --- a/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * When a 3xx response is returned and the "max_redirects" option has been reached. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface RedirectionExceptionInterface extends HttpExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php index f994ba2dd..9bfe1354b 100644 --- a/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * When a 5xx response is returned. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface ServerExceptionInterface extends HttpExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php new file mode 100644 index 000000000..08acf9fb6 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php @@ -0,0 +1,21 @@ +<?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\Contracts\HttpClient\Exception; + +/** + * When an idle timeout occurs. + * + * @author Nicolas Grekas <p@tchwork.com> + */ +interface TimeoutExceptionInterface extends TransportExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php index 1cdc30a2f..0c8d131a0 100644 --- a/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php +++ b/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php @@ -15,8 +15,6 @@ namespace Symfony\Contracts\HttpClient\Exception; * When any error happens at the transport level. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface TransportExceptionInterface extends ExceptionInterface { diff --git a/vendor/symfony/http-client-contracts/HttpClientInterface.php b/vendor/symfony/http-client-contracts/HttpClientInterface.php index 68afa7811..158c1a7d0 100644 --- a/vendor/symfony/http-client-contracts/HttpClientInterface.php +++ b/vendor/symfony/http-client-contracts/HttpClientInterface.php @@ -19,9 +19,9 @@ use Symfony\Contracts\HttpClient\Test\HttpClientTestCase; * * @see HttpClientTestCase for a reference test suite * - * @author Nicolas Grekas <p@tchwork.com> + * @method static withOptions(array $options) Returns a new instance of the client with new default options * - * @experimental in 1.1 + * @author Nicolas Grekas <p@tchwork.com> */ interface HttpClientInterface { @@ -88,8 +88,8 @@ interface HttpClientInterface /** * Yields responses chunk by chunk as they complete. * - * @param ResponseInterface|ResponseInterface[]|iterable $responses One or more responses created by the current HTTP client - * @param float|null $timeout The idle timeout before yielding timeout chunks + * @param ResponseInterface|iterable<array-key, ResponseInterface> $responses One or more responses created by the current HTTP client + * @param float|null $timeout The idle timeout before yielding timeout chunks */ public function stream($responses, float $timeout = null): ResponseStreamInterface; } diff --git a/vendor/symfony/http-client-contracts/ResponseInterface.php b/vendor/symfony/http-client-contracts/ResponseInterface.php index ad4a4687d..df7148816 100644 --- a/vendor/symfony/http-client-contracts/ResponseInterface.php +++ b/vendor/symfony/http-client-contracts/ResponseInterface.php @@ -22,8 +22,6 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; * A (lazily retrieved) HTTP response. * * @author Nicolas Grekas <p@tchwork.com> - * - * @experimental in 1.1 */ interface ResponseInterface { diff --git a/vendor/symfony/http-client-contracts/ResponseStreamInterface.php b/vendor/symfony/http-client-contracts/ResponseStreamInterface.php index dfff554df..fa3e5db6c 100644 --- a/vendor/symfony/http-client-contracts/ResponseStreamInterface.php +++ b/vendor/symfony/http-client-contracts/ResponseStreamInterface.php @@ -16,7 +16,7 @@ namespace Symfony\Contracts\HttpClient; * * @author Nicolas Grekas <p@tchwork.com> * - * @experimental in 1.1 + * @extends \Iterator<ResponseInterface, ChunkInterface> */ interface ResponseStreamInterface extends \Iterator { diff --git a/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php b/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php index bce7a85c1..7acd6b79c 100644 --- a/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php +++ b/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php @@ -14,13 +14,12 @@ namespace Symfony\Contracts\HttpClient\Test; use PHPUnit\Framework\TestCase; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TimeoutExceptionInterface; use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; /** * A reference test suite for HttpClientInterface implementations. - * - * @experimental in 1.1 */ abstract class HttpClientTestCase extends TestCase { @@ -746,9 +745,35 @@ abstract class HttpClientTestCase extends TestCase $response->getHeaders(); } - public function testTimeoutOnStream() + public function testTimeoutIsNotAFatalError() { usleep(300000); // wait for the previous test to release the server + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body', [ + 'timeout' => 0.25, + ]); + + try { + $response->getContent(); + $this->fail(TimeoutExceptionInterface::class.' expected'); + } catch (TimeoutExceptionInterface $e) { + } + + for ($i = 0; $i < 10; ++$i) { + try { + $this->assertSame('<1><2>', $response->getContent()); + break; + } catch (TimeoutExceptionInterface $e) { + } + } + + if (10 === $i) { + throw $e; + } + } + + public function testTimeoutOnStream() + { $client = $this->getHttpClient(__FUNCTION__); $response = $client->request('GET', 'http://localhost:8057/timeout-body'); @@ -1093,4 +1118,20 @@ abstract class HttpClientTestCase extends TestCase $this->assertLessThan(10, $duration); } + + public function testWithOptions() + { + $client = $this->getHttpClient(__FUNCTION__); + if (!method_exists($client, 'withOptions')) { + $this->markTestSkipped(sprintf('Not implementing "%s::withOptions()" is deprecated.', get_debug_type($client))); + } + + $client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']); + + $this->assertNotSame($client, $client2); + $this->assertSame(\get_class($client), \get_class($client2)); + + $response = $client2->request('GET', '/'); + $this->assertSame(200, $response->getStatusCode()); + } } diff --git a/vendor/symfony/http-client-contracts/Test/TestHttpServer.php b/vendor/symfony/http-client-contracts/Test/TestHttpServer.php index a1fcc593a..55a744aef 100644 --- a/vendor/symfony/http-client-contracts/Test/TestHttpServer.php +++ b/vendor/symfony/http-client-contracts/Test/TestHttpServer.php @@ -14,9 +14,6 @@ namespace Symfony\Contracts\HttpClient\Test; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; -/** - * @experimental in 1.1 - */ class TestHttpServer { private static $process = []; diff --git a/vendor/symfony/http-client-contracts/composer.json b/vendor/symfony/http-client-contracts/composer.json index 2464d0817..b76cab852 100644 --- a/vendor/symfony/http-client-contracts/composer.json +++ b/vendor/symfony/http-client-contracts/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1.3" + "php": ">=7.2.5" }, "suggest": { "symfony/http-client-implementation": "" @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php index eeb7a6ef9..43bd7c808 100644 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ b/vendor/symfony/http-kernel/HttpCache/Store.php @@ -26,19 +26,29 @@ class Store implements StoreInterface { protected $root; private $keyCache; - private $locks; + private $locks = []; + private $options; /** + * Constructor. + * + * The available options are: + * + * * private_headers Set of response headers that should not be stored + * when a response is cached. (default: Set-Cookie) + * * @throws \RuntimeException */ - public function __construct(string $root) + public function __construct(string $root, array $options = []) { $this->root = $root; if (!file_exists($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) { throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); } $this->keyCache = new \SplObjectStorage(); - $this->locks = []; + $this->options = array_merge([ + 'private_headers' => ['Set-Cookie'], + ], $options); } /** @@ -215,6 +225,10 @@ class Store implements StoreInterface $headers = $this->persistResponse($response); unset($headers['age']); + foreach ($this->options['private_headers'] as $h) { + unset($headers[strtolower($h)]); + } + array_unshift($entries, [$storedEnv, $headers]); if (!$this->save($key, serialize($entries))) { diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index be36bc634..7064edefb 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -76,11 +76,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '4.4.49'; - public const VERSION_ID = 40449; + public const VERSION = '4.4.50'; + public const VERSION_ID = 40450; public const MAJOR_VERSION = 4; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 49; + public const RELEASE_VERSION = 50; public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2022'; diff --git a/vendor/symfony/mime/Address.php b/vendor/symfony/mime/Address.php index 246846dfe..ae83efd73 100644 --- a/vendor/symfony/mime/Address.php +++ b/vendor/symfony/mime/Address.php @@ -98,11 +98,20 @@ final class Address if ($address instanceof self) { return $address; } - if (\is_string($address)) { - return self::fromString($address); + + if (!\is_string($address)) { + throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s" given).', get_debug_type($address))); } - throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s") given).', \is_object($address) ? \get_class($address) : \gettype($address))); + if (false === strpos($address, '<')) { + return new self($address); + } + + if (!preg_match(self::FROM_STRING_PATTERN, $address, $matches)) { + throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $address, self::class)); + } + + return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"')); } /** @@ -120,14 +129,19 @@ final class Address return $addrs; } + /** + * @deprecated since Symfony 5.2, use "create()" instead. + */ public static function fromString(string $string): self { + trigger_deprecation('symfony/mime', '5.2', '"%s()" is deprecated, use "%s::create()" instead.', __METHOD__, __CLASS__); + if (!str_contains($string, '<')) { return new self($string, ''); } if (!preg_match(self::FROM_STRING_PATTERN, $string, $matches)) { - throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $string, static::class)); + throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $string, self::class)); } return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"')); diff --git a/vendor/symfony/mime/CHANGELOG.md b/vendor/symfony/mime/CHANGELOG.md index 6148360dd..f272346c9 100644 --- a/vendor/symfony/mime/CHANGELOG.md +++ b/vendor/symfony/mime/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +5.2.0 +----- + + * Add support for DKIM + * Deprecated `Address::fromString()`, use `Address::create()` instead + 4.4.0 ----- diff --git a/vendor/symfony/mime/CharacterStream.php b/vendor/symfony/mime/CharacterStream.php index 6400a4aa6..238debde1 100644 --- a/vendor/symfony/mime/CharacterStream.php +++ b/vendor/symfony/mime/CharacterStream.php @@ -97,10 +97,7 @@ final class CharacterStream } } if (\is_resource($input)) { - $blocks = 512; - if (stream_get_meta_data($input)['seekable'] ?? false) { - rewind($input); - } + $blocks = 16372; while (false !== $read = fread($input, $blocks)) { $this->write($read); } diff --git a/vendor/symfony/mime/Crypto/DkimOptions.php b/vendor/symfony/mime/Crypto/DkimOptions.php new file mode 100644 index 000000000..171bb2583 --- /dev/null +++ b/vendor/symfony/mime/Crypto/DkimOptions.php @@ -0,0 +1,97 @@ +<?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\Mime\Crypto; + +/** + * A helper providing autocompletion for available DkimSigner options. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +final class DkimOptions +{ + private $options = []; + + public function toArray(): array + { + return $this->options; + } + + /** + * @return $this + */ + public function algorithm(string $algo): self + { + $this->options['algorithm'] = $algo; + + return $this; + } + + /** + * @return $this + */ + public function signatureExpirationDelay(int $show): self + { + $this->options['signature_expiration_delay'] = $show; + + return $this; + } + + /** + * @return $this + */ + public function bodyMaxLength(int $max): self + { + $this->options['body_max_length'] = $max; + + return $this; + } + + /** + * @return $this + */ + public function bodyShowLength(bool $show): self + { + $this->options['body_show_length'] = $show; + + return $this; + } + + /** + * @return $this + */ + public function headerCanon(string $canon): self + { + $this->options['header_canon'] = $canon; + + return $this; + } + + /** + * @return $this + */ + public function bodyCanon(string $canon): self + { + $this->options['body_canon'] = $canon; + + return $this; + } + + /** + * @return $this + */ + public function headersToIgnore(array $headers): self + { + $this->options['headers_to_ignore'] = $headers; + + return $this; + } +} diff --git a/vendor/symfony/mime/Crypto/DkimSigner.php b/vendor/symfony/mime/Crypto/DkimSigner.php new file mode 100644 index 000000000..f0f7091ed --- /dev/null +++ b/vendor/symfony/mime/Crypto/DkimSigner.php @@ -0,0 +1,220 @@ +<?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\Mime\Crypto; + +use Symfony\Component\Mime\Exception\InvalidArgumentException; +use Symfony\Component\Mime\Exception\RuntimeException; +use Symfony\Component\Mime\Header\UnstructuredHeader; +use Symfony\Component\Mime\Message; +use Symfony\Component\Mime\Part\AbstractPart; + +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * RFC 6376 and 8301 + */ +final class DkimSigner +{ + public const CANON_SIMPLE = 'simple'; + public const CANON_RELAXED = 'relaxed'; + + public const ALGO_SHA256 = 'rsa-sha256'; + public const ALGO_ED25519 = 'ed25519-sha256'; // RFC 8463 + + private $key; + private $domainName; + private $selector; + private $defaultOptions; + + /** + * @param string $pk The private key as a string or the path to the file containing the private key, should be prefixed with file:// (in PEM format) + * @param string $passphrase A passphrase of the private key (if any) + */ + public function __construct(string $pk, string $domainName, string $selector, array $defaultOptions = [], string $passphrase = '') + { + if (!\extension_loaded('openssl')) { + throw new \LogicException('PHP extension "openssl" is required to use DKIM.'); + } + if (!$this->key = openssl_pkey_get_private($pk, $passphrase)) { + throw new InvalidArgumentException('Unable to load DKIM private key: '.openssl_error_string()); + } + + $this->domainName = $domainName; + $this->selector = $selector; + $this->defaultOptions = $defaultOptions + [ + 'algorithm' => self::ALGO_SHA256, + 'signature_expiration_delay' => 0, + 'body_max_length' => \PHP_INT_MAX, + 'body_show_length' => false, + 'header_canon' => self::CANON_RELAXED, + 'body_canon' => self::CANON_RELAXED, + 'headers_to_ignore' => [], + ]; + } + + public function sign(Message $message, array $options = []): Message + { + $options += $this->defaultOptions; + if (!\in_array($options['algorithm'], [self::ALGO_SHA256, self::ALGO_ED25519], true)) { + throw new InvalidArgumentException(sprintf('Invalid DKIM signing algorithm "%s".', $options['algorithm'])); + } + $headersToIgnore['return-path'] = true; + $headersToIgnore['x-transport'] = true; + foreach ($options['headers_to_ignore'] as $name) { + $headersToIgnore[strtolower($name)] = true; + } + unset($headersToIgnore['from']); + $signedHeaderNames = []; + $headerCanonData = ''; + $headers = $message->getPreparedHeaders(); + foreach ($headers->getNames() as $name) { + foreach ($headers->all($name) as $header) { + if (isset($headersToIgnore[strtolower($header->getName())])) { + continue; + } + + if ('' !== $header->getBodyAsString()) { + $headerCanonData .= $this->canonicalizeHeader($header->toString(), $options['header_canon']); + $signedHeaderNames[] = $header->getName(); + } + } + } + + [$bodyHash, $bodyLength] = $this->hashBody($message->getBody(), $options['body_canon'], $options['body_max_length']); + + $params = [ + 'v' => '1', + 'q' => 'dns/txt', + 'a' => $options['algorithm'], + 'bh' => base64_encode($bodyHash), + 'd' => $this->domainName, + 'h' => implode(': ', $signedHeaderNames), + 'i' => '@'.$this->domainName, + 's' => $this->selector, + 't' => time(), + 'c' => $options['header_canon'].'/'.$options['body_canon'], + ]; + + if ($options['body_show_length']) { + $params['l'] = $bodyLength; + } + if ($options['signature_expiration_delay']) { + $params['x'] = $params['t'] + $options['signature_expiration_delay']; + } + $value = ''; + foreach ($params as $k => $v) { + $value .= $k.'='.$v.'; '; + } + $value = trim($value); + $header = new UnstructuredHeader('DKIM-Signature', $value); + $headerCanonData .= rtrim($this->canonicalizeHeader($header->toString()."\r\n b=", $options['header_canon'])); + if (self::ALGO_SHA256 === $options['algorithm']) { + if (!openssl_sign($headerCanonData, $signature, $this->key, \OPENSSL_ALGO_SHA256)) { + throw new RuntimeException('Unable to sign DKIM hash: '.openssl_error_string()); + } + } else { + throw new \RuntimeException(sprintf('The "%s" DKIM signing algorithm is not supported yet.', self::ALGO_ED25519)); + } + $header->setValue($value.' b='.trim(chunk_split(base64_encode($signature), 73, ' '))); + $headers->add($header); + + return new Message($headers, $message->getBody()); + } + + private function canonicalizeHeader(string $header, string $headerCanon): string + { + if (self::CANON_RELAXED !== $headerCanon) { + return $header."\r\n"; + } + + $exploded = explode(':', $header, 2); + $name = strtolower(trim($exploded[0])); + $value = str_replace("\r\n", '', $exploded[1]); + $value = trim(preg_replace("/[ \t][ \t]+/", ' ', $value)); + + return $name.':'.$value."\r\n"; + } + + private function hashBody(AbstractPart $body, string $bodyCanon, int $maxLength): array + { + $hash = hash_init('sha256'); + $relaxed = self::CANON_RELAXED === $bodyCanon; + $currentLine = ''; + $emptyCounter = 0; + $isSpaceSequence = false; + $length = 0; + foreach ($body->bodyToIterable() as $chunk) { + $canon = ''; + for ($i = 0, $len = \strlen($chunk); $i < $len; ++$i) { + switch ($chunk[$i]) { + case "\r": + break; + case "\n": + // previous char is always \r + if ($relaxed) { + $isSpaceSequence = false; + } + if ('' === $currentLine) { + ++$emptyCounter; + } else { + $currentLine = ''; + $canon .= "\r\n"; + } + break; + case ' ': + case "\t": + if ($relaxed) { + $isSpaceSequence = true; + break; + } + // no break + default: + if ($emptyCounter > 0) { + $canon .= str_repeat("\r\n", $emptyCounter); + $emptyCounter = 0; + } + if ($isSpaceSequence) { + $currentLine .= ' '; + $canon .= ' '; + $isSpaceSequence = false; + } + $currentLine .= $chunk[$i]; + $canon .= $chunk[$i]; + } + } + + if ($length + \strlen($canon) >= $maxLength) { + $canon = substr($canon, 0, $maxLength - $length); + $length += \strlen($canon); + hash_update($hash, $canon); + + break; + } + + $length += \strlen($canon); + hash_update($hash, $canon); + } + + // Add trailing Line return if last line is non empty + if ('' !== $currentLine) { + hash_update($hash, "\r\n"); + $length += \strlen("\r\n"); + } + + if (!$relaxed && 0 === $length) { + hash_update($hash, "\r\n"); + $length = 2; + } + + return [hash_final($hash, true), $length]; + } +} diff --git a/vendor/symfony/mime/Crypto/SMime.php b/vendor/symfony/mime/Crypto/SMime.php index 0f4643806..cba95f210 100644 --- a/vendor/symfony/mime/Crypto/SMime.php +++ b/vendor/symfony/mime/Crypto/SMime.php @@ -65,7 +65,7 @@ abstract class SMime protected function getStreamIterator($stream): iterable { while (!feof($stream)) { - yield fread($stream, 16372); + yield str_replace("\n", "\r\n", str_replace("\r\n", "\n", fread($stream, 16372))); } } diff --git a/vendor/symfony/mime/DependencyInjection/AddMimeTypeGuesserPass.php b/vendor/symfony/mime/DependencyInjection/AddMimeTypeGuesserPass.php index e24beb0da..00eef94ee 100644 --- a/vendor/symfony/mime/DependencyInjection/AddMimeTypeGuesserPass.php +++ b/vendor/symfony/mime/DependencyInjection/AddMimeTypeGuesserPass.php @@ -27,6 +27,10 @@ class AddMimeTypeGuesserPass implements CompilerPassInterface public function __construct(string $mimeTypesService = 'mime_types', string $mimeTypeGuesserTag = 'mime.mime_type_guesser') { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/mime', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + $this->mimeTypesService = $mimeTypesService; $this->mimeTypeGuesserTag = $mimeTypeGuesserTag; } diff --git a/vendor/symfony/mime/Email.php b/vendor/symfony/mime/Email.php index 70ea74578..bd0a476c4 100644 --- a/vendor/symfony/mime/Email.php +++ b/vendor/symfony/mime/Email.php @@ -405,7 +405,7 @@ class Email extends Message } /** - * @return DataPart[] + * @return array|DataPart[] */ public function getAttachments(): array { @@ -495,14 +495,8 @@ class Email extends Message $htmlPart = null; $html = $this->html; if (null !== $html) { - if (\is_resource($html)) { - if (stream_get_meta_data($html)['seekable'] ?? false) { - rewind($html); - } - - $html = stream_get_contents($html); - } $htmlPart = new TextPart($html, $this->htmlCharset, 'html'); + $html = $htmlPart->getBody(); preg_match_all('(<img\s+[^>]*src\s*=\s*(?:([\'"])cid:(.+?)\\1|cid:([^>\s]+)))i', $html, $names); $names = array_filter(array_unique(array_merge($names[2], $names[3]))); } @@ -569,7 +563,7 @@ class Email extends Message /** * @return $this */ - private function setHeaderBody(string $type, string $name, $body) + private function setHeaderBody(string $type, string $name, $body): object { $this->getHeaders()->setHeaderBody($type, $name, $body); @@ -586,6 +580,9 @@ class Email extends Message return $this; } + /** + * @return $this + */ private function setListAddressHeaderBody(string $name, array $addresses) { $addresses = Address::createArray($addresses); @@ -605,28 +602,16 @@ class Email extends Message public function __serialize(): array { if (\is_resource($this->text)) { - if (stream_get_meta_data($this->text)['seekable'] ?? false) { - rewind($this->text); - } - - $this->text = stream_get_contents($this->text); + $this->text = (new TextPart($this->text))->getBody(); } if (\is_resource($this->html)) { - if (stream_get_meta_data($this->html)['seekable'] ?? false) { - rewind($this->html); - } - - $this->html = stream_get_contents($this->html); + $this->html = (new TextPart($this->html))->getBody(); } foreach ($this->attachments as $i => $attachment) { if (isset($attachment['body']) && \is_resource($attachment['body'])) { - if (stream_get_meta_data($attachment['body'])['seekable'] ?? false) { - rewind($attachment['body']); - } - - $this->attachments[$i]['body'] = stream_get_contents($attachment['body']); + $this->attachments[$i]['body'] = (new TextPart($attachment['body']))->getBody(); } } diff --git a/vendor/symfony/mime/Encoder/Base64ContentEncoder.php b/vendor/symfony/mime/Encoder/Base64ContentEncoder.php index 338490b3e..440868af7 100644 --- a/vendor/symfony/mime/Encoder/Base64ContentEncoder.php +++ b/vendor/symfony/mime/Encoder/Base64ContentEncoder.php @@ -32,11 +32,8 @@ final class Base64ContentEncoder extends Base64Encoder implements ContentEncoder throw new RuntimeException('Unable to set the base64 content encoder to the filter.'); } - if (stream_get_meta_data($stream)['seekable'] ?? false) { - rewind($stream); - } while (!feof($stream)) { - yield fread($stream, 8192); + yield fread($stream, 16372); } stream_filter_remove($filter); } diff --git a/vendor/symfony/mime/Encoder/IdnAddressEncoder.php b/vendor/symfony/mime/Encoder/IdnAddressEncoder.php index e049fe5e7..b56e7e396 100644 --- a/vendor/symfony/mime/Encoder/IdnAddressEncoder.php +++ b/vendor/symfony/mime/Encoder/IdnAddressEncoder.php @@ -11,16 +11,14 @@ namespace Symfony\Component\Mime\Encoder; -use Symfony\Component\Mime\Exception\AddressEncoderException; - /** * An IDN email address encoder. * * Encodes the domain part of an address using IDN. This is compatible will all * SMTP servers. * - * This encoder does not support email addresses with non-ASCII characters in - * local-part (the substring before @). + * Note: It leaves the local part as is. In case there are non-ASCII characters + * in the local part then it depends on the SMTP Server if this is supported. * * @author Christian Schmidt */ @@ -28,8 +26,6 @@ final class IdnAddressEncoder implements AddressEncoderInterface { /** * Encodes the domain part of an address using IDN. - * - * @throws AddressEncoderException If local-part contains non-ASCII characters */ public function encodeString(string $address): string { @@ -38,10 +34,6 @@ final class IdnAddressEncoder implements AddressEncoderInterface $local = substr($address, 0, $i); $domain = substr($address, $i + 1); - if (preg_match('/[^\x00-\x7F]/', $local)) { - throw new AddressEncoderException(sprintf('Non-ASCII characters not supported in local-part os "%s".', $address)); - } - if (preg_match('/[^\x00-\x7F]/', $domain)) { $address = sprintf('%s@%s', $local, idn_to_ascii($domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46)); } diff --git a/vendor/symfony/mime/Encoder/QpContentEncoder.php b/vendor/symfony/mime/Encoder/QpContentEncoder.php index e0b8605dd..4703cc2e6 100644 --- a/vendor/symfony/mime/Encoder/QpContentEncoder.php +++ b/vendor/symfony/mime/Encoder/QpContentEncoder.php @@ -23,10 +23,6 @@ final class QpContentEncoder implements ContentEncoderInterface } // we don't use PHP stream filters here as the content should be small enough - if (stream_get_meta_data($stream)['seekable'] ?? false) { - rewind($stream); - } - yield $this->encodeString(stream_get_contents($stream), 'utf-8', 0, $maxLineLength); } diff --git a/vendor/symfony/mime/Header/Headers.php b/vendor/symfony/mime/Header/Headers.php index 201a7a5f9..8db912520 100644 --- a/vendor/symfony/mime/Header/Headers.php +++ b/vendor/symfony/mime/Header/Headers.php @@ -25,7 +25,23 @@ final class Headers 'date', 'from', 'sender', 'reply-to', 'to', 'cc', 'bcc', 'message-id', 'in-reply-to', 'references', 'subject', ]; + private const HEADER_CLASS_MAP = [ + 'date' => DateHeader::class, + 'from' => MailboxListHeader::class, + 'sender' => MailboxHeader::class, + 'reply-to' => MailboxListHeader::class, + 'to' => MailboxListHeader::class, + 'cc' => MailboxListHeader::class, + 'bcc' => MailboxListHeader::class, + 'message-id' => IdentificationHeader::class, + 'in-reply-to' => UnstructuredHeader::class, // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ... + 'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id` + 'return-path' => PathHeader::class, + ]; + /** + * @var HeaderInterface[][] + */ private $headers = []; private $lineLength = 76; @@ -122,6 +138,22 @@ final class Headers return $this->add(new ParameterizedHeader($name, $value, $params)); } + /** + * @return $this + */ + public function addHeader(string $name, $argument, array $more = []): self + { + $parts = explode('\\', self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class); + $method = 'add'.ucfirst(array_pop($parts)); + if ('addUnstructuredHeader' === $method) { + $method = 'addTextHeader'; + } elseif ('addIdentificationHeader' === $method) { + $method = 'addIdHeader'; + } + + return $this->$method($name, $argument, $more); + } + public function has(string $name): bool { return isset($this->headers[strtolower($name)]); @@ -132,27 +164,11 @@ final class Headers */ public function add(HeaderInterface $header): self { - static $map = [ - 'date' => DateHeader::class, - 'from' => MailboxListHeader::class, - 'sender' => MailboxHeader::class, - 'reply-to' => MailboxListHeader::class, - 'to' => MailboxListHeader::class, - 'cc' => MailboxListHeader::class, - 'bcc' => MailboxListHeader::class, - 'message-id' => IdentificationHeader::class, - 'in-reply-to' => UnstructuredHeader::class, // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ... - 'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id` - 'return-path' => PathHeader::class, - ]; + self::checkHeaderClass($header); $header->setMaxLineLength($this->lineLength); $name = strtolower($header->getName()); - if (isset($map[$name]) && !$header instanceof $map[$name]) { - throw new LogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), $map[$name], \get_class($header))); - } - if (\in_array($name, self::UNIQUE_HEADERS, true) && isset($this->headers[$name]) && \count($this->headers[$name]) > 0) { throw new LogicException(sprintf('Impossible to set header "%s" as it\'s already defined and must be unique.', $header->getName())); } @@ -204,6 +220,18 @@ final class Headers return \in_array(strtolower($name), self::UNIQUE_HEADERS, true); } + /** + * @throws LogicException if the header name and class are not compatible + */ + public static function checkHeaderClass(HeaderInterface $header): void + { + $name = strtolower($header->getName()); + + if (($c = self::HEADER_CLASS_MAP[$name] ?? null) && !$header instanceof $c) { + throw new LogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), $c, get_debug_type($header))); + } + } + public function toString(): string { $string = ''; @@ -246,9 +274,6 @@ final class Headers } } - /** - * @internal - */ public function getHeaderParameter(string $name, string $parameter): ?string { if (!$this->has($name)) { diff --git a/vendor/symfony/mime/LICENSE b/vendor/symfony/mime/LICENSE index 298be1416..58b42bc8a 100644 --- a/vendor/symfony/mime/LICENSE +++ b/vendor/symfony/mime/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2010-2022 Fabien Potencier +Copyright (c) 2010-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/mime/Message.php b/vendor/symfony/mime/Message.php index b7ddb76bc..651ffd452 100644 --- a/vendor/symfony/mime/Message.php +++ b/vendor/symfony/mime/Message.php @@ -80,7 +80,9 @@ class Message extends RawMessage $headers->addMailboxListHeader('From', [$headers->get('Sender')->getAddress()]); } - $headers->addTextHeader('MIME-Version', '1.0'); + if (!$headers->has('MIME-Version')) { + $headers->addTextHeader('MIME-Version', '1.0'); + } if (!$headers->has('Date')) { $headers->addDateHeader('Date', new \DateTimeImmutable()); diff --git a/vendor/symfony/mime/MessageConverter.php b/vendor/symfony/mime/MessageConverter.php index 4163e51cd..0539eac8e 100644 --- a/vendor/symfony/mime/MessageConverter.php +++ b/vendor/symfony/mime/MessageConverter.php @@ -55,13 +55,13 @@ final class MessageConverter } elseif ($parts[0] instanceof TextPart) { $email = self::createEmailFromTextPart($message, $parts[0]); } else { - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($message))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message))); } return self::attachParts($email, \array_slice($parts, 1)); } - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($message))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message))); } private static function createEmailFromTextPart(Message $message, TextPart $part): Email @@ -73,7 +73,7 @@ final class MessageConverter return (new Email(clone $message->getHeaders()))->html($part->getBody(), $part->getPreparedHeaders()->getHeaderParameter('Content-Type', 'charset') ?: 'utf-8'); } - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($message))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message))); } private static function createEmailFromAlternativePart(Message $message, AlternativePart $part): Email @@ -90,7 +90,7 @@ final class MessageConverter ; } - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($message))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message))); } private static function createEmailFromRelatedPart(Message $message, RelatedPart $part): Email @@ -101,7 +101,7 @@ final class MessageConverter } elseif ($parts[0] instanceof TextPart) { $email = self::createEmailFromTextPart($message, $parts[0]); } else { - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($message))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message))); } return self::attachParts($email, \array_slice($parts, 1)); @@ -111,7 +111,7 @@ final class MessageConverter { foreach ($parts as $part) { if (!$part instanceof DataPart) { - throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', \get_class($email))); + throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($email))); } $headers = $part->getPreparedHeaders(); diff --git a/vendor/symfony/mime/MimeTypeGuesserInterface.php b/vendor/symfony/mime/MimeTypeGuesserInterface.php index 6eded54c6..30ee3b64a 100644 --- a/vendor/symfony/mime/MimeTypeGuesserInterface.php +++ b/vendor/symfony/mime/MimeTypeGuesserInterface.php @@ -26,8 +26,6 @@ interface MimeTypeGuesserInterface /** * Guesses the MIME type of the file with the given path. * - * @return string|null The MIME type or null, if none could be guessed - * * @throws \LogicException If the guesser is not supported * @throws \InvalidArgumentException If the file does not exist or is not readable */ diff --git a/vendor/symfony/mime/MimeTypes.php b/vendor/symfony/mime/MimeTypes.php index e2b5bf435..bdea994b5 100644 --- a/vendor/symfony/mime/MimeTypes.php +++ b/vendor/symfony/mime/MimeTypes.php @@ -146,7 +146,7 @@ final class MimeTypes implements MimeTypesInterface /** * A map of MIME types and their default extensions. * - * Updated from upstream on 2019-01-16 + * Updated from upstream on 2021-09-03 * * @see Resources/bin/update_mime_types.php */ @@ -157,8 +157,16 @@ final class MimeTypes implements MimeTypesInterface 'application/applixware' => ['aw'], 'application/atom+xml' => ['atom'], 'application/atomcat+xml' => ['atomcat'], + 'application/atomdeleted+xml' => ['atomdeleted'], 'application/atomsvc+xml' => ['atomsvc'], + 'application/atsc-dwd+xml' => ['dwd'], + 'application/atsc-held+xml' => ['held'], + 'application/atsc-rsat+xml' => ['rsat'], + 'application/bdoc' => ['bdoc'], + 'application/bzip2' => ['bz2', 'bz'], + 'application/calendar+xml' => ['xcs'], 'application/ccxml+xml' => ['ccxml'], + 'application/cdfx+xml' => ['cdfx'], 'application/cdmi-capability' => ['cdmia'], 'application/cdmi-container' => ['cdmic'], 'application/cdmi-domain' => ['cdmid'], @@ -168,6 +176,7 @@ final class MimeTypes implements MimeTypesInterface 'application/coreldraw' => ['cdr'], 'application/csv' => ['csv'], 'application/cu-seeme' => ['cu'], + 'application/dash+xml' => ['mpd'], 'application/davmount+xml' => ['davmount'], 'application/dbase' => ['dbf'], 'application/dbf' => ['dbf'], @@ -178,8 +187,10 @@ final class MimeTypes implements MimeTypesInterface 'application/ecmascript' => ['ecma', 'es'], 'application/emf' => ['emf'], 'application/emma+xml' => ['emma'], + 'application/emotionml+xml' => ['emotionml'], 'application/epub+zip' => ['epub'], 'application/exi' => ['exi'], + 'application/fdt+xml' => ['fdt'], 'application/font-tdpfr' => ['pfr'], 'application/font-woff' => ['woff'], 'application/futuresplash' => ['swf', 'spl'], @@ -190,29 +201,34 @@ final class MimeTypes implements MimeTypesInterface 'application/gpx+xml' => ['gpx'], 'application/gxf' => ['gxf'], 'application/gzip' => ['gz'], + 'application/hjson' => ['hjson'], 'application/hyperstudio' => ['stk'], 'application/ico' => ['ico'], 'application/ics' => ['vcs', 'ics'], 'application/illustrator' => ['ai'], 'application/inkml+xml' => ['ink', 'inkml'], 'application/ipfix' => ['ipfix'], + 'application/its+xml' => ['its'], 'application/java' => ['class'], - 'application/java-archive' => ['jar'], + 'application/java-archive' => ['jar', 'war', 'ear'], 'application/java-byte-code' => ['class'], 'application/java-serialized-object' => ['ser'], 'application/java-vm' => ['class'], - 'application/javascript' => ['js', 'jsm', 'mjs'], + 'application/javascript' => ['js', 'mjs', 'jsm'], 'application/jrd+json' => ['jrd'], - 'application/json' => ['json'], + 'application/json' => ['json', 'map'], 'application/json-patch+json' => ['json-patch'], + 'application/json5' => ['json5'], 'application/jsonml+json' => ['jsonml'], 'application/ld+json' => ['jsonld'], + 'application/lgr+xml' => ['lgr'], 'application/lost+xml' => ['lostxml'], 'application/lotus123' => ['123', 'wk1', 'wk3', 'wk4', 'wks'], 'application/m3u' => ['m3u', 'm3u8', 'vlc'], 'application/mac-binhex40' => ['hqx'], 'application/mac-compactpro' => ['cpt'], 'application/mads+xml' => ['mads'], + 'application/manifest+json' => ['webmanifest'], 'application/marc' => ['mrc'], 'application/marcxml+xml' => ['mrcx'], 'application/mathematica' => ['ma', 'nb', 'mb'], @@ -223,9 +239,13 @@ final class MimeTypes implements MimeTypesInterface 'application/metalink+xml' => ['metalink'], 'application/metalink4+xml' => ['meta4'], 'application/mets+xml' => ['mets'], + 'application/mmt-aei+xml' => ['maei'], + 'application/mmt-usd+xml' => ['musd'], 'application/mods+xml' => ['mods'], 'application/mp21' => ['m21', 'mp21'], - 'application/mp4' => ['mp4s'], + 'application/mp4' => ['mp4s', 'm4p'], + 'application/mrb-consumer+xml' => ['xdf'], + 'application/mrb-publish+xml' => ['xdf'], 'application/ms-tnef' => ['tnef', 'tnf'], 'application/msaccess' => ['mdb'], 'application/msexcel' => ['xls', 'xlc', 'xll', 'xlm', 'xlw', 'xla', 'xlt', 'xld'], @@ -233,21 +253,26 @@ final class MimeTypes implements MimeTypesInterface 'application/msword' => ['doc', 'dot'], 'application/msword-template' => ['dot'], 'application/mxf' => ['mxf'], + 'application/n-quads' => ['nq'], + 'application/n-triples' => ['nt'], 'application/nappdf' => ['pdf'], - 'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy'], + 'application/node' => ['cjs'], + 'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy', 'exe', 'dll', 'deb', 'dmg', 'iso', 'img', 'msi', 'msp', 'msm', 'buffer'], 'application/oda' => ['oda'], 'application/oebps-package+xml' => ['opf'], 'application/ogg' => ['ogx'], 'application/omdoc+xml' => ['omdoc'], 'application/onenote' => ['onetoc', 'onetoc2', 'onetmp', 'onepkg'], + 'application/ovf' => ['ova'], 'application/owl+xml' => ['owx'], - 'application/oxps' => ['oxps', 'xps'], + 'application/oxps' => ['oxps'], + 'application/p2p-overlay+xml' => ['relo'], 'application/patch-ops-error+xml' => ['xer'], 'application/pcap' => ['pcap', 'cap', 'dmp'], 'application/pdf' => ['pdf'], 'application/pgp' => ['pgp', 'gpg', 'asc'], 'application/pgp-encrypted' => ['pgp', 'gpg', 'asc'], - 'application/pgp-keys' => ['skr', 'pkr', 'asc', 'pgp', 'gpg'], + 'application/pgp-keys' => ['skr', 'pkr', 'asc', 'pgp', 'gpg', 'key'], 'application/pgp-signature' => ['asc', 'sig', 'pgp', 'gpg'], 'application/photoshop' => ['psd'], 'application/pics-rules' => ['prf'], @@ -266,16 +291,20 @@ final class MimeTypes implements MimeTypesInterface 'application/pls+xml' => ['pls'], 'application/postscript' => ['ai', 'eps', 'ps'], 'application/powerpoint' => ['ppz', 'ppt', 'pps', 'pot'], + 'application/provenance+xml' => ['provx'], 'application/prs.cww' => ['cww'], 'application/pskc+xml' => ['pskcxml'], 'application/ram' => ['ram'], 'application/raml+yaml' => ['raml'], - 'application/rdf+xml' => ['rdf', 'rdfs', 'owl'], + 'application/rdf+xml' => ['rdf', 'owl', 'rdfs'], 'application/reginfo+xml' => ['rif'], 'application/relax-ng-compact-syntax' => ['rnc'], 'application/resource-lists+xml' => ['rl'], 'application/resource-lists-diff+xml' => ['rld'], 'application/rls-services+xml' => ['rs'], + 'application/route-apd+xml' => ['rapd'], + 'application/route-s-tsid+xml' => ['sls'], + 'application/route-usd+xml' => ['rusd'], 'application/rpki-ghostbusters' => ['gbr'], 'application/rpki-manifest' => ['mft'], 'application/rpki-roa' => ['roa'], @@ -283,15 +312,18 @@ final class MimeTypes implements MimeTypesInterface 'application/rss+xml' => ['rss'], 'application/rtf' => ['rtf'], 'application/sbml+xml' => ['sbml'], + 'application/schema+json' => ['json'], 'application/scvp-cv-request' => ['scq'], 'application/scvp-cv-response' => ['scs'], 'application/scvp-vp-request' => ['spq'], 'application/scvp-vp-response' => ['spp'], 'application/sdp' => ['sdp'], + 'application/senml+xml' => ['senmlx'], + 'application/sensml+xml' => ['sensmlx'], 'application/set-payment-initiation' => ['setpay'], 'application/set-registration-initiation' => ['setreg'], 'application/shf+xml' => ['shf'], - 'application/sieve' => ['siv'], + 'application/sieve' => ['siv', 'sieve'], 'application/smil' => ['smil', 'smi', 'sml', 'kino'], 'application/smil+xml' => ['smi', 'smil', 'sml', 'kino'], 'application/sparql-query' => ['rq'], @@ -302,11 +334,19 @@ final class MimeTypes implements MimeTypesInterface 'application/sru+xml' => ['sru'], 'application/ssdl+xml' => ['ssdl'], 'application/ssml+xml' => ['ssml'], - 'application/stuffit' => ['sit'], + 'application/stuffit' => ['sit', 'hqx'], + 'application/swid+xml' => ['swidtag'], 'application/tei+xml' => ['tei', 'teicorpus'], + 'application/tga' => ['tga', 'icb', 'tpic', 'vda', 'vst'], 'application/thraud+xml' => ['tfi'], 'application/timestamped-data' => ['tsd'], + 'application/toml' => ['toml'], 'application/trig' => ['trig'], + 'application/ttml+xml' => ['ttml'], + 'application/ubjson' => ['ubj'], + 'application/urc-ressheet+xml' => ['rsheet'], + 'application/urc-targetdesc+xml' => ['td'], + 'application/vnd.1000minds.decision-model+xml' => ['1km'], 'application/vnd.3gpp.pic-bw-large' => ['plb'], 'application/vnd.3gpp.pic-bw-small' => ['psb'], 'application/vnd.3gpp.pic-bw-var' => ['pvb'], @@ -327,6 +367,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.airzip.filesecure.azf' => ['azf'], 'application/vnd.airzip.filesecure.azs' => ['azs'], 'application/vnd.amazon.ebook' => ['azw'], + 'application/vnd.amazon.mobi8-ebook' => ['azw3', 'kfx'], 'application/vnd.americandynamics.acc' => ['acc'], 'application/vnd.amiga.ami' => ['ami'], 'application/vnd.android.package-archive' => ['apk'], @@ -335,11 +376,15 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.antix.game-component' => ['atx'], 'application/vnd.appimage' => ['appimage'], 'application/vnd.apple.installer+xml' => ['mpkg'], - 'application/vnd.apple.keynote' => ['key'], + 'application/vnd.apple.keynote' => ['key', 'keynote'], 'application/vnd.apple.mpegurl' => ['m3u8', 'm3u'], + 'application/vnd.apple.numbers' => ['numbers'], + 'application/vnd.apple.pages' => ['pages'], + 'application/vnd.apple.pkpass' => ['pkpass'], 'application/vnd.aristanetworks.swi' => ['swi'], 'application/vnd.astraea-software.iota' => ['iota'], 'application/vnd.audiograph' => ['aep'], + 'application/vnd.balsamiq.bmml+xml' => ['bmml'], 'application/vnd.blueice.multipass' => ['mpm'], 'application/vnd.bmi' => ['bmi'], 'application/vnd.businessobjects' => ['rep'], @@ -347,6 +392,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.chess-pgn' => ['pgn'], 'application/vnd.chipnuts.karaoke-mmd' => ['mmd'], 'application/vnd.cinderella' => ['cdy'], + 'application/vnd.citationstyles.style+xml' => ['csl'], 'application/vnd.claymore' => ['cla'], 'application/vnd.cloanto.rp9' => ['rp9'], 'application/vnd.clonk.c4group' => ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'], @@ -371,6 +417,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.curl.pcurl' => ['pcurl'], 'application/vnd.dart' => ['dart'], 'application/vnd.data-vision.rdz' => ['rdz'], + 'application/vnd.dbf' => ['dbf'], 'application/vnd.debian.binary-package' => ['deb', 'udeb'], 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], @@ -394,6 +441,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.epson.salt' => ['slt'], 'application/vnd.epson.ssf' => ['ssf'], 'application/vnd.eszigno3+xml' => ['es3', 'et3'], + 'application/vnd.etsi.asic-e+zip' => ['asice'], 'application/vnd.ezpix-album' => ['ez2'], 'application/vnd.ezpix-package' => ['ez3'], 'application/vnd.fdf' => ['fdf'], @@ -426,6 +474,9 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.geoplan' => ['g2w'], 'application/vnd.geospace' => ['g3w'], 'application/vnd.gmx' => ['gmx'], + 'application/vnd.google-apps.document' => ['gdoc'], + 'application/vnd.google-apps.presentation' => ['gslides'], + 'application/vnd.google-apps.spreadsheet' => ['gsheet'], 'application/vnd.google-earth.kml+xml' => ['kml'], 'application/vnd.google-earth.kmz' => ['kmz'], 'application/vnd.grafeq' => ['gqf', 'gqs'], @@ -495,6 +546,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.lotus-screencam' => ['scm'], 'application/vnd.lotus-wordpro' => ['lwp'], 'application/vnd.macports.portpkg' => ['portpkg'], + 'application/vnd.mapbox-vector-tile' => ['mvt'], 'application/vnd.mcd' => ['mcd'], 'application/vnd.medcalcdata' => ['mc1'], 'application/vnd.mediastation.cdkey' => ['cdkey'], @@ -527,6 +579,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.ms-ims' => ['ims'], 'application/vnd.ms-lrm' => ['lrm'], 'application/vnd.ms-officetheme' => ['thmx'], + 'application/vnd.ms-outlook' => ['msg'], 'application/vnd.ms-pki.seccat' => ['cat'], 'application/vnd.ms-pki.stl' => ['stl'], 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot', 'ppz'], @@ -549,7 +602,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.ms-word.template.macroenabled.12' => ['dotm'], 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb', 'xlr'], 'application/vnd.ms-wpl' => ['wpl'], - 'application/vnd.ms-xpsdocument' => ['xps', 'oxps'], + 'application/vnd.ms-xpsdocument' => ['xps'], 'application/vnd.msaccess' => ['mdb'], 'application/vnd.mseq' => ['mseq'], 'application/vnd.musician' => ['mus'], @@ -561,6 +614,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.noblenet-directory' => ['nnd'], 'application/vnd.noblenet-sealer' => ['nns'], 'application/vnd.noblenet-web' => ['nnw'], + 'application/vnd.nokia.n-gage.ac+xml' => ['ac'], 'application/vnd.nokia.n-gage.data' => ['ngdat'], 'application/vnd.nokia.n-gage.symbian.install' => ['n-gage'], 'application/vnd.nokia.radio-preset' => ['rpst'], @@ -592,7 +646,9 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.oasis.opendocument.text-web' => ['oth'], 'application/vnd.olpc-sugar' => ['xo'], 'application/vnd.oma.dd2+xml' => ['dd2'], + 'application/vnd.openblox.game+xml' => ['obgx'], 'application/vnd.openofficeorg.extension' => ['oxt'], + 'application/vnd.openstreetmap.data+xml' => ['osm'], 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => ['pptx'], 'application/vnd.openxmlformats-officedocument.presentationml.slide' => ['sldx'], 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => ['ppsx'], @@ -640,6 +696,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.smaf' => ['mmf', 'smaf'], 'application/vnd.smart.teacher' => ['teacher'], 'application/vnd.snap' => ['snap'], + 'application/vnd.software602.filler.form+xml' => ['fo'], 'application/vnd.solent.sdkm+xml' => ['sdkm', 'sdkd'], 'application/vnd.spotfire.dxp' => ['dxp'], 'application/vnd.spotfire.sfs' => ['sfs'], @@ -655,6 +712,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.stardivision.writer-global' => ['sgl', 'sdw', 'vor'], 'application/vnd.stepmania.package' => ['smzip'], 'application/vnd.stepmania.stepchart' => ['sm'], + 'application/vnd.sun.wadl+xml' => ['wadl'], 'application/vnd.sun.xml.base' => ['odb'], 'application/vnd.sun.xml.calc' => ['sxc'], 'application/vnd.sun.xml.calc.template' => ['stc'], @@ -672,6 +730,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.syncml+xml' => ['xsm'], 'application/vnd.syncml.dm+wbxml' => ['bdm'], 'application/vnd.syncml.dm+xml' => ['xdm'], + 'application/vnd.syncml.dmddf+xml' => ['ddf'], 'application/vnd.tao.intent-module-archive' => ['tao'], 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], 'application/vnd.tmobile-livetv' => ['tmo'], @@ -710,6 +769,7 @@ final class MimeTypes implements MimeTypesInterface 'application/vnd.zul' => ['zir', 'zirz'], 'application/vnd.zzazz.deck+xml' => ['zaz'], 'application/voicexml+xml' => ['vxml'], + 'application/wasm' => ['wasm'], 'application/widget' => ['wgt'], 'application/winhlp' => ['hlp'], 'application/wk1' => ['123', 'wk1', 'wk3', 'wk4', 'wks'], @@ -719,7 +779,7 @@ final class MimeTypes implements MimeTypesInterface 'application/wspolicy+xml' => ['wspolicy'], 'application/wwf' => ['wwf'], 'application/x-123' => ['123', 'wk1', 'wk3', 'wk4', 'wks'], - 'application/x-7z-compressed' => ['7z'], + 'application/x-7z-compressed' => ['7z', '7z.001'], 'application/x-abiword' => ['abw', 'abw.CRASHED', 'abw.gz', 'zabw'], 'application/x-ace' => ['ace'], 'application/x-ace-compressed' => ['ace'], @@ -729,6 +789,8 @@ final class MimeTypes implements MimeTypesInterface 'application/x-annodex' => ['anx'], 'application/x-aportisdoc' => ['pdb', 'pdc'], 'application/x-apple-diskimage' => ['dmg'], + 'application/x-apple-systemprofiler+xml' => ['spx'], + 'application/x-appleworks-document' => ['cwk'], 'application/x-applix-spreadsheet' => ['as'], 'application/x-applix-word' => ['aw'], 'application/x-archive' => ['a', 'ar'], @@ -742,10 +804,13 @@ final class MimeTypes implements MimeTypesInterface 'application/x-authorware-seg' => ['aas'], 'application/x-awk' => ['awk'], 'application/x-bcpio' => ['bcpio'], + 'application/x-bdoc' => ['bdoc'], 'application/x-bittorrent' => ['torrent'], 'application/x-blender' => ['blender', 'blend', 'BLEND'], 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bps-patch' => ['bps'], 'application/x-bsdiff' => ['bsdiff'], + 'application/x-bz2' => ['bz2'], 'application/x-bzdvi' => ['dvi.bz2'], 'application/x-bzip' => ['bz', 'bz2'], 'application/x-bzip-compressed-tar' => ['tar.bz2', 'tar.bz', 'tbz2', 'tbz', 'tb2'], @@ -765,8 +830,11 @@ final class MimeTypes implements MimeTypesInterface 'application/x-chat' => ['chat'], 'application/x-chess-pgn' => ['pgn'], 'application/x-chm' => ['chm'], + 'application/x-chrome-extension' => ['crx'], 'application/x-cisco-vpn-settings' => ['pcf'], + 'application/x-cocoa' => ['cco'], 'application/x-compress' => ['Z'], + 'application/x-compressed-iso' => ['cso'], 'application/x-compressed-tar' => ['tar.gz', 'tgz'], 'application/x-conference' => ['nsc'], 'application/x-coreldraw' => ['cdr'], @@ -786,9 +854,11 @@ final class MimeTypes implements MimeTypesInterface 'application/x-dia-diagram' => ['dia'], 'application/x-dia-shape' => ['shape'], 'application/x-director' => ['dir', 'dcr', 'dxr', 'cst', 'cct', 'cxt', 'w3d', 'fgd', 'swa'], + 'application/x-discjuggler-cd-image' => ['cdi'], 'application/x-docbook+xml' => ['dbk', 'docbook'], 'application/x-doom' => ['wad'], 'application/x-doom-wad' => ['wad'], + 'application/x-dreamcast-rom' => ['iso'], 'application/x-dtbncx+xml' => ['ncx'], 'application/x-dtbook+xml' => ['dtb'], 'application/x-dtbresource+xml' => ['res'], @@ -812,6 +882,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-font-pcf' => ['pcf', 'pcf.Z', 'pcf.gz'], 'application/x-font-snf' => ['snf'], 'application/x-font-speedo' => ['spd'], + 'application/x-font-truetype' => ['ttf'], 'application/x-font-ttf' => ['ttf'], 'application/x-font-ttx' => ['ttx'], 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm', 'gsf'], @@ -826,9 +897,10 @@ final class MimeTypes implements MimeTypesInterface 'application/x-gamegear-rom' => ['gg'], 'application/x-gba-rom' => ['gba', 'agb'], 'application/x-gca-compressed' => ['gca'], + 'application/x-gd-rom-cue' => ['gdi'], 'application/x-gedcom' => ['ged', 'gedcom'], 'application/x-genesis-32x-rom' => ['32x', 'mdx'], - 'application/x-genesis-rom' => ['gen', 'smd'], + 'application/x-genesis-rom' => ['gen', 'smd', 'sgd'], 'application/x-gettext' => ['po'], 'application/x-gettext-translation' => ['gmo', 'mo'], 'application/x-glade' => ['glade'], @@ -852,18 +924,23 @@ final class MimeTypes implements MimeTypesInterface 'application/x-hdf' => ['hdf', 'hdf4', 'h4', 'hdf5', 'h5'], 'application/x-hfe-file' => ['hfe'], 'application/x-hfe-floppy-image' => ['hfe'], + 'application/x-httpd-php' => ['php'], 'application/x-hwp' => ['hwp'], 'application/x-hwt' => ['hwt'], 'application/x-ica' => ['ica'], 'application/x-install-instructions' => ['install'], + 'application/x-ips-patch' => ['ips'], 'application/x-ipynb+json' => ['ipynb'], 'application/x-iso9660-appimage' => ['appimage'], 'application/x-iso9660-image' => ['iso', 'iso9660'], 'application/x-it87' => ['it87'], 'application/x-iwork-keynote-sffkey' => ['key'], + 'application/x-iwork-numbers-sffnumbers' => ['numbers'], + 'application/x-iwork-pages-sffpages' => ['pages'], 'application/x-jar' => ['jar'], 'application/x-java' => ['class'], 'application/x-java-archive' => ['jar'], + 'application/x-java-archive-diff' => ['jardiff'], 'application/x-java-class' => ['class'], 'application/x-java-jce-keystore' => ['jceks'], 'application/x-java-jnlp-file' => ['jnlp'], @@ -874,6 +951,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-jbuilder-project' => ['jpr', 'jpx'], 'application/x-karbon' => ['karbon'], 'application/x-kchart' => ['chrt'], + 'application/x-keepass2' => ['kdbx'], 'application/x-kexi-connectiondata' => ['kexic'], 'application/x-kexiproject-shortcut' => ['kexis'], 'application/x-kexiproject-sqlite' => ['kexi'], @@ -885,7 +963,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-kontour' => ['kon'], 'application/x-kpovmodeler' => ['kpm'], 'application/x-kpresenter' => ['kpr', 'kpt'], - 'application/x-krita' => ['kra'], + 'application/x-krita' => ['kra', 'krz'], 'application/x-kspread' => ['ksp'], 'application/x-kugar' => ['kud'], 'application/x-kword' => ['kwd', 'kwt'], @@ -896,6 +974,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-lotus123' => ['123', 'wk1', 'wk3', 'wk4', 'wks'], 'application/x-lrzip' => ['lrz'], 'application/x-lrzip-compressed-tar' => ['tar.lrz', 'tlrz'], + 'application/x-lua-bytecode' => ['luac'], 'application/x-lyx' => ['lyx'], 'application/x-lz4' => ['lz4'], 'application/x-lz4-compressed-tar' => ['tar.lz4'], @@ -908,12 +987,15 @@ final class MimeTypes implements MimeTypesInterface 'application/x-lzpdf' => ['pdf.lz'], 'application/x-m4' => ['m4'], 'application/x-magicpoint' => ['mgp'], + 'application/x-makeself' => ['run'], + 'application/x-mame-chd' => ['chd'], 'application/x-markaby' => ['mab'], 'application/x-mathematica' => ['nb'], 'application/x-mdb' => ['mdb'], 'application/x-mie' => ['mie'], 'application/x-mif' => ['mif'], 'application/x-mimearchive' => ['mhtml', 'mht'], + 'application/x-mobi8-ebook' => ['azw3', 'kfx'], 'application/x-mobipocket-ebook' => ['prc', 'mobi'], 'application/x-ms-application' => ['application'], 'application/x-ms-asx' => ['asx', 'wax', 'wvx', 'wmx'], @@ -927,6 +1009,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-msbinder' => ['obd'], 'application/x-mscardfile' => ['crd'], 'application/x-msclip' => ['clp'], + 'application/x-msdos-program' => ['exe'], 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], 'application/x-msexcel' => ['xls', 'xlc', 'xll', 'xlm', 'xlw', 'xla', 'xlt', 'xld'], 'application/x-msi' => ['msi'], @@ -948,9 +1031,12 @@ final class MimeTypes implements MimeTypesInterface 'application/x-nes-rom' => ['nes', 'nez', 'unf', 'unif'], 'application/x-netcdf' => ['nc', 'cdf'], 'application/x-netshow-channel' => ['nsc'], + 'application/x-nintendo-3ds-executable' => ['3dsx'], + 'application/x-nintendo-3ds-rom' => ['3ds', 'cci'], 'application/x-nintendo-ds-rom' => ['nds'], + 'application/x-ns-proxy-autoconfig' => ['pac'], 'application/x-nzb' => ['nzb'], - 'application/x-object' => ['o'], + 'application/x-object' => ['o', 'mod'], 'application/x-ogg' => ['ogx'], 'application/x-oleo' => ['oleo'], 'application/x-pagemaker' => ['p65', 'pm', 'pm6', 'pmd'], @@ -961,16 +1047,21 @@ final class MimeTypes implements MimeTypesInterface 'application/x-pc-engine-rom' => ['pce'], 'application/x-pcap' => ['pcap', 'cap', 'dmp'], 'application/x-pdf' => ['pdf'], - 'application/x-perl' => ['pl', 'PL', 'pm', 'al', 'perl', 'pod', 't'], + 'application/x-perl' => ['pl', 'pm', 'PL', 'al', 'perl', 'pod', 't'], 'application/x-photoshop' => ['psd'], 'application/x-php' => ['php', 'php3', 'php4', 'php5', 'phps'], + 'application/x-pilot' => ['prc', 'pdb'], 'application/x-pkcs12' => ['p12', 'pfx'], 'application/x-pkcs7-certificates' => ['p7b', 'spc'], 'application/x-pkcs7-certreqresp' => ['p7r'], 'application/x-planperfect' => ['pln'], 'application/x-pocket-word' => ['psw'], 'application/x-pw' => ['pw'], + 'application/x-pyspread-bz-spreadsheet' => ['pys'], + 'application/x-pyspread-spreadsheet' => ['pysu'], 'application/x-python-bytecode' => ['pyc', 'pyo'], + 'application/x-qed-disk' => ['qed'], + 'application/x-qemu-disk' => ['qcow2', 'qcow'], 'application/x-qpress' => ['qp'], 'application/x-qtiplot' => ['qti', 'qti.gz'], 'application/x-quattropro' => ['wb1', 'wb2', 'wb3'], @@ -990,9 +1081,11 @@ final class MimeTypes implements MimeTypesInterface 'application/x-ruby' => ['rb'], 'application/x-sami' => ['smi', 'sami'], 'application/x-sap-file' => ['sap'], - 'application/x-saturn-rom' => ['bin', 'iso'], + 'application/x-saturn-rom' => ['iso'], 'application/x-sdp' => ['sdp'], - 'application/x-sega-cd-rom' => ['bin', 'iso'], + 'application/x-sea' => ['sea'], + 'application/x-sega-cd-rom' => ['iso'], + 'application/x-sega-pico-rom' => ['iso'], 'application/x-sg1000-rom' => ['sg'], 'application/x-sh' => ['sh'], 'application/x-shar' => ['shar'], @@ -1024,13 +1117,15 @@ final class MimeTypes implements MimeTypesInterface 'application/x-t602' => ['602'], 'application/x-tads' => ['gam'], 'application/x-tar' => ['tar', 'gtar', 'gem'], + 'application/x-targa' => ['tga', 'icb', 'tpic', 'vda', 'vst'], 'application/x-tarz' => ['tar.Z', 'taz'], - 'application/x-tcl' => ['tcl'], + 'application/x-tcl' => ['tcl', 'tk'], 'application/x-tex' => ['tex', 'ltx', 'sty', 'cls', 'dtx', 'ins', 'latex'], 'application/x-tex-gf' => ['gf'], 'application/x-tex-pk' => ['pk'], 'application/x-tex-tfm' => ['tfm'], 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tga' => ['tga', 'icb', 'tpic', 'vda', 'vst'], 'application/x-tgif' => ['obj'], 'application/x-theme' => ['theme'], 'application/x-thomson-cartridge-memo7' => ['m7'], @@ -1043,10 +1138,24 @@ final class MimeTypes implements MimeTypesInterface 'application/x-tzo' => ['tar.lzo', 'tzo'], 'application/x-ufraw' => ['ufraw'], 'application/x-ustar' => ['ustar'], + 'application/x-vdi-disk' => ['vdi'], + 'application/x-vhd-disk' => ['vhd', 'vpc'], + 'application/x-vhdx-disk' => ['vhdx'], 'application/x-virtual-boy-rom' => ['vb'], + 'application/x-virtualbox-hdd' => ['hdd'], + 'application/x-virtualbox-ova' => ['ova'], + 'application/x-virtualbox-ovf' => ['ovf'], + 'application/x-virtualbox-vbox' => ['vbox'], + 'application/x-virtualbox-vbox-extpack' => ['vbox-extpack'], + 'application/x-virtualbox-vdi' => ['vdi'], + 'application/x-virtualbox-vhd' => ['vhd', 'vpc'], + 'application/x-virtualbox-vhdx' => ['vhdx'], + 'application/x-virtualbox-vmdk' => ['vmdk'], + 'application/x-vmdk-disk' => ['vmdk'], 'application/x-vnd.kde.kexi' => ['kexi'], 'application/x-wais-source' => ['src'], 'application/x-wbfs' => ['iso'], + 'application/x-web-app-manifest+json' => ['webapp'], 'application/x-wia' => ['iso'], 'application/x-wii-iso-image' => ['iso'], 'application/x-wii-rom' => ['iso'], @@ -1058,7 +1167,7 @@ final class MimeTypes implements MimeTypesInterface 'application/x-wordperfect' => ['wp', 'wp4', 'wp5', 'wp6', 'wpd', 'wpp'], 'application/x-wpg' => ['wpg'], 'application/x-wwf' => ['wwf'], - 'application/x-x509-ca-cert' => ['der', 'crt', 'cert', 'pem'], + 'application/x-x509-ca-cert' => ['der', 'crt', 'pem', 'cert'], 'application/x-xar' => ['xar', 'pkg'], 'application/x-xbel' => ['xbel'], 'application/x-xfig' => ['fig'], @@ -1075,25 +1184,32 @@ final class MimeTypes implements MimeTypesInterface 'application/x-zip-compressed-fb2' => ['fb2.zip'], 'application/x-zmachine' => ['z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7', 'z8'], 'application/x-zoo' => ['zoo'], + 'application/x-zstd-compressed-tar' => ['tar.zst', 'tzst'], 'application/xaml+xml' => ['xaml'], + 'application/xcap-att+xml' => ['xav'], + 'application/xcap-caps+xml' => ['xca'], 'application/xcap-diff+xml' => ['xdf'], + 'application/xcap-el+xml' => ['xel'], + 'application/xcap-error+xml' => ['xer'], + 'application/xcap-ns+xml' => ['xns'], 'application/xenc+xml' => ['xenc'], - 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xhtml+xml' => ['xhtml', 'xht', 'html', 'htm'], 'application/xliff+xml' => ['xlf', 'xliff'], - 'application/xml' => ['xml', 'xsl', 'xbl', 'xsd', 'rng'], + 'application/xml' => ['xml', 'xsl', 'xsd', 'rng', 'xbl'], 'application/xml-dtd' => ['dtd'], 'application/xml-external-parsed-entity' => ['ent'], 'application/xop+xml' => ['xop'], 'application/xproc+xml' => ['xpl'], - 'application/xps' => ['oxps', 'xps'], - 'application/xslt+xml' => ['xslt', 'xsl'], + 'application/xps' => ['xps'], + 'application/xslt+xml' => ['xsl', 'xslt'], 'application/xspf+xml' => ['xspf'], 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], 'application/yang' => ['yang'], 'application/yin+xml' => ['yin'], 'application/zip' => ['zip'], 'application/zlib' => ['zz'], - 'audio/3gpp' => ['3gp', '3gpp', '3ga'], + 'application/zstd' => ['zst'], + 'audio/3gpp' => ['3gpp', '3gp', '3ga'], 'audio/3gpp-encrypted' => ['3gp', '3gpp', '3ga'], 'audio/3gpp2' => ['3g2', '3gp2', '3gpp2'], 'audio/aac' => ['aac', 'adts', 'ass'], @@ -1110,13 +1226,13 @@ final class MimeTypes implements MimeTypesInterface 'audio/m3u' => ['m3u', 'm3u8', 'vlc'], 'audio/m4a' => ['m4a', 'f4a'], 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], - 'audio/mobile-xmf' => ['xmf'], + 'audio/mobile-xmf' => ['mxmf', 'xmf'], 'audio/mp2' => ['mp2'], 'audio/mp3' => ['mp3', 'mpga'], 'audio/mp4' => ['m4a', 'mp4a', 'f4a'], 'audio/mpeg' => ['mp3', 'mpga', 'mp2', 'mp2a', 'm2a', 'm3a'], 'audio/mpegurl' => ['m3u', 'm3u8', 'vlc'], - 'audio/ogg' => ['oga', 'ogg', 'spx', 'opus'], + 'audio/ogg' => ['ogg', 'oga', 'spx', 'opus'], 'audio/prs.sid' => ['sid', 'psid'], 'audio/s3m' => ['s3m'], 'audio/scpls' => ['pls'], @@ -1124,7 +1240,7 @@ final class MimeTypes implements MimeTypesInterface 'audio/tta' => ['tta'], 'audio/usac' => ['loas', 'xhe'], 'audio/vnd.audible' => ['aa', 'aax'], - 'audio/vnd.audible.aax' => ['aa', 'aax'], + 'audio/vnd.audible.aax' => ['aax'], 'audio/vnd.dece.audio' => ['uva', 'uvva'], 'audio/vnd.digital-winds' => ['eol'], 'audio/vnd.dra' => ['dra'], @@ -1141,6 +1257,7 @@ final class MimeTypes implements MimeTypesInterface 'audio/vnd.wave' => ['wav'], 'audio/vorbis' => ['oga', 'ogg'], 'audio/wav' => ['wav'], + 'audio/wave' => ['wav'], 'audio/webm' => ['weba'], 'audio/wma' => ['wma'], 'audio/x-aac' => ['aac', 'adts', 'ass'], @@ -1178,6 +1295,7 @@ final class MimeTypes implements MimeTypesInterface 'audio/x-ms-asx' => ['asx', 'wax', 'wvx', 'wmx'], 'audio/x-ms-wax' => ['wax'], 'audio/x-ms-wma' => ['wma'], + 'audio/x-ms-wmv' => ['wmv'], 'audio/x-musepack' => ['mpc', 'mpp', 'mp+'], 'audio/x-ogg' => ['oga', 'ogg', 'opus'], 'audio/x-oggflac' => ['oga', 'ogg'], @@ -1187,6 +1305,7 @@ final class MimeTypes implements MimeTypesInterface 'audio/x-pn-realaudio-plugin' => ['rmp'], 'audio/x-psf' => ['psf'], 'audio/x-psflib' => ['psflib'], + 'audio/x-realaudio' => ['ra'], 'audio/x-rn-3gpp-amr' => ['3gp', '3gpp', '3ga'], 'audio/x-rn-3gpp-amr-encrypted' => ['3gp', '3gpp', '3ga'], 'audio/x-rn-3gpp-amr-wb' => ['3gp', '3gpp', '3ga'], @@ -1195,7 +1314,7 @@ final class MimeTypes implements MimeTypesInterface 'audio/x-scpls' => ['pls'], 'audio/x-shorten' => ['shn'], 'audio/x-speex' => ['spx'], - 'audio/x-speex+ogg' => ['oga', 'ogg'], + 'audio/x-speex+ogg' => ['oga', 'ogg', 'spx'], 'audio/x-stm' => ['stm'], 'audio/x-tta' => ['tta'], 'audio/x-voc' => ['voc'], @@ -1219,44 +1338,70 @@ final class MimeTypes implements MimeTypesInterface 'font/collection' => ['ttc'], 'font/otf' => ['otf'], 'font/ttf' => ['ttf'], - 'font/woff' => ['woff', 'woff2'], + 'font/woff' => ['woff'], 'font/woff2' => ['woff2'], + 'image/aces' => ['exr'], + 'image/apng' => ['apng'], + 'image/astc' => ['astc'], + 'image/avif' => ['avif', 'avifs'], + 'image/avif-sequence' => ['avif', 'avifs'], 'image/bmp' => ['bmp', 'dib'], 'image/cdr' => ['cdr'], 'image/cgm' => ['cgm'], + 'image/dicom-rle' => ['drle'], 'image/emf' => ['emf'], 'image/fax-g3' => ['g3'], 'image/fits' => ['fits'], 'image/g3fax' => ['g3'], 'image/gif' => ['gif'], 'image/heic' => ['heic', 'heif'], - 'image/heic-sequence' => ['heic', 'heif'], - 'image/heif' => ['heic', 'heif'], - 'image/heif-sequence' => ['heic', 'heif'], + 'image/heic-sequence' => ['heics', 'heic', 'heif'], + 'image/heif' => ['heif', 'heic'], + 'image/heif-sequence' => ['heifs', 'heic', 'heif'], + 'image/hej2k' => ['hej2'], + 'image/hsj2' => ['hsj2'], 'image/ico' => ['ico'], 'image/icon' => ['ico'], 'image/ief' => ['ief'], + 'image/jls' => ['jls'], 'image/jp2' => ['jp2', 'jpg2'], - 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/jpeg' => ['jpg', 'jpeg', 'jpe'], 'image/jpeg2000' => ['jp2', 'jpg2'], 'image/jpeg2000-image' => ['jp2', 'jpg2'], + 'image/jph' => ['jph'], + 'image/jphc' => ['jhc'], 'image/jpm' => ['jpm', 'jpgm'], - 'image/jpx' => ['jpf', 'jpx'], + 'image/jpx' => ['jpx', 'jpf'], + 'image/jxl' => ['jxl'], + 'image/jxr' => ['jxr'], + 'image/jxra' => ['jxra'], + 'image/jxrs' => ['jxrs'], + 'image/jxs' => ['jxs'], + 'image/jxsc' => ['jxsc'], + 'image/jxsi' => ['jxsi'], + 'image/jxss' => ['jxss'], 'image/ktx' => ['ktx'], + 'image/ktx2' => ['ktx2'], 'image/openraster' => ['ora'], 'image/pdf' => ['pdf'], 'image/photoshop' => ['psd'], - 'image/pjpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/pjpeg' => ['jpg', 'jpeg', 'jpe'], 'image/png' => ['png'], 'image/prs.btif' => ['btif'], + 'image/prs.pti' => ['pti'], 'image/psd' => ['psd'], 'image/rle' => ['rle'], 'image/sgi' => ['sgi'], 'image/svg' => ['svg'], 'image/svg+xml' => ['svg', 'svgz'], 'image/svg+xml-compressed' => ['svgz'], - 'image/tiff' => ['tiff', 'tif'], + 'image/t38' => ['t38'], + 'image/targa' => ['tga', 'icb', 'tpic', 'vda', 'vst'], + 'image/tga' => ['tga', 'icb', 'tpic', 'vda', 'vst'], + 'image/tiff' => ['tif', 'tiff'], + 'image/tiff-fx' => ['tfx'], 'image/vnd.adobe.photoshop' => ['psd'], + 'image/vnd.airzip.accelerator.azv' => ['azv'], 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], 'image/vnd.djvu' => ['djvu', 'djv'], 'image/vnd.djvu+multipage' => ['djvu', 'djv'], @@ -1269,10 +1414,14 @@ final class MimeTypes implements MimeTypesInterface 'image/vnd.fujixerox.edmics-mmr' => ['mmr'], 'image/vnd.fujixerox.edmics-rlc' => ['rlc'], 'image/vnd.microsoft.icon' => ['ico'], + 'image/vnd.ms-dds' => ['dds'], 'image/vnd.ms-modi' => ['mdi'], 'image/vnd.ms-photo' => ['wdp'], 'image/vnd.net-fpx' => ['npx'], + 'image/vnd.pco.b16' => ['b16'], 'image/vnd.rn-realpix' => ['rp'], + 'image/vnd.tencent.tap' => ['tap'], + 'image/vnd.valve.source.texture' => ['vtf'], 'image/vnd.wap.wbmp' => ['wbmp'], 'image/vnd.xiff' => ['xif'], 'image/vnd.zbrush.pcx' => ['pcx'], @@ -1284,6 +1433,7 @@ final class MimeTypes implements MimeTypesInterface 'image/x-bmp' => ['bmp', 'dib'], 'image/x-bzeps' => ['eps.bz2', 'epsi.bz2', 'epsf.bz2'], 'image/x-canon-cr2' => ['cr2'], + 'image/x-canon-cr3' => ['cr3'], 'image/x-canon-crw' => ['crw'], 'image/x-cdr' => ['cdr'], 'image/x-cmu-raster' => ['ras'], @@ -1321,6 +1471,7 @@ final class MimeTypes implements MimeTypesInterface 'image/x-ms-bmp' => ['bmp', 'dib'], 'image/x-msod' => ['msod'], 'image/x-nikon-nef' => ['nef'], + 'image/x-nikon-nrw' => ['nrw'], 'image/x-olympus-orf' => ['orf'], 'image/x-panasonic-raw' => ['raw'], 'image/x-panasonic-raw2' => ['rw2'], @@ -1345,6 +1496,7 @@ final class MimeTypes implements MimeTypesInterface 'image/x-sony-sr2' => ['sr2'], 'image/x-sony-srf' => ['srf'], 'image/x-sun-raster' => ['sun'], + 'image/x-targa' => ['tga', 'icb', 'tpic', 'vda', 'vst'], 'image/x-tga' => ['tga', 'icb', 'tpic', 'vda', 'vst'], 'image/x-win-bitmap' => ['cur'], 'image/x-win-metafile' => ['wmf'], @@ -1356,24 +1508,47 @@ final class MimeTypes implements MimeTypesInterface 'image/x-xpm' => ['xpm'], 'image/x-xwindowdump' => ['xwd'], 'image/x.djvu' => ['djvu', 'djv'], + 'message/disposition-notification' => ['disposition-notification'], + 'message/global' => ['u8msg'], + 'message/global-delivery-status' => ['u8dsn'], + 'message/global-disposition-notification' => ['u8mdn'], + 'message/global-headers' => ['u8hdr'], 'message/rfc822' => ['eml', 'mime'], + 'message/vnd.wfa.wsc' => ['wsc'], + 'model/3mf' => ['3mf'], + 'model/gltf+json' => ['gltf'], + 'model/gltf-binary' => ['glb'], 'model/iges' => ['igs', 'iges'], 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/mtl' => ['mtl'], + 'model/obj' => ['obj'], + 'model/step+zip' => ['stpz'], + 'model/step-xml+zip' => ['stpxz'], 'model/stl' => ['stl'], 'model/vnd.collada+xml' => ['dae'], 'model/vnd.dwf' => ['dwf'], 'model/vnd.gdl' => ['gdl'], 'model/vnd.gtw' => ['gtw'], 'model/vnd.mts' => ['mts'], + 'model/vnd.opengex' => ['ogex'], + 'model/vnd.parasolid.transmit.binary' => ['x_b'], + 'model/vnd.parasolid.transmit.text' => ['x_t'], + 'model/vnd.sap.vds' => ['vds'], + 'model/vnd.usdz+zip' => ['usdz'], + 'model/vnd.valve.source.compiled-map' => ['bsp'], 'model/vnd.vtu' => ['vtu'], 'model/vrml' => ['wrl', 'vrml', 'vrm'], 'model/x.stl-ascii' => ['stl'], 'model/x.stl-binary' => ['stl'], 'model/x3d+binary' => ['x3db', 'x3dbz'], + 'model/x3d+fastinfoset' => ['x3db'], 'model/x3d+vrml' => ['x3dv', 'x3dvz'], 'model/x3d+xml' => ['x3d', 'x3dz'], + 'model/x3d-vrml' => ['x3dv'], 'text/cache-manifest' => ['appcache', 'manifest'], 'text/calendar' => ['ics', 'ifb', 'vcs'], + 'text/coffeescript' => ['coffee', 'litcoffee'], + 'text/crystal' => ['cr'], 'text/css' => ['css'], 'text/csv' => ['csv'], 'text/csv-schema' => ['csvs'], @@ -1381,13 +1556,18 @@ final class MimeTypes implements MimeTypesInterface 'text/ecmascript' => ['es'], 'text/gedcom' => ['ged', 'gedcom'], 'text/google-video-pointer' => ['gvp'], - 'text/html' => ['html', 'htm'], + 'text/html' => ['html', 'htm', 'shtml'], 'text/ico' => ['ico'], + 'text/jade' => ['jade'], 'text/javascript' => ['js', 'jsm', 'mjs'], - 'text/markdown' => ['md', 'mkd', 'markdown'], + 'text/jsx' => ['jsx'], + 'text/less' => ['less'], + 'text/markdown' => ['md', 'markdown', 'mkd'], 'text/mathml' => ['mml'], + 'text/mdx' => ['mdx'], 'text/n3' => ['n3'], - 'text/plain' => ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'asc'], + 'text/org' => ['org'], + 'text/plain' => ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini', 'asc'], 'text/prs.lines.tag' => ['dsc'], 'text/rdf' => ['rdf', 'rdfs', 'owl'], 'text/richtext' => ['rtx'], @@ -1395,11 +1575,18 @@ final class MimeTypes implements MimeTypesInterface 'text/rtf' => ['rtf'], 'text/rust' => ['rs'], 'text/sgml' => ['sgml', 'sgm'], + 'text/shex' => ['shex'], + 'text/slim' => ['slim', 'slm'], + 'text/spdx' => ['spdx'], 'text/spreadsheet' => ['sylk', 'slk'], + 'text/stylus' => ['stylus', 'styl'], 'text/tab-separated-values' => ['tsv'], + 'text/tcl' => ['tcl', 'tk'], 'text/troff' => ['t', 'tr', 'roff', 'man', 'me', 'ms'], 'text/turtle' => ['ttl'], 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vbs' => ['vbs'], + 'text/vbscript' => ['vbs'], 'text/vcard' => ['vcard', 'vcf', 'vct', 'gcrd'], 'text/vnd.curl' => ['curl'], 'text/vnd.curl.dcurl' => ['dcurl'], @@ -1413,6 +1600,7 @@ final class MimeTypes implements MimeTypesInterface 'text/vnd.in3d.spot' => ['spot'], 'text/vnd.qt.linguist' => ['ts'], 'text/vnd.rn-realtext' => ['rt'], + 'text/vnd.senx.warpscript' => ['mc2'], 'text/vnd.sun.j2me.app-descriptor' => ['jad'], 'text/vnd.trolltech.linguist' => ['ts'], 'text/vnd.wap.wml' => ['wml'], @@ -1428,9 +1616,13 @@ final class MimeTypes implements MimeTypesInterface 'text/x-cmake' => ['cmake'], 'text/x-cobol' => ['cbl', 'cob'], 'text/x-comma-separated-values' => ['csv'], + 'text/x-common-lisp' => ['asd', 'fasl', 'lisp', 'ros'], + 'text/x-component' => ['htc'], + 'text/x-crystal' => ['cr'], 'text/x-csharp' => ['cs'], 'text/x-csrc' => ['c'], 'text/x-csv' => ['csv'], + 'text/x-dart' => ['dart'], 'text/x-dbus-service' => ['service'], 'text/x-dcl' => ['dcl'], 'text/x-diff' => ['diff', 'patch'], @@ -1438,6 +1630,7 @@ final class MimeTypes implements MimeTypesInterface 'text/x-dsrc' => ['d', 'di'], 'text/x-dtd' => ['dtd'], 'text/x-eiffel' => ['e', 'eif'], + 'text/x-elixir' => ['ex', 'exs'], 'text/x-emacs-lisp' => ['el'], 'text/x-erlang' => ['erl'], 'text/x-fortran' => ['f', 'for', 'f77', 'f90', 'f95'], @@ -1447,12 +1640,17 @@ final class MimeTypes implements MimeTypesInterface 'text/x-gherkin' => ['feature'], 'text/x-go' => ['go'], 'text/x-google-video-pointer' => ['gvp'], + 'text/x-gradle' => ['gradle'], + 'text/x-groovy' => ['groovy', 'gvy', 'gy', 'gsh'], + 'text/x-handlebars-template' => ['hbs'], 'text/x-haskell' => ['hs'], 'text/x-idl' => ['idl'], 'text/x-imelody' => ['imy', 'ime'], 'text/x-iptables' => ['iptables'], 'text/x-java' => ['java'], 'text/x-java-source' => ['java'], + 'text/x-kaitai-struct' => ['ksy'], + 'text/x-kotlin' => ['kt'], 'text/x-ldif' => ['ldif'], 'text/x-lilypond' => ['ly'], 'text/x-literate-haskell' => ['lhs'], @@ -1479,18 +1677,22 @@ final class MimeTypes implements MimeTypesInterface 'text/x-opencl-src' => ['cl'], 'text/x-opml' => ['opml'], 'text/x-opml+xml' => ['opml'], + 'text/x-org' => ['org'], 'text/x-pascal' => ['p', 'pas'], 'text/x-patch' => ['diff', 'patch'], 'text/x-perl' => ['pl', 'PL', 'pm', 'al', 'perl', 'pod', 't'], 'text/x-po' => ['po'], 'text/x-pot' => ['pot'], + 'text/x-processing' => ['pde'], 'text/x-python' => ['py', 'pyx', 'wsgi'], - 'text/x-python3' => ['py', 'py3', 'py3x'], + 'text/x-python3' => ['py', 'py3', 'py3x', 'pyi'], 'text/x-qml' => ['qml', 'qmltypes', 'qmlproject'], 'text/x-reject' => ['rej'], 'text/x-rpm-spec' => ['spec'], + 'text/x-rst' => ['rst'], + 'text/x-sagemath' => ['sage'], 'text/x-sass' => ['sass'], - 'text/x-scala' => ['scala'], + 'text/x-scala' => ['scala', 'sc'], 'text/x-scheme' => ['scm', 'ss'], 'text/x-scss' => ['scss'], 'text/x-setext' => ['etx'], @@ -1499,6 +1701,7 @@ final class MimeTypes implements MimeTypesInterface 'text/x-sql' => ['sql'], 'text/x-ssa' => ['ssa', 'ass'], 'text/x-subviewer' => ['sub'], + 'text/x-suse-ymp' => ['ymp'], 'text/x-svhdr' => ['svh'], 'text/x-svsrc' => ['sv'], 'text/x-systemd-unit' => ['automount', 'device', 'mount', 'path', 'scope', 'service', 'slice', 'socket', 'swap', 'target', 'timer'], @@ -1538,17 +1741,18 @@ final class MimeTypes implements MimeTypesInterface 'video/h261' => ['h261'], 'video/h263' => ['h263'], 'video/h264' => ['h264'], + 'video/iso.segment' => ['m4s'], 'video/jpeg' => ['jpgv'], 'video/jpm' => ['jpm', 'jpgm'], 'video/mj2' => ['mj2', 'mjp2'], - 'video/mp2t' => ['m2t', 'm2ts', 'ts', 'mts', 'cpi', 'clpi', 'mpl', 'mpls', 'bdm', 'bdmv'], + 'video/mp2t' => ['ts', 'm2t', 'm2ts', 'mts', 'cpi', 'clpi', 'mpl', 'mpls', 'bdm', 'bdmv'], 'video/mp4' => ['mp4', 'mp4v', 'mpg4', 'm4v', 'f4v', 'lrv'], 'video/mp4v-es' => ['mp4', 'm4v', 'f4v', 'lrv'], 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v', 'mp2', 'vob'], 'video/mpeg-system' => ['mpeg', 'mpg', 'mp2', 'mpe', 'vob'], 'video/msvideo' => ['avi', 'avf', 'divx'], 'video/ogg' => ['ogv', 'ogg'], - 'video/quicktime' => ['qt', 'mov', 'moov', 'qtvr'], + 'video/quicktime' => ['mov', 'qt', 'moov', 'qtvr'], 'video/vivo' => ['viv', 'vivo'], 'video/vnd.dece.hd' => ['uvh', 'uvvh'], 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], @@ -1560,6 +1764,8 @@ final class MimeTypes implements MimeTypesInterface 'video/vnd.fvt' => ['fvt'], 'video/vnd.mpegurl' => ['mxu', 'm4u', 'm1u'], 'video/vnd.ms-playready.media.pyv' => ['pyv'], + 'video/vnd.radgamettools.bink' => ['bik', 'bk2'], + 'video/vnd.radgamettools.smacker' => ['smk'], 'video/vnd.rn-realvideo' => ['rv', 'rvx'], 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], 'video/vnd.vivo' => ['viv', 'vivo'], @@ -1612,16 +1818,20 @@ final class MimeTypes implements MimeTypesInterface ]; private const REVERSE_MAP = [ + '1km' => ['application/vnd.1000minds.decision-model+xml'], '32x' => ['application/x-genesis-32x-rom'], '3dml' => ['text/vnd.in3d.3dml'], - '3ds' => ['image/x-3ds'], + '3ds' => ['application/x-nintendo-3ds-rom', 'image/x-3ds'], + '3dsx' => ['application/x-nintendo-3ds-executable'], '3g2' => ['audio/3gpp2', 'video/3gpp2'], '3ga' => ['audio/3gpp', 'audio/3gpp-encrypted', 'audio/x-rn-3gpp-amr', 'audio/x-rn-3gpp-amr-encrypted', 'audio/x-rn-3gpp-amr-wb', 'audio/x-rn-3gpp-amr-wb-encrypted', 'video/3gp', 'video/3gpp', 'video/3gpp-encrypted'], '3gp' => ['audio/3gpp', 'audio/3gpp-encrypted', 'audio/x-rn-3gpp-amr', 'audio/x-rn-3gpp-amr-encrypted', 'audio/x-rn-3gpp-amr-wb', 'audio/x-rn-3gpp-amr-wb-encrypted', 'video/3gp', 'video/3gpp', 'video/3gpp-encrypted'], '3gp2' => ['audio/3gpp2', 'video/3gpp2'], '3gpp' => ['audio/3gpp', 'audio/3gpp-encrypted', 'audio/x-rn-3gpp-amr', 'audio/x-rn-3gpp-amr-encrypted', 'audio/x-rn-3gpp-amr-wb', 'audio/x-rn-3gpp-amr-wb-encrypted', 'video/3gp', 'video/3gpp', 'video/3gpp-encrypted'], '3gpp2' => ['audio/3gpp2', 'video/3gpp2'], + '3mf' => ['model/3mf'], '7z' => ['application/x-7z-compressed'], + '7z.001' => ['application/x-7z-compressed'], 'BLEND' => ['application/x-blender'], 'C' => ['text/x-c++src'], 'PAR2' => ['application/x-par2'], @@ -1630,7 +1840,7 @@ final class MimeTypes implements MimeTypesInterface 'a' => ['application/x-archive'], 'a26' => ['application/x-atari-2600-rom'], 'a78' => ['application/x-atari-7800-rom'], - 'aa' => ['audio/vnd.audible', 'audio/vnd.audible.aax', 'audio/x-pn-audibleaudio'], + 'aa' => ['audio/vnd.audible', 'audio/x-pn-audibleaudio'], 'aab' => ['application/x-authorware-bin'], 'aac' => ['audio/aac', 'audio/x-aac', 'audio/x-hx-aac-adts'], 'aam' => ['application/x-authorware-map'], @@ -1639,7 +1849,7 @@ final class MimeTypes implements MimeTypesInterface 'abw' => ['application/x-abiword'], 'abw.CRASHED' => ['application/x-abiword'], 'abw.gz' => ['application/x-abiword'], - 'ac' => ['application/pkix-attr-cert'], + 'ac' => ['application/pkix-attr-cert', 'application/vnd.nokia.n-gage.ac+xml'], 'ac3' => ['audio/ac3'], 'acc' => ['application/vnd.americandynamics.acc'], 'ace' => ['application/x-ace', 'application/x-ace-compressed'], @@ -1673,32 +1883,38 @@ final class MimeTypes implements MimeTypesInterface 'anx' => ['application/annodex', 'application/x-annodex'], 'ape' => ['audio/x-ape'], 'apk' => ['application/vnd.android.package-archive'], + 'apng' => ['image/apng'], 'appcache' => ['text/cache-manifest'], 'appimage' => ['application/vnd.appimage', 'application/x-iso9660-appimage'], 'application' => ['application/x-ms-application'], 'apr' => ['application/vnd.lotus-approach'], - 'aps' => ['application/postscript'], 'ar' => ['application/x-archive'], 'arc' => ['application/x-freearc'], 'arj' => ['application/x-arj'], 'arw' => ['image/x-sony-arw'], 'as' => ['application/x-applix-spreadsheet'], 'asc' => ['application/pgp', 'application/pgp-encrypted', 'application/pgp-keys', 'application/pgp-signature', 'text/plain'], + 'asd' => ['text/x-common-lisp'], 'asf' => ['application/vnd.ms-asf', 'video/x-ms-asf', 'video/x-ms-asf-plugin', 'video/x-ms-wm'], + 'asice' => ['application/vnd.etsi.asic-e+zip'], 'asm' => ['text/x-asm'], 'aso' => ['application/vnd.accpac.simply.aso'], 'asp' => ['application/x-asp'], 'ass' => ['audio/aac', 'audio/x-aac', 'audio/x-hx-aac-adts', 'text/x-ssa'], + 'astc' => ['image/astc'], 'asx' => ['application/x-ms-asx', 'audio/x-ms-asx', 'video/x-ms-asf', 'video/x-ms-wax', 'video/x-ms-wmx', 'video/x-ms-wvx'], 'atc' => ['application/vnd.acucorp'], 'atom' => ['application/atom+xml'], 'atomcat' => ['application/atomcat+xml'], + 'atomdeleted' => ['application/atomdeleted+xml'], 'atomsvc' => ['application/atomsvc+xml'], 'atx' => ['application/vnd.antix.game-component'], 'au' => ['audio/basic'], 'automount' => ['text/x-systemd-unit'], 'avf' => ['video/avi', 'video/divx', 'video/msvideo', 'video/vnd.divx', 'video/x-avi', 'video/x-msvideo'], 'avi' => ['video/avi', 'video/divx', 'video/msvideo', 'video/vnd.divx', 'video/x-avi', 'video/x-msvideo'], + 'avif' => ['image/avif', 'image/avif-sequence'], + 'avifs' => ['image/avif', 'image/avif-sequence'], 'aw' => ['application/applixware', 'application/x-applix-word'], 'awb' => ['audio/amr-wb', 'audio/amr-wb-encrypted'], 'awk' => ['application/x-awk'], @@ -1706,31 +1922,39 @@ final class MimeTypes implements MimeTypesInterface 'axv' => ['video/annodex', 'video/x-annodex'], 'azf' => ['application/vnd.airzip.filesecure.azf'], 'azs' => ['application/vnd.airzip.filesecure.azs'], + 'azv' => ['image/vnd.airzip.accelerator.azv'], 'azw' => ['application/vnd.amazon.ebook'], + 'azw3' => ['application/vnd.amazon.mobi8-ebook', 'application/x-mobi8-ebook'], + 'b16' => ['image/vnd.pco.b16'], 'bak' => ['application/x-trash'], 'bat' => ['application/x-msdownload'], 'bcpio' => ['application/x-bcpio'], 'bdf' => ['application/x-font-bdf'], 'bdm' => ['application/vnd.syncml.dm+wbxml', 'video/mp2t'], 'bdmv' => ['video/mp2t'], + 'bdoc' => ['application/bdoc', 'application/x-bdoc'], 'bed' => ['application/vnd.realvnc.bed'], 'bh2' => ['application/vnd.fujitsu.oasysprs'], 'bib' => ['text/x-bibtex'], - 'bin' => ['application/octet-stream', 'application/x-saturn-rom', 'application/x-sega-cd-rom'], + 'bik' => ['video/vnd.radgamettools.bink'], + 'bin' => ['application/octet-stream'], + 'bk2' => ['video/vnd.radgamettools.bink'], 'blb' => ['application/x-blorb'], 'blend' => ['application/x-blender'], 'blender' => ['application/x-blender'], 'blorb' => ['application/x-blorb'], 'bmi' => ['application/vnd.bmi'], + 'bmml' => ['application/vnd.balsamiq.bmml+xml'], 'bmp' => ['image/bmp', 'image/x-bmp', 'image/x-ms-bmp'], 'book' => ['application/vnd.framemaker'], 'box' => ['application/vnd.previewsystems.box'], 'boz' => ['application/x-bzip2'], - 'bpk' => ['application/octet-stream'], + 'bps' => ['application/x-bps-patch'], 'bsdiff' => ['application/x-bsdiff'], + 'bsp' => ['model/vnd.valve.source.compiled-map'], 'btif' => ['image/prs.btif'], - 'bz' => ['application/x-bzip', 'application/x-bzip2'], - 'bz2' => ['application/x-bz2', 'application/x-bzip', 'application/x-bzip2'], + 'bz' => ['application/bzip2', 'application/x-bzip', 'application/x-bzip2'], + 'bz2' => ['application/x-bz2', 'application/bzip2', 'application/x-bzip', 'application/x-bzip2'], 'c' => ['text/x-c', 'text/x-csrc'], 'c++' => ['text/x-c++src'], 'c11amc' => ['application/vnd.cluetrust.cartomobile-config'], @@ -1752,11 +1976,15 @@ final class MimeTypes implements MimeTypesInterface 'cbt' => ['application/x-cbr', 'application/x-cbt'], 'cbz' => ['application/vnd.comicbook+zip', 'application/x-cbr', 'application/x-cbz'], 'cc' => ['text/x-c', 'text/x-c++src'], + 'cci' => ['application/x-nintendo-3ds-rom'], 'ccmx' => ['application/x-ccmx'], + 'cco' => ['application/x-cocoa'], 'cct' => ['application/x-director'], 'ccxml' => ['application/ccxml+xml'], 'cdbcmsg' => ['application/vnd.contact.cmsg'], 'cdf' => ['application/x-netcdf'], + 'cdfx' => ['application/cdfx+xml'], + 'cdi' => ['application/x-discjuggler-cd-image'], 'cdkey' => ['application/vnd.mediastation.cdkey'], 'cdmia' => ['application/cdmi-capability'], 'cdmic' => ['application/cdmi-container'], @@ -1773,11 +2001,13 @@ final class MimeTypes implements MimeTypesInterface 'cgb' => ['application/x-gameboy-color-rom'], 'cgm' => ['image/cgm'], 'chat' => ['application/x-chat'], + 'chd' => ['application/x-mame-chd'], 'chm' => ['application/vnd.ms-htmlhelp', 'application/x-chm'], 'chrt' => ['application/vnd.kde.kchart', 'application/x-kchart'], 'cif' => ['chemical/x-cif'], 'cii' => ['application/vnd.anser-web-certificate-issue-initiation'], 'cil' => ['application/vnd.ms-artgalry'], + 'cjs' => ['application/node'], 'cl' => ['text/x-opencl-src'], 'cla' => ['application/vnd.claymore'], 'class' => ['application/java', 'application/java-byte-code', 'application/java-vm', 'application/x-java', 'application/x-java-class', 'application/x-java-vm'], @@ -1797,7 +2027,7 @@ final class MimeTypes implements MimeTypesInterface 'cmx' => ['image/x-cmx'], 'cob' => ['text/x-cobol'], 'cod' => ['application/vnd.rim.cod'], - 'coffee' => ['application/vnd.coffeescript'], + 'coffee' => ['application/vnd.coffeescript', 'text/coffeescript'], 'com' => ['application/x-msdownload'], 'conf' => ['text/plain'], 'cpi' => ['video/mp2t'], @@ -1805,25 +2035,31 @@ final class MimeTypes implements MimeTypesInterface 'cpio.gz' => ['application/x-cpio-compressed'], 'cpp' => ['text/x-c', 'text/x-c++src'], 'cpt' => ['application/mac-compactpro'], + 'cr' => ['text/crystal', 'text/x-crystal'], 'cr2' => ['image/x-canon-cr2'], + 'cr3' => ['image/x-canon-cr3'], 'crd' => ['application/x-mscardfile'], 'crdownload' => ['application/x-partial-download'], 'crl' => ['application/pkix-crl'], 'crt' => ['application/x-x509-ca-cert'], 'crw' => ['image/x-canon-crw'], + 'crx' => ['application/x-chrome-extension'], 'cryptonote' => ['application/vnd.rig.cryptonote'], 'cs' => ['text/x-csharp'], 'csh' => ['application/x-csh'], + 'csl' => ['application/vnd.citationstyles.style+xml'], 'csml' => ['chemical/x-csml'], + 'cso' => ['application/x-compressed-iso'], 'csp' => ['application/vnd.commonspace'], 'css' => ['text/css'], 'cst' => ['application/x-director'], - 'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/x-csv', 'application/csv'], + 'csv' => ['text/csv', 'application/csv', 'text/x-comma-separated-values', 'text/x-csv'], 'csvs' => ['text/csv-schema'], 'cu' => ['application/cu-seeme'], 'cue' => ['application/x-cue'], 'cur' => ['image/x-win-bitmap'], 'curl' => ['text/vnd.curl'], + 'cwk' => ['application/x-appleworks-document'], 'cww' => ['application/prs.cww'], 'cxt' => ['application/x-director'], 'cxx' => ['text/x-c', 'text/x-c++src'], @@ -1831,10 +2067,10 @@ final class MimeTypes implements MimeTypesInterface 'dae' => ['model/vnd.collada+xml'], 'daf' => ['application/vnd.mobius.daf'], 'dar' => ['application/x-dar'], - 'dart' => ['application/vnd.dart'], + 'dart' => ['application/vnd.dart', 'text/x-dart'], 'dataless' => ['application/vnd.fdsn.seed'], 'davmount' => ['application/davmount+xml'], - 'dbf' => ['application/dbase', 'application/dbf', 'application/x-dbase', 'application/x-dbf'], + 'dbf' => ['application/dbase', 'application/dbf', 'application/vnd.dbf', 'application/x-dbase', 'application/x-dbf'], 'dbk' => ['application/docbook+xml', 'application/vnd.oasis.docbook+xml', 'application/x-docbook+xml'], 'dc' => ['application/x-dc-rom'], 'dcl' => ['text/x-dcl'], @@ -1843,10 +2079,10 @@ final class MimeTypes implements MimeTypesInterface 'dcurl' => ['text/vnd.curl.dcurl'], 'dd2' => ['application/vnd.oma.dd2+xml'], 'ddd' => ['application/vnd.fujixerox.ddd'], - 'dds' => ['image/x-dds'], + 'ddf' => ['application/vnd.syncml.dmddf+xml'], + 'dds' => ['image/vnd.ms-dds', 'image/x-dds'], 'deb' => ['application/vnd.debian.binary-package', 'application/x-deb', 'application/x-debian-package'], 'def' => ['text/plain'], - 'deploy' => ['application/octet-stream'], 'der' => ['application/x-x509-ca-cert'], 'desktop' => ['application/x-desktop', 'application/x-gnome-app-info'], 'device' => ['text/x-systemd-unit'], @@ -1859,15 +2095,13 @@ final class MimeTypes implements MimeTypesInterface 'diff' => ['text/x-diff', 'text/x-patch'], 'dir' => ['application/x-director'], 'dis' => ['application/vnd.mobius.dis'], - 'dist' => ['application/octet-stream'], - 'distz' => ['application/octet-stream'], + 'disposition-notification' => ['message/disposition-notification'], 'divx' => ['video/avi', 'video/divx', 'video/msvideo', 'video/vnd.divx', 'video/x-avi', 'video/x-msvideo'], 'djv' => ['image/vnd.djvu', 'image/vnd.djvu+multipage', 'image/x-djvu', 'image/x.djvu'], 'djvu' => ['image/vnd.djvu', 'image/vnd.djvu+multipage', 'image/x-djvu', 'image/x.djvu'], 'dll' => ['application/x-msdownload'], 'dmg' => ['application/x-apple-diskimage'], 'dmp' => ['application/pcap', 'application/vnd.tcpdump.pcap', 'application/x-pcap'], - 'dms' => ['application/octet-stream'], 'dna' => ['application/vnd.dna'], 'dng' => ['image/x-adobe-dng'], 'doc' => ['application/msword', 'application/vnd.ms-word', 'application/x-msword', 'zz-application/zz-winassoc-doc'], @@ -1880,6 +2114,7 @@ final class MimeTypes implements MimeTypesInterface 'dp' => ['application/vnd.osgi.dp'], 'dpg' => ['application/vnd.dpgraph'], 'dra' => ['audio/vnd.dra'], + 'drle' => ['image/dicom-rle'], 'dsc' => ['text/prs.lines.tag'], 'dsl' => ['text/x-dsl'], 'dssc' => ['application/dssc+der'], @@ -1888,18 +2123,19 @@ final class MimeTypes implements MimeTypesInterface 'dts' => ['audio/vnd.dts', 'audio/x-dts'], 'dtshd' => ['audio/vnd.dts.hd', 'audio/x-dtshd'], 'dtx' => ['application/x-tex', 'text/x-tex'], - 'dump' => ['application/octet-stream'], 'dv' => ['video/dv'], 'dvb' => ['video/vnd.dvb.file'], 'dvi' => ['application/x-dvi'], 'dvi.bz2' => ['application/x-bzdvi'], 'dvi.gz' => ['application/x-gzdvi'], + 'dwd' => ['application/atsc-dwd+xml'], 'dwf' => ['model/vnd.dwf'], 'dwg' => ['image/vnd.dwg'], 'dxf' => ['image/vnd.dxf'], 'dxp' => ['application/vnd.spotfire.dxp'], 'dxr' => ['application/x-director'], 'e' => ['text/x-eiffel'], + 'ear' => ['application/java-archive'], 'ecelp4800' => ['audio/vnd.nuera.ecelp4800'], 'ecelp7470' => ['audio/vnd.nuera.ecelp7470'], 'ecelp9600' => ['audio/vnd.nuera.ecelp9600'], @@ -1911,10 +2147,10 @@ final class MimeTypes implements MimeTypesInterface 'ei6' => ['application/vnd.pg.osasli'], 'eif' => ['text/x-eiffel'], 'el' => ['text/x-emacs-lisp'], - 'elc' => ['application/octet-stream'], 'emf' => ['application/emf', 'application/x-emf', 'application/x-msmetafile', 'image/emf', 'image/x-emf'], 'eml' => ['message/rfc822'], 'emma' => ['application/emma+xml'], + 'emotionml' => ['application/emotionml+xml'], 'emp' => ['application/vnd.emusic-emusic_package'], 'emz' => ['application/x-msmetafile'], 'ent' => ['application/xml-external-parsed-entity', 'text/xml-external-parsed-entity'], @@ -1940,9 +2176,11 @@ final class MimeTypes implements MimeTypesInterface 'etx' => ['text/x-setext'], 'eva' => ['application/x-eva'], 'evy' => ['application/x-envoy'], - 'exe' => ['application/x-ms-dos-executable', 'application/x-msdownload'], + 'ex' => ['text/x-elixir'], + 'exe' => ['application/x-ms-dos-executable', 'application/x-msdos-program', 'application/x-msdownload'], 'exi' => ['application/exi'], - 'exr' => ['image/x-exr'], + 'exr' => ['image/aces', 'image/x-exr'], + 'exs' => ['text/x-elixir'], 'ext' => ['application/vnd.novadigm.ext'], 'ez' => ['application/andrew-inset'], 'ez2' => ['application/vnd.ezpix-album'], @@ -1954,6 +2192,7 @@ final class MimeTypes implements MimeTypesInterface 'f77' => ['text/x-fortran'], 'f90' => ['text/x-fortran'], 'f95' => ['text/x-fortran'], + 'fasl' => ['text/x-common-lisp'], 'fb2' => ['application/x-fictionbook', 'application/x-fictionbook+xml'], 'fb2.zip' => ['application/x-zip-compressed-fb2'], 'fbs' => ['image/vnd.fastbidsheet'], @@ -1962,6 +2201,7 @@ final class MimeTypes implements MimeTypesInterface 'fd' => ['application/x-fd-file', 'application/x-raw-floppy-disk-image'], 'fdf' => ['application/vnd.fdf'], 'fds' => ['application/x-fds-disk'], + 'fdt' => ['application/fdt+xml'], 'fe_launch' => ['application/vnd.denovo.fcselayout-link'], 'feature' => ['text/x-gherkin'], 'fg5' => ['application/vnd.fujitsu.oasysgp'], @@ -1987,7 +2227,7 @@ final class MimeTypes implements MimeTypesInterface 'fly' => ['text/vnd.fly'], 'fm' => ['application/vnd.framemaker', 'application/x-frame'], 'fnc' => ['application/vnd.frogans.fnc'], - 'fo' => ['text/x-xslfo'], + 'fo' => ['application/vnd.software602.filler.form+xml', 'text/x-xslfo'], 'fodg' => ['application/vnd.oasis.opendocument.graphics-flat-xml'], 'fodp' => ['application/vnd.oasis.opendocument.presentation-flat-xml'], 'fods' => ['application/vnd.oasis.opendocument.spreadsheet-flat-xml'], @@ -2016,7 +2256,9 @@ final class MimeTypes implements MimeTypesInterface 'gca' => ['application/x-gca-compressed'], 'gcode' => ['text/x.gcode'], 'gcrd' => ['text/directory', 'text/vcard', 'text/x-vcard'], + 'gdi' => ['application/x-gd-rom-cue'], 'gdl' => ['model/vnd.gdl'], + 'gdoc' => ['application/vnd.google-apps.document'], 'ged' => ['application/x-gedcom', 'text/gedcom'], 'gedcom' => ['application/x-gedcom', 'text/gedcom'], 'gem' => ['application/x-gtar', 'application/x-tar'], @@ -2034,6 +2276,8 @@ final class MimeTypes implements MimeTypesInterface 'gih' => ['image/x-gimp-gih'], 'gim' => ['application/vnd.groove-identity-message'], 'glade' => ['application/x-glade'], + 'glb' => ['model/gltf-binary'], + 'gltf' => ['model/gltf+json'], 'gml' => ['application/gml+xml'], 'gmo' => ['application/x-gettext-translation'], 'gmx' => ['application/vnd.gmx'], @@ -2051,21 +2295,28 @@ final class MimeTypes implements MimeTypesInterface 'gqf' => ['application/vnd.grafeq'], 'gqs' => ['application/vnd.grafeq'], 'gra' => ['application/x-graphite'], + 'gradle' => ['text/x-gradle'], 'gram' => ['application/srgs'], 'gramps' => ['application/x-gramps-xml'], 'gre' => ['application/vnd.geometry-explorer'], + 'groovy' => ['text/x-groovy'], 'grv' => ['application/vnd.groove-injector'], 'grxml' => ['application/srgs+xml'], 'gs' => ['text/x-genie'], 'gsf' => ['application/x-font-ghostscript', 'application/x-font-type1'], + 'gsh' => ['text/x-groovy'], + 'gsheet' => ['application/vnd.google-apps.spreadsheet'], + 'gslides' => ['application/vnd.google-apps.presentation'], 'gsm' => ['audio/x-gsm'], 'gtar' => ['application/x-gtar', 'application/x-tar'], 'gtm' => ['application/vnd.groove-tool-message'], 'gtw' => ['model/vnd.gtw'], 'gv' => ['text/vnd.graphviz'], 'gvp' => ['text/google-video-pointer', 'text/x-google-video-pointer'], + 'gvy' => ['text/x-groovy'], 'gxf' => ['application/gxf'], 'gxt' => ['application/vnd.geonext'], + 'gy' => ['text/x-groovy'], 'gz' => ['application/x-gzip', 'application/gzip'], 'h' => ['text/x-c', 'text/x-chdr'], 'h++' => ['text/x-c++hdr'], @@ -2076,13 +2327,20 @@ final class MimeTypes implements MimeTypesInterface 'h5' => ['application/x-hdf'], 'hal' => ['application/vnd.hal+xml'], 'hbci' => ['application/vnd.hbci'], + 'hbs' => ['text/x-handlebars-template'], + 'hdd' => ['application/x-virtualbox-hdd'], 'hdf' => ['application/x-hdf'], 'hdf4' => ['application/x-hdf'], 'hdf5' => ['application/x-hdf'], 'heic' => ['image/heic', 'image/heic-sequence', 'image/heif', 'image/heif-sequence'], + 'heics' => ['image/heic-sequence'], 'heif' => ['image/heic', 'image/heic-sequence', 'image/heif', 'image/heif-sequence'], + 'heifs' => ['image/heif-sequence'], + 'hej2' => ['image/hej2k'], + 'held' => ['application/atsc-held+xml'], 'hfe' => ['application/x-hfe-file', 'application/x-hfe-floppy-image'], 'hh' => ['text/x-c', 'text/x-c++hdr'], + 'hjson' => ['application/hjson'], 'hlp' => ['application/winhlp', 'zz-application/zz-winassoc-hlp'], 'hp' => ['text/x-c++hdr'], 'hpgl' => ['application/vnd.hp-hpgl'], @@ -2091,9 +2349,11 @@ final class MimeTypes implements MimeTypesInterface 'hps' => ['application/vnd.hp-hps'], 'hqx' => ['application/stuffit', 'application/mac-binhex40'], 'hs' => ['text/x-haskell'], + 'hsj2' => ['image/hsj2'], + 'htc' => ['text/x-component'], 'htke' => ['application/vnd.kenameaapp'], - 'htm' => ['text/html'], - 'html' => ['text/html'], + 'htm' => ['text/html', 'application/xhtml+xml'], + 'html' => ['text/html', 'application/xhtml+xml'], 'hvd' => ['application/vnd.yamaha.hv-dic'], 'hvp' => ['application/vnd.yamaha.hv-voice'], 'hvs' => ['application/vnd.yamaha.hv-script'], @@ -2102,7 +2362,7 @@ final class MimeTypes implements MimeTypesInterface 'hxx' => ['text/x-c++hdr'], 'i2g' => ['application/vnd.intergeo'], 'ica' => ['application/x-ica'], - 'icb' => ['image/x-icb', 'image/x-tga'], + 'icb' => ['application/tga', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'], 'icc' => ['application/vnd.iccprofile'], 'ice' => ['x-conference/x-cooltalk'], 'icm' => ['application/vnd.iccprofile'], @@ -2128,6 +2388,7 @@ final class MimeTypes implements MimeTypesInterface 'ims' => ['application/vnd.ms-ims'], 'imy' => ['audio/imelody', 'audio/x-imelody', 'text/x-imelody'], 'in' => ['text/plain'], + 'ini' => ['text/plain'], 'ink' => ['application/inkml+xml'], 'inkml' => ['application/inkml+xml'], 'ins' => ['application/x-tex', 'text/x-tex'], @@ -2135,26 +2396,32 @@ final class MimeTypes implements MimeTypesInterface 'iota' => ['application/vnd.astraea-software.iota'], 'ipfix' => ['application/ipfix'], 'ipk' => ['application/vnd.shana.informed.package'], + 'ips' => ['application/x-ips-patch'], 'iptables' => ['text/x-iptables'], 'ipynb' => ['application/x-ipynb+json'], 'irm' => ['application/vnd.ibm.rights-management'], 'irp' => ['application/vnd.irepository.package+xml'], - 'iso' => ['application/x-cd-image', 'application/x-gamecube-iso-image', 'application/x-gamecube-rom', 'application/x-iso9660-image', 'application/x-saturn-rom', 'application/x-sega-cd-rom', 'application/x-wbfs', 'application/x-wia', 'application/x-wii-iso-image', 'application/x-wii-rom'], + 'iso' => ['application/x-cd-image', 'application/x-dreamcast-rom', 'application/x-gamecube-iso-image', 'application/x-gamecube-rom', 'application/x-iso9660-image', 'application/x-saturn-rom', 'application/x-sega-cd-rom', 'application/x-sega-pico-rom', 'application/x-wbfs', 'application/x-wia', 'application/x-wii-iso-image', 'application/x-wii-rom'], 'iso9660' => ['application/x-cd-image', 'application/x-iso9660-image'], 'it' => ['audio/x-it'], 'it87' => ['application/x-it87'], 'itp' => ['application/vnd.shana.informed.formtemplate'], + 'its' => ['application/its+xml'], 'ivp' => ['application/vnd.immervision-ivp'], 'ivu' => ['application/vnd.immervision-ivu'], 'j2c' => ['image/x-jp2-codestream'], 'j2k' => ['image/x-jp2-codestream'], 'jad' => ['text/vnd.sun.j2me.app-descriptor'], + 'jade' => ['text/jade'], 'jam' => ['application/vnd.jam'], 'jar' => ['application/x-java-archive', 'application/java-archive', 'application/x-jar'], + 'jardiff' => ['application/x-java-archive-diff'], 'java' => ['text/x-java', 'text/x-java-source'], 'jceks' => ['application/x-java-jce-keystore'], + 'jhc' => ['image/jphc'], 'jisp' => ['application/vnd.jisp'], 'jks' => ['application/x-java-keystore'], + 'jls' => ['image/jls'], 'jlt' => ['application/vnd.hp-jlyt'], 'jng' => ['image/x-jng'], 'jnlp' => ['application/x-java-jnlp-file'], @@ -2168,27 +2435,41 @@ final class MimeTypes implements MimeTypesInterface 'jpg2' => ['image/jp2', 'image/jpeg2000', 'image/jpeg2000-image', 'image/x-jpeg2000-image'], 'jpgm' => ['image/jpm', 'video/jpm'], 'jpgv' => ['video/jpeg'], + 'jph' => ['image/jph'], 'jpm' => ['image/jpm', 'video/jpm'], 'jpr' => ['application/x-jbuilder-project'], 'jpx' => ['application/x-jbuilder-project', 'image/jpx'], 'jrd' => ['application/jrd+json'], 'js' => ['text/javascript', 'application/javascript', 'application/x-javascript'], 'jsm' => ['application/javascript', 'application/x-javascript', 'text/javascript'], - 'json' => ['application/json'], + 'json' => ['application/json', 'application/schema+json'], 'json-patch' => ['application/json-patch+json'], + 'json5' => ['application/json5'], 'jsonld' => ['application/ld+json'], 'jsonml' => ['application/jsonml+json'], + 'jsx' => ['text/jsx'], + 'jxl' => ['image/jxl'], + 'jxr' => ['image/jxr'], + 'jxra' => ['image/jxra'], + 'jxrs' => ['image/jxrs'], + 'jxs' => ['image/jxs'], + 'jxsc' => ['image/jxsc'], + 'jxsi' => ['image/jxsi'], + 'jxss' => ['image/jxss'], 'k25' => ['image/x-kodak-k25'], 'k7' => ['application/x-thomson-cassette'], 'kar' => ['audio/midi', 'audio/x-midi'], 'karbon' => ['application/vnd.kde.karbon', 'application/x-karbon'], + 'kdbx' => ['application/x-keepass2'], 'kdc' => ['image/x-kodak-kdc'], 'kdelnk' => ['application/x-desktop', 'application/x-gnome-app-info'], 'kexi' => ['application/x-kexiproject-sqlite', 'application/x-kexiproject-sqlite2', 'application/x-kexiproject-sqlite3', 'application/x-vnd.kde.kexi'], 'kexic' => ['application/x-kexi-connectiondata'], 'kexis' => ['application/x-kexiproject-shortcut'], - 'key' => ['application/vnd.apple.keynote', 'application/x-iwork-keynote-sffkey'], + 'key' => ['application/vnd.apple.keynote', 'application/pgp-keys', 'application/x-iwork-keynote-sffkey'], + 'keynote' => ['application/vnd.apple.keynote'], 'kfo' => ['application/vnd.kde.kformula', 'application/x-kformula'], + 'kfx' => ['application/vnd.amazon.mobi8-ebook', 'application/x-mobi8-ebook'], 'kia' => ['application/vnd.kidspiration'], 'kil' => ['application/x-killustrator'], 'kino' => ['application/smil', 'application/smil+xml'], @@ -2202,10 +2483,14 @@ final class MimeTypes implements MimeTypesInterface 'kpt' => ['application/vnd.kde.kpresenter', 'application/x-kpresenter'], 'kpxx' => ['application/vnd.ds-keypoint'], 'kra' => ['application/x-krita'], + 'krz' => ['application/x-krita'], 'ks' => ['application/x-java-keystore'], 'ksp' => ['application/vnd.kde.kspread', 'application/x-kspread'], + 'ksy' => ['text/x-kaitai-struct'], + 'kt' => ['text/x-kotlin'], 'ktr' => ['application/vnd.kahootz'], 'ktx' => ['image/ktx'], + 'ktx2' => ['image/ktx2'], 'ktz' => ['application/vnd.kahootz'], 'kud' => ['application/x-kugar'], 'kwd' => ['application/vnd.kde.kword', 'application/x-kword'], @@ -2218,25 +2503,29 @@ final class MimeTypes implements MimeTypesInterface 'lbm' => ['image/x-iff', 'image/x-ilbm'], 'ldif' => ['text/x-ldif'], 'les' => ['application/vnd.hhe.lesson-player'], + 'less' => ['text/less'], + 'lgr' => ['application/lgr+xml'], 'lha' => ['application/x-lha', 'application/x-lzh-compressed'], 'lhs' => ['text/x-literate-haskell'], 'lhz' => ['application/x-lhz'], 'link66' => ['application/vnd.route66.link66+xml'], + 'lisp' => ['text/x-common-lisp'], 'list' => ['text/plain'], 'list3820' => ['application/vnd.ibm.modcap'], 'listafp' => ['application/vnd.ibm.modcap'], + 'litcoffee' => ['text/coffeescript'], 'lnk' => ['application/x-ms-shortcut'], 'lnx' => ['application/x-atari-lynx-rom'], 'loas' => ['audio/usac'], 'log' => ['text/plain', 'text/x-log'], 'lostxml' => ['application/lost+xml'], - 'lrf' => ['application/octet-stream'], 'lrm' => ['application/vnd.ms-lrm'], 'lrv' => ['video/mp4', 'video/mp4v-es', 'video/x-m4v'], 'lrz' => ['application/x-lrzip'], 'ltf' => ['application/vnd.frogans.ltf'], 'ltx' => ['application/x-tex', 'text/x-tex'], 'lua' => ['text/x-lua'], + 'luac' => ['application/x-lua-bytecode'], 'lvp' => ['audio/vnd.lucent.voice'], 'lwo' => ['image/x-lwo'], 'lwob' => ['image/x-lwo'], @@ -2266,31 +2555,35 @@ final class MimeTypes implements MimeTypesInterface 'm4' => ['application/x-m4'], 'm4a' => ['audio/mp4', 'audio/m4a', 'audio/x-m4a'], 'm4b' => ['audio/x-m4b'], + 'm4p' => ['application/mp4'], 'm4r' => ['audio/x-m4r'], + 'm4s' => ['video/iso.segment'], 'm4u' => ['video/vnd.mpegurl', 'video/x-mpegurl'], 'm4v' => ['video/mp4', 'video/mp4v-es', 'video/x-m4v'], 'm7' => ['application/x-thomson-cartridge-memo7'], 'ma' => ['application/mathematica'], 'mab' => ['application/x-markaby'], 'mads' => ['application/mads+xml'], + 'maei' => ['application/mmt-aei+xml'], 'mag' => ['application/vnd.ecowin.chart'], 'mak' => ['text/x-makefile'], 'maker' => ['application/vnd.framemaker'], 'man' => ['application/x-troff-man', 'text/troff'], 'manifest' => ['text/cache-manifest'], - 'mar' => ['application/octet-stream'], + 'map' => ['application/json'], 'markdown' => ['text/markdown', 'text/x-markdown'], 'mathml' => ['application/mathml+xml'], 'mb' => ['application/mathematica'], 'mbk' => ['application/vnd.mobius.mbk'], 'mbox' => ['application/mbox'], 'mc1' => ['application/vnd.medcalcdata'], + 'mc2' => ['text/vnd.senx.warpscript'], 'mcd' => ['application/vnd.mcd'], 'mcurl' => ['text/vnd.curl.mcurl'], 'md' => ['text/markdown', 'text/x-markdown'], 'mdb' => ['application/x-msaccess', 'application/mdb', 'application/msaccess', 'application/vnd.ms-access', 'application/vnd.msaccess', 'application/x-mdb', 'zz-application/zz-winassoc-mdb'], 'mdi' => ['image/vnd.ms-modi'], - 'mdx' => ['application/x-genesis-32x-rom'], + 'mdx' => ['application/x-genesis-32x-rom', 'text/mdx'], 'me' => ['text/troff', 'text/x-troff-me'], 'med' => ['audio/x-mod'], 'mesh' => ['model/mesh'], @@ -2334,7 +2627,7 @@ final class MimeTypes implements MimeTypesInterface 'mo3' => ['audio/x-mo3'], 'mobi' => ['application/x-mobipocket-ebook'], 'moc' => ['text/x-moc'], - 'mod' => ['audio/x-mod'], + 'mod' => ['application/x-object', 'audio/x-mod'], 'mods' => ['application/mods+xml'], 'mof' => ['text/x-mof'], 'moov' => ['video/quicktime'], @@ -2351,6 +2644,7 @@ final class MimeTypes implements MimeTypesInterface 'mp4s' => ['application/mp4'], 'mp4v' => ['video/mp4'], 'mpc' => ['application/vnd.mophun.certificate', 'audio/x-musepack'], + 'mpd' => ['application/dash+xml'], 'mpe' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2'], 'mpeg' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2'], 'mpg' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2'], @@ -2375,21 +2669,26 @@ final class MimeTypes implements MimeTypesInterface 'mseed' => ['application/vnd.fdsn.mseed'], 'mseq' => ['application/vnd.mseq'], 'msf' => ['application/vnd.epson.msf'], + 'msg' => ['application/vnd.ms-outlook'], 'msh' => ['model/mesh'], 'msi' => ['application/x-msdownload', 'application/x-msi'], 'msl' => ['application/vnd.mobius.msl'], 'msod' => ['image/x-msod'], 'msty' => ['application/vnd.muvee.style'], 'msx' => ['application/x-msx-rom'], + 'mtl' => ['model/mtl'], 'mtm' => ['audio/x-mod'], 'mts' => ['model/vnd.mts', 'video/mp2t'], 'mup' => ['text/x-mup'], 'mus' => ['application/vnd.musician'], + 'musd' => ['application/mmt-usd+xml'], 'musicxml' => ['application/vnd.recordare.musicxml+xml'], 'mvb' => ['application/x-msmediaview'], + 'mvt' => ['application/vnd.mapbox-vector-tile'], 'mwf' => ['application/vnd.mfer'], 'mxf' => ['application/mxf'], 'mxl' => ['application/vnd.recordare.musicxml'], + 'mxmf' => ['audio/mobile-xmf'], 'mxml' => ['application/xv+xml'], 'mxs' => ['application/vnd.triscape.mxs'], 'mxu' => ['video/vnd.mpegurl', 'video/x-mpegurl'], @@ -2416,17 +2715,22 @@ final class MimeTypes implements MimeTypesInterface 'nnw' => ['application/vnd.noblenet-web'], 'not' => ['text/x-mup'], 'npx' => ['image/vnd.net-fpx'], + 'nq' => ['application/n-quads'], + 'nrw' => ['image/x-nikon-nrw'], 'nsc' => ['application/x-conference', 'application/x-netshow-channel'], 'nsf' => ['application/vnd.lotus-notes'], 'nsv' => ['video/x-nsv'], + 'nt' => ['application/n-triples'], 'ntf' => ['application/vnd.nitf'], + 'numbers' => ['application/vnd.apple.numbers', 'application/x-iwork-numbers-sffnumbers'], 'nzb' => ['application/x-nzb'], 'o' => ['application/x-object'], 'oa2' => ['application/vnd.fujitsu.oasys2'], 'oa3' => ['application/vnd.fujitsu.oasys3'], 'oas' => ['application/vnd.fujitsu.oasys'], 'obd' => ['application/x-msbinder'], - 'obj' => ['application/x-tgif'], + 'obgx' => ['application/vnd.openblox.game+xml'], + 'obj' => ['application/x-tgif', 'model/obj'], 'ocl' => ['text/x-ocl'], 'oda' => ['application/oda'], 'odb' => ['application/vnd.oasis.opendocument.database', 'application/vnd.sun.xml.base'], @@ -2440,6 +2744,7 @@ final class MimeTypes implements MimeTypesInterface 'ods' => ['application/vnd.oasis.opendocument.spreadsheet'], 'odt' => ['application/vnd.oasis.opendocument.text'], 'oga' => ['audio/ogg', 'audio/vorbis', 'audio/x-flac+ogg', 'audio/x-ogg', 'audio/x-oggflac', 'audio/x-speex+ogg', 'audio/x-vorbis', 'audio/x-vorbis+ogg'], + 'ogex' => ['model/vnd.opengex'], 'ogg' => ['audio/ogg', 'audio/vorbis', 'audio/x-flac+ogg', 'audio/x-ogg', 'audio/x-oggflac', 'audio/x-speex+ogg', 'audio/x-vorbis', 'audio/x-vorbis+ogg', 'video/ogg', 'video/x-ogg', 'video/x-theora', 'video/x-theora+ogg'], 'ogm' => ['video/x-ogm', 'video/x-ogm+ogg'], 'ogv' => ['video/ogg', 'video/x-ogg'], @@ -2458,9 +2763,10 @@ final class MimeTypes implements MimeTypesInterface 'opus' => ['audio/ogg', 'audio/x-ogg', 'audio/x-opus+ogg'], 'ora' => ['image/openraster'], 'orf' => ['image/x-olympus-orf'], - 'org' => ['application/vnd.lotus-organizer'], + 'org' => ['application/vnd.lotus-organizer', 'text/org', 'text/x-org'], 'osf' => ['application/vnd.yamaha.openscoreformat'], 'osfpvg' => ['application/vnd.yamaha.openscoreformat.osfpvg+xml'], + 'osm' => ['application/vnd.openstreetmap.data+xml'], 'otc' => ['application/vnd.oasis.opendocument.chart-template'], 'otf' => ['application/vnd.oasis.opendocument.formula-template', 'application/x-font-otf', 'font/otf'], 'otg' => ['application/vnd.oasis.opendocument.graphics-template'], @@ -2469,9 +2775,11 @@ final class MimeTypes implements MimeTypesInterface 'otp' => ['application/vnd.oasis.opendocument.presentation-template'], 'ots' => ['application/vnd.oasis.opendocument.spreadsheet-template'], 'ott' => ['application/vnd.oasis.opendocument.text-template'], + 'ova' => ['application/ovf', 'application/x-virtualbox-ova'], + 'ovf' => ['application/x-virtualbox-ovf'], 'owl' => ['application/rdf+xml', 'text/rdf'], 'owx' => ['application/owl+xml'], - 'oxps' => ['application/oxps', 'application/vnd.ms-xpsdocument', 'application/xps'], + 'oxps' => ['application/oxps'], 'oxt' => ['application/vnd.openofficeorg.extension'], 'p' => ['text/x-pascal'], 'p10' => ['application/pkcs10'], @@ -2484,7 +2792,9 @@ final class MimeTypes implements MimeTypesInterface 'p7s' => ['application/pkcs7-signature'], 'p8' => ['application/pkcs8'], 'p8e' => ['application/pkcs8-encrypted'], + 'pac' => ['application/x-ns-proxy-autoconfig'], 'pack' => ['application/x-java-pack200'], + 'pages' => ['application/vnd.apple.pages', 'application/x-iwork-pages-sffpages'], 'pak' => ['application/x-pak'], 'par2' => ['application/x-par2'], 'part' => ['application/x-partial-download'], @@ -2506,8 +2816,9 @@ final class MimeTypes implements MimeTypesInterface 'pct' => ['image/x-pict'], 'pcurl' => ['application/vnd.curl.pcurl'], 'pcx' => ['image/vnd.zbrush.pcx', 'image/x-pcx'], - 'pdb' => ['application/vnd.palm', 'application/x-aportisdoc', 'application/x-palm-database'], + 'pdb' => ['application/vnd.palm', 'application/x-aportisdoc', 'application/x-palm-database', 'application/x-pilot'], 'pdc' => ['application/x-aportisdoc'], + 'pde' => ['text/x-processing'], 'pdf' => ['application/pdf', 'application/acrobat', 'application/nappdf', 'application/x-pdf', 'image/pdf'], 'pdf.bz2' => ['application/x-bzpdf'], 'pdf.gz' => ['application/x-gzpdf'], @@ -2524,7 +2835,7 @@ final class MimeTypes implements MimeTypesInterface 'pgm' => ['image/x-portable-graymap'], 'pgn' => ['application/vnd.chess-pgn', 'application/x-chess-pgn'], 'pgp' => ['application/pgp', 'application/pgp-encrypted', 'application/pgp-keys', 'application/pgp-signature'], - 'php' => ['application/x-php'], + 'php' => ['application/x-php', 'application/x-httpd-php'], 'php3' => ['application/x-php'], 'php4' => ['application/x-php'], 'php5' => ['application/x-php'], @@ -2534,9 +2845,10 @@ final class MimeTypes implements MimeTypesInterface 'pict1' => ['image/x-pict'], 'pict2' => ['image/x-pict'], 'pk' => ['application/x-tex-pk'], - 'pkg' => ['application/octet-stream', 'application/x-xar'], + 'pkg' => ['application/x-xar'], 'pki' => ['application/pkixcmp'], 'pkipath' => ['application/pkix-pkipath'], + 'pkpass' => ['application/vnd.apple.pkpass'], 'pkr' => ['application/pgp-keys'], 'pl' => ['application/x-perl', 'text/x-perl'], 'pla' => ['audio/x-iriver-pla'], @@ -2570,9 +2882,10 @@ final class MimeTypes implements MimeTypesInterface 'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation'], 'ppz' => ['application/mspowerpoint', 'application/powerpoint', 'application/vnd.ms-powerpoint', 'application/x-mspowerpoint'], 'pqa' => ['application/vnd.palm', 'application/x-palm-database'], - 'prc' => ['application/vnd.palm', 'application/x-mobipocket-ebook', 'application/x-palm-database'], + 'prc' => ['application/vnd.palm', 'application/x-mobipocket-ebook', 'application/x-palm-database', 'application/x-pilot'], 'pre' => ['application/vnd.lotus-freelance'], 'prf' => ['application/pics-rules'], + 'provx' => ['application/provenance+xml'], 'ps' => ['application/postscript'], 'ps.bz2' => ['application/x-bzpostscript'], 'ps.gz' => ['application/x-gzpostscript'], @@ -2584,6 +2897,7 @@ final class MimeTypes implements MimeTypesInterface 'psid' => ['audio/prs.sid'], 'pskcxml' => ['application/pskc+xml'], 'psw' => ['application/x-pocket-word'], + 'pti' => ['image/prs.pti'], 'ptid' => ['application/vnd.pvi.ptid1'], 'pub' => ['application/vnd.ms-publisher', 'application/x-mspublisher'], 'pvb' => ['application/vnd.3gpp.pic-bw-var'], @@ -2594,12 +2908,18 @@ final class MimeTypes implements MimeTypesInterface 'py3x' => ['text/x-python3'], 'pya' => ['audio/vnd.ms-playready.media.pya'], 'pyc' => ['application/x-python-bytecode'], + 'pyi' => ['text/x-python3'], 'pyo' => ['application/x-python-bytecode'], + 'pys' => ['application/x-pyspread-bz-spreadsheet'], + 'pysu' => ['application/x-pyspread-spreadsheet'], 'pyv' => ['video/vnd.ms-playready.media.pyv'], 'pyx' => ['text/x-python'], 'qam' => ['application/vnd.epson.quickanime'], 'qbo' => ['application/vnd.intu.qbo'], + 'qcow' => ['application/x-qemu-disk'], + 'qcow2' => ['application/x-qemu-disk'], 'qd' => ['application/x-fd-file', 'application/x-raw-floppy-disk-image'], + 'qed' => ['application/x-qed-disk'], 'qfx' => ['application/vnd.intu.qfx'], 'qif' => ['application/x-qw', 'image/x-quicktime'], 'qml' => ['text/x-qml'], @@ -2619,10 +2939,11 @@ final class MimeTypes implements MimeTypesInterface 'qxd' => ['application/vnd.quark.quarkxpress'], 'qxl' => ['application/vnd.quark.quarkxpress'], 'qxt' => ['application/vnd.quark.quarkxpress'], - 'ra' => ['audio/vnd.m-realaudio', 'audio/vnd.rn-realaudio', 'audio/x-pn-realaudio'], + 'ra' => ['audio/vnd.m-realaudio', 'audio/vnd.rn-realaudio', 'audio/x-pn-realaudio', 'audio/x-realaudio'], 'raf' => ['image/x-fuji-raf'], 'ram' => ['application/ram', 'audio/x-pn-realaudio'], 'raml' => ['application/raml+yaml'], + 'rapd' => ['application/route-apd+xml'], 'rar' => ['application/x-rar-compressed', 'application/vnd.rar', 'application/x-rar'], 'ras' => ['image/x-cmu-raster'], 'raw' => ['image/x-panasonic-raw', 'image/x-panasonic-rw'], @@ -2636,6 +2957,7 @@ final class MimeTypes implements MimeTypesInterface 'rdz' => ['application/vnd.data-vision.rdz'], 'reg' => ['text/x-ms-regedit'], 'rej' => ['application/x-reject', 'text/x-reject'], + 'relo' => ['application/p2p-overlay+xml'], 'rep' => ['application/vnd.businessobjects'], 'res' => ['application/x-dtbresource+xml'], 'rgb' => ['image/x-rgb'], @@ -2658,6 +2980,7 @@ final class MimeTypes implements MimeTypesInterface 'rng' => ['application/xml', 'text/xml'], 'roa' => ['application/rpki-roa'], 'roff' => ['application/x-troff', 'text/troff', 'text/x-troff'], + 'ros' => ['text/x-common-lisp'], 'rp' => ['image/vnd.rn-realpix'], 'rp9' => ['application/vnd.cloanto.rp9'], 'rpm' => ['application/x-redhat-package-manager', 'application/x-rpm'], @@ -2665,24 +2988,30 @@ final class MimeTypes implements MimeTypesInterface 'rpst' => ['application/vnd.nokia.radio-preset'], 'rq' => ['application/sparql-query'], 'rs' => ['application/rls-services+xml', 'text/rust'], + 'rsat' => ['application/atsc-rsat+xml'], 'rsd' => ['application/rsd+xml'], + 'rsheet' => ['application/urc-ressheet+xml'], 'rss' => ['application/rss+xml', 'text/rss'], + 'rst' => ['text/x-rst'], 'rt' => ['text/vnd.rn-realtext'], 'rtf' => ['application/rtf', 'text/rtf'], 'rtx' => ['text/richtext'], + 'run' => ['application/x-makeself'], + 'rusd' => ['application/route-usd+xml'], 'rv' => ['video/vnd.rn-realvideo', 'video/x-real-video'], 'rvx' => ['video/vnd.rn-realvideo', 'video/x-real-video'], 'rw2' => ['image/x-panasonic-raw2', 'image/x-panasonic-rw2'], 's' => ['text/x-asm'], 's3m' => ['audio/s3m', 'audio/x-s3m'], 'saf' => ['application/vnd.yamaha.smaf-audio'], + 'sage' => ['text/x-sagemath'], 'sam' => ['application/x-amipro'], 'sami' => ['application/x-sami'], 'sap' => ['application/x-sap-file', 'application/x-thomson-sap-image'], 'sass' => ['text/x-sass'], 'sav' => ['application/x-spss-sav', 'application/x-spss-savefile'], 'sbml' => ['application/sbml+xml'], - 'sc' => ['application/vnd.ibm.secure-container'], + 'sc' => ['application/vnd.ibm.secure-container', 'text/x-scala'], 'scala' => ['text/x-scala'], 'scd' => ['application/x-msschedule'], 'scm' => ['application/vnd.lotus-screencam', 'text/x-scheme'], @@ -2699,11 +3028,14 @@ final class MimeTypes implements MimeTypesInterface 'sdp' => ['application/sdp', 'application/vnd.sdp', 'application/vnd.stardivision.impress', 'application/x-sdp'], 'sds' => ['application/vnd.stardivision.chart'], 'sdw' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'], + 'sea' => ['application/x-sea'], 'see' => ['application/vnd.seemail'], 'seed' => ['application/vnd.fdsn.seed'], 'sema' => ['application/vnd.sema'], 'semd' => ['application/vnd.semd'], 'semf' => ['application/vnd.semf'], + 'senmlx' => ['application/senml+xml'], + 'sensmlx' => ['application/sensml+xml'], 'ser' => ['application/java-serialized-object'], 'service' => ['text/x-dbus-service', 'text/x-systemd-unit'], 'setpay' => ['application/set-payment-initiation'], @@ -2714,6 +3046,7 @@ final class MimeTypes implements MimeTypesInterface 'sfv' => ['text/x-sfv'], 'sg' => ['application/x-sg1000-rom'], 'sgb' => ['application/x-gameboy-rom'], + 'sgd' => ['application/x-genesis-rom'], 'sgf' => ['application/x-go-sgf'], 'sgi' => ['image/sgi', 'image/x-sgi'], 'sgl' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'], @@ -2722,10 +3055,13 @@ final class MimeTypes implements MimeTypesInterface 'sh' => ['application/x-sh', 'application/x-shellscript', 'text/x-sh'], 'shape' => ['application/x-dia-shape'], 'shar' => ['application/x-shar'], + 'shex' => ['text/shex'], 'shf' => ['application/shf+xml'], 'shn' => ['application/x-shorten', 'audio/x-shorten'], + 'shtml' => ['text/html'], 'siag' => ['application/x-siag'], 'sid' => ['audio/prs.sid', 'image/x-mrsid-image'], + 'sieve' => ['application/sieve'], 'sig' => ['application/pgp-signature'], 'sik' => ['application/x-trash'], 'sil' => ['audio/silk'], @@ -2745,7 +3081,10 @@ final class MimeTypes implements MimeTypesInterface 'sldm' => ['application/vnd.ms-powerpoint.slide.macroenabled.12'], 'sldx' => ['application/vnd.openxmlformats-officedocument.presentationml.slide'], 'slice' => ['text/x-systemd-unit'], + 'slim' => ['text/slim'], 'slk' => ['text/spreadsheet'], + 'slm' => ['text/slim'], + 'sls' => ['application/route-s-tsid+xml'], 'slt' => ['application/vnd.epson.salt'], 'sm' => ['application/vnd.stepmania.stepchart'], 'smaf' => ['application/vnd.smaf', 'application/x-smaf'], @@ -2754,6 +3093,7 @@ final class MimeTypes implements MimeTypesInterface 'smf' => ['application/vnd.stardivision.math'], 'smi' => ['application/smil', 'application/smil+xml', 'application/x-sami'], 'smil' => ['application/smil', 'application/smil+xml'], + 'smk' => ['video/vnd.radgamettools.smacker'], 'sml' => ['application/smil', 'application/smil+xml'], 'sms' => ['application/x-sms-rom'], 'smv' => ['video/x-smv'], @@ -2761,10 +3101,11 @@ final class MimeTypes implements MimeTypesInterface 'snap' => ['application/vnd.snap'], 'snd' => ['audio/basic'], 'snf' => ['application/x-font-snf'], - 'so' => ['application/octet-stream', 'application/x-sharedlib'], + 'so' => ['application/x-sharedlib'], 'socket' => ['text/x-systemd-unit'], 'spc' => ['application/x-pkcs7-certificates'], 'spd' => ['application/x-font-speedo'], + 'spdx' => ['text/spdx'], 'spec' => ['text/x-rpm-spec'], 'spf' => ['application/vnd.yamaha.smaf-phrase'], 'spl' => ['application/futuresplash', 'application/vnd.adobe.flash.movie', 'application/x-futuresplash', 'application/x-shockwave-flash'], @@ -2772,7 +3113,7 @@ final class MimeTypes implements MimeTypesInterface 'spot' => ['text/vnd.in3d.spot'], 'spp' => ['application/scvp-vp-response'], 'spq' => ['application/scvp-vp-request'], - 'spx' => ['audio/ogg', 'audio/x-speex'], + 'spx' => ['application/x-apple-systemprofiler+xml', 'audio/ogg', 'audio/x-speex', 'audio/x-speex+ogg'], 'sql' => ['application/sql', 'application/x-sql', 'text/x-sql'], 'sqlite2' => ['application/x-sqlite2'], 'sqlite3' => ['application/vnd.sqlite3', 'application/x-sqlite3'], @@ -2798,9 +3139,13 @@ final class MimeTypes implements MimeTypesInterface 'stk' => ['application/hyperstudio'], 'stl' => ['application/vnd.ms-pki.stl', 'model/stl', 'model/x.stl-ascii', 'model/x.stl-binary'], 'stm' => ['audio/x-stm'], + 'stpxz' => ['model/step-xml+zip'], + 'stpz' => ['model/step+zip'], 'str' => ['application/vnd.pg.format'], 'stw' => ['application/vnd.sun.xml.writer.template'], 'sty' => ['application/x-tex', 'text/x-tex'], + 'styl' => ['text/stylus'], + 'stylus' => ['text/stylus'], 'sub' => ['image/vnd.dvb.subtitle', 'text/vnd.dvb.subtitle', 'text/x-microdvd', 'text/x-mpsub', 'text/x-subviewer'], 'sun' => ['image/x-sun-raster'], 'sus' => ['application/vnd.sus-calendar'], @@ -2817,6 +3162,7 @@ final class MimeTypes implements MimeTypesInterface 'swap' => ['text/x-systemd-unit'], 'swf' => ['application/futuresplash', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash'], 'swi' => ['application/vnd.aristanetworks.swi'], + 'swidtag' => ['application/swid+xml'], 'swm' => ['application/x-ms-wim'], 'sxc' => ['application/vnd.sun.xml.calc'], 'sxd' => ['application/vnd.sun.xml.draw'], @@ -2828,8 +3174,10 @@ final class MimeTypes implements MimeTypesInterface 't' => ['application/x-perl', 'application/x-troff', 'text/troff', 'text/x-perl', 'text/x-troff'], 't2t' => ['text/x-txt2tags'], 't3' => ['application/x-t3vm-image'], + 't38' => ['image/t38'], 'taglet' => ['application/vnd.mynfc'], 'tao' => ['application/vnd.tao.intent-module-archive'], + 'tap' => ['image/vnd.tencent.tap'], 'tar' => ['application/x-tar', 'application/x-gtar'], 'tar.Z' => ['application/x-tarz'], 'tar.bz' => ['application/x-bzip-compressed-tar'], @@ -2841,13 +3189,15 @@ final class MimeTypes implements MimeTypesInterface 'tar.lzma' => ['application/x-lzma-compressed-tar'], 'tar.lzo' => ['application/x-tzo'], 'tar.xz' => ['application/x-xz-compressed-tar'], + 'tar.zst' => ['application/x-zstd-compressed-tar'], 'target' => ['text/x-systemd-unit'], 'taz' => ['application/x-tarz'], 'tb2' => ['application/x-bzip-compressed-tar'], 'tbz' => ['application/x-bzip-compressed-tar'], 'tbz2' => ['application/x-bzip-compressed-tar'], 'tcap' => ['application/vnd.3gpp2.tcap'], - 'tcl' => ['application/x-tcl', 'text/x-tcl'], + 'tcl' => ['application/x-tcl', 'text/tcl', 'text/x-tcl'], + 'td' => ['application/urc-targetdesc+xml'], 'teacher' => ['application/vnd.smart.teacher'], 'tei' => ['application/tei+xml'], 'teicorpus' => ['application/tei+xml'], @@ -2857,7 +3207,8 @@ final class MimeTypes implements MimeTypesInterface 'text' => ['text/plain'], 'tfi' => ['application/thraud+xml'], 'tfm' => ['application/x-tex-tfm'], - 'tga' => ['image/x-icb', 'image/x-tga'], + 'tfx' => ['image/tiff-fx'], + 'tga' => ['application/tga', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'], 'tgz' => ['application/x-compressed-tar'], 'theme' => ['application/x-theme'], 'themepack' => ['application/x-windows-themepack'], @@ -2865,15 +3216,16 @@ final class MimeTypes implements MimeTypesInterface 'tif' => ['image/tiff'], 'tiff' => ['image/tiff'], 'timer' => ['text/x-systemd-unit'], - 'tk' => ['text/x-tcl'], + 'tk' => ['application/x-tcl', 'text/tcl', 'text/x-tcl'], 'tlrz' => ['application/x-lrzip-compressed-tar'], 'tlz' => ['application/x-lzma-compressed-tar'], 'tmo' => ['application/vnd.tmobile-livetv'], 'tnef' => ['application/ms-tnef', 'application/vnd.ms-tnef'], 'tnf' => ['application/ms-tnef', 'application/vnd.ms-tnef'], 'toc' => ['application/x-cdrdao-toc'], + 'toml' => ['application/toml'], 'torrent' => ['application/x-bittorrent'], - 'tpic' => ['image/x-icb', 'image/x-tga'], + 'tpic' => ['application/tga', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'], 'tpl' => ['application/vnd.groove-tool-template'], 'tpt' => ['application/vnd.trid.tpt'], 'tr' => ['application/x-troff', 'text/troff', 'text/x-troff'], @@ -2887,6 +3239,7 @@ final class MimeTypes implements MimeTypesInterface 'ttc' => ['font/collection'], 'ttf' => ['application/x-font-truetype', 'application/x-font-ttf', 'font/ttf'], 'ttl' => ['text/turtle'], + 'ttml' => ['application/ttml+xml'], 'ttx' => ['application/x-font-ttx'], 'twd' => ['application/vnd.simtech-mindmapper'], 'twds' => ['application/vnd.simtech-mindmapper'], @@ -2896,7 +3249,13 @@ final class MimeTypes implements MimeTypesInterface 'txt' => ['text/plain'], 'txz' => ['application/x-xz-compressed-tar'], 'tzo' => ['application/x-tzo'], + 'tzst' => ['application/x-zstd-compressed-tar'], 'u32' => ['application/x-authorware-bin'], + 'u8dsn' => ['message/global-delivery-status'], + 'u8hdr' => ['message/global-headers'], + 'u8mdn' => ['message/global-disposition-notification'], + 'u8msg' => ['message/global'], + 'ubj' => ['application/ubjson'], 'udeb' => ['application/vnd.debian.binary-package', 'application/x-deb', 'application/x-debian-package'], 'ufd' => ['application/vnd.ufdl'], 'ufdl' => ['application/vnd.ufdl'], @@ -2915,6 +3274,7 @@ final class MimeTypes implements MimeTypesInterface 'uris' => ['text/uri-list'], 'url' => ['application/x-mswinurl'], 'urls' => ['text/uri-list'], + 'usdz' => ['model/vnd.usdz+zip'], 'ustar' => ['application/x-ustar'], 'utz' => ['application/vnd.uiq.theme'], 'uu' => ['text/x-uuencode'], @@ -2952,6 +3312,9 @@ final class MimeTypes implements MimeTypesInterface 'vala' => ['text/x-vala'], 'vapi' => ['text/x-vala'], 'vb' => ['application/x-virtual-boy-rom'], + 'vbox' => ['application/x-virtualbox-vbox'], + 'vbox-extpack' => ['application/x-virtualbox-vbox-extpack'], + 'vbs' => ['text/vbs', 'text/vbscript'], 'vcard' => ['text/directory', 'text/vcard', 'text/x-vcard'], 'vcd' => ['application/x-cdlink'], 'vcf' => ['text/x-vcard', 'text/directory', 'text/vcard'], @@ -2959,17 +3322,22 @@ final class MimeTypes implements MimeTypesInterface 'vcs' => ['application/ics', 'text/calendar', 'text/x-vcalendar'], 'vct' => ['text/directory', 'text/vcard', 'text/x-vcard'], 'vcx' => ['application/vnd.vcx'], - 'vda' => ['image/x-icb', 'image/x-tga'], - 'vhd' => ['text/x-vhdl'], + 'vda' => ['application/tga', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'], + 'vdi' => ['application/x-vdi-disk', 'application/x-virtualbox-vdi'], + 'vds' => ['model/vnd.sap.vds'], + 'vhd' => ['application/x-vhd-disk', 'application/x-virtualbox-vhd', 'text/x-vhdl'], 'vhdl' => ['text/x-vhdl'], + 'vhdx' => ['application/x-vhdx-disk', 'application/x-virtualbox-vhdx'], 'vis' => ['application/vnd.visionary'], 'viv' => ['video/vivo', 'video/vnd.vivo'], 'vivo' => ['video/vivo', 'video/vnd.vivo'], 'vlc' => ['application/m3u', 'audio/m3u', 'audio/mpegurl', 'audio/x-m3u', 'audio/x-mp3-playlist', 'audio/x-mpegurl'], + 'vmdk' => ['application/x-virtualbox-vmdk', 'application/x-vmdk-disk'], 'vob' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2', 'video/x-ms-vob'], 'voc' => ['audio/x-voc'], 'vor' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'], 'vox' => ['application/x-authorware-bin'], + 'vpc' => ['application/x-vhd-disk', 'application/x-virtualbox-vhd'], 'vrm' => ['model/vrml'], 'vrml' => ['model/vrml'], 'vsd' => ['application/vnd.visio'], @@ -2979,16 +3347,20 @@ final class MimeTypes implements MimeTypesInterface 'vss' => ['application/vnd.visio'], 'vssm' => ['application/vnd.ms-visio.stencil.macroenabled.main+xml'], 'vssx' => ['application/vnd.ms-visio.stencil.main+xml'], - 'vst' => ['application/vnd.visio', 'image/x-icb', 'image/x-tga'], + 'vst' => ['application/tga', 'application/vnd.visio', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'], 'vstm' => ['application/vnd.ms-visio.template.macroenabled.main+xml'], 'vstx' => ['application/vnd.ms-visio.template.main+xml'], 'vsw' => ['application/vnd.visio'], + 'vtf' => ['image/vnd.valve.source.texture'], 'vtt' => ['text/vtt'], 'vtu' => ['model/vnd.vtu'], 'vxml' => ['application/voicexml+xml'], 'w3d' => ['application/x-director'], 'wad' => ['application/x-doom', 'application/x-doom-wad', 'application/x-wii-wad'], - 'wav' => ['audio/wav', 'audio/vnd.wave', 'audio/x-wav'], + 'wadl' => ['application/vnd.sun.wadl+xml'], + 'war' => ['application/java-archive'], + 'wasm' => ['application/wasm'], + 'wav' => ['audio/wav', 'audio/vnd.wave', 'audio/wave', 'audio/x-wav'], 'wax' => ['application/x-ms-asx', 'audio/x-ms-asx', 'audio/x-ms-wax', 'video/x-ms-wax', 'video/x-ms-wmx', 'video/x-ms-wvx'], 'wb1' => ['application/x-quattropro'], 'wb2' => ['application/x-quattropro'], @@ -3000,7 +3372,9 @@ final class MimeTypes implements MimeTypesInterface 'wdb' => ['application/vnd.ms-works'], 'wdp' => ['image/vnd.ms-photo'], 'weba' => ['audio/webm'], + 'webapp' => ['application/x-web-app-manifest+json'], 'webm' => ['video/webm'], + 'webmanifest' => ['application/manifest+json'], 'webp' => ['image/webp'], 'wg' => ['application/vnd.pmi.widget'], 'wgt' => ['application/widget'], @@ -3022,7 +3396,7 @@ final class MimeTypes implements MimeTypesInterface 'wmx' => ['application/x-ms-asx', 'audio/x-ms-asx', 'video/x-ms-wax', 'video/x-ms-wmx', 'video/x-ms-wvx'], 'wmz' => ['application/x-ms-wmz', 'application/x-msmetafile'], 'woff' => ['application/font-woff', 'application/x-font-woff', 'font/woff'], - 'woff2' => ['font/woff', 'font/woff2'], + 'woff2' => ['font/woff2'], 'wp' => ['application/vnd.wordperfect', 'application/wordperfect', 'application/x-wordperfect'], 'wp4' => ['application/vnd.wordperfect', 'application/wordperfect', 'application/x-wordperfect'], 'wp5' => ['application/vnd.wordperfect', 'application/wordperfect', 'application/x-wordperfect'], @@ -3036,7 +3410,7 @@ final class MimeTypes implements MimeTypesInterface 'wri' => ['application/x-mswrite'], 'wrl' => ['model/vrml'], 'ws' => ['application/x-wonderswan-rom'], - 'wsc' => ['application/x-wonderswan-color-rom'], + 'wsc' => ['application/x-wonderswan-color-rom', 'message/vnd.wfa.wsc'], 'wsdl' => ['application/wsdl+xml'], 'wsgi' => ['text/x-python'], 'wspolicy' => ['application/wspolicy+xml'], @@ -3048,32 +3422,38 @@ final class MimeTypes implements MimeTypesInterface 'wwf' => ['application/wwf', 'application/x-wwf'], 'x32' => ['application/x-authorware-bin'], 'x3d' => ['model/x3d+xml'], - 'x3db' => ['model/x3d+binary'], + 'x3db' => ['model/x3d+binary', 'model/x3d+fastinfoset'], 'x3dbz' => ['model/x3d+binary'], - 'x3dv' => ['model/x3d+vrml'], + 'x3dv' => ['model/x3d+vrml', 'model/x3d-vrml'], 'x3dvz' => ['model/x3d+vrml'], 'x3dz' => ['model/x3d+xml'], 'x3f' => ['image/x-sigma-x3f'], + 'x_b' => ['model/vnd.parasolid.transmit.binary'], + 'x_t' => ['model/vnd.parasolid.transmit.text'], 'xac' => ['application/x-gnucash'], 'xaml' => ['application/xaml+xml'], 'xap' => ['application/x-silverlight-app'], 'xar' => ['application/vnd.xara', 'application/x-xar'], + 'xav' => ['application/xcap-att+xml'], 'xbap' => ['application/x-ms-xbap'], 'xbd' => ['application/vnd.fujixerox.docuworks.binder'], 'xbel' => ['application/x-xbel'], 'xbl' => ['application/xml', 'text/xml'], 'xbm' => ['image/x-xbitmap'], + 'xca' => ['application/xcap-caps+xml'], 'xcf' => ['image/x-xcf'], 'xcf.bz2' => ['image/x-compressed-xcf'], 'xcf.gz' => ['image/x-compressed-xcf'], - 'xdf' => ['application/xcap-diff+xml'], + 'xcs' => ['application/calendar+xml'], + 'xdf' => ['application/mrb-consumer+xml', 'application/mrb-publish+xml', 'application/xcap-diff+xml'], 'xdgapp' => ['application/vnd.flatpak', 'application/vnd.xdgapp'], 'xdm' => ['application/vnd.syncml.dm+xml'], 'xdp' => ['application/vnd.adobe.xdp+xml'], 'xdssc' => ['application/dssc+xml'], 'xdw' => ['application/vnd.fujixerox.docuworks'], + 'xel' => ['application/xcap-el+xml'], 'xenc' => ['application/xenc+xml'], - 'xer' => ['application/patch-ops-error+xml'], + 'xer' => ['application/patch-ops-error+xml', 'application/xcap-error+xml'], 'xfdf' => ['application/vnd.adobe.xfdf'], 'xfdl' => ['application/vnd.xfdl'], 'xhe' => ['audio/usac'], @@ -3103,13 +3483,14 @@ final class MimeTypes implements MimeTypesInterface 'xmf' => ['audio/mobile-xmf', 'audio/x-xmf', 'audio/xmf'], 'xmi' => ['text/x-xmi'], 'xml' => ['application/xml', 'text/xml'], + 'xns' => ['application/xcap-ns+xml'], 'xo' => ['application/vnd.olpc-sugar'], 'xop' => ['application/xop+xml'], 'xpi' => ['application/x-xpinstall'], 'xpl' => ['application/xproc+xml'], 'xpm' => ['image/x-xpixmap', 'image/x-xpm'], 'xpr' => ['application/vnd.is-xpr'], - 'xps' => ['application/oxps', 'application/vnd.ms-xpsdocument', 'application/xps'], + 'xps' => ['application/vnd.ms-xpsdocument', 'application/xps'], 'xpw' => ['application/vnd.intercon.formnet'], 'xpx' => ['application/vnd.intercon.formnet'], 'xsd' => ['application/xml', 'text/xml'], @@ -3128,6 +3509,7 @@ final class MimeTypes implements MimeTypesInterface 'yang' => ['application/yang'], 'yin' => ['application/yin+xml'], 'yml' => ['application/x-yaml', 'text/x-yaml', 'text/yaml'], + 'ymp' => ['text/x-suse-ymp'], 'yt' => ['application/vnd.youtube.yt'], 'z1' => ['application/x-zmachine'], 'z2' => ['application/x-zmachine'], @@ -3146,6 +3528,7 @@ final class MimeTypes implements MimeTypesInterface 'zmm' => ['application/vnd.handheld-entertainment+xml'], 'zoo' => ['application/x-zoo'], 'zsav' => ['application/x-spss-sav', 'application/x-spss-savefile'], + 'zst' => ['application/zstd'], 'zz' => ['application/zlib'], '123' => ['application/lotus123', 'application/vnd.lotus-1-2-3', 'application/wk1', 'application/x-123', 'application/x-lotus123', 'zz-application/zz-winassoc-123'], '602' => ['application/x-t602'], diff --git a/vendor/symfony/mime/MimeTypesInterface.php b/vendor/symfony/mime/MimeTypesInterface.php index 9fbd2cc2d..17d45ad21 100644 --- a/vendor/symfony/mime/MimeTypesInterface.php +++ b/vendor/symfony/mime/MimeTypesInterface.php @@ -17,16 +17,16 @@ namespace Symfony\Component\Mime; interface MimeTypesInterface extends MimeTypeGuesserInterface { /** - * Gets the extensions for the given MIME type. + * Gets the extensions for the given MIME type in decreasing order of preference. * - * @return string[] an array of extensions (first one is the preferred one) + * @return string[] */ public function getExtensions(string $mimeType): array; /** - * Gets the MIME types for the given extension. + * Gets the MIME types for the given extension in decreasing order of preference. * - * @return string[] an array of MIME types (first one is the preferred one) + * @return string[] */ public function getMimeTypes(string $ext): array; } diff --git a/vendor/symfony/mime/Part/MessagePart.php b/vendor/symfony/mime/Part/MessagePart.php index 1b5c23e2b..00129b475 100644 --- a/vendor/symfony/mime/Part/MessagePart.php +++ b/vendor/symfony/mime/Part/MessagePart.php @@ -59,4 +59,17 @@ class MessagePart extends DataPart { return $this->message->toIterable(); } + + /** + * @return array + */ + public function __sleep() + { + return ['message']; + } + + public function __wakeup() + { + $this->__construct($this->message); + } } diff --git a/vendor/symfony/mime/Part/Multipart/FormDataPart.php b/vendor/symfony/mime/Part/Multipart/FormDataPart.php index 93ae1b910..ff6df818f 100644 --- a/vendor/symfony/mime/Part/Multipart/FormDataPart.php +++ b/vendor/symfony/mime/Part/Multipart/FormDataPart.php @@ -34,7 +34,7 @@ final class FormDataPart extends AbstractMultipartPart foreach ($fields as $name => $value) { if (!\is_string($value) && !\is_array($value) && !$value instanceof TextPart) { - throw new InvalidArgumentException(sprintf('A form field value can only be a string, an array, or an instance of TextPart ("%s" given).', \is_object($value) ? \get_class($value) : \gettype($value))); + throw new InvalidArgumentException(sprintf('A form field value can only be a string, an array, or an instance of TextPart ("%s" given).', get_debug_type($value))); } $this->fields[$name] = $value; @@ -58,7 +58,16 @@ final class FormDataPart extends AbstractMultipartPart $values = []; $prepare = function ($item, $key, $root = null) use (&$values, &$prepare) { - $fieldName = $root ? sprintf('%s[%s]', $root, $key) : $key; + if (\is_int($key) && \is_array($item)) { + if (1 !== \count($item)) { + throw new InvalidArgumentException(sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item))); + } + + $key = key($item); + $item = $item[$key]; + } + + $fieldName = null !== $root ? sprintf('%s[%s]', $root, $key) : $key; if (\is_array($item)) { array_walk($item, $prepare, $fieldName); diff --git a/vendor/symfony/mime/Part/SMimePart.php b/vendor/symfony/mime/Part/SMimePart.php index b4c932a67..cb619c293 100644 --- a/vendor/symfony/mime/Part/SMimePart.php +++ b/vendor/symfony/mime/Part/SMimePart.php @@ -36,7 +36,7 @@ class SMimePart extends AbstractPart parent::__construct(); if (!\is_string($body) && !is_iterable($body)) { - throw new \TypeError(sprintf('The body of "%s" must be a string or a iterable (got "%s").', self::class, \is_object($body) ? \get_class($body) : \gettype($body))); + throw new \TypeError(sprintf('The body of "%s" must be a string or a iterable (got "%s").', self::class, get_debug_type($body))); } $this->body = $body; diff --git a/vendor/symfony/mime/Part/TextPart.php b/vendor/symfony/mime/Part/TextPart.php index 013a6dfe5..bfe41c0aa 100644 --- a/vendor/symfony/mime/Part/TextPart.php +++ b/vendor/symfony/mime/Part/TextPart.php @@ -31,9 +31,13 @@ class TextPart extends AbstractPart private $body; private $charset; private $subtype; + /** + * @var ?string + */ private $disposition; private $name; private $encoding; + private $seekable; /** * @param resource|string $body @@ -45,12 +49,13 @@ class TextPart extends AbstractPart parent::__construct(); if (!\is_string($body) && !\is_resource($body)) { - throw new \TypeError(sprintf('The body of "%s" must be a string or a resource (got "%s").', self::class, \is_object($body) ? \get_class($body) : \gettype($body))); + throw new \TypeError(sprintf('The body of "%s" must be a string or a resource (got "%s").', self::class, get_debug_type($body))); } $this->body = $body; $this->charset = $charset; $this->subtype = $subtype; + $this->seekable = \is_resource($body) ? stream_get_meta_data($body)['seekable'] && 0 === fseek($body, 0, \SEEK_CUR) : null; if (null === $encoding) { $this->encoding = $this->chooseEncoding(); @@ -89,7 +94,7 @@ class TextPart extends AbstractPart * * @return $this */ - public function setName($name) + public function setName(string $name) { $this->name = $name; @@ -98,11 +103,11 @@ class TextPart extends AbstractPart public function getBody(): string { - if (!\is_resource($this->body)) { + if (null === $this->seekable) { return $this->body; } - if (stream_get_meta_data($this->body)['seekable'] ?? false) { + if ($this->seekable) { rewind($this->body); } @@ -116,8 +121,8 @@ class TextPart extends AbstractPart public function bodyToIterable(): iterable { - if (\is_resource($this->body)) { - if (stream_get_meta_data($this->body)['seekable'] ?? false) { + if (null !== $this->seekable) { + if ($this->seekable) { rewind($this->body); } yield from $this->getEncoder()->encodeByteStream($this->body); @@ -190,8 +195,9 @@ class TextPart extends AbstractPart public function __sleep() { // convert resources to strings for serialization - if (\is_resource($this->body)) { + if (null !== $this->seekable) { $this->body = $this->getBody(); + $this->seekable = null; } $this->_headers = $this->getHeaders(); diff --git a/vendor/symfony/mime/Resources/bin/update_mime_types.php b/vendor/symfony/mime/Resources/bin/update_mime_types.php index 08c52f7d0..5586f097f 100644 --- a/vendor/symfony/mime/Resources/bin/update_mime_types.php +++ b/vendor/symfony/mime/Resources/bin/update_mime_types.php @@ -14,18 +14,16 @@ if ('cli' !== \PHP_SAPI) { } // load new map -$data = file_get_contents('https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types'); +$data = json_decode(file_get_contents('https://cdn.jsdelivr.net/gh/jshttp/mime-db@v1.49.0/db.json'), true); $new = []; -foreach (explode("\n", $data) as $line) { - if (!$line || '#' == $line[0]) { +foreach ($data as $mimeType => $mimeTypeInformation) { + if (!array_key_exists('extensions', $mimeTypeInformation)) { continue; } - $mimeType = substr($line, 0, strpos($line, "\t")); - $extensions = explode(' ', substr($line, strrpos($line, "\t") + 1)); - $new[$mimeType] = $extensions; + $new[$mimeType] = $mimeTypeInformation['extensions']; } -$xml = simplexml_load_string(file_get_contents('https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml')); +$xml = simplexml_load_string(file_get_contents('https://gitlab.freedesktop.org/xdg/shared-mime-info/-/raw/master/data/freedesktop.org.xml.in')); foreach ($xml as $node) { $exts = []; foreach ($node->glob as $glob) { @@ -66,82 +64,79 @@ foreach (explode("\n", $data) as $line) { $current[$matches[1]] = explode("', '", $matches[2]); } -// we merge the 2 maps (we never remove old mime types) -$map = array_replace_recursive($current, $new); -ksort($map); - $data = $pre; -foreach ($map as $mimeType => $exts) { - $data .= sprintf(" '%s' => ['%s'],\n", $mimeType, implode("', '", array_unique($exts))); -} -$data .= $post; // reverse map // we prefill the extensions with some preferences for content-types $exts = [ - 'aif' => ['audio/x-aiff'], - 'aiff' => ['audio/x-aiff'], - 'aps' => ['application/postscript'], - 'avi' => ['video/avi'], - 'bmp' => ['image/bmp'], + 'asice' => ['application/vnd.etsi.asic-e+zip'], 'bz2' => ['application/x-bz2'], - 'css' => ['text/css'], 'csv' => ['text/csv'], - 'dmg' => ['application/x-apple-diskimage'], - 'doc' => ['application/msword'], - 'docx' => ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'], - 'eml' => ['message/rfc822'], - 'exe' => ['application/x-ms-dos-executable'], + 'ecma' => ['application/ecmascript'], 'flv' => ['video/x-flv'], 'gif' => ['image/gif'], 'gz' => ['application/x-gzip'], - 'hqx' => ['application/stuffit'], 'htm' => ['text/html'], 'html' => ['text/html'], 'jar' => ['application/x-java-archive'], - 'jpeg' => ['image/jpeg'], 'jpg' => ['image/jpeg'], 'js' => ['text/javascript'], + 'keynote' => ['application/vnd.apple.keynote'], + 'key' => ['application/vnd.apple.keynote'], 'm3u' => ['audio/x-mpegurl'], 'm4a' => ['audio/mp4'], + 'md' => ['text/markdown', 'text/x-markdown'], 'mdb' => ['application/x-msaccess'], 'mid' => ['audio/midi'], - 'midi' => ['audio/midi'], 'mov' => ['video/quicktime'], 'mp3' => ['audio/mpeg'], - 'mp4' => ['video/mp4'], - 'mpeg' => ['video/mpeg'], - 'mpg' => ['video/mpeg'], 'ogg' => ['audio/ogg'], 'pdf' => ['application/pdf'], 'php' => ['application/x-php'], - 'php3' => ['application/x-php'], - 'php4' => ['application/x-php'], - 'php5' => ['application/x-php'], - 'png' => ['image/png'], 'ppt' => ['application/vnd.ms-powerpoint'], - 'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation'], - 'ps' => ['application/postscript'], 'rar' => ['application/x-rar-compressed'], - 'rtf' => ['application/rtf'], - 'sit' => ['application/x-stuffit'], + 'hqx' => ['application/stuffit'], + 'sit' => ['application/x-stuffit', 'application/stuffit'], 'svg' => ['image/svg+xml'], 'tar' => ['application/x-tar'], 'tif' => ['image/tiff'], - 'tiff' => ['image/tiff'], 'ttf' => ['application/x-font-truetype'], - 'txt' => ['text/plain'], 'vcf' => ['text/x-vcard'], 'wav' => ['audio/wav'], 'wma' => ['audio/x-ms-wma'], 'wmv' => ['audio/x-ms-wmv'], 'xls' => ['application/vnd.ms-excel'], - 'xlsx' => ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], - 'xml' => ['application/xml'], 'zip' => ['application/zip'], ]; + +// we merge the 2 maps (we never remove old mime types) +$map = array_replace_recursive($current, $new); + +foreach ($exts as $ext => $types) { + foreach ($types as $mt) { + if (!isset($map[$mt])) { + $map += [$mt => [$ext]]; + } + } +} +ksort($map); + +foreach ($map as $mimeType => $extensions) { + foreach ($exts as $ext => $types) { + if (in_array($mimeType, $types, true)) { + array_unshift($extensions, $ext); + } + } + $data .= sprintf(" '%s' => ['%s'],\n", $mimeType, implode("', '", array_unique($extensions))); +} +$data .= $post; + foreach ($map as $mimeType => $extensions) { foreach ($extensions as $extension) { + if ('application/octet-stream' === $mimeType && 'bin' !== $extension) { + continue; + } + $exts[$extension][] = $mimeType; } } diff --git a/vendor/symfony/mime/composer.json b/vendor/symfony/mime/composer.json index fa4025cd1..5472deab1 100644 --- a/vendor/symfony/mime/composer.json +++ b/vendor/symfony/mime/composer.json @@ -16,18 +16,26 @@ } ], "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16" }, "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", - "symfony/dependency-injection": "^3.4|^4.1|^5.0" + "egulias/email-validator": "^2.1.10|^3.1|^4", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.4.14|~6.0.14|^6.1.6" }, "conflict": { "egulias/email-validator": "~3.0.0", - "symfony/mailer": "<4.4" + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4", + "symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6" }, "autoload": { "psr-4": { "Symfony\\Component\\Mime\\": "" }, diff --git a/vendor/symfony/options-resolver/CHANGELOG.md b/vendor/symfony/options-resolver/CHANGELOG.md new file mode 100644 index 000000000..84c45946a --- /dev/null +++ b/vendor/symfony/options-resolver/CHANGELOG.md @@ -0,0 +1,81 @@ +CHANGELOG +========= + +5.3 +--- + + * Add prototype definition for nested options + +5.1.0 +----- + + * added fluent configuration of options using `OptionResolver::define()` + * added `setInfo()` and `getInfo()` methods + * updated the signature of method `OptionsResolver::setDeprecated()` to `OptionsResolver::setDeprecation(string $option, string $package, string $version, $message)` + * deprecated `OptionsResolverIntrospector::getDeprecationMessage()`, use `OptionsResolverIntrospector::getDeprecation()` instead + +5.0.0 +----- + + * added argument `$triggerDeprecation` to `OptionsResolver::offsetGet()` + +4.3.0 +----- + + * added `OptionsResolver::addNormalizer` method + +4.2.0 +----- + + * added support for nested options definition + * added `setDeprecated` and `isDeprecated` methods + +3.4.0 +----- + + * added `OptionsResolverIntrospector` to inspect options definitions inside an `OptionsResolver` instance + * added array of types support in allowed types (e.g int[]) + +2.6.0 +----- + + * deprecated OptionsResolverInterface + * [BC BREAK] removed "array" type hint from OptionsResolverInterface methods + setRequired(), setAllowedValues(), addAllowedValues(), setAllowedTypes() and + addAllowedTypes() + * added OptionsResolver::setDefault() + * added OptionsResolver::hasDefault() + * added OptionsResolver::setNormalizer() + * added OptionsResolver::isRequired() + * added OptionsResolver::getRequiredOptions() + * added OptionsResolver::isMissing() + * added OptionsResolver::getMissingOptions() + * added OptionsResolver::setDefined() + * added OptionsResolver::isDefined() + * added OptionsResolver::getDefinedOptions() + * added OptionsResolver::remove() + * added OptionsResolver::clear() + * deprecated OptionsResolver::replaceDefaults() + * deprecated OptionsResolver::setOptional() in favor of setDefined() + * deprecated OptionsResolver::isKnown() in favor of isDefined() + * [BC BREAK] OptionsResolver::isRequired() returns true now if a required + option has a default value set + * [BC BREAK] merged Options into OptionsResolver and turned Options into an + interface + * deprecated Options::overload() (now in OptionsResolver) + * deprecated Options::set() (now in OptionsResolver) + * deprecated Options::get() (now in OptionsResolver) + * deprecated Options::has() (now in OptionsResolver) + * deprecated Options::replace() (now in OptionsResolver) + * [BC BREAK] Options::get() (now in OptionsResolver) can only be used within + lazy option/normalizer closures now + * [BC BREAK] removed Traversable interface from Options since using within + lazy option/normalizer closures resulted in exceptions + * [BC BREAK] removed Options::all() since using within lazy option/normalizer + closures resulted in exceptions + * [BC BREAK] OptionDefinitionException now extends LogicException instead of + RuntimeException + * [BC BREAK] normalizers are not executed anymore for unset options + * normalizers are executed after validating the options now + * [BC BREAK] an UndefinedOptionsException is now thrown instead of an + InvalidOptionsException when non-existing options are passed diff --git a/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php new file mode 100644 index 000000000..95909f32e --- /dev/null +++ b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php @@ -0,0 +1,120 @@ +<?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\OptionsResolver\Debug; + +use Symfony\Component\OptionsResolver\Exception\NoConfigurationException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Maxime Steinhausser <maxime.steinhausser@gmail.com> + * + * @final + */ +class OptionsResolverIntrospector +{ + private $get; + + public function __construct(OptionsResolver $optionsResolver) + { + $this->get = \Closure::bind(function ($property, $option, $message) { + /** @var OptionsResolver $this */ + if (!$this->isDefined($option)) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist.', $option)); + } + + if (!\array_key_exists($option, $this->{$property})) { + throw new NoConfigurationException($message); + } + + return $this->{$property}[$option]; + }, $optionsResolver, $optionsResolver); + } + + /** + * @return mixed + * + * @throws NoConfigurationException on no configured value + */ + public function getDefault(string $option) + { + return ($this->get)('defaults', $option, sprintf('No default value was set for the "%s" option.', $option)); + } + + /** + * @return \Closure[] + * + * @throws NoConfigurationException on no configured closures + */ + public function getLazyClosures(string $option): array + { + return ($this->get)('lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option)); + } + + /** + * @return string[] + * + * @throws NoConfigurationException on no configured types + */ + public function getAllowedTypes(string $option): array + { + return ($this->get)('allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option)); + } + + /** + * @return mixed[] + * + * @throws NoConfigurationException on no configured values + */ + public function getAllowedValues(string $option): array + { + return ($this->get)('allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option)); + } + + /** + * @throws NoConfigurationException on no configured normalizer + */ + public function getNormalizer(string $option): \Closure + { + return current($this->getNormalizers($option)); + } + + /** + * @throws NoConfigurationException when no normalizer is configured + */ + public function getNormalizers(string $option): array + { + return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option)); + } + + /** + * @return string|\Closure + * + * @throws NoConfigurationException on no configured deprecation + * + * @deprecated since Symfony 5.1, use "getDeprecation()" instead. + */ + public function getDeprecationMessage(string $option) + { + trigger_deprecation('symfony/options-resolver', '5.1', 'The "%s()" method is deprecated, use "getDeprecation()" instead.', __METHOD__); + + return $this->getDeprecation($option)['message']; + } + + /** + * @throws NoConfigurationException on no configured deprecation + */ + public function getDeprecation(string $option): array + { + return ($this->get)('deprecated', $option, sprintf('No deprecation was set for the "%s" option.', $option)); + } +} diff --git a/vendor/symfony/options-resolver/Exception/AccessException.php b/vendor/symfony/options-resolver/Exception/AccessException.php new file mode 100644 index 000000000..c12b68064 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/AccessException.php @@ -0,0 +1,22 @@ +<?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\OptionsResolver\Exception; + +/** + * Thrown when trying to read an option outside of or write it inside of + * {@link \Symfony\Component\OptionsResolver\Options::resolve()}. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class AccessException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/ExceptionInterface.php b/vendor/symfony/options-resolver/Exception/ExceptionInterface.php new file mode 100644 index 000000000..ea99d050e --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ +<?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\OptionsResolver\Exception; + +/** + * Marker interface for all exceptions thrown by the OptionsResolver component. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php b/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php new file mode 100644 index 000000000..6d421d68b --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ +<?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\OptionsResolver\Exception; + +/** + * Thrown when an argument is invalid. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php b/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php new file mode 100644 index 000000000..6fd4f125f --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php @@ -0,0 +1,23 @@ +<?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\OptionsResolver\Exception; + +/** + * Thrown when the value of an option does not match its validation rules. + * + * You should make sure a valid value is passed to the option. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class InvalidOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/Exception/MissingOptionsException.php b/vendor/symfony/options-resolver/Exception/MissingOptionsException.php new file mode 100644 index 000000000..faa487f16 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/MissingOptionsException.php @@ -0,0 +1,23 @@ +<?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\OptionsResolver\Exception; + +/** + * Exception thrown when a required option is missing. + * + * Add the option to the passed options array. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class MissingOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/Exception/NoConfigurationException.php b/vendor/symfony/options-resolver/Exception/NoConfigurationException.php new file mode 100644 index 000000000..6693ec14d --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/NoConfigurationException.php @@ -0,0 +1,26 @@ +<?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\OptionsResolver\Exception; + +use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector; + +/** + * Thrown when trying to introspect an option definition property + * for which no value was configured inside the OptionsResolver instance. + * + * @see OptionsResolverIntrospector + * + * @author Maxime Steinhausser <maxime.steinhausser@gmail.com> + */ +class NoConfigurationException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php b/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php new file mode 100644 index 000000000..4c3280f4c --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php @@ -0,0 +1,26 @@ +<?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\OptionsResolver\Exception; + +/** + * Thrown when trying to read an option that has no value set. + * + * When accessing optional options from within a lazy option or normalizer you should first + * check whether the optional option is set. You can do this with `isset($options['optional'])`. + * In contrast to the {@link UndefinedOptionsException}, this is a runtime exception that can + * occur when evaluating lazy options. + * + * @author Tobias Schultze <http://tobion.de> + */ +class NoSuchOptionException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php b/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php new file mode 100644 index 000000000..e8e339d44 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php @@ -0,0 +1,21 @@ +<?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\OptionsResolver\Exception; + +/** + * Thrown when two lazy options have a cyclic dependency. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class OptionDefinitionException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php b/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php new file mode 100644 index 000000000..6ca3fce47 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php @@ -0,0 +1,24 @@ +<?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\OptionsResolver\Exception; + +/** + * Exception thrown when an undefined option is passed. + * + * You should remove the options in question from your code or define them + * beforehand. + * + * @author Bernhard Schussek <bschussek@gmail.com> + */ +class UndefinedOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/LICENSE b/vendor/symfony/options-resolver/LICENSE new file mode 100644 index 000000000..008370457 --- /dev/null +++ b/vendor/symfony/options-resolver/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2023 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/options-resolver/OptionConfigurator.php b/vendor/symfony/options-resolver/OptionConfigurator.php new file mode 100644 index 000000000..62f03d064 --- /dev/null +++ b/vendor/symfony/options-resolver/OptionConfigurator.php @@ -0,0 +1,139 @@ +<?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\OptionsResolver; + +use Symfony\Component\OptionsResolver\Exception\AccessException; + +final class OptionConfigurator +{ + private $name; + private $resolver; + + public function __construct(string $name, OptionsResolver $resolver) + { + $this->name = $name; + $this->resolver = $resolver; + $this->resolver->setDefined($name); + } + + /** + * Adds allowed types for this option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function allowedTypes(string ...$types): self + { + $this->resolver->setAllowedTypes($this->name, $types); + + return $this; + } + + /** + * Sets allowed values for this option. + * + * @param mixed ...$values One or more acceptable values/closures + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function allowedValues(...$values): self + { + $this->resolver->setAllowedValues($this->name, $values); + + return $this; + } + + /** + * Sets the default value for this option. + * + * @param mixed $value The default value of the option + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function default($value): self + { + $this->resolver->setDefault($this->name, $value); + + return $this; + } + + /** + * Defines an option configurator with the given name. + */ + public function define(string $option): self + { + return $this->resolver->define($option); + } + + /** + * Marks this option as deprecated. + * + * @param string $package The name of the composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string|\Closure $message The deprecation message to use + * + * @return $this + */ + public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self + { + $this->resolver->setDeprecated($this->name, $package, $version, $message); + + return $this; + } + + /** + * Sets the normalizer for this option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function normalize(\Closure $normalizer): self + { + $this->resolver->setNormalizer($this->name, $normalizer); + + return $this; + } + + /** + * Marks this option as required. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function required(): self + { + $this->resolver->setRequired($this->name); + + return $this; + } + + /** + * Sets an info message for an option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function info(string $info): self + { + $this->resolver->setInfo($this->name, $info); + + return $this; + } +} diff --git a/vendor/symfony/options-resolver/Options.php b/vendor/symfony/options-resolver/Options.php new file mode 100644 index 000000000..d444ec423 --- /dev/null +++ b/vendor/symfony/options-resolver/Options.php @@ -0,0 +1,22 @@ +<?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\OptionsResolver; + +/** + * Contains resolved option values. + * + * @author Bernhard Schussek <bschussek@gmail.com> + * @author Tobias Schultze <http://tobion.de> + */ +interface Options extends \ArrayAccess, \Countable +{ +} diff --git a/vendor/symfony/options-resolver/OptionsResolver.php b/vendor/symfony/options-resolver/OptionsResolver.php new file mode 100644 index 000000000..3db291f99 --- /dev/null +++ b/vendor/symfony/options-resolver/OptionsResolver.php @@ -0,0 +1,1347 @@ +<?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\OptionsResolver; + +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; + +/** + * Validates options and merges them with default values. + * + * @author Bernhard Schussek <bschussek@gmail.com> + * @author Tobias Schultze <http://tobion.de> + */ +class OptionsResolver implements Options +{ + private const VALIDATION_FUNCTIONS = [ + 'bool' => 'is_bool', + 'boolean' => 'is_bool', + 'int' => 'is_int', + 'integer' => 'is_int', + 'long' => 'is_int', + 'float' => 'is_float', + 'double' => 'is_float', + 'real' => 'is_float', + 'numeric' => 'is_numeric', + 'string' => 'is_string', + 'scalar' => 'is_scalar', + 'array' => 'is_array', + 'iterable' => 'is_iterable', + 'countable' => 'is_countable', + 'callable' => 'is_callable', + 'object' => 'is_object', + 'resource' => 'is_resource', + ]; + + /** + * The names of all defined options. + */ + private $defined = []; + + /** + * The default option values. + */ + private $defaults = []; + + /** + * A list of closure for nested options. + * + * @var \Closure[][] + */ + private $nested = []; + + /** + * The names of required options. + */ + private $required = []; + + /** + * The resolved option values. + */ + private $resolved = []; + + /** + * A list of normalizer closures. + * + * @var \Closure[][] + */ + private $normalizers = []; + + /** + * A list of accepted values for each option. + */ + private $allowedValues = []; + + /** + * A list of accepted types for each option. + */ + private $allowedTypes = []; + + /** + * A list of info messages for each option. + */ + private $info = []; + + /** + * A list of closures for evaluating lazy options. + */ + private $lazy = []; + + /** + * A list of lazy options whose closure is currently being called. + * + * This list helps detecting circular dependencies between lazy options. + */ + private $calling = []; + + /** + * A list of deprecated options. + */ + private $deprecated = []; + + /** + * The list of options provided by the user. + */ + private $given = []; + + /** + * Whether the instance is locked for reading. + * + * Once locked, the options cannot be changed anymore. This is + * necessary in order to avoid inconsistencies during the resolving + * process. If any option is changed after being read, all evaluated + * lazy options that depend on this option would become invalid. + */ + private $locked = false; + + private $parentsOptions = []; + + /** + * Whether the whole options definition is marked as array prototype. + */ + private $prototype; + + /** + * The prototype array's index that is being read. + */ + private $prototypeIndex; + + /** + * Sets the default value of a given option. + * + * If the default value should be set based on other options, you can pass + * a closure with the following signature: + * + * function (Options $options) { + * // ... + * } + * + * The closure will be evaluated when {@link resolve()} is called. The + * closure has access to the resolved values of other options through the + * passed {@link Options} instance: + * + * function (Options $options) { + * if (isset($options['port'])) { + * // ... + * } + * } + * + * If you want to access the previously set default value, add a second + * argument to the closure's signature: + * + * $options->setDefault('name', 'Default Name'); + * + * $options->setDefault('name', function (Options $options, $previousValue) { + * // 'Default Name' === $previousValue + * }); + * + * This is mostly useful if the configuration of the {@link Options} object + * is spread across different locations of your code, such as base and + * sub-classes. + * + * If you want to define nested options, you can pass a closure with the + * following signature: + * + * $options->setDefault('database', function (OptionsResolver $resolver) { + * $resolver->setDefined(['dbname', 'host', 'port', 'user', 'pass']); + * } + * + * To get access to the parent options, add a second argument to the closure's + * signature: + * + * function (OptionsResolver $resolver, Options $parent) { + * // 'default' === $parent['connection'] + * } + * + * @param string $option The name of the option + * @param mixed $value The default value of the option + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefault(string $option, $value) + { + // Setting is not possible once resolving starts, because then lazy + // options could manipulate the state of the object, leading to + // inconsistent results. + if ($this->locked) { + throw new AccessException('Default values cannot be set from a lazy option or normalizer.'); + } + + // If an option is a closure that should be evaluated lazily, store it + // in the "lazy" property. + if ($value instanceof \Closure) { + $reflClosure = new \ReflectionFunction($value); + $params = $reflClosure->getParameters(); + + if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) { + // Initialize the option if no previous value exists + if (!isset($this->defaults[$option])) { + $this->defaults[$option] = null; + } + + // Ignore previous lazy options if the closure has no second parameter + if (!isset($this->lazy[$option]) || !isset($params[1])) { + $this->lazy[$option] = []; + } + + // Store closure for later evaluation + $this->lazy[$option][] = $value; + $this->defined[$option] = true; + + // Make sure the option is processed and is not nested anymore + unset($this->resolved[$option], $this->nested[$option]); + + return $this; + } + + if (isset($params[0]) && null !== ($type = $params[0]->getType()) && self::class === $type->getName() && (!isset($params[1]) || (($type = $params[1]->getType()) instanceof \ReflectionNamedType && Options::class === $type->getName()))) { + // Store closure for later evaluation + $this->nested[$option][] = $value; + $this->defaults[$option] = []; + $this->defined[$option] = true; + + // Make sure the option is processed and is not lazy anymore + unset($this->resolved[$option], $this->lazy[$option]); + + return $this; + } + } + + // This option is not lazy nor nested anymore + unset($this->lazy[$option], $this->nested[$option]); + + // Yet undefined options can be marked as resolved, because we only need + // to resolve options with lazy closures, normalizers or validation + // rules, none of which can exist for undefined options + // If the option was resolved before, update the resolved value + if (!isset($this->defined[$option]) || \array_key_exists($option, $this->resolved)) { + $this->resolved[$option] = $value; + } + + $this->defaults[$option] = $value; + $this->defined[$option] = true; + + return $this; + } + + /** + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefaults(array $defaults) + { + foreach ($defaults as $option => $value) { + $this->setDefault($option, $value); + } + + return $this; + } + + /** + * Returns whether a default value is set for an option. + * + * Returns true if {@link setDefault()} was called for this option. + * An option is also considered set if it was set to null. + * + * @return bool + */ + public function hasDefault(string $option) + { + return \array_key_exists($option, $this->defaults); + } + + /** + * Marks one or more options as required. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setRequired($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be made required from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + $this->defined[$option] = true; + $this->required[$option] = true; + } + + return $this; + } + + /** + * Returns whether an option is required. + * + * An option is required if it was passed to {@link setRequired()}. + * + * @return bool + */ + public function isRequired(string $option) + { + return isset($this->required[$option]); + } + + /** + * Returns the names of all required options. + * + * @return string[] + * + * @see isRequired() + */ + public function getRequiredOptions() + { + return array_keys($this->required); + } + + /** + * Returns whether an option is missing a default value. + * + * An option is missing if it was passed to {@link setRequired()}, but not + * to {@link setDefault()}. This option must be passed explicitly to + * {@link resolve()}, otherwise an exception will be thrown. + * + * @return bool + */ + public function isMissing(string $option) + { + return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults); + } + + /** + * Returns the names of all options missing a default value. + * + * @return string[] + */ + public function getMissingOptions() + { + return array_keys(array_diff_key($this->required, $this->defaults)); + } + + /** + * Defines a valid option name. + * + * Defines an option name without setting a default value. The option will + * be accepted when passed to {@link resolve()}. When not passed, the + * option will not be included in the resolved options. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefined($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be defined from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + $this->defined[$option] = true; + } + + return $this; + } + + /** + * Returns whether an option is defined. + * + * Returns true for any option passed to {@link setDefault()}, + * {@link setRequired()} or {@link setDefined()}. + * + * @return bool + */ + public function isDefined(string $option) + { + return isset($this->defined[$option]); + } + + /** + * Returns the names of all defined options. + * + * @return string[] + * + * @see isDefined() + */ + public function getDefinedOptions() + { + return array_keys($this->defined); + } + + public function isNested(string $option): bool + { + return isset($this->nested[$option]); + } + + /** + * Deprecates an option, allowed types or values. + * + * Instead of passing the message, you may also pass a closure with the + * following signature: + * + * function (Options $options, $value): string { + * // ... + * } + * + * The closure receives the value as argument and should return a string. + * Return an empty string to ignore the option deprecation. + * + * The closure is invoked when {@link resolve()} is called. The parameter + * passed to the closure is the value of the option after validating it + * and before normalizing it. + * + * @param string $package The name of the composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string|\Closure $message The deprecation message to use + * + * @return $this + */ + public function setDeprecated(string $option/* , string $package, string $version, $message = 'The option "%name%" is deprecated.' */): self + { + if ($this->locked) { + throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $args = \func_get_args(); + + if (\func_num_args() < 3) { + trigger_deprecation('symfony/options-resolver', '5.1', 'The signature of method "%s()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.', __METHOD__); + + $message = $args[1] ?? 'The option "%name%" is deprecated.'; + $package = $version = ''; + } else { + $package = $args[1]; + $version = $args[2]; + $message = $args[3] ?? 'The option "%name%" is deprecated.'; + } + + if (!\is_string($message) && !$message instanceof \Closure) { + throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message))); + } + + // ignore if empty string + if ('' === $message) { + return $this; + } + + $this->deprecated[$option] = [ + 'package' => $package, + 'version' => $version, + 'message' => $message, + ]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + public function isDeprecated(string $option): bool + { + return isset($this->deprecated[$option]); + } + + /** + * Sets the normalizer for an option. + * + * The normalizer should be a closure with the following signature: + * + * function (Options $options, $value) { + * // ... + * } + * + * The closure is invoked when {@link resolve()} is called. The closure + * has access to the resolved values of other options through the passed + * {@link Options} instance. + * + * The second parameter passed to the closure is the value of + * the option. + * + * The resolved option value is set to the return value of the closure. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setNormalizer(string $option, \Closure $normalizer) + { + if ($this->locked) { + throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->normalizers[$option] = [$normalizer]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds a normalizer for an option. + * + * The normalizer should be a closure with the following signature: + * + * function (Options $options, $value): mixed { + * // ... + * } + * + * The closure is invoked when {@link resolve()} is called. The closure + * has access to the resolved values of other options through the passed + * {@link Options} instance. + * + * The second parameter passed to the closure is the value of + * the option. + * + * The resolved option value is set to the return value of the closure. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): self + { + if ($this->locked) { + throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if ($forcePrepend) { + $this->normalizers[$option] = $this->normalizers[$option] ?? []; + array_unshift($this->normalizers[$option], $normalizer); + } else { + $this->normalizers[$option][] = $normalizer; + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Sets allowed values for an option. + * + * Instead of passing values, you may also pass a closures with the + * following signature: + * + * function ($value) { + * // return true or false + * } + * + * The closure receives the value as argument and should return true to + * accept the value and false to reject the value. + * + * @param string $option The option name + * @param mixed $allowedValues One or more acceptable values/closures + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setAllowedValues(string $option, $allowedValues) + { + if ($this->locked) { + throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds allowed values for an option. + * + * The values are merged with the allowed values defined previously. + * + * Instead of passing values, you may also pass a closures with the + * following signature: + * + * function ($value) { + * // return true or false + * } + * + * The closure receives the value as argument and should return true to + * accept the value and false to reject the value. + * + * @param string $option The option name + * @param mixed $allowedValues One or more acceptable values/closures + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addAllowedValues(string $option, $allowedValues) + { + if ($this->locked) { + throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if (!\is_array($allowedValues)) { + $allowedValues = [$allowedValues]; + } + + if (!isset($this->allowedValues[$option])) { + $this->allowedValues[$option] = $allowedValues; + } else { + $this->allowedValues[$option] = array_merge($this->allowedValues[$option], $allowedValues); + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Sets allowed types for an option. + * + * Any type for which a corresponding is_<type>() function exists is + * acceptable. Additionally, fully-qualified class or interface names may + * be passed. + * + * @param string|string[] $allowedTypes One or more accepted types + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setAllowedTypes(string $option, $allowedTypes) + { + if ($this->locked) { + throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->allowedTypes[$option] = (array) $allowedTypes; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds allowed types for an option. + * + * The types are merged with the allowed types defined previously. + * + * Any type for which a corresponding is_<type>() function exists is + * acceptable. Additionally, fully-qualified class or interface names may + * be passed. + * + * @param string|string[] $allowedTypes One or more accepted types + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addAllowedTypes(string $option, $allowedTypes) + { + if ($this->locked) { + throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if (!isset($this->allowedTypes[$option])) { + $this->allowedTypes[$option] = (array) $allowedTypes; + } else { + $this->allowedTypes[$option] = array_merge($this->allowedTypes[$option], (array) $allowedTypes); + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Defines an option configurator with the given name. + */ + public function define(string $option): OptionConfigurator + { + if (isset($this->defined[$option])) { + throw new OptionDefinitionException(sprintf('The option "%s" is already defined.', $option)); + } + + return new OptionConfigurator($option, $this); + } + + /** + * Sets an info message for an option. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setInfo(string $option, string $info): self + { + if ($this->locked) { + throw new AccessException('The Info message cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->info[$option] = $info; + + return $this; + } + + /** + * Gets the info message for an option. + */ + public function getInfo(string $option): ?string + { + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + return $this->info[$option] ?? null; + } + + /** + * Marks the whole options definition as array prototype. + * + * @return $this + * + * @throws AccessException If called from a lazy option, a normalizer or a root definition + */ + public function setPrototype(bool $prototype): self + { + if ($this->locked) { + throw new AccessException('The prototype property cannot be set from a lazy option or normalizer.'); + } + + if (null === $this->prototype && $prototype) { + throw new AccessException('The prototype property cannot be set from a root definition.'); + } + + $this->prototype = $prototype; + + return $this; + } + + public function isPrototype(): bool + { + return $this->prototype ?? false; + } + + /** + * Removes the option with the given name. + * + * Undefined options are ignored. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function remove($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be removed from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + unset($this->defined[$option], $this->defaults[$option], $this->required[$option], $this->resolved[$option]); + unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option], $this->info[$option]); + } + + return $this; + } + + /** + * Removes all options. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function clear() + { + if ($this->locked) { + throw new AccessException('Options cannot be cleared from a lazy option or normalizer.'); + } + + $this->defined = []; + $this->defaults = []; + $this->nested = []; + $this->required = []; + $this->resolved = []; + $this->lazy = []; + $this->normalizers = []; + $this->allowedTypes = []; + $this->allowedValues = []; + $this->deprecated = []; + $this->info = []; + + return $this; + } + + /** + * Merges options with the default values stored in the container and + * validates them. + * + * Exceptions are thrown if: + * + * - Undefined options are passed; + * - Required options are missing; + * - Options have invalid types; + * - Options have invalid values. + * + * @return array + * + * @throws UndefinedOptionsException If an option name is undefined + * @throws InvalidOptionsException If an option doesn't fulfill the + * specified validation rules + * @throws MissingOptionsException If a required option is missing + * @throws OptionDefinitionException If there is a cyclic dependency between + * lazy options and/or normalizers + * @throws NoSuchOptionException If a lazy option reads an unavailable option + * @throws AccessException If called from a lazy option or normalizer + */ + public function resolve(array $options = []) + { + if ($this->locked) { + throw new AccessException('Options cannot be resolved from a lazy option or normalizer.'); + } + + // Allow this method to be called multiple times + $clone = clone $this; + + // Make sure that no unknown options are passed + $diff = array_diff_key($options, $clone->defined); + + if (\count($diff) > 0) { + ksort($clone->defined); + ksort($diff); + + throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', $this->formatOptions(array_keys($diff)), implode('", "', array_keys($clone->defined)))); + } + + // Override options set by the user + foreach ($options as $option => $value) { + $clone->given[$option] = true; + $clone->defaults[$option] = $value; + unset($clone->resolved[$option], $clone->lazy[$option]); + } + + // Check whether any required option is missing + $diff = array_diff_key($clone->required, $clone->defaults); + + if (\count($diff) > 0) { + ksort($diff); + + throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', $this->formatOptions(array_keys($diff)))); + } + + // Lock the container + $clone->locked = true; + + // Now process the individual options. Use offsetGet(), which resolves + // the option itself and any options that the option depends on + foreach ($clone->defaults as $option => $_) { + $clone->offsetGet($option); + } + + return $clone->resolved; + } + + /** + * Returns the resolved value of an option. + * + * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) + * + * @return mixed + * + * @throws AccessException If accessing this method outside of + * {@link resolve()} + * @throws NoSuchOptionException If the option is not set + * @throws InvalidOptionsException If the option doesn't fulfill the + * specified validation rules + * @throws OptionDefinitionException If there is a cyclic dependency between + * lazy options and/or normalizers + */ + #[\ReturnTypeWillChange] + public function offsetGet($option, bool $triggerDeprecation = true) + { + if (!$this->locked) { + throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); + } + + // Shortcut for resolved options + if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) { + if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option]['message'])) { + trigger_deprecation($this->deprecated[$option]['package'], $this->deprecated[$option]['version'], strtr($this->deprecated[$option]['message'], ['%name%' => $option])); + } + + return $this->resolved[$option]; + } + + // Check whether the option is set at all + if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) { + if (!isset($this->defined[$option])) { + throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $this->formatOptions([$option]))); + } + + $value = $this->defaults[$option]; + + // Resolve the option if it is a nested definition + if (isset($this->nested[$option])) { + // If the closure is already being called, we have a cyclic dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + if (!\is_array($value)) { + throw new InvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), get_debug_type($value))); + } + + // The following section must be protected from cyclic calls. + $this->calling[$option] = true; + try { + $resolver = new self(); + $resolver->prototype = false; + $resolver->parentsOptions = $this->parentsOptions; + $resolver->parentsOptions[] = $option; + foreach ($this->nested[$option] as $closure) { + $closure($resolver, $this); + } + + if ($resolver->prototype) { + $values = []; + foreach ($value as $index => $prototypeValue) { + if (!\is_array($prototypeValue)) { + throw new InvalidOptionsException(sprintf('The value of the option "%s" is expected to be of type array of array, but is of type array of "%s".', $this->formatOptions([$option]), get_debug_type($prototypeValue))); + } + + $resolver->prototypeIndex = $index; + $values[$index] = $resolver->resolve($prototypeValue); + } + $value = $values; + } else { + $value = $resolver->resolve($value); + } + } finally { + $resolver->prototypeIndex = null; + unset($this->calling[$option]); + } + } + + // Resolve the option if the default value is lazily evaluated + if (isset($this->lazy[$option])) { + // If the closure is already being called, we have a cyclic + // dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + // The following section must be protected from cyclic + // calls. Set $calling for the current $option to detect a cyclic + // dependency + // BEGIN + $this->calling[$option] = true; + try { + foreach ($this->lazy[$option] as $closure) { + $value = $closure($this, $value); + } + } finally { + unset($this->calling[$option]); + } + // END + } + + // Validate the type of the resolved option + if (isset($this->allowedTypes[$option])) { + $valid = true; + $invalidTypes = []; + + foreach ($this->allowedTypes[$option] as $type) { + if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) { + break; + } + } + + if (!$valid) { + $fmtActualValue = $this->formatValue($value); + $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]); + $fmtProvidedTypes = implode('|', array_keys($invalidTypes)); + $allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) { + return str_ends_with($item, '[]'); + })) > 0; + + if (\is_array($value) && $allowedContainsArrayType) { + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); + } + + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); + } + } + + // Validate the value of the resolved option + if (isset($this->allowedValues[$option])) { + $success = false; + $printableAllowedValues = []; + + foreach ($this->allowedValues[$option] as $allowedValue) { + if ($allowedValue instanceof \Closure) { + if ($allowedValue($value)) { + $success = true; + break; + } + + // Don't include closures in the exception message + continue; + } + + if ($value === $allowedValue) { + $success = true; + break; + } + + $printableAllowedValues[] = $allowedValue; + } + + if (!$success) { + $message = sprintf( + 'The option "%s" with value %s is invalid.', + $option, + $this->formatValue($value) + ); + + if (\count($printableAllowedValues) > 0) { + $message .= sprintf( + ' Accepted values are: %s.', + $this->formatValues($printableAllowedValues) + ); + } + + if (isset($this->info[$option])) { + $message .= sprintf(' Info: %s.', $this->info[$option]); + } + + throw new InvalidOptionsException($message); + } + } + + // Check whether the option is deprecated + // and it is provided by the user or is being called from a lazy evaluation + if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || ($this->calling && \is_string($this->deprecated[$option]['message'])))) { + $deprecation = $this->deprecated[$option]; + $message = $this->deprecated[$option]['message']; + + if ($message instanceof \Closure) { + // If the closure is already being called, we have a cyclic dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + $this->calling[$option] = true; + try { + if (!\is_string($message = $message($this, $value))) { + throw new InvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($message))); + } + } finally { + unset($this->calling[$option]); + } + } + + if ('' !== $message) { + trigger_deprecation($deprecation['package'], $deprecation['version'], strtr($message, ['%name%' => $option])); + } + } + + // Normalize the validated option + if (isset($this->normalizers[$option])) { + // If the closure is already being called, we have a cyclic + // dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + // The following section must be protected from cyclic + // calls. Set $calling for the current $option to detect a cyclic + // dependency + // BEGIN + $this->calling[$option] = true; + try { + foreach ($this->normalizers[$option] as $normalizer) { + $value = $normalizer($this, $value); + } + } finally { + unset($this->calling[$option]); + } + // END + } + + // Mark as resolved + $this->resolved[$option] = $value; + + return $value; + } + + private function verifyTypes(string $type, $value, array &$invalidTypes, int $level = 0): bool + { + if (\is_array($value) && '[]' === substr($type, -2)) { + $type = substr($type, 0, -2); + $valid = true; + + foreach ($value as $val) { + if (!$this->verifyTypes($type, $val, $invalidTypes, $level + 1)) { + $valid = false; + } + } + + return $valid; + } + + if (('null' === $type && null === $value) || (isset(self::VALIDATION_FUNCTIONS[$type]) ? self::VALIDATION_FUNCTIONS[$type]($value) : $value instanceof $type)) { + return true; + } + + if (!$invalidTypes || $level > 0) { + $invalidTypes[get_debug_type($value)] = true; + } + + return false; + } + + /** + * Returns whether a resolved option with the given name exists. + * + * @param string $option The option name + * + * @return bool + * + * @throws AccessException If accessing this method outside of {@link resolve()} + * + * @see \ArrayAccess::offsetExists() + */ + #[\ReturnTypeWillChange] + public function offsetExists($option) + { + if (!$this->locked) { + throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); + } + + return \array_key_exists($option, $this->defaults); + } + + /** + * Not supported. + * + * @return void + * + * @throws AccessException + */ + #[\ReturnTypeWillChange] + public function offsetSet($option, $value) + { + throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.'); + } + + /** + * Not supported. + * + * @return void + * + * @throws AccessException + */ + #[\ReturnTypeWillChange] + public function offsetUnset($option) + { + throw new AccessException('Removing options via array access is not supported. Use remove() instead.'); + } + + /** + * Returns the number of set options. + * + * This may be only a subset of the defined options. + * + * @return int + * + * @throws AccessException If accessing this method outside of {@link resolve()} + * + * @see \Countable::count() + */ + #[\ReturnTypeWillChange] + public function count() + { + if (!$this->locked) { + throw new AccessException('Counting is only supported within closures of lazy options and normalizers.'); + } + + return \count($this->defaults); + } + + /** + * Returns a string representation of the value. + * + * This method returns the equivalent PHP tokens for most scalar types + * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped + * in double quotes ("). + * + * @param mixed $value The value to format as string + */ + private function formatValue($value): string + { + if (\is_object($value)) { + return \get_class($value); + } + + if (\is_array($value)) { + return 'array'; + } + + if (\is_string($value)) { + return '"'.$value.'"'; + } + + if (\is_resource($value)) { + return 'resource'; + } + + if (null === $value) { + return 'null'; + } + + if (false === $value) { + return 'false'; + } + + if (true === $value) { + return 'true'; + } + + return (string) $value; + } + + /** + * Returns a string representation of a list of values. + * + * Each of the values is converted to a string using + * {@link formatValue()}. The values are then concatenated with commas. + * + * @see formatValue() + */ + private function formatValues(array $values): string + { + foreach ($values as $key => $value) { + $values[$key] = $this->formatValue($value); + } + + return implode(', ', $values); + } + + private function formatOptions(array $options): string + { + if ($this->parentsOptions) { + $prefix = array_shift($this->parentsOptions); + if ($this->parentsOptions) { + $prefix .= sprintf('[%s]', implode('][', $this->parentsOptions)); + } + + if ($this->prototype && null !== $this->prototypeIndex) { + $prefix .= sprintf('[%s]', $this->prototypeIndex); + } + + $options = array_map(static function (string $option) use ($prefix): string { + return sprintf('%s[%s]', $prefix, $option); + }, $options); + } + + return implode('", "', $options); + } + + private function getParameterClassName(\ReflectionParameter $parameter): ?string + { + if (!($type = $parameter->getType()) instanceof \ReflectionNamedType || $type->isBuiltin()) { + return null; + } + + return $type->getName(); + } +} diff --git a/vendor/symfony/options-resolver/README.md b/vendor/symfony/options-resolver/README.md new file mode 100644 index 000000000..c63b9005e --- /dev/null +++ b/vendor/symfony/options-resolver/README.md @@ -0,0 +1,15 @@ +OptionsResolver Component +========================= + +The OptionsResolver component is `array_replace` on steroids. It allows you to +create an options system with required options, defaults, validation (type, +value), normalization and more. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/options_resolver.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/options-resolver/composer.json b/vendor/symfony/options-resolver/composer.json new file mode 100644 index 000000000..a38d1bd04 --- /dev/null +++ b/vendor/symfony/options-resolver/composer.json @@ -0,0 +1,31 @@ +{ + "name": "symfony/options-resolver", + "type": "library", + "description": "Provides an improved replacement for the array_replace PHP function", + "keywords": ["options", "config", "configuration"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/service-contracts/Attribute/Required.php b/vendor/symfony/service-contracts/Attribute/Required.php new file mode 100644 index 000000000..9df851189 --- /dev/null +++ b/vendor/symfony/service-contracts/Attribute/Required.php @@ -0,0 +1,25 @@ +<?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\Contracts\Service\Attribute; + +/** + * A required dependency. + * + * This attribute indicates that a property holds a required dependency. The annotated property or method should be + * considered during the instantiation process of the containing class. + * + * @author Alexander M. Turek <me@derrabus.de> + */ +#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] +final class Required +{ +} diff --git a/vendor/symfony/service-contracts/Attribute/SubscribedService.php b/vendor/symfony/service-contracts/Attribute/SubscribedService.php new file mode 100644 index 000000000..10d1bc38e --- /dev/null +++ b/vendor/symfony/service-contracts/Attribute/SubscribedService.php @@ -0,0 +1,33 @@ +<?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\Contracts\Service\Attribute; + +use Symfony\Contracts\Service\ServiceSubscriberTrait; + +/** + * Use with {@see ServiceSubscriberTrait} to mark a method's return type + * as a subscribed service. + * + * @author Kevin Bond <kevinbond@gmail.com> + */ +#[\Attribute(\Attribute::TARGET_METHOD)] +final class SubscribedService +{ + /** + * @param string|null $key The key to use for the service + * If null, use "ClassName::methodName" + */ + public function __construct( + public ?string $key = null + ) { + } +} diff --git a/vendor/symfony/service-contracts/CHANGELOG.md b/vendor/symfony/service-contracts/CHANGELOG.md new file mode 100644 index 000000000..7932e2613 --- /dev/null +++ b/vendor/symfony/service-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/service-contracts/ServiceLocatorTrait.php b/vendor/symfony/service-contracts/ServiceLocatorTrait.php index da797edca..74dfa4362 100644 --- a/vendor/symfony/service-contracts/ServiceLocatorTrait.php +++ b/vendor/symfony/service-contracts/ServiceLocatorTrait.php @@ -43,7 +43,7 @@ trait ServiceLocatorTrait * * @return bool */ - public function has($id) + public function has(string $id) { return isset($this->factories[$id]); } @@ -53,7 +53,7 @@ trait ServiceLocatorTrait * * @return mixed */ - public function get($id) + public function get(string $id) { if (!isset($this->factories[$id])) { throw $this->createNotFoundException($id); diff --git a/vendor/symfony/service-contracts/ServiceSubscriberTrait.php b/vendor/symfony/service-contracts/ServiceSubscriberTrait.php index 48c610ab1..16e3eb2c1 100644 --- a/vendor/symfony/service-contracts/ServiceSubscriberTrait.php +++ b/vendor/symfony/service-contracts/ServiceSubscriberTrait.php @@ -12,10 +12,11 @@ namespace Symfony\Contracts\Service; use Psr\Container\ContainerInterface; +use Symfony\Contracts\Service\Attribute\SubscribedService; /** * Implementation of ServiceSubscriberInterface that determines subscribed services from - * private method return types. Service ids are available as "ClassName::methodName". + * method return types. Service ids are available as "ClassName::methodName". * * @author Kevin Bond <kevinbond@gmail.com> */ @@ -30,25 +31,61 @@ trait ServiceSubscriberTrait public static function getSubscribedServices(): array { $services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : []; + $attributeOptIn = false; - foreach ((new \ReflectionClass(self::class))->getMethods() as $method) { - if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) { - continue; + if (\PHP_VERSION_ID >= 80000) { + foreach ((new \ReflectionClass(self::class))->getMethods() as $method) { + if (self::class !== $method->getDeclaringClass()->name) { + continue; + } + + if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) { + continue; + } + + if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) { + throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name)); + } + + if (!$returnType = $method->getReturnType()) { + throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class)); + } + + $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; + + if ($returnType->allowsNull()) { + $serviceId = '?'.$serviceId; + } + + $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId; + $attributeOptIn = true; } + } - if (self::class !== $method->getDeclaringClass()->name) { - continue; + if (!$attributeOptIn) { + foreach ((new \ReflectionClass(self::class))->getMethods() as $method) { + if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) { + continue; + } + + if (self::class !== $method->getDeclaringClass()->name) { + continue; + } + + if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) { + continue; + } + + if ($returnType->isBuiltin()) { + continue; + } + + if (\PHP_VERSION_ID >= 80000) { + trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class); + } + + $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType); } - - if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) { - continue; - } - - if ($returnType->isBuiltin()) { - continue; - } - - $services[self::class.'::'.$method->name] = '?'.$returnType->getName(); } return $services; diff --git a/vendor/symfony/service-contracts/composer.json b/vendor/symfony/service-contracts/composer.json index e3bf920ca..f05863701 100644 --- a/vendor/symfony/service-contracts/composer.json +++ b/vendor/symfony/service-contracts/composer.json @@ -16,8 +16,12 @@ } ], "require": { - "php": ">=7.1.3", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -28,7 +32,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/vendor/symfony/translation-contracts/CHANGELOG.md b/vendor/symfony/translation-contracts/CHANGELOG.md new file mode 100644 index 000000000..7932e2613 --- /dev/null +++ b/vendor/symfony/translation-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/translation-contracts/LocaleAwareInterface.php b/vendor/symfony/translation-contracts/LocaleAwareInterface.php index dbd8894fe..693f92ba9 100644 --- a/vendor/symfony/translation-contracts/LocaleAwareInterface.php +++ b/vendor/symfony/translation-contracts/LocaleAwareInterface.php @@ -20,12 +20,12 @@ interface LocaleAwareInterface * * @throws \InvalidArgumentException If the locale contains invalid characters */ - public function setLocale($locale); + public function setLocale(string $locale); /** * Returns the current locale. * - * @return string The locale + * @return string */ public function getLocale(); } diff --git a/vendor/symfony/translation-contracts/Test/TranslatorTest.php b/vendor/symfony/translation-contracts/Test/TranslatorTest.php index 83551cb84..a3e9b20af 100644 --- a/vendor/symfony/translation-contracts/Test/TranslatorTest.php +++ b/vendor/symfony/translation-contracts/Test/TranslatorTest.php @@ -74,6 +74,8 @@ class TranslatorTest extends TestCase } /** + * @requires extension intl + * * @dataProvider getTransChoiceTests */ public function testTransChoiceWithDefaultLocale($expected, $id, $number) @@ -165,11 +167,11 @@ class TranslatorTest extends TestCase /** * @dataProvider getChooseTests */ - public function testChoose($expected, $id, $number) + public function testChoose($expected, $id, $number, $locale = null) { $translator = $this->getTranslator(); - $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number])); + $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number], null, $locale)); } public function testReturnMessageIfExactlyOneStandardRuleIsGiven() @@ -278,6 +280,18 @@ class TranslatorTest extends TestCase ['', '|', 1], // Empty plural set (3 plural forms) from a .PO file ['', '||', 1], + + // Floating values + ['1.5 liters', '%count% liter|%count% liters', 1.5], + ['1.5 litre', '%count% litre|%count% litres', 1.5, 'fr'], + + // Negative values + ['-1 degree', '%count% degree|%count% degrees', -1], + ['-1 degré', '%count% degré|%count% degrés', -1], + ['-1.5 degrees', '%count% degree|%count% degrees', -1.5], + ['-1.5 degré', '%count% degré|%count% degrés', -1.5, 'fr'], + ['-2 degrees', '%count% degree|%count% degrees', -2], + ['-2 degrés', '%count% degré|%count% degrés', -2], ]; } diff --git a/vendor/symfony/translation-contracts/TranslatableInterface.php b/vendor/symfony/translation-contracts/TranslatableInterface.php new file mode 100644 index 000000000..47fd6fa02 --- /dev/null +++ b/vendor/symfony/translation-contracts/TranslatableInterface.php @@ -0,0 +1,20 @@ +<?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\Contracts\Translation; + +/** + * @author Nicolas Grekas <p@tchwork.com> + */ +interface TranslatableInterface +{ + public function trans(TranslatorInterface $translator, string $locale = null): string; +} diff --git a/vendor/symfony/translation-contracts/TranslatorInterface.php b/vendor/symfony/translation-contracts/TranslatorInterface.php index d86763737..77b7a9c58 100644 --- a/vendor/symfony/translation-contracts/TranslatorInterface.php +++ b/vendor/symfony/translation-contracts/TranslatorInterface.php @@ -13,6 +13,8 @@ namespace Symfony\Contracts\Translation; /** * @author Fabien Potencier <fabien@symfony.com> + * + * @method string getLocale() Returns the default locale */ interface TranslatorInterface { @@ -57,9 +59,9 @@ interface TranslatorInterface * @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 + * @return string * * @throws \InvalidArgumentException If the locale contains invalid characters */ - public function trans($id, array $parameters = [], $domain = null, $locale = null); + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null); } diff --git a/vendor/symfony/translation-contracts/TranslatorTrait.php b/vendor/symfony/translation-contracts/TranslatorTrait.php index 92a6a0021..405ce8d70 100644 --- a/vendor/symfony/translation-contracts/TranslatorTrait.php +++ b/vendor/symfony/translation-contracts/TranslatorTrait.php @@ -25,13 +25,15 @@ trait TranslatorTrait /** * {@inheritdoc} */ - public function setLocale($locale) + public function setLocale(string $locale) { - $this->locale = (string) $locale; + $this->locale = $locale; } /** * {@inheritdoc} + * + * @return string */ public function getLocale() { @@ -41,9 +43,9 @@ trait TranslatorTrait /** * {@inheritdoc} */ - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string { - if ('' === $id = (string) $id) { + if (null === $id || '' === $id) { return ''; } @@ -52,7 +54,7 @@ trait TranslatorTrait } $number = (float) $parameters['%count%']; - $locale = (string) $locale ?: $this->getLocale(); + $locale = $locale ?: $this->getLocale(); $parts = []; if (preg_match('/^\|++$/', $id)) { diff --git a/vendor/symfony/translation-contracts/composer.json b/vendor/symfony/translation-contracts/composer.json index 8fe4b2094..65fe243a4 100644 --- a/vendor/symfony/translation-contracts/composer.json +++ b/vendor/symfony/translation-contracts/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1.3" + "php": ">=7.2.5" }, "suggest": { "symfony/translation-implementation": "" @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php b/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php index 6efc06f39..e40ae25df 100644 --- a/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php +++ b/vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php @@ -113,7 +113,7 @@ class CssToInlineStyles { $document = new \DOMDocument('1.0', 'UTF-8'); $internalErrors = libxml_use_internal_errors(true); - $document->loadHTML(mb_encode_numericentity($html, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8')); + $document->loadHTML(mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8')); libxml_use_internal_errors($internalErrors); $document->formatOutput = true; diff --git a/vendor/twig/twig/.github/dependabot.yml b/vendor/twig/twig/.github/dependabot.yml new file mode 100644 index 000000000..5ace4600a --- /dev/null +++ b/vendor/twig/twig/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/vendor/twig/twig/.github/workflows/ci.yml b/vendor/twig/twig/.github/workflows/ci.yml index 88aebc164..3f49259ca 100644 --- a/vendor/twig/twig/.github/workflows/ci.yml +++ b/vendor/twig/twig/.github/workflows/ci.yml @@ -29,11 +29,12 @@ jobs: - '7.4' - '8.0' - '8.1' + - '8.2' experimental: [false] steps: - name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Install PHP with extensions" uses: shivammathur/setup-php@v2 @@ -74,6 +75,7 @@ jobs: - '7.4' - '8.0' - '8.1' + - '8.2' extension: - 'extra/cssinliner-extra' - 'extra/html-extra' @@ -86,7 +88,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Install PHP with extensions" uses: shivammathur/setup-php@v2 @@ -131,7 +133,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Install PHP with extensions" uses: shivammathur/setup-php@v2 diff --git a/vendor/twig/twig/.github/workflows/documentation.yml b/vendor/twig/twig/.github/workflows/documentation.yml index ee83b5887..f2f46fc6d 100644 --- a/vendor/twig/twig/.github/workflows/documentation.yml +++ b/vendor/twig/twig/.github/workflows/documentation.yml @@ -18,22 +18,22 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Set-up PHP" uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 coverage: none tools: "composer:v2" - name: Get composer cache directory id: composercache working-directory: doc/_build - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -54,7 +54,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: "Run DOCtor-RST" uses: docker://oskarstark/doctor-rst diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index 51712223b..db87b2360 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,9 @@ +# 2.15.4 (2022-12-27) + + * Fix optimizing closures callbacks + * Add a better exception when getting an undefined constant via `constant` + * Fix `if` nodes when outside of a block and with an empty body + # 2.15.3 (2022-09-28) * Fix a security issue on filesystem loader (possibility to load a template outside a configured directory) diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php index 13ce511f4..96f725106 100644 --- a/vendor/twig/twig/src/Environment.php +++ b/vendor/twig/twig/src/Environment.php @@ -38,11 +38,11 @@ use Twig\TokenParser\TokenParserInterface; */ class Environment { - public const VERSION = '2.15.3'; - public const VERSION_ID = 21503; + public const VERSION = '2.15.4'; + public const VERSION_ID = 21504; public const MAJOR_VERSION = 2; public const MINOR_VERSION = 15; - public const RELEASE_VERSION = 3; + public const RELEASE_VERSION = 4; public const EXTRA_VERSION = ''; private $charset; diff --git a/vendor/twig/twig/src/Extension/CoreExtension.php b/vendor/twig/twig/src/Extension/CoreExtension.php index 6ac361081..5c4087ec2 100644 --- a/vendor/twig/twig/src/Extension/CoreExtension.php +++ b/vendor/twig/twig/src/Extension/CoreExtension.php @@ -1329,6 +1329,10 @@ function twig_constant($constant, $object = null) $constant = \get_class($object).'::'.$constant; } + if (!\defined($constant)) { + throw new RuntimeError(sprintf('Constant "%s" is undefined.', $constant)); + } + return \constant($constant); } diff --git a/vendor/twig/twig/src/Node/Expression/CallExpression.php b/vendor/twig/twig/src/Node/Expression/CallExpression.php index 79e9defdf..aeb38c42f 100644 --- a/vendor/twig/twig/src/Node/Expression/CallExpression.php +++ b/vendor/twig/twig/src/Node/Expression/CallExpression.php @@ -304,7 +304,9 @@ abstract class CallExpression extends AbstractExpression if ($object = $r->getClosureThis()) { $callable = [$object, $r->name]; $callableName = (\function_exists('get_debug_type') ? get_debug_type($object) : \get_class($object)).'::'.$r->name; - } elseif ($class = $r->getClosureScopeClass()) { + } elseif (\PHP_VERSION_ID >= 80111 && $class = $r->getClosureCalledClass()) { + $callableName = $class->name.'::'.$r->name; + } elseif (\PHP_VERSION_ID < 80111 && $class = $r->getClosureScopeClass()) { $callableName = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name; } else { $callable = $callableName = $r->name; diff --git a/vendor/twig/twig/src/Node/IfNode.php b/vendor/twig/twig/src/Node/IfNode.php index 8ba23ddb6..e74ca523b 100644 --- a/vendor/twig/twig/src/Node/IfNode.php +++ b/vendor/twig/twig/src/Node/IfNode.php @@ -50,8 +50,11 @@ class IfNode extends Node ->subcompile($this->getNode('tests')->getNode($i)) ->raw(") {\n") ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) ; + // The node might not exists if the content is empty + if ($this->getNode('tests')->hasNode($i + 1)) { + $compiler->subcompile($this->getNode('tests')->getNode($i + 1)); + } } if ($this->hasNode('else')) { diff --git a/vendor/wikimedia/less.php/.github/workflows/php.yml b/vendor/wikimedia/less.php/.github/workflows/php.yml deleted file mode 100644 index 14be2ca0a..000000000 --- a/vendor/wikimedia/less.php/.github/workflows/php.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: PHP Composer - -on: [push,pull_request] - -jobs: - build: - name: Test PHP ${{ matrix.php-version }} - - strategy: - matrix: - php-version: ['7.1', '7.2', '7.3', '7.4'] - - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@master - with: - php-version: ${{ matrix.php-version }} - extension-csv: dom, mbstring - # coverage: xdebug - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run test suite - run: composer run-script test diff --git a/vendor/wikimedia/less.php/API.md b/vendor/wikimedia/less.php/API.md new file mode 100644 index 000000000..010c90f85 --- /dev/null +++ b/vendor/wikimedia/less.php/API.md @@ -0,0 +1,197 @@ +Less.php API +======== + +## Basic use + +#### Parse strings + +```php +$parser = new Less_Parser(); +$parser->parse( '@color: #36c; .link { color: @color; } a { color: @color; }' ); +$css = $parser->getCss(); +``` + +#### Parse files + +The `parseFile()` function takes two parameters: + +* The absolute path to a `.less` file. +* The base URL for any relative image or CSS references in the `.less` file, + typically the same directory that contains the `.less` file or a public equivalent. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', 'https://example.org/mysite/' ); +$css = $parser->getCss(); +``` + +#### Handle invalid syntax + +An exception will be thrown if the compiler encounters invalid LESS. + +```php +try{ + $parser = new Less_Parser(); + $parser->parseFile( '/var/www/mysite/bootstrap.less', 'https://example.org/mysite/' ); + $css = $parser->getCss(); +} catch (Exception $e) { + echo $e->getMessage(); +} +``` + +#### Parse multiple inputs + +Less.php can parse multiple input sources (e.g. files and/or strings) and generate a single CSS output. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$parser->parse( '@color: #36c; .link { color: @color; } a { color: @color; }' ); +$css = $parser->getCss(); +``` + +#### Metadata + +Less.php keeps track of which `.less` files have been parsed, i.e. the input +file(s) and any direct and indirect imports. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +$files = $parser->AllParsedFiles(); +``` + +#### Compress output + +You can tell Less.php to remove comments and whitespace to generate minified CSS. + +```php +$options = [ 'compress' => true ]; +$parser = new Less_Parser( $options ); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +#### Get variables + +You can use the `getVariables()` method to get an all variables defined and +their value in an associative array. Note that the input must be compiled first +by calling `getCss()`. + +```php +$parser = new Less_Parser; +$parser->parseFile( '/var/www/mysite/bootstrap.less'); +$css = $parser->getCss(); +$variables = $parser->getVariables(); + +``` + +#### Set variables + +Use the `ModifyVars()` method to inject additional variables, i.e. custom values +computed or accessed from your PHP code. + +```php +$parser = new Less_Parser(); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$parser->ModifyVars( [ 'font-size-base' => '16px' ] ); +$css = $parser->getCss(); +``` + +#### Import directories + +By default, Less.php will look for imported files in the directory of the file passed to `parseFile()`. + +If you use `parse()`, or if need to enable additional import directories, you can specify these by +calling `SetImportDirs()`. + +```php +$directories = [ '/var/www/mysite/bootstrap/' => '/mysite/bootstrap/' ]; +$parser = new Less_Parser(); +$parser->SetImportDirs( $directories ); +$parser->parseFile( '/var/www/mysite/theme.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +## Caching + +Compiling LESS code into CSS can be a time-consuming process. It is recommended to cache your results. + +#### Basic cache + +Use the `Less_Cache` class to save and reuse the results of compiling LESS files. +This class will check the modified time and size of each LESS file (including imported files) and +either re-use or re-generate the CSS output accordingly. + +The cache files are determinstically named, based on the full list of referenced LESS files and the metadata (file path, file mtime, file size) of each file. This means that each time a change is made, a different cache filename is used. + +```php +$lessFiles = [ '/var/www/mysite/bootstrap.less' => '/mysite/' ]; +$options = [ 'cache_dir' => '/var/www/writable_folder' ]; +$cssOutputFile = Less_Cache::Get( $lessFiles, $options ); +$css = file_get_contents( '/var/www/writable_folder/' . $cssOutputFile ); +``` + +#### Caching with variables + +Passing custom variables to `Less_Cache::Get()`: + +```php +$lessFiles = [ '/var/www/mysite/bootstrap.less' => '/mysite/' ]; +$options = [ 'cache_dir' => '/var/www/writable_folder' ]; +$variables = [ 'width' => '100px' ]; +$cssOutputFile = Less_Cache::Get( $lessFiles, $options, $variables ); +$css = file_get_contents( '/var/www/writable_folder/' . $cssOutputFile ); +``` + +#### Incremental caching + +In addition to the whole-output caching described above, Less.php also has the ability to keep an internal cache which allows re-parses to be faster by effectively only re-compiling portions that have changed. + +## Source maps + +Less.php supports v3 sourcemaps. + +#### Inline + +The sourcemap will be appended to the generated CSS file. + +```php +$options = [ 'sourceMap' => true ]; +$parser = new Less_Parser($options); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +#### Saving to map file + +```php +$options = [ + 'sourceMap' => true, + 'sourceMapWriteTo' => '/var/www/mysite/writable_folder/filename.map', + 'sourceMapURL' => '/mysite/writable_folder/filename.map', +]; +$parser = new Less_Parser($options); +$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); +$css = $parser->getCss(); +``` + +## Command line + +An additional script has been included to use the Less.php compiler from the command line. +In its simplest invocation, you specify an input file and the compiled CSS is written to standard out: + +``` +$ lessc input.less > output.css +``` + +By using the `-w` flag you can watch a specified input file and have it compile as needed to the output file: + +``` +$ lessc -w input.less output.css +``` + +Errors from watch mode are written to standard out. + +For more information, run `lessc --help` diff --git a/vendor/wikimedia/less.php/CHANGES.md b/vendor/wikimedia/less.php/CHANGES.md index 0164bd1c7..3334aeb48 100644 --- a/vendor/wikimedia/less.php/CHANGES.md +++ b/vendor/wikimedia/less.php/CHANGES.md @@ -1,55 +1,91 @@ -# 2.0.0 -- [All Changes](https://github.com/wikimedia/less.php/compare/1.8.2...2.0.0) -- Relax PHP requirement down to 7.1, from 7.2.9 (Franz Liedke) -- Reflect recent breaking changes properly with the semantic versioning (James Forrester) +# Changelog -# 1.8.2 -- [All Changes](https://github.com/wikimedia/less.php/compare/1.8.1...1.8.2) -- Require PHP 7.2.9+, up from 5.3+ (James Forrester) -- Release: Update Version.php with the current release ID (COBadger) -- Fix access array offset on value of type null (Michele Locati) -- Fixed test suite on PHP 7.4 (Sergei Morozov) -- docs: Fix 1.8.1 "All changes" link (Timo Tijhof) +## 3.2.1 -# 1.8.1 -- [All Changes](https://github.com/wikimedia/less.php/compare/v1.8.0...1.8.1) -- Another PHP 7.3 compatibility tweak +* [All changes](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+log/v3.2.1) +* Tree_Ruleset: Fix support for nested parent selectors (Timo Tijhof) [T204816](https://phabricator.wikimedia.org/T204816) +* Fix ParseError when interpolating variable after colon in selector (Timo Tijhof) [T327163](https://phabricator.wikimedia.org/T327163) +* Functions: Fix "Undefined property" warning on bad minmax arg +* Tree_Call: Include previous exception when catching functions (Robert Frunzke) -# 1.8.0 -- [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.13...v1.8.0) -- Wikimedia fork -- Supports up to PHP 7.3 -- No longer tested against PHP 5, though it's still remains allowed in `composer.json` for HHVM compatibility -- Switched to [semantic versioning](https://semver.org/), hence version numbers now use 3 digits +## 3.2.0 -# 1.7.0.13 - - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.12...v1.7.0.13) - - Fix composer.json (PSR-4 was invalid) +* [All changes](https://github.com/wikimedia/less.php/compare/v3.1.0...v3.2.0) +* Fix "Implicit conversion" PHP 8.1 warnings (Ayokunle Odusan) +* Fix "Creation of dynamic property" PHP 8.2 warnings (Bas Couwenberg) +* Fix "Creation of dynamic property" PHP 8.2 warnings (Rajesh Kumar) +* Tree_Url: Add support for "Url" type to `Parser::getVariables()` (ciroarcadio) [#51](https://github.com/wikimedia/less.php/pull/51) +* Tree_Import: Add support for importing URLs without file extension (Timo Tijhof) [#27](https://github.com/wikimedia/less.php/issues/27) -# 1.7.0.12 - - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.11...v1.7.0.12) - - set bin/lessc bit executable - - Add 'gettingVariables' method in Less_Parser +## 3.1.0 -# 1.7.0.11 - - [All Changes](https://github.com/Asenar/less.php/compare/v1.7.0.10...v1.7.0.11) - - Fix realpath issue (windows) - - Set Less_Tree_Call property back to public ( Fix 258 266 267 issues from oyejorge/less.php) +* [All changes](https://github.com/wikimedia/less.php/compare/v3.0.0...v3.1.0) +* Add PHP 8.0 support: Drop use of curly braces for sub-string eval (James D. Forrester) +* Make `Directive::__construct` $rules arg optional (fix PHP 7.4 warning) (Sam Reed) +* ProcessExtends: Improve performance by using a map for selectors and parents (Andrey Legayev) -# 1.7.0.10 +## 3.0.0 - - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.9...v1.7.10) - - Add indentation option - - Add 'optional' modifier for @import - - fix $color in Exception messages - - don't use set_time_limit when running cli - - take relative-url into account when building the cache filename - - urlArgs should be string no array() - - add bug-report fixtures [#6dc898f](https://github.com/oyejorge/less.php/commit/6dc898f5d75b447464906bdf19d79c2e19d95e33) - - fix #269, missing on NameValue type [#a8dac63](https://github.com/oyejorge/less.php/commit/a8dac63d93fb941c54fb78b12588abf635747c1b) +* [All changes](https://github.com/wikimedia/less.php/compare/v2.0.0...v3.0.0) +* Raise PHP requirement from 7.1 to 7.2.9 (James Forrester) -# 1.7.0.9 +## 2.0.0 - - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.8...v1.7.0.9) - - Remove space at beginning of Version.php - - Revert require() paths in test interface +* [All changes](https://github.com/wikimedia/less.php/compare/v1.8.2...v2.0.0) +* Relax PHP requirement down to 7.1, from 7.2.9 (Franz Liedke) +* Reflect recent breaking changes properly with the semantic versioning (James Forrester) + +## 1.8.2 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.8.1...v1.8.2) +* Require PHP 7.2.9+, up from 5.3+ (James Forrester) +* release: Update Version.php with the current release ID (COBadger) +* Fix access array offset on value of type null (Michele Locati) +* Fix test suite on PHP 7.4 (Sergei Morozov) + +## 1.8.1 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.8.0...v1.8.1) +* Another PHP 7.3 compatibility tweak + +## 1.8.0 + +Library forked by Wikimedia, from [oyejorge/less.php](https://github.com/oyejorge/less.php). + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.13...v1.8.0) +* Supports up to PHP 7.3 +* No longer tested against PHP 5, though it's still remains allowed in `composer.json` for HHVM compatibility +* Switched to [semantic versioning](https://semver.org/), hence version numbers now use 3 digits + +## 1.7.0.13 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.12...v1.7.0.13) +* Fix composer.json (PSR-4 was invalid) + +## 1.7.0.12 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.11...v1.7.0.12) +* set bin/lessc bit executable +* Add `gettingVariables` method to `Less_Parser` + +## 1.7.0.11 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.10...v1.7.0.11) +* Fix realpath issue (windows) +* Set Less_Tree_Call property back to public ( Fix 258 266 267 issues from oyejorge/less.php) + +## 1.7.0.10 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.9...v1.7.10) +* Add indentation option +* Add `optional` modifier for `@import` +* Fix $color in Exception messages +* take relative-url into account when building the cache filename +* urlArgs should be string no array() +* fix missing on NameValue type [#269](https://github.com/oyejorge/less.php/issues/269) + +## 1.7.0.9 + +* [All changes](https://github.com/wikimedia/less.php/compare/v1.7.0.8...v1.7.0.9) +* Remove space at beginning of Version.php +* Revert require() paths in test interface diff --git a/vendor/wikimedia/less.php/CODE_OF_CONDUCT.md b/vendor/wikimedia/less.php/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..498acf76f --- /dev/null +++ b/vendor/wikimedia/less.php/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct). diff --git a/vendor/wikimedia/less.php/LICENSE b/vendor/wikimedia/less.php/LICENSE index 82216a5da..d64569567 100644 --- a/vendor/wikimedia/less.php/LICENSE +++ b/vendor/wikimedia/less.php/LICENSE @@ -1,178 +1,202 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -1. Definitions. + 1. Definitions. - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. -END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/wikimedia/less.php/NOTICE.txt b/vendor/wikimedia/less.php/NOTICE.txt new file mode 100644 index 000000000..099293ca0 --- /dev/null +++ b/vendor/wikimedia/less.php/NOTICE.txt @@ -0,0 +1,18 @@ +wikimedia/less.php. https://gerrit.wikimedia.org/g/mediawiki/libs/less.php + +Copyright Matt Agar <https://github.com/agar> +Copyright Martin Jantošovič <https://github.com/Mordred> +Copyright Josh Schmidt <https://github.com/oyejorge> +Copyright Timo Tijhof <https://timotijhof.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/wikimedia/less.php/README.md b/vendor/wikimedia/less.php/README.md index 440c4db06..a89ea6ce7 100644 --- a/vendor/wikimedia/less.php/README.md +++ b/vendor/wikimedia/less.php/README.md @@ -1,323 +1,77 @@ -[Less.php](http://lessphp.typesettercms.com) +[![Packagist](https://img.shields.io/packagist/v/wikimedia/less.php.svg?style=flat)](https://packagist.org/packages/wikimedia/less.php) + +Less.php ======== -This is the Wikimedia fork of a PHP port of the official LESS processor <http://lesscss.org>. [![Build Status](https://travis-ci.org/wikimedia/less.php.png?branch=master)](https://travis-ci.org/wikimedia/less.php) +This is a PHP port of the [official LESS processor](https://lesscss.org). -* [About](#about) -* [Installation](#installation) -* [Basic Use](#basic-use) -* [Caching](#caching) -* [Source Maps](#source-maps) -* [Command Line](#command-line) -* [Integration with other projects](#integration-with-other-projects) -* [Transitioning from Leafo/lessphp](#transitioning-from-leafolessphp) -* [Credits](#credits) +## About +The code structure of Less.php mirrors that of upstream Less.js to ensure compatibility and help reduce maintenance. The port is currently compatible with Less.js 2.5.3. Please note that "inline JavaScript expressions" (via eval or backticks) are not supported. +* [API § Caching](./API.md#caching), Less.php includes a file-based cache. +* [API § Source maps](./API.md#source-maps), Less.php supports v3 sourcemaps. +* [API § Command line](./API.md#command-line), the `lessc` command includes a watch mode. -About ---- -The code structure of less.php mirrors that of the official processor which helps us ensure compatibility and allows for easy maintenance. +## Installation -Please note, there are a few unsupported LESS features: +You can install the library with Composer or standalone. -- Evaluation of JavaScript expressions within back-ticks (for obvious reasons). -- Definition of custom functions. +If you have [Composer](https://getcomposer.org/download/) installed: +1. Run `composer require wikimedia/less.php` +2. Use `Less_Parser` in your code. -Installation ---- +Or standalone: -You can install the library with Composer or manually. +1. [Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz) and upload the PHP files to your server. +2. Include the library: + ```php + require_once '[path to]/less.php/lib/Less/Autoloader.php'; + Less_Autoloader::register(); + ``` +3. Use `Less_Parser` in your code. -#### Composer +## Security -1. [Install Composer](https://getcomposer.org/download/) -2. Run `composer require wikimedia/less.php` +The LESS processor language is powerful and includes features that may read or embed arbitrary files that the web server has access to, and features that may be computationally exensive if misused. -#### Manually From Release +In general you should treat LESS files as being in the same trust domain as other server-side executables, such as PHP code. In particular, it is not recommended to allow people that use your web service to provide arbitrary LESS code for server-side processing. -Step 1. [Download the latest release](https://github.com/wikimedia/less.php/releases) and upload the PHP files to your server. +_See also [SECURITY](./SECURITY.md)._ -Step 2. Include the library: +## Who uses Less.php? -```php -require_once '[path to less.php]/Less.php'; -``` +* **[Wikipedia](https://en.wikipedia.org/wiki/MediaWiki)** and the MediaWiki platform ([docs](https://www.mediawiki.org/wiki/ResourceLoader/Architecture#Resource:_Styles)). +* **[Matomo](https://en.wikipedia.org/wiki/Matomo_(software))** ([docs](https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/custom_preprocess.html)). +* **[Magento](https://en.wikipedia.org/wiki/Magento)** as part of Adobe Commerce ([docs](https://developer.matomo.org/guides/asset-pipeline#vanilla-javascript-css-and-less-files)). +* **[Icinga](https://en.wikipedia.org/wiki/Icinga)** in Icinga Web ([docs](https://github.com/Icinga/icingaweb2)). +* **[Shopware](https://de.wikipedia.org/wiki/Shopware)** ([docs](https://developers.shopware.com/designers-guide/less/)). -#### Manually From Source +## Integrations -Step 1. [Download the source](https://github.com/wikimedia/less.php/archive/master.zip) and upload the files in /lib/Less to a folder on your server. +Less.php has been integrated with various other projects. -Step 2. Include the library and register the autoloader +#### Transitioning from Leafo/lessphp -```php -require_once '[path to less.php]/Autoloader.php'; -Less_Autoloader::register(); -``` +If you're looking to transition from the [Leafo/lessphp](https://github.com/leafo/lessphp) library, use the `lessc.inc.php` adapter file that comes with Less.php. -Basic Use ---- +This allows Less.php to be a drop-in replacement for Leafo/lessphp. -#### Parsing Strings +[Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz), unzip the files into your project, and include its `lessc.inc.php` instead. -```php -$parser = new Less_Parser(); -$parser->parse( '@color: #4D926F; #header { color: @color; } h2 { color: @color; }' ); -$css = $parser->getCss(); -``` +Note: The `setPreserveComments` option is ignored. Less.php already preserves CSS block comments by default, and removes LESS inline comments. +#### Drupal -#### Parsing LESS Files -The parseFile() function takes two arguments: - -1. The absolute path of the .less file to be parsed -2. The url root to prepend to any relative image or @import urls in the .less file. - -```php -$parser = new Less_Parser(); -$parser->parseFile( '/var/www/mysite/bootstrap.less', 'http://example.com/mysite/' ); -$css = $parser->getCss(); -``` - - -#### Handling Invalid LESS -An exception will be thrown if the compiler encounters invalid LESS. - -```php -try{ - $parser = new Less_Parser(); - $parser->parseFile( '/var/www/mysite/bootstrap.less', 'http://example.com/mysite/' ); - $css = $parser->getCss(); -}catch(Exception $e){ - $error_message = $e->getMessage(); -} -``` - - -#### Parsing Multiple Sources -less.php can parse multiple sources to generate a single CSS file. - -```php -$parser = new Less_Parser(); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$parser->parse( '@color: #4D926F; #header { color: @color; } h2 { color: @color; }' ); -$css = $parser->getCss(); -``` - -#### Getting Info About The Parsed Files -less.php can tell you which .less files were imported and parsed. - -```php -$parser = new Less_Parser(); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$css = $parser->getCss(); -$imported_files = $parser->allParsedFiles(); -``` - - -#### Compressing Output -You can tell less.php to remove comments and whitespace to generate minimized CSS files. - -```php -$options = array( 'compress'=>true ); -$parser = new Less_Parser( $options ); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$css = $parser->getCss(); -``` - -#### Getting Variables -You can use the getVariables() method to get an all variables defined and -their value in a php associative array. Note that LESS has to be previously -compiled. -```php -$parser = new Less_Parser; -$parser->parseFile( '/var/www/mysite/bootstrap.less'); -$css = $parser->getCss(); -$variables = $parser->getVariables(); - -``` - - - -#### Setting Variables -You can use the ModifyVars() method to customize your CSS if you have variables stored in PHP associative arrays. - -```php -$parser = new Less_Parser(); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$parser->ModifyVars( array('font-size-base'=>'16px') ); -$css = $parser->getCss(); -``` - - -#### Import Directories -By default, less.php will look for @imports in the directory of the file passed to parseFile(). -If you're using parse() or if @imports reside in different directories, you can tell less.php where to look. - -```php -$directories = array( '/var/www/mysite/bootstrap/' => '/mysite/bootstrap/' ); -$parser = new Less_Parser(); -$parser->SetImportDirs( $directories ); -$parser->parseFile( '/var/www/mysite/theme.less', '/mysite/' ); -$css = $parser->getCss(); -``` - - -Caching ---- -Compiling LESS code into CSS is a time consuming process, caching your results is highly recommended. - - -#### Caching CSS -Use the Less_Cache class to save and reuse the results of compiled LESS files. -This method will check the modified time and size of each LESS file (including imported files) and regenerate a new CSS file when changes are found. -Note: When changes are found, this method will return a different file name for the new cached content. - -```php -$less_files = array( '/var/www/mysite/bootstrap.less' => '/mysite/' ); -$options = array( 'cache_dir' => '/var/www/writable_folder' ); -$css_file_name = Less_Cache::Get( $less_files, $options ); -$compiled = file_get_contents( '/var/www/writable_folder/'.$css_file_name ); -``` - -#### Caching CSS With Variables -Passing options to Less_Cache::Get() - -```php -$less_files = array( '/var/www/mysite/bootstrap.less' => '/mysite/' ); -$options = array( 'cache_dir' => '/var/www/writable_folder' ); -$variables = array( 'width' => '100px' ); -$css_file_name = Less_Cache::Get( $less_files, $options, $variables ); -$compiled = file_get_contents( '/var/www/writable_folder/'.$css_file_name ); -``` - - -#### Parser Caching -less.php will save serialized parser data for each .less file if a writable folder is passed to the SetCacheDir() method. -Note: This feature only caches intermediate parsing results to improve the performance of repeated CSS generation. -Your application should cache any CSS generated by less.php. - -```php -$options = array('cache_dir'=>'/var/www/writable_folder'); -$parser = new Less_Parser( $options ); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$css = $parser->getCss(); -``` - -You can specify the caching technique used by changing the ```cache_method``` option. Supported methods are: -* ```php```: Creates valid PHP files which can be included without any changes (default method). -* ```var_export```: Like "php", but using PHP's ```var_export()``` function without any optimizations. - It's recommended to use "php" instead. -* ```serialize```: Faster, but pretty memory-intense. -* ```callback```: Use custom callback functions to implement your own caching method. Give the "cache_callback_get" and - "cache_callback_set" options with callables (see PHP's ```call_user_func()``` and ```is_callable()``` functions). less.php - will pass the parser object (class ```Less_Parser```), the path to the parsed .less file ("/some/path/to/file.less") and - an identifier that will change every time the .less file is modified. The ```get``` callback must return the ruleset - (an array with ```Less_Tree``` objects) provided as fourth parameter of the ```set``` callback. If something goes wrong, - return ```NULL``` (cache doesn't exist) or ```FALSE```. - - - -Source Maps ---- -Less.php supports v3 sourcemaps - -#### Inline -The sourcemap will be appended to the generated CSS file. - -```php -$options = array( 'sourceMap' => true ); -$parser = new Less_Parser($options); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$css = $parser->getCss(); -``` - -#### Saving to Map File - -```php -$options = array( - 'sourceMap' => true, - 'sourceMapWriteTo' => '/var/www/mysite/writable_folder/filename.map', - 'sourceMapURL' => '/mysite/writable_folder/filename.map', - ); -$parser = new Less_Parser($options); -$parser->parseFile( '/var/www/mysite/bootstrap.less', '/mysite/' ); -$css = $parser->getCss(); -``` - - -Command line ---- -An additional script has been included to use the compiler from the command line. -In the simplest invocation, you specify an input file and the compiled CSS is written to standard out: - -``` -$ lessc input.less > output.css -``` - -By using the -w flag you can watch a specified input file and have it compile as needed to the output file: - -``` -$ lessc -w input.less output.css -``` - -Errors from watch mode are written to standard out. - -For more help, run `lessc --help` - - -Integration with other projects ---- - -#### Drupal 7 - -This library can be used as drop-in replacement of lessphp to work with [Drupal 7 less module](https://drupal.org/project/less). - -How to install: - -1. [Download the less.php source code](https://github.com/wikimedia/less.php/archive/master.zip) and unzip it so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'. -2. Download and install [Drupal 7 less module](https://drupal.org/project/less) as usual. -3. That's it :) - -#### JBST WordPress theme - -JBST has a built-in LESS compiler based on lessphp. Customize your WordPress theme with LESS. - -How to use / install: - -1. [Download the latest release](https://github.com/bassjobsen/jamedo-bootstrap-start-theme) copy the files to your {wordpress/}wp-content/themes folder and activate it. -2. Find the compiler under Appearance > LESS Compiler in your WordPress dashboard -3. Enter your LESS code in the text area and press (re)compile - -Use the built-in compiler to: -- set any [Bootstrap](http://getbootstrap.com/customize/) variable or use Bootstrap's mixins: - -`@navbar-default-color: blue;` - - create a custom button: `.btn-custom { - .button-variant(white; red; blue); -}` -- set any built-in LESS variable: for example `@footer_bg_color: black;` sets the background color of the footer to black -- use built-in mixins: - add a custom font: `.include-custom-font(@family: arial,@font-path, @path: @custom-font-dir, @weight: normal, @style: normal);` - -The compiler can also be downloaded as [plugin](http://wordpress.org/plugins/wp-less-to-css/) +Less.php can be used with [Drupal's less module](https://drupal.org/project/less) via the `lessc.inc.php` adapter. [Download Less.php](https://gerrit.wikimedia.org/g/mediawiki/libs/less.php/+archive/HEAD.tar.gz) and unzip it so that `lessc.inc.php` is located at `sites/all/libraries/lessphp/lessc.inc.php`, then install the Drupal less module as usual. #### WordPress -This simple plugin will simply make the library available to other plugins and themes and can be used as a dependency using the [TGM Library](http://tgmpluginactivation.com/) +* [wp_enqueue_less](https://github.com/Ed-ITSolutions/wp_enqueue_less) is a Composer package for use in WordPress themes and plugins. It provides a `wp_enqueue_less()` function to automatically manage caching and compilation on-demand, and loads the compressed CSS on the page. +* [JBST framework](https://github.com/bassjobsen/jamedo-bootstrap-start-theme) bundles a copy of Less.php. +* The [lessphp plugin](https://wordpress.org/plugins/lessphp/) bundles a copy of Less.php for use in other plugins or themes. This dependency can also be combined with the [TGM Library](http://tgmpluginactivation.com/). -How to install: - -1. Install the plugin from your WordPress Dashboard: http://wordpress.org/plugins/lessphp/ -2. That's it :) - - -Transitioning from Leafo/lessphp ---- -Projects looking for an easy transition from leafo/lessphp can use the lessc.inc.php adapter. To use, [Download the less.php source code](https://github.com/wikimedia/less.php/archive/master.zip) and unzip the files into your project so that the new 'lessc.inc.php' replaces the existing 'lessc.inc.php'. - -Note, the 'setPreserveComments' will no longer have any effect on the compiled LESS. - -Credits ---- -less.php was originally ported to PHP by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred). This Wikimedia-maintained fork was split off from [Josh Schmidt's version](https://github.com/oyejorge/less.php). +## Credits +Less.php was originally ported to PHP in 2011 by [Matt Agar](https://github.com/agar) and then updated by [Martin Jantošovič](https://github.com/Mordred) in 2012. From 2013 to 2017, [Josh Schmidt](https://github.com/oyejorge) lead development of the library. Since 2019, the library is maintained by Wikimedia Foundation. diff --git a/vendor/wikimedia/less.php/SECURITY.md b/vendor/wikimedia/less.php/SECURITY.md new file mode 100644 index 000000000..687c7357c --- /dev/null +++ b/vendor/wikimedia/less.php/SECURITY.md @@ -0,0 +1,5 @@ +# Security policy + +Wikimedia takes security seriously. If you believe you have found a +security issue, see <https://www.mediawiki.org/wiki/Reporting_security_bugs> +for information on how to responsibly report it. diff --git a/vendor/wikimedia/less.php/bin/lessc b/vendor/wikimedia/less.php/bin/lessc index fa1fb9588..7e3d128d8 100755 --- a/vendor/wikimedia/less.php/bin/lessc +++ b/vendor/wikimedia/less.php/bin/lessc @@ -1,7 +1,7 @@ #!/usr/bin/env php <?php -require_once dirname(__FILE__) . '/../lib/Less/Autoloader.php'; +require_once __DIR__ . '/../lib/Less/Autoloader.php'; Less_Autoloader::register(); // Create our environment diff --git a/vendor/wikimedia/less.php/composer.json b/vendor/wikimedia/less.php/composer.json deleted file mode 100644 index b03364f6e..000000000 --- a/vendor/wikimedia/less.php/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "wikimedia/less.php", - "description": "PHP port of the Javascript version of LESS http://lesscss.org (Originally maintained by Josh Schmidt)", - "keywords": [ "less", "css", "php", "stylesheet", "less.js", "lesscss" ], - "license": "Apache-2.0", - "authors": [ - { - "name": "Josh Schmidt", - "homepage": "https://github.com/oyejorge" - }, - { - "name": "Matt Agar", - "homepage": "https://github.com/agar" - }, - { - "name": "Martin Jantošovič", - "homepage": "https://github.com/Mordred" - } - ], - "require": { - "PHP" : ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "7.5.14" - }, - "scripts": { - "test": [ - "phpunit" - ] - }, - "autoload": { - "psr-0": { "Less": "lib/" }, - "classmap": ["lessc.inc.php"] - }, - "bin": [ - "bin/lessc" - ] -} diff --git a/vendor/wikimedia/less.php/lessc.inc.php b/vendor/wikimedia/less.php/lessc.inc.php index e6cdf20ab..a3c66dd26 100644 --- a/vendor/wikimedia/less.php/lessc.inc.php +++ b/vendor/wikimedia/less.php/lessc.inc.php @@ -14,16 +14,17 @@ if ( !class_exists( 'Less_Parser' ) ) { class lessc { - static public $VERSION = Less_Version::less_version; + public static $VERSION = Less_Version::less_version; public $importDir = ''; - protected $allParsedFiles = array(); - protected $libFunctions = array(); - protected $registeredVars = array(); + protected $allParsedFiles = []; + protected $libFunctions = []; + protected $registeredVars = []; private $formatterName; - private $options = array(); + private $options = []; - public function __construct( $lessc=null, $sourceName=null ) {} + public function __construct( $lessc = null, $sourceName = null ) { + } public function setImportDir( $dirs ) { $this->importDir = (array)$dirs; @@ -38,7 +39,8 @@ class lessc { $this->formatterName = $name; } - public function setPreserveComments( $preserve ) {} + public function setPreserveComments( $preserve ) { + } public function registerFunction( $name, $func ) { $this->libFunctions[$name] = $func; @@ -48,7 +50,7 @@ class lessc { unset( $this->libFunctions[$name] ); } - public function setVariables( $variables ){ + public function setVariables( $variables ) { foreach ( $variables as $name => $value ) { $this->setVariable( $name, $value ); } @@ -64,16 +66,15 @@ class lessc { public function setOptions( $options ) { foreach ( $options as $name => $value ) { - $this->setOption( $name, $value); + $this->setOption( $name, $value ); } } - + public function setOption( $name, $value ) { $this->options[$name] = $value; } - - public function parse( $buffer, $presets = array() ) { + public function parse( $buffer, $presets = [] ) { $this->setVariables( $presets ); $parser = new Less_Parser( $this->getOptions() ); @@ -81,7 +82,7 @@ class lessc { foreach ( $this->libFunctions as $name => $func ) { $parser->registerFunction( $name, $func ); } - $parser->parse($buffer); + $parser->parse( $buffer ); if ( count( $this->registeredVars ) ) { $parser->ModifyVars( $this->registeredVars ); } @@ -90,22 +91,21 @@ class lessc { } protected function getOptions() { - $options = array( 'relativeUrls'=>false ); - switch( $this->formatterName ) { + $options = [ 'relativeUrls' => false ]; + switch ( $this->formatterName ) { case 'compressed': $options['compress'] = true; break; } - if (is_array($this->options)) - { - $options = array_merge($options, $this->options); + if ( is_array( $this->options ) ) { + $options = array_merge( $options, $this->options ); } return $options; } protected function getImportDirs() { $dirs_ = (array)$this->importDir; - $dirs = array(); + $dirs = []; foreach ( $dirs_ as $dir ) { $dirs[$dir] = ''; } @@ -113,11 +113,10 @@ class lessc { } public function compile( $string, $name = null ) { - $oldImport = $this->importDir; $this->importDir = (array)$this->importDir; - $this->allParsedFiles = array(); + $this->allParsedFiles = []; $parser = new Less_Parser( $this->getOptions() ); $parser->SetImportDirs( $this->getImportDirs() ); @@ -142,7 +141,7 @@ class lessc { public function compileFile( $fname, $outFname = null ) { if ( !is_readable( $fname ) ) { - throw new Exception( 'load error: failed to find '.$fname ); + throw new Exception( 'load error: failed to find ' . $fname ); } $pi = pathinfo( $fname ); @@ -150,9 +149,9 @@ class lessc { $oldImport = $this->importDir; $this->importDir = (array)$this->importDir; - $this->importDir[] = Less_Parser::AbsPath( $pi['dirname'] ).'/'; + $this->importDir[] = Less_Parser::AbsPath( $pi['dirname'] ) . '/'; - $this->allParsedFiles = array(); + $this->allParsedFiles = []; $this->addParsedFile( $fname ); $parser = new Less_Parser( $this->getOptions() ); @@ -182,13 +181,12 @@ class lessc { public function checkedCompile( $in, $out ) { if ( !is_file( $out ) || filemtime( $in ) > filemtime( $out ) ) { - $this->compileFile($in, $out); + $this->compileFile( $in, $out ); return true; } return false; } - /** * Execute lessphp on a .less file or a lessphp cache structure * @@ -216,7 +214,7 @@ class lessc { if ( is_string( $in ) ) { $root = $in; } elseif ( is_array( $in ) and isset( $in['root'] ) ) { - if ( $force or ! isset( $in['files'] ) ) { + if ( $force or !isset( $in['files'] ) ) { // If we are forcing a recompile or if for some reason the // structure does not contain any file information we should // specify the root to trigger a rebuild. @@ -239,9 +237,9 @@ class lessc { if ( $root !== null ) { // If we have a root value which means we should rebuild. - $out = array(); + $out = []; $out['root'] = $root; - $out['compiled'] = $this->compileFile($root); + $out['compiled'] = $this->compileFile( $root ); $out['files'] = $this->allParsedFiles(); $out['updated'] = time(); return $out; @@ -263,7 +261,7 @@ class lessc { if ( $less === null ) { $less = new self; } - return $less->cachedCompile($in, $force); + return $less->cachedCompile( $in, $force ); } public function allParsedFiles() { diff --git a/vendor/wikimedia/less.php/lib/Less/Autoloader.php b/vendor/wikimedia/less.php/lib/Less/Autoloader.php index b6300c020..a4f7a4a23 100644 --- a/vendor/wikimedia/less.php/lib/Less/Autoloader.php +++ b/vendor/wikimedia/less.php/lib/Less/Autoloader.php @@ -2,78 +2,56 @@ /** * Autoloader - * - * @package Less - * @subpackage autoload */ class Less_Autoloader { - /** - * Registered flag - * - * @var boolean - */ + /** @var bool */ protected static $registered = false; /** - * Library directory - * - * @var string - */ - protected static $libDir; - - /** - * Register the autoloader in the spl autoloader + * Register the autoloader in the SPL autoloader * * @return void * @throws Exception If there was an error in registration */ - public static function register(){ - if( self::$registered ){ + public static function register() { + if ( self::$registered ) { return; } - self::$libDir = dirname(__FILE__); - - if(false === spl_autoload_register(array('Less_Autoloader', 'loadClass'))){ - throw new Exception('Unable to register Less_Autoloader::loadClass as an autoloading method.'); + if ( !spl_autoload_register( [ 'Less_Autoloader', 'loadClass' ] ) ) { + throw new Exception( 'Unable to register Less_Autoloader::loadClass as an autoloading method.' ); } self::$registered = true; } /** - * Unregisters the autoloader + * Unregister the autoloader * * @return void */ - public static function unregister(){ - spl_autoload_unregister(array('Less_Autoloader', 'loadClass')); + public static function unregister() { + spl_autoload_unregister( [ 'Less_Autoloader', 'loadClass' ] ); self::$registered = false; } /** - * Loads the class + * Load the class * * @param string $className The class to load */ - public static function loadClass($className){ - - + public static function loadClass( $className ) { // handle only package classes - if(strpos($className, 'Less_') !== 0){ + if ( strpos( $className, 'Less_' ) !== 0 ) { return; } - $className = substr($className,5); - $fileName = self::$libDir . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + $className = substr( $className, 5 ); + $fileName = __DIR__ . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $className ) . '.php'; - if(file_exists($fileName)){ - require $fileName; - return true; - }else{ - throw new Exception('file not loadable '.$fileName); - } + require $fileName; + return true; } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Cache.php b/vendor/wikimedia/less.php/lib/Less/Cache.php index 40d0358dd..c8c4b4489 100644 --- a/vendor/wikimedia/less.php/lib/Less/Cache.php +++ b/vendor/wikimedia/less.php/lib/Less/Cache.php @@ -1,28 +1,21 @@ <?php -require_once( dirname(__FILE__).'/Version.php'); - /** * Utility for handling the generation and caching of css files - * - * @package Less - * @subpackage cache - * */ -class Less_Cache{ +class Less_Cache { // directory less.php can use for storing data - public static $cache_dir = false; + public static $cache_dir = false; // prefix for the storing data - public static $prefix = 'lessphp_'; + public static $prefix = 'lessphp_'; // prefix for the storing vars - public static $prefix_vars = 'lessphpvars_'; + public static $prefix_vars = 'lessphpvars_'; // specifies the number of seconds after which data created by less.php will be seen as 'garbage' and potentially cleaned up - public static $gc_lifetime = 604800; - + public static $gc_lifetime = 604800; /** * Save and reuse the results of compiled less files. @@ -32,101 +25,94 @@ class Less_Cache{ * @param array $less_files Array of .less files to compile * @param array $parser_options Array of compiler options * @param array $modify_vars Array of variables - * @return string Name of the css file + * @return string|false Name of the css file */ - public static function Get( $less_files, $parser_options = array(), $modify_vars = array() ){ - - - //check $cache_dir - if( isset($parser_options['cache_dir']) ){ - Less_Cache::$cache_dir = $parser_options['cache_dir']; + public static function Get( $less_files, $parser_options = [], $modify_vars = [] ) { + // check $cache_dir + if ( isset( $parser_options['cache_dir'] ) ) { + self::$cache_dir = $parser_options['cache_dir']; } - if( empty(Less_Cache::$cache_dir) ){ - throw new Exception('cache_dir not set'); + if ( empty( self::$cache_dir ) ) { + throw new Exception( 'cache_dir not set' ); } - if( isset($parser_options['prefix']) ){ - Less_Cache::$prefix = $parser_options['prefix']; + if ( isset( $parser_options['prefix'] ) ) { + self::$prefix = $parser_options['prefix']; } - if( empty(Less_Cache::$prefix) ){ - throw new Exception('prefix not set'); + if ( empty( self::$prefix ) ) { + throw new Exception( 'prefix not set' ); } - if( isset($parser_options['prefix_vars']) ){ - Less_Cache::$prefix_vars = $parser_options['prefix_vars']; + if ( isset( $parser_options['prefix_vars'] ) ) { + self::$prefix_vars = $parser_options['prefix_vars']; } - if( empty(Less_Cache::$prefix_vars) ){ - throw new Exception('prefix_vars not set'); + if ( empty( self::$prefix_vars ) ) { + throw new Exception( 'prefix_vars not set' ); } self::CheckCacheDir(); $less_files = (array)$less_files; + // create a file for variables + if ( !empty( $modify_vars ) ) { + $lessvars = Less_Parser::serializeVars( $modify_vars ); + $vars_file = self::$cache_dir . self::$prefix_vars . sha1( $lessvars ) . '.less'; - //create a file for variables - if( !empty($modify_vars) ){ - $lessvars = Less_Parser::serializeVars($modify_vars); - $vars_file = Less_Cache::$cache_dir . Less_Cache::$prefix_vars . sha1($lessvars) . '.less'; - - if( !file_exists($vars_file) ){ - file_put_contents($vars_file, $lessvars); + if ( !file_exists( $vars_file ) ) { + file_put_contents( $vars_file, $lessvars ); } - $less_files += array($vars_file => '/'); + $less_files += [ $vars_file => '/' ]; } - // generate name for compiled css file - $hash = md5(json_encode($less_files)); - $list_file = Less_Cache::$cache_dir . Less_Cache::$prefix . $hash . '.list'; + $hash = md5( json_encode( $less_files ) ); + $list_file = self::$cache_dir . self::$prefix . $hash . '.list'; - // check cached content - if( !isset($parser_options['use_cache']) || $parser_options['use_cache'] === true ){ - if( file_exists($list_file) ){ + // check cached content + if ( !isset( $parser_options['use_cache'] ) || $parser_options['use_cache'] === true ) { + if ( file_exists( $list_file ) ) { - self::ListFiles($list_file, $list, $cached_name); - $compiled_name = self::CompiledName($list, $hash); + self::ListFiles( $list_file, $list, $cached_name ); + $compiled_name = self::CompiledName( $list, $hash ); // if $cached_name is the same as the $compiled name, don't regenerate - if( !$cached_name || $cached_name === $compiled_name ){ + if ( !$cached_name || $cached_name === $compiled_name ) { - $output_file = self::OutputFile($compiled_name, $parser_options ); + $output_file = self::OutputFile( $compiled_name, $parser_options ); - if( $output_file && file_exists($output_file) ){ - @touch($list_file); - return basename($output_file); // for backwards compatibility, we just return the name of the file + if ( $output_file && file_exists( $output_file ) ) { + @touch( $list_file ); + return basename( $output_file ); // for backwards compatibility, we just return the name of the file } } } } $compiled = self::Cache( $less_files, $parser_options ); - if( !$compiled ){ + if ( !$compiled ) { return false; } $compiled_name = self::CompiledName( $less_files, $hash ); - $output_file = self::OutputFile($compiled_name, $parser_options ); + $output_file = self::OutputFile( $compiled_name, $parser_options ); - - //save the file list + // save the file list $list = $less_files; $list[] = $compiled_name; - $cache = implode("\n",$list); + $cache = implode( "\n", $list ); file_put_contents( $list_file, $cache ); - - //save the css + // save the css file_put_contents( $output_file, $compiled ); - - //clean up + // clean up self::CleanCache(); - return basename($output_file); + return basename( $output_file ); } /** @@ -137,29 +123,20 @@ class Less_Cache{ * @param array $modify_vars Array of variables * @return string Name of the css file */ - public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ){ + public static function Regen( $less_files, $parser_options = [], $modify_vars = [] ) { $parser_options['use_cache'] = false; return self::Get( $less_files, $parser_options, $modify_vars ); } - public static function Cache( &$less_files, $parser_options = array() ){ - - - // get less.php if it exists - $file = dirname(__FILE__) . '/Less.php'; - if( file_exists($file) && !class_exists('Less_Parser') ){ - require_once($file); - } - - $parser_options['cache_dir'] = Less_Cache::$cache_dir; - $parser = new Less_Parser($parser_options); - + public static function Cache( &$less_files, $parser_options = [] ) { + $parser_options['cache_dir'] = self::$cache_dir; + $parser = new Less_Parser( $parser_options ); // combine files - foreach($less_files as $file_path => $uri_or_less ){ + foreach ( $less_files as $file_path => $uri_or_less ) { - //treat as less markup if there are newline characters - if( strpos($uri_or_less,"\n") !== false ){ + // treat as less markup if there are newline characters + if ( strpos( $uri_or_less, "\n" ) !== false ) { $parser->Parse( $uri_or_less ); continue; } @@ -169,77 +146,66 @@ class Less_Cache{ $compiled = $parser->getCss(); - $less_files = $parser->allParsedFiles(); return $compiled; } + private static function OutputFile( $compiled_name, $parser_options ) { + // custom output file + if ( !empty( $parser_options['output'] ) ) { - private static function OutputFile( $compiled_name, $parser_options ){ - - //custom output file - if( !empty($parser_options['output']) ){ - - //relative to cache directory? - if( preg_match('#[\\\\/]#',$parser_options['output']) ){ + // relative to cache directory? + if ( preg_match( '#[\\\\/]#', $parser_options['output'] ) ) { return $parser_options['output']; } - return Less_Cache::$cache_dir.$parser_options['output']; + return self::$cache_dir . $parser_options['output']; } - return Less_Cache::$cache_dir.$compiled_name; + return self::$cache_dir . $compiled_name; } - - private static function CompiledName( $files, $extrahash ){ - - //save the file list - $temp = array(Less_Version::cache_version); - foreach($files as $file){ - $temp[] = filemtime($file)."\t".filesize($file)."\t".$file; + private static function CompiledName( $files, $extrahash ) { + // save the file list + $temp = [ Less_Version::cache_version ]; + foreach ( $files as $file ) { + $temp[] = filemtime( $file ) . "\t" . filesize( $file ) . "\t" . $file; } - return Less_Cache::$prefix.sha1(json_encode($temp).$extrahash).'.css'; + return self::$prefix . sha1( json_encode( $temp ) . $extrahash ) . '.css'; } - - public static function SetCacheDir( $dir ){ - Less_Cache::$cache_dir = $dir; + public static function SetCacheDir( $dir ) { + self::$cache_dir = $dir; self::CheckCacheDir(); } - public static function CheckCacheDir(){ + public static function CheckCacheDir() { + self::$cache_dir = str_replace( '\\', '/', self::$cache_dir ); + self::$cache_dir = rtrim( self::$cache_dir, '/' ) . '/'; - Less_Cache::$cache_dir = str_replace('\\','/',Less_Cache::$cache_dir); - Less_Cache::$cache_dir = rtrim(Less_Cache::$cache_dir,'/').'/'; - - if( !file_exists(Less_Cache::$cache_dir) ){ - if( !mkdir(Less_Cache::$cache_dir) ){ - throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir); + if ( !file_exists( self::$cache_dir ) ) { + if ( !mkdir( self::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: ' . self::$cache_dir ); } - }elseif( !is_dir(Less_Cache::$cache_dir) ){ - throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir); + } elseif ( !is_dir( self::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: ' . self::$cache_dir ); - }elseif( !is_writable(Less_Cache::$cache_dir) ){ - throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir); + } elseif ( !is_writable( self::$cache_dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: ' . self::$cache_dir ); } - } - /** * Delete unused less.php files - * */ - public static function CleanCache(){ + public static function CleanCache() { static $clean = false; - - if( $clean || empty(Less_Cache::$cache_dir) ){ + if ( $clean || empty( self::$cache_dir ) ) { return; } @@ -247,73 +213,64 @@ class Less_Cache{ // only remove files with extensions created by less.php // css files removed based on the list files - $remove_types = array('lesscache'=>1,'list'=>1,'less'=>1,'map'=>1); + $remove_types = [ 'lesscache' => 1,'list' => 1,'less' => 1,'map' => 1 ]; - $files = scandir(Less_Cache::$cache_dir); - if( !$files ){ + $files = scandir( self::$cache_dir ); + if ( !$files ) { return; } $check_time = time() - self::$gc_lifetime; - foreach($files as $file){ - + foreach ( $files as $file ) { // don't delete if the file wasn't created with less.php - if( strpos($file,Less_Cache::$prefix) !== 0 ){ + if ( strpos( $file, self::$prefix ) !== 0 ) { continue; } - $parts = explode('.',$file); - $type = array_pop($parts); + $parts = explode( '.', $file ); + $type = array_pop( $parts ); - - if( !isset($remove_types[$type]) ){ + if ( !isset( $remove_types[$type] ) ) { continue; } - $full_path = Less_Cache::$cache_dir . $file; - $mtime = filemtime($full_path); + $full_path = self::$cache_dir . $file; + $mtime = filemtime( $full_path ); // don't delete if it's a relatively new file - if( $mtime > $check_time ){ + if ( $mtime > $check_time ) { continue; } - // delete the list file and associated css file - if( $type === 'list' ){ - self::ListFiles($full_path, $list, $css_file_name); - if( $css_file_name ){ - $css_file = Less_Cache::$cache_dir . $css_file_name; - if( file_exists($css_file) ){ - unlink($css_file); + if ( $type === 'list' ) { + self::ListFiles( $full_path, $list, $css_file_name ); + if ( $css_file_name ) { + $css_file = self::$cache_dir . $css_file_name; + if ( file_exists( $css_file ) ) { + unlink( $css_file ); } } } - unlink($full_path); + unlink( $full_path ); } - - } - /** * Get the list of less files and generated css file from a list file - * */ - static function ListFiles($list_file, &$list, &$css_file_name ){ + static function ListFiles( $list_file, &$list, &$css_file_name ) { + $list = explode( "\n", file_get_contents( $list_file ) ); - $list = explode("\n",file_get_contents($list_file)); + // pop the cached name that should match $compiled_name + $css_file_name = array_pop( $list ); - //pop the cached name that should match $compiled_name - $css_file_name = array_pop($list); - - if( !preg_match('/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/',$css_file_name) ){ + if ( !preg_match( '/^' . self::$prefix . '[a-f0-9]+\.css$/', $css_file_name ) ) { $list[] = $css_file_name; $css_file_name = false; } - } } diff --git a/vendor/wikimedia/less.php/lib/Less/Colors.php b/vendor/wikimedia/less.php/lib/Less/Colors.php index ad3f31dc4..2f715c2b8 100644 --- a/vendor/wikimedia/less.php/lib/Less/Colors.php +++ b/vendor/wikimedia/less.php/lib/Less/Colors.php @@ -1,170 +1,176 @@ <?php - /** * Utility for css colors * - * @package Less - * @subpackage color + * @private */ class Less_Colors { - public static $colors = array( - 'aliceblue'=>'#f0f8ff', - 'antiquewhite'=>'#faebd7', - 'aqua'=>'#00ffff', - 'aquamarine'=>'#7fffd4', - 'azure'=>'#f0ffff', - 'beige'=>'#f5f5dc', - 'bisque'=>'#ffe4c4', - 'black'=>'#000000', - 'blanchedalmond'=>'#ffebcd', - 'blue'=>'#0000ff', - 'blueviolet'=>'#8a2be2', - 'brown'=>'#a52a2a', - 'burlywood'=>'#deb887', - 'cadetblue'=>'#5f9ea0', - 'chartreuse'=>'#7fff00', - 'chocolate'=>'#d2691e', - 'coral'=>'#ff7f50', - 'cornflowerblue'=>'#6495ed', - 'cornsilk'=>'#fff8dc', - 'crimson'=>'#dc143c', - 'cyan'=>'#00ffff', - 'darkblue'=>'#00008b', - 'darkcyan'=>'#008b8b', - 'darkgoldenrod'=>'#b8860b', - 'darkgray'=>'#a9a9a9', - 'darkgrey'=>'#a9a9a9', - 'darkgreen'=>'#006400', - 'darkkhaki'=>'#bdb76b', - 'darkmagenta'=>'#8b008b', - 'darkolivegreen'=>'#556b2f', - 'darkorange'=>'#ff8c00', - 'darkorchid'=>'#9932cc', - 'darkred'=>'#8b0000', - 'darksalmon'=>'#e9967a', - 'darkseagreen'=>'#8fbc8f', - 'darkslateblue'=>'#483d8b', - 'darkslategray'=>'#2f4f4f', - 'darkslategrey'=>'#2f4f4f', - 'darkturquoise'=>'#00ced1', - 'darkviolet'=>'#9400d3', - 'deeppink'=>'#ff1493', - 'deepskyblue'=>'#00bfff', - 'dimgray'=>'#696969', - 'dimgrey'=>'#696969', - 'dodgerblue'=>'#1e90ff', - 'firebrick'=>'#b22222', - 'floralwhite'=>'#fffaf0', - 'forestgreen'=>'#228b22', - 'fuchsia'=>'#ff00ff', - 'gainsboro'=>'#dcdcdc', - 'ghostwhite'=>'#f8f8ff', - 'gold'=>'#ffd700', - 'goldenrod'=>'#daa520', - 'gray'=>'#808080', - 'grey'=>'#808080', - 'green'=>'#008000', - 'greenyellow'=>'#adff2f', - 'honeydew'=>'#f0fff0', - 'hotpink'=>'#ff69b4', - 'indianred'=>'#cd5c5c', - 'indigo'=>'#4b0082', - 'ivory'=>'#fffff0', - 'khaki'=>'#f0e68c', - 'lavender'=>'#e6e6fa', - 'lavenderblush'=>'#fff0f5', - 'lawngreen'=>'#7cfc00', - 'lemonchiffon'=>'#fffacd', - 'lightblue'=>'#add8e6', - 'lightcoral'=>'#f08080', - 'lightcyan'=>'#e0ffff', - 'lightgoldenrodyellow'=>'#fafad2', - 'lightgray'=>'#d3d3d3', - 'lightgrey'=>'#d3d3d3', - 'lightgreen'=>'#90ee90', - 'lightpink'=>'#ffb6c1', - 'lightsalmon'=>'#ffa07a', - 'lightseagreen'=>'#20b2aa', - 'lightskyblue'=>'#87cefa', - 'lightslategray'=>'#778899', - 'lightslategrey'=>'#778899', - 'lightsteelblue'=>'#b0c4de', - 'lightyellow'=>'#ffffe0', - 'lime'=>'#00ff00', - 'limegreen'=>'#32cd32', - 'linen'=>'#faf0e6', - 'magenta'=>'#ff00ff', - 'maroon'=>'#800000', - 'mediumaquamarine'=>'#66cdaa', - 'mediumblue'=>'#0000cd', - 'mediumorchid'=>'#ba55d3', - 'mediumpurple'=>'#9370d8', - 'mediumseagreen'=>'#3cb371', - 'mediumslateblue'=>'#7b68ee', - 'mediumspringgreen'=>'#00fa9a', - 'mediumturquoise'=>'#48d1cc', - 'mediumvioletred'=>'#c71585', - 'midnightblue'=>'#191970', - 'mintcream'=>'#f5fffa', - 'mistyrose'=>'#ffe4e1', - 'moccasin'=>'#ffe4b5', - 'navajowhite'=>'#ffdead', - 'navy'=>'#000080', - 'oldlace'=>'#fdf5e6', - 'olive'=>'#808000', - 'olivedrab'=>'#6b8e23', - 'orange'=>'#ffa500', - 'orangered'=>'#ff4500', - 'orchid'=>'#da70d6', - 'palegoldenrod'=>'#eee8aa', - 'palegreen'=>'#98fb98', - 'paleturquoise'=>'#afeeee', - 'palevioletred'=>'#d87093', - 'papayawhip'=>'#ffefd5', - 'peachpuff'=>'#ffdab9', - 'peru'=>'#cd853f', - 'pink'=>'#ffc0cb', - 'plum'=>'#dda0dd', - 'powderblue'=>'#b0e0e6', - 'purple'=>'#800080', - 'red'=>'#ff0000', - 'rosybrown'=>'#bc8f8f', - 'royalblue'=>'#4169e1', - 'saddlebrown'=>'#8b4513', - 'salmon'=>'#fa8072', - 'sandybrown'=>'#f4a460', - 'seagreen'=>'#2e8b57', - 'seashell'=>'#fff5ee', - 'sienna'=>'#a0522d', - 'silver'=>'#c0c0c0', - 'skyblue'=>'#87ceeb', - 'slateblue'=>'#6a5acd', - 'slategray'=>'#708090', - 'slategrey'=>'#708090', - 'snow'=>'#fffafa', - 'springgreen'=>'#00ff7f', - 'steelblue'=>'#4682b4', - 'tan'=>'#d2b48c', - 'teal'=>'#008080', - 'thistle'=>'#d8bfd8', - 'tomato'=>'#ff6347', - 'turquoise'=>'#40e0d0', - 'violet'=>'#ee82ee', - 'wheat'=>'#f5deb3', - 'white'=>'#ffffff', - 'whitesmoke'=>'#f5f5f5', - 'yellow'=>'#ffff00', - 'yellowgreen'=>'#9acd32' - ); + private const COLORS = [ + 'aliceblue' => '#f0f8ff', + 'antiquewhite' => '#faebd7', + 'aqua' => '#00ffff', + 'aquamarine' => '#7fffd4', + 'azure' => '#f0ffff', + 'beige' => '#f5f5dc', + 'bisque' => '#ffe4c4', + 'black' => '#000000', + 'blanchedalmond' => '#ffebcd', + 'blue' => '#0000ff', + 'blueviolet' => '#8a2be2', + 'brown' => '#a52a2a', + 'burlywood' => '#deb887', + 'cadetblue' => '#5f9ea0', + 'chartreuse' => '#7fff00', + 'chocolate' => '#d2691e', + 'coral' => '#ff7f50', + 'cornflowerblue' => '#6495ed', + 'cornsilk' => '#fff8dc', + 'crimson' => '#dc143c', + 'cyan' => '#00ffff', + 'darkblue' => '#00008b', + 'darkcyan' => '#008b8b', + 'darkgoldenrod' => '#b8860b', + 'darkgray' => '#a9a9a9', + 'darkgrey' => '#a9a9a9', + 'darkgreen' => '#006400', + 'darkkhaki' => '#bdb76b', + 'darkmagenta' => '#8b008b', + 'darkolivegreen' => '#556b2f', + 'darkorange' => '#ff8c00', + 'darkorchid' => '#9932cc', + 'darkred' => '#8b0000', + 'darksalmon' => '#e9967a', + 'darkseagreen' => '#8fbc8f', + 'darkslateblue' => '#483d8b', + 'darkslategray' => '#2f4f4f', + 'darkslategrey' => '#2f4f4f', + 'darkturquoise' => '#00ced1', + 'darkviolet' => '#9400d3', + 'deeppink' => '#ff1493', + 'deepskyblue' => '#00bfff', + 'dimgray' => '#696969', + 'dimgrey' => '#696969', + 'dodgerblue' => '#1e90ff', + 'firebrick' => '#b22222', + 'floralwhite' => '#fffaf0', + 'forestgreen' => '#228b22', + 'fuchsia' => '#ff00ff', + 'gainsboro' => '#dcdcdc', + 'ghostwhite' => '#f8f8ff', + 'gold' => '#ffd700', + 'goldenrod' => '#daa520', + 'gray' => '#808080', + 'grey' => '#808080', + 'green' => '#008000', + 'greenyellow' => '#adff2f', + 'honeydew' => '#f0fff0', + 'hotpink' => '#ff69b4', + 'indianred' => '#cd5c5c', + 'indigo' => '#4b0082', + 'ivory' => '#fffff0', + 'khaki' => '#f0e68c', + 'lavender' => '#e6e6fa', + 'lavenderblush' => '#fff0f5', + 'lawngreen' => '#7cfc00', + 'lemonchiffon' => '#fffacd', + 'lightblue' => '#add8e6', + 'lightcoral' => '#f08080', + 'lightcyan' => '#e0ffff', + 'lightgoldenrodyellow' => '#fafad2', + 'lightgray' => '#d3d3d3', + 'lightgrey' => '#d3d3d3', + 'lightgreen' => '#90ee90', + 'lightpink' => '#ffb6c1', + 'lightsalmon' => '#ffa07a', + 'lightseagreen' => '#20b2aa', + 'lightskyblue' => '#87cefa', + 'lightslategray' => '#778899', + 'lightslategrey' => '#778899', + 'lightsteelblue' => '#b0c4de', + 'lightyellow' => '#ffffe0', + 'lime' => '#00ff00', + 'limegreen' => '#32cd32', + 'linen' => '#faf0e6', + 'magenta' => '#ff00ff', + 'maroon' => '#800000', + 'mediumaquamarine' => '#66cdaa', + 'mediumblue' => '#0000cd', + 'mediumorchid' => '#ba55d3', + 'mediumpurple' => '#9370d8', + 'mediumseagreen' => '#3cb371', + 'mediumslateblue' => '#7b68ee', + 'mediumspringgreen' => '#00fa9a', + 'mediumturquoise' => '#48d1cc', + 'mediumvioletred' => '#c71585', + 'midnightblue' => '#191970', + 'mintcream' => '#f5fffa', + 'mistyrose' => '#ffe4e1', + 'moccasin' => '#ffe4b5', + 'navajowhite' => '#ffdead', + 'navy' => '#000080', + 'oldlace' => '#fdf5e6', + 'olive' => '#808000', + 'olivedrab' => '#6b8e23', + 'orange' => '#ffa500', + 'orangered' => '#ff4500', + 'orchid' => '#da70d6', + 'palegoldenrod' => '#eee8aa', + 'palegreen' => '#98fb98', + 'paleturquoise' => '#afeeee', + 'palevioletred' => '#d87093', + 'papayawhip' => '#ffefd5', + 'peachpuff' => '#ffdab9', + 'peru' => '#cd853f', + 'pink' => '#ffc0cb', + 'plum' => '#dda0dd', + 'powderblue' => '#b0e0e6', + 'purple' => '#800080', + 'red' => '#ff0000', + 'rosybrown' => '#bc8f8f', + 'royalblue' => '#4169e1', + 'saddlebrown' => '#8b4513', + 'salmon' => '#fa8072', + 'sandybrown' => '#f4a460', + 'seagreen' => '#2e8b57', + 'seashell' => '#fff5ee', + 'sienna' => '#a0522d', + 'silver' => '#c0c0c0', + 'skyblue' => '#87ceeb', + 'slateblue' => '#6a5acd', + 'slategray' => '#708090', + 'slategrey' => '#708090', + 'snow' => '#fffafa', + 'springgreen' => '#00ff7f', + 'steelblue' => '#4682b4', + 'tan' => '#d2b48c', + 'teal' => '#008080', + 'thistle' => '#d8bfd8', + 'tomato' => '#ff6347', + 'turquoise' => '#40e0d0', + 'violet' => '#ee82ee', + 'wheat' => '#f5deb3', + 'white' => '#ffffff', + 'whitesmoke' => '#f5f5f5', + 'yellow' => '#ffff00', + 'yellowgreen' => '#9acd32', + ]; - public static function hasOwnProperty($color) { - return isset(self::$colors[$color]); + /** + * @param string $color + * @return bool + */ + public static function hasOwnProperty( string $color ): bool { + return isset( self::COLORS[$color] ); } - - public static function color($color) { - return self::$colors[$color]; + /** + * @param string $color Should be an existing color name, + * checked via hasOwnProperty() + * @return string the corresponding hexadecimal representation + */ + public static function color( string $color ): string { + return self::COLORS[$color]; } } diff --git a/vendor/wikimedia/less.php/lib/Less/Configurable.php b/vendor/wikimedia/less.php/lib/Less/Configurable.php index aa7fd3eb7..ec16d801b 100644 --- a/vendor/wikimedia/less.php/lib/Less/Configurable.php +++ b/vendor/wikimedia/less.php/lib/Less/Configurable.php @@ -1,10 +1,6 @@ <?php - /** - * Configurable - * - * @package Less - * @subpackage Core + * @private */ abstract class Less_Configurable { @@ -13,15 +9,14 @@ abstract class Less_Configurable { * * @var array */ - protected $options = array(); + protected $options = []; /** * Array of default options * * @var array */ - protected $defaultOptions = array(); - + protected $defaultOptions = []; /** * Set options @@ -29,16 +24,13 @@ abstract class Less_Configurable { * If $options is an object it will be converted into an array by called * it's toArray method. * - * @throws Exception * @param array|object $options - * */ - public function setOptions($options){ - $options = array_intersect_key($options,$this->defaultOptions); - $this->options = array_merge($this->defaultOptions, $this->options, $options); + public function setOptions( $options ) { + $options = array_intersect_key( $options, $this->defaultOptions ); + $this->options = array_merge( $this->defaultOptions, $this->options, $options ); } - /** * Get an option value by name * @@ -48,22 +40,21 @@ abstract class Less_Configurable { * @param mixed $default Default value if confiuration of $name is not present * @return mixed */ - public function getOption($name, $default = null){ - if(isset($this->options[$name])){ + public function getOption( $name, $default = null ) { + if ( isset( $this->options[$name] ) ) { return $this->options[$name]; } return $default; } - /** * Set an option * * @param string $name * @param mixed $value */ - public function setOption($name, $value){ + public function setOption( $name, $value ) { $this->options[$name] = $value; } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Environment.php b/vendor/wikimedia/less.php/lib/Less/Environment.php index b2203014f..bfc382550 100644 --- a/vendor/wikimedia/less.php/lib/Less/Environment.php +++ b/vendor/wikimedia/less.php/lib/Less/Environment.php @@ -1,41 +1,35 @@ <?php - - /** - * Environment - * - * @package Less - * @subpackage environment + * @private */ -class Less_Environment{ +class Less_Environment { - //public $paths = array(); // option - unmodified - paths to search for imports on - //public static $files = array(); // list of files that have been imported, used for import-once - //public $rootpath; // option - rootpath to append to URL's - //public static $strictImports = null; // option - - //public $insecure; // option - whether to allow imports from insecure ssl hosts - //public $processImports; // option - whether to process imports. if false then imports will not be imported - //public $javascriptEnabled; // option - whether JavaScript is enabled. if undefined, defaults to true - //public $useFileCache; // browser only - whether to use the per file session cache - public $currentFileInfo; // information about the current file - for error reporting and importing and making urls relative etc. - - public $importMultiple = false; // whether we are currently importing multiple copies + /** + * Information about the current file - for error reporting and importing and making urls relative etc. + * + * - rootpath: rootpath to append to URLs + * + * @var array|null $currentFileInfo; + */ + public $currentFileInfo; + /* Whether we are currently importing multiple copies */ + public $importMultiple = false; /** * @var array */ - public $frames = array(); + public $frames = []; /** * @var array */ - public $mediaBlocks = array(); + public $mediaBlocks = []; /** * @var array */ - public $mediaPath = array(); + public $mediaPath = []; public static $parensStack = 0; @@ -50,19 +44,17 @@ class Less_Environment{ /** * @var array */ - public $functions = array(); - - - public function Init(){ + public $functions = []; + public function Init() { self::$parensStack = 0; self::$tabLevel = 0; self::$lastRule = false; self::$mixin_stack = 0; - if( Less_Parser::$options['compress'] ){ + if ( Less_Parser::$options['compress'] ) { - Less_Environment::$_outputMap = array( + self::$_outputMap = [ ',' => ',', ': ' => ':', '' => '', @@ -72,13 +64,13 @@ class Less_Environment{ '~' => '~', '>' => '>', '|' => '|', - '^' => '^', - '^^' => '^^' - ); + '^' => '^', + '^^' => '^^' + ]; - }else{ + } else { - Less_Environment::$_outputMap = array( + self::$_outputMap = [ ',' => ', ', ': ' => ': ', '' => '', @@ -88,79 +80,74 @@ class Less_Environment{ '~' => ' ~ ', '>' => ' > ', '|' => '|', - '^' => ' ^ ', - '^^' => ' ^^ ' - ); + '^' => ' ^ ', + '^^' => ' ^^ ' + ]; } } - - public function copyEvalEnv($frames = array() ){ + public function copyEvalEnv( $frames = [] ) { $new_env = new Less_Environment(); $new_env->frames = $frames; return $new_env; } - - public static function isMathOn(){ - return !Less_Parser::$options['strictMath'] || Less_Environment::$parensStack; + public static function isMathOn() { + return !Less_Parser::$options['strictMath'] || self::$parensStack; } - public static function isPathRelative($path){ - return !preg_match('/^(?:[a-z-]+:|\/)/',$path); + public static function isPathRelative( $path ) { + return !preg_match( '/^(?:[a-z-]+:|\/)/', $path ); } - /** * Canonicalize a path by resolving references to '/./', '/../' * Does not remove leading "../" - * @param string path or url + * @param string $path or url * @return string Canonicalized path - * */ - public static function normalizePath($path){ + public static function normalizePath( $path ) { + $segments = explode( '/', $path ); + $segments = array_reverse( $segments ); - $segments = explode('/',$path); - $segments = array_reverse($segments); - - $path = array(); + $path = []; $path_len = 0; - while( $segments ){ - $segment = array_pop($segments); - switch( $segment ) { + while ( $segments ) { + $segment = array_pop( $segments ); + switch ( $segment ) { case '.': - break; + break; case '..': - if( !$path_len || ( $path[$path_len-1] === '..') ){ + // @phan-suppress-next-line PhanTypeInvalidDimOffset False positive + if ( !$path_len || ( $path[$path_len - 1] === '..' ) ) { $path[] = $segment; $path_len++; - }else{ - array_pop($path); + } else { + array_pop( $path ); $path_len--; } - break; + break; default: $path[] = $segment; $path_len++; - break; + break; } } - return implode('/',$path); + return implode( '/', $path ); } - - public function unshiftFrame($frame){ - array_unshift($this->frames, $frame); + public function unshiftFrame( $frame ) { + array_unshift( $this->frames, $frame ); } - public function shiftFrame(){ - return array_shift($this->frames); + public function shiftFrame() { + return array_shift( $this->frames ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php b/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php index 0a4f4e507..8071eb85a 100644 --- a/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php +++ b/vendor/wikimedia/less.php/lib/Less/Exception/Chunk.php @@ -1,13 +1,8 @@ <?php - /** - * Chunk Exception - * - * @package Less - * @subpackage exception + * @private */ -class Less_Exception_Chunk extends Less_Exception_Parser{ - +class Less_Exception_Chunk extends Less_Exception_Parser { protected $parserCurrentIndex = 0; @@ -15,38 +10,32 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ protected $input_len; - /** - * Constructor - * * @param string $input - * @param Exception $previous Previous exception - * @param integer $index The current parser index - * @param Less_FileInfo|string $currentFile The file - * @param integer $code The exception code + * @param Exception|null $previous Previous exception + * @param int|null $index The current parser index + * @param array|null $currentFile The file + * @param int $code The exception code */ - public function __construct($input, Exception $previous = null, $index = null, $currentFile = null, $code = 0){ - - $this->message = 'ParseError: Unexpected input'; //default message + public function __construct( $input, Exception $previous = null, $index = null, $currentFile = null, $code = 0 ) { + $this->message = 'ParseError: Unexpected input'; // default message $this->index = $index; $this->currentFile = $currentFile; $this->input = $input; - $this->input_len = strlen($input); + $this->input_len = strlen( $input ); $this->Chunks(); $this->genMessage(); } - /** * See less.js chunks() * We don't actually need the chunks - * */ - protected function Chunks(){ + protected function Chunks() { $level = 0; $parenLevel = 0; $lastMultiCommentEndBrace = null; @@ -54,14 +43,14 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ $lastMultiComment = null; $lastParen = null; - for( $this->parserCurrentIndex = 0; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ){ - $cc = $this->CharCode($this->parserCurrentIndex); - if ((($cc >= 97) && ($cc <= 122)) || ($cc < 34)) { + for ( $this->parserCurrentIndex = 0; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc = $this->CharCode( $this->parserCurrentIndex ); + if ( ( ( $cc >= 97 ) && ( $cc <= 122 ) ) || ( $cc < 34 ) ) { // a-z or whitespace continue; } - switch ($cc) { + switch ( $cc ) { // ( case 40: @@ -72,14 +61,14 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ // ) case 41: $parenLevel--; - if( $parenLevel < 0 ){ - return $this->fail("missing opening `(`"); + if ( $parenLevel < 0 ) { + return $this->fail( "missing opening `(`" ); } break; // ; case 59: - //if (!$parenLevel) { $this->emitChunk(); } + // if (!$parenLevel) { $this->emitChunk(); } break; // { @@ -91,16 +80,19 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ // } case 125: $level--; - if( $level < 0 ){ - return $this->fail("missing opening `{`"); + if ( $level < 0 ) { + return $this->fail( "missing opening `{`" ); } - //if (!$level && !$parenLevel) { $this->emitChunk(); } + // if (!$level && !$parenLevel) { $this->emitChunk(); } break; // \ case 92: - if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; break; } - return $this->fail("unescaped `\\`"); + if ( $this->parserCurrentIndex < $this->input_len - 1 ) { + $this->parserCurrentIndex++; + break; + } + return $this->fail( "unescaped `\\`" ); // ", ' and ` case 34: @@ -108,87 +100,91 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ case 96: $matched = 0; $currentChunkStartIndex = $this->parserCurrentIndex; - for ($this->parserCurrentIndex = $this->parserCurrentIndex + 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++) { - $cc2 = $this->CharCode($this->parserCurrentIndex); - if ($cc2 > 96) { continue; } - if ($cc2 == $cc) { $matched = 1; break; } - if ($cc2 == 92) { // \ - if ($this->parserCurrentIndex == $this->input_len - 1) { - return $this->fail("unescaped `\\`"); + for ( $this->parserCurrentIndex += 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( $cc2 > 96 ) { continue; + } + if ( $cc2 == $cc ) { $matched = 1; +break; + } + if ( $cc2 == 92 ) { // \ + if ( $this->parserCurrentIndex == $this->input_len - 1 ) { + return $this->fail( "unescaped `\\`" ); } $this->parserCurrentIndex++; } } - if ($matched) { break; } - return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex); + if ( $matched ) { break; + } + return $this->fail( "unmatched `" . chr( $cc ) . "`", $currentChunkStartIndex ); // /, check for comment case 47: - if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { break; } - $cc2 = $this->CharCode($this->parserCurrentIndex+1); - if ($cc2 == 47) { + if ( $parenLevel || ( $this->parserCurrentIndex == $this->input_len - 1 ) ) { break; + } + $cc2 = $this->CharCode( $this->parserCurrentIndex + 1 ); + if ( $cc2 == 47 ) { // //, find lnfeed - for ($this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++) { - $cc2 = $this->CharCode($this->parserCurrentIndex); - if (($cc2 <= 13) && (($cc2 == 10) || ($cc2 == 13))) { break; } + for ( $this->parserCurrentIndex += 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( ( $cc2 <= 13 ) && ( ( $cc2 == 10 ) || ( $cc2 == 13 ) ) ) { break; + } } - } else if ($cc2 == 42) { + } elseif ( $cc2 == 42 ) { // /*, find */ $lastMultiComment = $currentChunkStartIndex = $this->parserCurrentIndex; - for ($this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++) { - $cc2 = $this->CharCode($this->parserCurrentIndex); - if ($cc2 == 125) { $lastMultiCommentEndBrace = $this->parserCurrentIndex; } - if ($cc2 != 42) { continue; } - if ($this->CharCode($this->parserCurrentIndex+1) == 47) { break; } + for ( $this->parserCurrentIndex += 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++ ) { + $cc2 = $this->CharCode( $this->parserCurrentIndex ); + if ( $cc2 == 125 ) { $lastMultiCommentEndBrace = $this->parserCurrentIndex; + } + if ( $cc2 != 42 ) { continue; + } + if ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) { break; + } } - if ($this->parserCurrentIndex == $this->input_len - 1) { - return $this->fail("missing closing `*/`", $currentChunkStartIndex); + if ( $this->parserCurrentIndex == $this->input_len - 1 ) { + return $this->fail( "missing closing `*/`", $currentChunkStartIndex ); } } break; // *, check for unmatched */ case 42: - if (($this->parserCurrentIndex < $this->input_len - 1) && ($this->CharCode($this->parserCurrentIndex+1) == 47)) { - return $this->fail("unmatched `/*`"); + if ( ( $this->parserCurrentIndex < $this->input_len - 1 ) && ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) ) { + return $this->fail( "unmatched `/*`" ); } break; } } - if( $level !== 0 ){ - if( ($lastMultiComment > $lastOpening) && ($lastMultiCommentEndBrace > $lastMultiComment) ){ - return $this->fail("missing closing `}` or `*/`", $lastOpening); + if ( $level !== 0 ) { + if ( ( $lastMultiComment > $lastOpening ) && ( $lastMultiCommentEndBrace > $lastMultiComment ) ) { + return $this->fail( "missing closing `}` or `*/`", $lastOpening ); } else { - return $this->fail("missing closing `}`", $lastOpening); + return $this->fail( "missing closing `}`", $lastOpening ); } - } else if ( $parenLevel !== 0 ){ - return $this->fail("missing closing `)`", $lastParen); + } elseif ( $parenLevel !== 0 ) { + return $this->fail( "missing closing `)`", $lastParen ); } - - //chunk didn't fail - + // chunk didn't fail //$this->emitChunk(true); } - public function CharCode($pos){ - return ord($this->input[$pos]); + public function CharCode( $pos ) { + return ord( $this->input[$pos] ); } - - public function fail( $msg, $index = null ){ - - if( !$index ){ + public function fail( $msg, $index = null ) { + if ( !$index ) { $this->index = $this->parserCurrentIndex; - }else{ + } else { $this->index = $index; } - $this->message = 'ParseError: '.$msg; + $this->message = 'ParseError: ' . $msg; } - /* function emitChunk( $force = false ){ $len = $this->parserCurrentIndex - $this->emitFrom; diff --git a/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php b/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php index 713e030d0..e963b6984 100644 --- a/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php +++ b/vendor/wikimedia/less.php/lib/Less/Exception/Compiler.php @@ -2,10 +2,7 @@ /** * Compiler Exception - * - * @package Less - * @subpackage exception */ -class Less_Exception_Compiler extends Less_Exception_Parser{ +class Less_Exception_Compiler extends Less_Exception_Parser { -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Exception/Parser.php b/vendor/wikimedia/less.php/lib/Less/Exception/Parser.php index f96b23c8d..22d9d1928 100644 --- a/vendor/wikimedia/less.php/lib/Less/Exception/Parser.php +++ b/vendor/wikimedia/less.php/lib/Less/Exception/Parser.php @@ -2,48 +2,36 @@ /** * Parser Exception - * - * @package Less - * @subpackage exception */ -class Less_Exception_Parser extends Exception{ +class Less_Exception_Parser extends Exception { /** * The current file * - * @var Less_ImportedFile + * @var array */ public $currentFile; /** * The current parser index * - * @var integer + * @var int */ public $index; protected $input; - protected $details = array(); - + protected $details = []; /** - * Constructor - * - * @param string $message - * @param Exception $previous Previous exception - * @param integer $index The current parser index - * @param Less_FileInfo|string $currentFile The file - * @param integer $code The exception code + * @param string|null $message + * @param Exception|null $previous Previous exception + * @param int|null $index The current parser index + * @param array|null $currentFile The file + * @param int $code The exception code */ - public function __construct($message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0){ - - if (PHP_VERSION_ID < 50300) { - $this->previous = $previous; - parent::__construct($message, $code); - } else { - parent::__construct($message, $code, $previous); - } + public function __construct( $message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0 ) { + parent::__construct( $message, $code, $previous ); $this->currentFile = $currentFile; $this->index = $index; @@ -51,74 +39,64 @@ class Less_Exception_Parser extends Exception{ $this->genMessage(); } - - protected function getInput(){ - - if( !$this->input && $this->currentFile && $this->currentFile['filename'] && file_exists($this->currentFile['filename']) ){ + protected function getInput() { + if ( !$this->input && $this->currentFile && $this->currentFile['filename'] && file_exists( $this->currentFile['filename'] ) ) { $this->input = file_get_contents( $this->currentFile['filename'] ); } } - - /** - * Converts the exception to string - * - * @return string + * Set a message based on the exception info */ - public function genMessage(){ - - if( $this->currentFile && $this->currentFile['filename'] ){ - $this->message .= ' in '.basename($this->currentFile['filename']); + public function genMessage() { + if ( $this->currentFile && $this->currentFile['filename'] ) { + $this->message .= ' in ' . basename( $this->currentFile['filename'] ); } - if( $this->index !== null ){ + if ( $this->index !== null ) { $this->getInput(); - if( $this->input ){ + if ( $this->input ) { $line = self::getLineNumber(); - $this->message .= ' on line '.$line.', column '.self::getColumn(); + $this->message .= ' on line ' . $line . ', column ' . self::getColumn(); - $lines = explode("\n",$this->input); + $lines = explode( "\n", $this->input ); - $count = count($lines); - $start_line = max(0, $line-3); - $last_line = min($count, $start_line+6); - $num_len = strlen($last_line); - for( $i = $start_line; $i < $last_line; $i++ ){ - $this->message .= "\n".str_pad($i+1,$num_len,'0',STR_PAD_LEFT).'| '.$lines[$i]; + $count = count( $lines ); + $start_line = max( 0, $line - 3 ); + $last_line = min( $count, $start_line + 6 ); + $num_len = strlen( $last_line ); + for ( $i = $start_line; $i < $last_line; $i++ ) { + $this->message .= "\n" . str_pad( (string)( $i + 1 ), $num_len, '0', STR_PAD_LEFT ) . '| ' . $lines[$i]; } } } - } /** * Returns the line number the error was encountered * - * @return integer + * @return int */ - public function getLineNumber(){ - if( $this->index ){ + public function getLineNumber() { + if ( $this->index ) { // https://bugs.php.net/bug.php?id=49790 - if (ini_get("mbstring.func_overload")) { - return substr_count(substr($this->input, 0, $this->index), "\n") + 1; + if ( ini_get( "mbstring.func_overload" ) ) { + return substr_count( substr( $this->input, 0, $this->index ), "\n" ) + 1; } else { - return substr_count($this->input, "\n", 0, $this->index) + 1; + return substr_count( $this->input, "\n", 0, $this->index ) + 1; } } return 1; } - /** * Returns the column the error was encountered * - * @return integer + * @return int */ - public function getColumn(){ - - $part = substr($this->input, 0, $this->index); - $pos = strrpos($part,"\n"); + public function getColumn() { + $part = substr( $this->input, 0, $this->index ); + $pos = strrpos( $part, "\n" ); return $this->index - $pos; } diff --git a/vendor/wikimedia/less.php/lib/Less/Functions.php b/vendor/wikimedia/less.php/lib/Less/Functions.php index a61e5ac3c..43a964c6e 100644 --- a/vendor/wikimedia/less.php/lib/Less/Functions.php +++ b/vendor/wikimedia/less.php/lib/Less/Functions.php @@ -2,414 +2,429 @@ /** * Builtin functions - * - * @package Less - * @subpackage function - * @see http://lesscss.org/functions/ + * @see https://lesscss.org/functions/ */ -class Less_Functions{ +class Less_Functions { public $env; public $currentFileInfo; - function __construct($env, $currentFileInfo = null ){ + function __construct( $env, array $currentFileInfo = null ) { $this->env = $env; $this->currentFileInfo = $currentFileInfo; } /** * @param string $op + * @param float $a + * @param float $b */ - public static function operate( $op, $a, $b ){ - switch ($op) { - case '+': return $a + $b; - case '-': return $a - $b; - case '*': return $a * $b; - case '/': return $a / $b; + public static function operate( $op, $a, $b ) { + switch ( $op ) { + case '+': + return $a + $b; + case '-': + return $a - $b; + case '*': + return $a * $b; + case '/': + return $a / $b; } } - public static function clamp($val, $max = 1){ - return min( max($val, 0), $max); + public static function clamp( $val, $max = 1 ) { + return min( max( $val, 0 ), $max ); } - public static function fround( $value ){ - - if( $value === 0 ){ + public static function fround( $value ) { + if ( $value === 0 ) { return $value; } - if( Less_Parser::$options['numPrecision'] ){ - $p = pow(10, Less_Parser::$options['numPrecision']); - return round( $value * $p) / $p; + if ( Less_Parser::$options['numPrecision'] ) { + $p = pow( 10, Less_Parser::$options['numPrecision'] ); + return round( $value * $p ) / $p; } return $value; } - public static function number($n){ - - if ($n instanceof Less_Tree_Dimension) { - return floatval( $n->unit->is('%') ? $n->value / 100 : $n->value); - } else if (is_numeric($n)) { + public static function number( $n ) { + if ( $n instanceof Less_Tree_Dimension ) { + return floatval( $n->unit->is( '%' ) ? $n->value / 100 : $n->value ); + } elseif ( is_numeric( $n ) ) { return $n; } else { - throw new Less_Exception_Compiler("color functions take numbers as parameters"); + throw new Less_Exception_Compiler( "color functions take numbers as parameters" ); } } - public static function scaled($n, $size = 255 ){ - if( $n instanceof Less_Tree_Dimension && $n->unit->is('%') ){ + public static function scaled( $n, $size = 255 ) { + if ( $n instanceof Less_Tree_Dimension && $n->unit->is( '%' ) ) { return (float)$n->value * $size / 100; } else { - return Less_Functions::number($n); + return self::number( $n ); } } - public function rgb ($r = null, $g = null, $b = null){ - if (is_null($r) || is_null($g) || is_null($b)) { - throw new Less_Exception_Compiler("rgb expects three parameters"); + public function rgb( $r = null, $g = null, $b = null ) { + if ( $r === null || $g === null || $b === null ) { + throw new Less_Exception_Compiler( "rgb expects three parameters" ); } - return $this->rgba($r, $g, $b, 1.0); + return $this->rgba( $r, $g, $b, 1.0 ); } - public function rgba($r = null, $g = null, $b = null, $a = null){ - $rgb = array($r, $g, $b); - $rgb = array_map(array('Less_Functions','scaled'),$rgb); + public function rgba( $r = null, $g = null, $b = null, $a = null ) { + $rgb = [ $r, $g, $b ]; + $rgb = array_map( [ 'Less_Functions','scaled' ], $rgb ); - $a = self::number($a); - return new Less_Tree_Color($rgb, $a); + $a = self::number( $a ); + return new Less_Tree_Color( $rgb, $a ); } - public function hsl($h, $s, $l){ - return $this->hsla($h, $s, $l, 1.0); + public function hsl( $h, $s, $l ) { + return $this->hsla( $h, $s, $l, 1.0 ); } - public function hsla($h, $s, $l, $a){ + public function hsla( $h, $s, $l, $a ) { + $h = fmod( self::number( $h ), 360 ) / 360; // Classic % operator will change float to int + $s = self::clamp( self::number( $s ) ); + $l = self::clamp( self::number( $l ) ); + $a = self::clamp( self::number( $a ) ); - $h = fmod(self::number($h), 360) / 360; // Classic % operator will change float to int - $s = self::clamp(self::number($s)); - $l = self::clamp(self::number($l)); - $a = self::clamp(self::number($a)); - - $m2 = $l <= 0.5 ? $l * ($s + 1) : $l + $s - $l * $s; + $m2 = $l <= 0.5 ? $l * ( $s + 1 ) : $l + $s - $l * $s; $m1 = $l * 2 - $m2; - return $this->rgba( self::hsla_hue($h + 1/3, $m1, $m2) * 255, - self::hsla_hue($h, $m1, $m2) * 255, - self::hsla_hue($h - 1/3, $m1, $m2) * 255, - $a); + return $this->rgba( + self::hsla_hue( $h + 1 / 3, $m1, $m2 ) * 255, + self::hsla_hue( $h, $m1, $m2 ) * 255, + self::hsla_hue( $h - 1 / 3, $m1, $m2 ) * 255, + $a + ); } /** - * @param double $h + * @param float $h + * @param float $m1 + * @param float $m2 */ - public function hsla_hue($h, $m1, $m2){ - $h = $h < 0 ? $h + 1 : ($h > 1 ? $h - 1 : $h); - if ($h * 6 < 1) return $m1 + ($m2 - $m1) * $h * 6; - else if ($h * 2 < 1) return $m2; - else if ($h * 3 < 2) return $m1 + ($m2 - $m1) * (2/3 - $h) * 6; - else return $m1; + public function hsla_hue( $h, $m1, $m2 ) { + $h = $h < 0 ? $h + 1 : ( $h > 1 ? $h - 1 : $h ); + if ( $h * 6 < 1 ) { + return $m1 + ( $m2 - $m1 ) * $h * 6; + } elseif ( $h * 2 < 1 ) { + return $m2; + } elseif ( $h * 3 < 2 ) { + return $m1 + ( $m2 - $m1 ) * ( 2 / 3 - $h ) * 6; + } else { + return $m1; + } } - public function hsv($h, $s, $v) { - return $this->hsva($h, $s, $v, 1.0); + public function hsv( $h, $s, $v ) { + return $this->hsva( $h, $s, $v, 1.0 ); } /** - * @param double $a + * @param Less_Tree|float $h + * @param Less_Tree|float $s + * @param Less_Tree|float $v + * @param float $a */ - public function hsva($h, $s, $v, $a) { - $h = ((Less_Functions::number($h) % 360) / 360 ) * 360; - $s = Less_Functions::number($s); - $v = Less_Functions::number($v); - $a = Less_Functions::number($a); + public function hsva( $h, $s, $v, $a ) { + $h = ( ( self::number( $h ) % 360 ) / 360 ) * 360; + $s = self::number( $s ); + $v = self::number( $v ); + $a = self::number( $a ); - $i = floor(($h / 60) % 6); - $f = ($h / 60) - $i; + $i = floor( (int)( $h / 60 ) % 6 ); + $f = ( $h / 60 ) - $i; - $vs = array( $v, - $v * (1 - $s), - $v * (1 - $f * $s), - $v * (1 - (1 - $f) * $s)); + $vs = [ + $v, + $v * ( 1 - $s ), + $v * ( 1 - $f * $s ), + $v * ( 1 - ( 1 - $f ) * $s ) + ]; - $perm = array(array(0, 3, 1), - array(2, 0, 1), - array(1, 0, 3), - array(1, 2, 0), - array(3, 1, 0), - array(0, 1, 2)); + $perm = [ + [ 0, 3, 1 ], + [ 2, 0, 1 ], + [ 1, 0, 3 ], + [ 1, 2, 0 ], + [ 3, 1, 0 ], + [ 0, 1, 2 ] + ]; - return $this->rgba($vs[$perm[$i][0]] * 255, - $vs[$perm[$i][1]] * 255, - $vs[$perm[$i][2]] * 255, - $a); + return $this->rgba( + $vs[$perm[$i][0]] * 255, + $vs[$perm[$i][1]] * 255, + $vs[$perm[$i][2]] * 255, + $a + ); } - public function hue($color = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function hue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $c = $color->toHSL(); - return new Less_Tree_Dimension(Less_Parser::round($c['h'])); + return new Less_Tree_Dimension( Less_Parser::round( $c['h'] ) ); } - public function saturation($color = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to saturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function saturation( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to saturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $c = $color->toHSL(); - return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%'); + return new Less_Tree_Dimension( Less_Parser::round( $c['s'] * 100 ), '%' ); } - public function lightness($color = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to lightness must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function lightness( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to lightness must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $c = $color->toHSL(); - return new Less_Tree_Dimension(Less_Parser::round($c['l'] * 100), '%'); + return new Less_Tree_Dimension( Less_Parser::round( $c['l'] * 100 ), '%' ); } - public function hsvhue( $color = null ){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hsvhue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function hsvhue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvhue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsv = $color->toHSV(); - return new Less_Tree_Dimension( Less_Parser::round($hsv['h']) ); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['h'] ) ); } - - public function hsvsaturation( $color = null ){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hsvsaturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function hsvsaturation( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvsaturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsv = $color->toHSV(); - return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' ); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['s'] * 100 ), '%' ); } - public function hsvvalue( $color = null ){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hsvvalue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function hsvvalue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hsvvalue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsv = $color->toHSV(); - return new Less_Tree_Dimension( Less_Parser::round($hsv['v'] * 100), '%' ); + return new Less_Tree_Dimension( Less_Parser::round( $hsv['v'] * 100 ), '%' ); } - public function red($color = null) { - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to red must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function red( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to red must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } return new Less_Tree_Dimension( $color->rgb[0] ); } - public function green($color = null) { - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to green must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function green( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to green must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } return new Less_Tree_Dimension( $color->rgb[1] ); } - public function blue($color = null) { - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to blue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function blue( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to blue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } return new Less_Tree_Dimension( $color->rgb[2] ); } - public function alpha($color = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to alpha must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function alpha( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to alpha must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $c = $color->toHSL(); - return new Less_Tree_Dimension($c['a']); + return new Less_Tree_Dimension( $c['a'] ); } - public function luma ($color = null) { - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to luma must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function luma( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to luma must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return new Less_Tree_Dimension(Less_Parser::round( $color->luma() * $color->alpha * 100), '%'); + return new Less_Tree_Dimension( Less_Parser::round( $color->luma() * $color->alpha * 100 ), '%' ); } - public function luminance( $color = null ){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to luminance must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function luminance( $color = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to luminance must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $luminance = - (0.2126 * $color->rgb[0] / 255) - + (0.7152 * $color->rgb[1] / 255) - + (0.0722 * $color->rgb[2] / 255); + ( 0.2126 * $color->rgb[0] / 255 ) + + ( 0.7152 * $color->rgb[1] / 255 ) + + ( 0.0722 * $color->rgb[2] / 255 ); - return new Less_Tree_Dimension(Less_Parser::round( $luminance * $color->alpha * 100), '%'); + return new Less_Tree_Dimension( Less_Parser::round( $luminance * $color->alpha * 100 ), '%' ); } - public function saturate($color = null, $amount = null){ + public function saturate( $color = null, $amount = null ) { // filter: saturate(3.2); // should be kept as is, so check for color - if ($color instanceof Less_Tree_Dimension) { + if ( $color instanceof Less_Tree_Dimension ) { return null; } - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to saturate must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to saturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to saturate must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to saturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['s'] += $amount->value / 100; - $hsl['s'] = self::clamp($hsl['s']); + $hsl['s'] = self::clamp( $hsl['s'] ); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } /** - * @param Less_Tree_Dimension $amount + * @param Less_Tree_Color|null $color + * @param Less_Tree_Dimension|null $amount */ - public function desaturate($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to desaturate must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function desaturate( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to desaturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to desaturate must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to desaturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); - $hsl['s'] -= $amount->value / 100; - $hsl['s'] = self::clamp($hsl['s']); + $hsl['s'] = self::clamp( $hsl['s'] ); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - - - public function lighten($color = null, $amount=null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to lighten must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function lighten( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to lighten must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to lighten must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to lighten must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['l'] += $amount->value / 100; - $hsl['l'] = self::clamp($hsl['l']); + $hsl['l'] = self::clamp( $hsl['l'] ); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - public function darken($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to darken must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function darken( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to darken must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to darken must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to darken must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['l'] -= $amount->value / 100; - $hsl['l'] = self::clamp($hsl['l']); + $hsl['l'] = self::clamp( $hsl['l'] ); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - public function fadein($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to fadein must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function fadein( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fadein must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to fadein must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fadein must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['a'] += $amount->value / 100; - $hsl['a'] = self::clamp($hsl['a']); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - public function fadeout($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to fadeout must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function fadeout( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fadeout must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to fadeout must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fadeout must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['a'] -= $amount->value / 100; - $hsl['a'] = self::clamp($hsl['a']); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - public function fade($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to fade must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function fade( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to fade must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to fade must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to fade must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); $hsl['a'] = $amount->value / 100; - $hsl['a'] = self::clamp($hsl['a']); - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + $hsl['a'] = self::clamp( $hsl['a'] ); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } - - - public function spin($color = null, $amount = null){ - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to spin must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function spin( $color = null, $amount = null ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to spin must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$amount instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The second argument to spin must be a number' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$amount instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The second argument to spin must be a number' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $hsl = $color->toHSL(); - $hue = fmod($hsl['h'] + $amount->value, 360); + $hue = fmod( $hsl['h'] + $amount->value, 360 ); $hsl['h'] = $hue < 0 ? 360 + $hue : $hue; - return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']); + return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] ); } // // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein - // http://sass-lang.com + // https://sass-lang.com/ // /** - * @param Less_Tree_Color $color1 + * @param Less_Tree|null $color1 + * @param Less_Tree|null $color2 + * @param Less_Tree|null $weight */ - public function mix($color1 = null, $color2 = null, $weight = null){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to mix must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function mix( $color1 = null, $color2 = null, $weight = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to mix must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to mix must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to mix must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$weight) { - $weight = new Less_Tree_Dimension('50', '%'); + if ( !$weight ) { + $weight = new Less_Tree_Dimension( '50', '%' ); } - if (!$weight instanceof Less_Tree_Dimension) { - throw new Less_Exception_Compiler('The third argument to contrast must be a percentage' . ($weight instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$weight instanceof Less_Tree_Dimension ) { + throw new Less_Exception_Compiler( 'The third argument to contrast must be a percentage' . ( $weight instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } $p = $weight->value / 100.0; @@ -418,144 +433,142 @@ class Less_Functions{ $hsl2 = $color2->toHSL(); $a = $hsl1['a'] - $hsl2['a']; - $w1 = (((($w * $a) == -1) ? $w : ($w + $a) / (1 + $w * $a)) + 1) / 2; + $w1 = ( ( ( ( $w * $a ) == -1 ) ? $w : ( $w + $a ) / ( 1 + $w * $a ) ) + 1 ) / 2; $w2 = 1 - $w1; - $rgb = array($color1->rgb[0] * $w1 + $color2->rgb[0] * $w2, - $color1->rgb[1] * $w1 + $color2->rgb[1] * $w2, - $color1->rgb[2] * $w1 + $color2->rgb[2] * $w2); + $rgb = [ + $color1->rgb[0] * $w1 + $color2->rgb[0] * $w2, + $color1->rgb[1] * $w1 + $color2->rgb[1] * $w2, + $color1->rgb[2] * $w1 + $color2->rgb[2] * $w2 + ]; - $alpha = $color1->alpha * $p + $color2->alpha * (1 - $p); + $alpha = $color1->alpha * $p + $color2->alpha * ( 1 - $p ); - return new Less_Tree_Color($rgb, $alpha); + return new Less_Tree_Color( $rgb, $alpha ); } - public function greyscale($color){ - return $this->desaturate($color, new Less_Tree_Dimension(100,'%')); + public function greyscale( $color ) { + return $this->desaturate( $color, new Less_Tree_Dimension( 100, '%' ) ); } - - public function contrast( $color, $dark = null, $light = null, $threshold = null){ + public function contrast( $color, $dark = null, $light = null, $threshold = null ) { // filter: contrast(3.2); // should be kept as is, so check for color - if (!$color instanceof Less_Tree_Color) { + if ( !$color instanceof Less_Tree_Color ) { return null; } - if( !$light ){ - $light = $this->rgba(255, 255, 255, 1.0); + if ( !$light ) { + $light = $this->rgba( 255, 255, 255, 1.0 ); } - if( !$dark ){ - $dark = $this->rgba(0, 0, 0, 1.0); + if ( !$dark ) { + $dark = $this->rgba( 0, 0, 0, 1.0 ); } - if (!$dark instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to contrast must be a color' . ($dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$dark instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to contrast must be a color' . ( $dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$light instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The third argument to contrast must be a color' . ($light instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$light instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The third argument to contrast must be a color' . ( $light instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - //Figure out which is actually light and dark! - if( $dark->luma() > $light->luma() ){ + // Figure out which is actually light and dark! + if ( $dark->luma() > $light->luma() ) { $t = $light; $light = $dark; $dark = $t; } - if( !$threshold ){ + if ( !$threshold ) { $threshold = 0.43; } else { - $threshold = Less_Functions::number($threshold); + $threshold = self::number( $threshold ); } - if( $color->luma() < $threshold ){ + if ( $color->luma() < $threshold ) { return $light; } else { return $dark; } } - public function e ($str){ - if( is_string($str) ){ - return new Less_Tree_Anonymous($str); + public function e( $str ) { + if ( is_string( $str ) ) { + return new Less_Tree_Anonymous( $str ); } - return new Less_Tree_Anonymous($str instanceof Less_Tree_JavaScript ? $str->expression : $str->value); + return new Less_Tree_Anonymous( $str instanceof Less_Tree_JavaScript ? $str->expression : $str->value ); } - public function escape ($str){ + public function escape( $str ) { + $revert = [ '%21' => '!', '%2A' => '*', '%27' => "'",'%3F' => '?','%26' => '&','%2C' => ',','%2F' => '/','%40' => '@','%2B' => '+','%24' => '$' ]; - $revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'",'%3F'=>'?','%26'=>'&','%2C'=>',','%2F'=>'/','%40'=>'@','%2B'=>'+','%24'=>'$'); - - return new Less_Tree_Anonymous(strtr(rawurlencode($str->value), $revert)); + return new Less_Tree_Anonymous( strtr( rawurlencode( $str->value ), $revert ) ); } - /** * todo: This function will need some additional work to make it work the same as less.js * */ - public function replace( $string, $pattern, $replacement, $flags = null ){ + public function replace( $string, $pattern, $replacement, $flags = null ) { $result = $string->value; - $expr = '/'.str_replace('/','\\/',$pattern->value).'/'; - if( $flags && $flags->value){ - $expr .= self::replace_flags($flags->value); + $expr = '/' . str_replace( '/', '\\/', $pattern->value ) . '/'; + if ( $flags && $flags->value ) { + $expr .= self::replace_flags( $flags->value ); } - $result = preg_replace($expr,$replacement->value,$result); + $result = preg_replace( $expr, $replacement->value, $result ); - - if( property_exists($string,'quote') ){ - return new Less_Tree_Quoted( $string->quote, $result, $string->escaped); + if ( property_exists( $string, 'quote' ) ) { + return new Less_Tree_Quoted( $string->quote, $result, $string->escaped ); } return new Less_Tree_Quoted( '', $result ); } - public static function replace_flags($flags){ - $flags = str_split($flags,1); + public static function replace_flags( $flags ) { + $flags = str_split( $flags, 1 ); $new_flags = ''; - foreach($flags as $flag){ - switch($flag){ + foreach ( $flags as $flag ) { + switch ( $flag ) { case 'e': case 'g': - break; + break; default: $new_flags .= $flag; - break; + break; } } return $new_flags; } - public function _percent(){ - $string = func_get_arg(0); + public function _percent() { + $string = func_get_arg( 0 ); $args = func_get_args(); - array_shift($args); + array_shift( $args ); $result = $string->value; - foreach($args as $arg){ - if( preg_match('/%[sda]/i',$result, $token) ){ + foreach ( $args as $arg ) { + if ( preg_match( '/%[sda]/i', $result, $token ) ) { $token = $token[0]; - $value = stristr($token, 's') ? $arg->value : $arg->toCSS(); - $value = preg_match('/[A-Z]$/', $token) ? urlencode($value) : $value; - $result = preg_replace('/%[sda]/i',$value, $result, 1); + $value = stristr( $token, 's' ) ? $arg->value : $arg->toCSS(); + $value = preg_match( '/[A-Z]$/', $token ) ? urlencode( $value ) : $value; + $result = preg_replace( '/%[sda]/i', $value, $result, 1 ); } } - $result = str_replace('%%', '%', $result); + $result = str_replace( '%%', '%', $result ); - return new Less_Tree_Quoted( $string->quote , $result, $string->escaped); + return new Less_Tree_Quoted( $string->quote, $result, $string->escaped ); } - public function unit( $val, $unit = null) { - if( !($val instanceof Less_Tree_Dimension) ){ - throw new Less_Exception_Compiler('The first argument to unit must be a number' . ($val instanceof Less_Tree_Operation ? '. Have you forgotten parenthesis?' : '.') ); + public function unit( $val, $unit = null ) { + if ( !( $val instanceof Less_Tree_Dimension ) ) { + throw new Less_Exception_Compiler( 'The first argument to unit must be a number' . ( $val instanceof Less_Tree_Operation ? '. Have you forgotten parenthesis?' : '.' ) ); } - if( $unit ){ - if( $unit instanceof Less_Tree_Keyword ){ + if ( $unit ) { + if ( $unit instanceof Less_Tree_Keyword ) { $unit = $unit->value; } else { $unit = $unit->toCSS(); @@ -563,320 +576,346 @@ class Less_Functions{ } else { $unit = ""; } - return new Less_Tree_Dimension($val->value, $unit ); + return new Less_Tree_Dimension( $val->value, $unit ); } - public function convert($val, $unit){ - return $val->convertTo($unit->value); + public function convert( $val, $unit ) { + return $val->convertTo( $unit->value ); } - public function round($n, $f = false) { - + public function round( $n, $f = false ) { $fraction = 0; - if( $f !== false ){ + if ( $f !== false ) { $fraction = $f->value; } - return $this->_math('Less_Parser::round',null, $n, $fraction); + return $this->_math( 'Less_Parser::round', null, $n, $fraction ); } - public function pi(){ - return new Less_Tree_Dimension(M_PI); + public function pi() { + return new Less_Tree_Dimension( M_PI ); } - public function mod($a, $b) { - return new Less_Tree_Dimension( $a->value % $b->value, $a->unit); + public function mod( $a, $b ) { + return new Less_Tree_Dimension( $a->value % $b->value, $a->unit ); } - - - public function pow($x, $y) { - if( is_numeric($x) && is_numeric($y) ){ - $x = new Less_Tree_Dimension($x); - $y = new Less_Tree_Dimension($y); - }elseif( !($x instanceof Less_Tree_Dimension) || !($y instanceof Less_Tree_Dimension) ){ - throw new Less_Exception_Compiler('Arguments must be numbers'); + public function pow( $x, $y ) { + if ( is_numeric( $x ) && is_numeric( $y ) ) { + $x = new Less_Tree_Dimension( $x ); + $y = new Less_Tree_Dimension( $y ); + } elseif ( !( $x instanceof Less_Tree_Dimension ) || !( $y instanceof Less_Tree_Dimension ) ) { + throw new Less_Exception_Compiler( 'Arguments must be numbers' ); } - return new Less_Tree_Dimension( pow($x->value, $y->value), $x->unit ); + return new Less_Tree_Dimension( pow( $x->value, $y->value ), $x->unit ); } // var mathFunctions = [{name:"ce ... - public function ceil( $n ){ return $this->_math('ceil', null, $n); } - public function floor( $n ){ return $this->_math('floor', null, $n); } - public function sqrt( $n ){ return $this->_math('sqrt', null, $n); } - public function abs( $n ){ return $this->_math('abs', null, $n); } + public function ceil( $n ) { + return $this->_math( 'ceil', null, $n ); + } - public function tan( $n ){ return $this->_math('tan', '', $n); } - public function sin( $n ){ return $this->_math('sin', '', $n); } - public function cos( $n ){ return $this->_math('cos', '', $n); } + public function floor( $n ) { + return $this->_math( 'floor', null, $n ); + } - public function atan( $n ){ return $this->_math('atan', 'rad', $n); } - public function asin( $n ){ return $this->_math('asin', 'rad', $n); } - public function acos( $n ){ return $this->_math('acos', 'rad', $n); } + public function sqrt( $n ) { + return $this->_math( 'sqrt', null, $n ); + } + + public function abs( $n ) { + return $this->_math( 'abs', null, $n ); + } + + public function tan( $n ) { + return $this->_math( 'tan', '', $n ); + } + + public function sin( $n ) { + return $this->_math( 'sin', '', $n ); + } + + public function cos( $n ) { + return $this->_math( 'cos', '', $n ); + } + + public function atan( $n ) { + return $this->_math( 'atan', 'rad', $n ); + } + + public function asin( $n ) { + return $this->_math( 'asin', 'rad', $n ); + } + + public function acos( $n ) { + return $this->_math( 'acos', 'rad', $n ); + } private function _math() { $args = func_get_args(); - $fn = array_shift($args); - $unit = array_shift($args); + $fn = array_shift( $args ); + $unit = array_shift( $args ); - if ($args[0] instanceof Less_Tree_Dimension) { + if ( $args[0] instanceof Less_Tree_Dimension ) { - if( $unit === null ){ + if ( $unit === null ) { $unit = $args[0]->unit; - }else{ + } else { $args[0] = $args[0]->unify(); } $args[0] = (float)$args[0]->value; - return new Less_Tree_Dimension( call_user_func_array($fn, $args), $unit); - } else if (is_numeric($args[0])) { - return call_user_func_array($fn,$args); + return new Less_Tree_Dimension( call_user_func_array( $fn, $args ), $unit ); + } elseif ( is_numeric( $args[0] ) ) { + return call_user_func_array( $fn, $args ); } else { - throw new Less_Exception_Compiler("math functions take numbers as parameters"); + throw new Less_Exception_Compiler( "math functions take numbers as parameters" ); } } /** - * @param boolean $isMin + * @param bool $isMin + * @param array<Less_Tree> $args */ - private function _minmax( $isMin, $args ){ + private function _minmax( $isMin, $args ) { + $arg_count = count( $args ); - $arg_count = count($args); - - if( $arg_count < 1 ){ - throw new Less_Exception_Compiler( 'one or more arguments required'); + if ( $arg_count < 1 ) { + throw new Less_Exception_Compiler( 'one or more arguments required' ); } $j = null; $unitClone = null; $unitStatic = null; + // elems only contains original argument values. + $order = []; + // key is the unit.toString() for unified tree.Dimension values, + // value is the index into the order array. + $values = []; - $order = array(); // elems only contains original argument values. - $values = array(); // key is the unit.toString() for unified tree.Dimension values, - // value is the index into the order array. - - - for( $i = 0; $i < $arg_count; $i++ ){ + for ( $i = 0; $i < $arg_count; $i++ ) { $current = $args[$i]; - if( !($current instanceof Less_Tree_Dimension) ){ - if( is_array($args[$i]->value) ){ + if ( !( $current instanceof Less_Tree_Dimension ) ) { + // @phan-suppress-next-line PhanUndeclaredProperty Checked Less_Tree->value + if ( property_exists( $args[$i], 'value' ) && is_array( $args[$i]->value ) ) { + // @phan-suppress-next-line PhanUndeclaredProperty Checked Less_Tree->value $args[] = $args[$i]->value; } continue; } + // PhanTypeInvalidDimOffset -- False positive, safe after continue or non-first iterations + '@phan-var non-empty-list<Less_Tree_Dimension> $order'; - if( $current->unit->toString() === '' && !$unitClone ){ - $temp = new Less_Tree_Dimension($current->value, $unitClone); + if ( $current->unit->toString() === '' && !$unitClone ) { + $temp = new Less_Tree_Dimension( $current->value, $unitClone ); $currentUnified = $temp->unify(); - }else{ + } else { $currentUnified = $current->unify(); } - if( $currentUnified->unit->toString() === "" && !$unitStatic ){ + if ( $currentUnified->unit->toString() === "" && !$unitStatic ) { $unit = $unitStatic; - }else{ + } else { $unit = $currentUnified->unit->toString(); } - if( $unit !== '' && !$unitStatic || $unit !== '' && $order[0]->unify()->unit->toString() === "" ){ + if ( $unit !== '' && !$unitStatic || $unit !== '' && $order[0]->unify()->unit->toString() === "" ) { $unitStatic = $unit; } - if( $unit != '' && !$unitClone ){ + if ( $unit != '' && !$unitClone ) { $unitClone = $current->unit->toString(); } - if( isset($values['']) && $unit !== '' && $unit === $unitStatic ){ + if ( isset( $values[''] ) && $unit !== '' && $unit === $unitStatic ) { $j = $values['']; - }elseif( isset($values[$unit]) ){ + } elseif ( isset( $values[$unit] ) ) { $j = $values[$unit]; - }else{ + } else { - if( $unitStatic && $unit !== $unitStatic ){ - throw new Less_Exception_Compiler( 'incompatible types'); + if ( $unitStatic && $unit !== $unitStatic ) { + throw new Less_Exception_Compiler( 'incompatible types' ); } - $values[$unit] = count($order); + $values[$unit] = count( $order ); $order[] = $current; continue; } - - if( $order[$j]->unit->toString() === "" && $unitClone ){ - $temp = new Less_Tree_Dimension( $order[$j]->value, $unitClone); + if ( $order[$j]->unit->toString() === "" && $unitClone ) { + $temp = new Less_Tree_Dimension( $order[$j]->value, $unitClone ); $referenceUnified = $temp->unify(); - }else{ + } else { $referenceUnified = $order[$j]->unify(); } - if( ($isMin && $currentUnified->value < $referenceUnified->value) || (!$isMin && $currentUnified->value > $referenceUnified->value) ){ + if ( ( $isMin && $currentUnified->value < $referenceUnified->value ) || ( !$isMin && $currentUnified->value > $referenceUnified->value ) ) { $order[$j] = $current; } } - if( count($order) == 1 ){ + if ( count( $order ) == 1 ) { return $order[0]; } - $args = array(); - foreach($order as $a){ - $args[] = $a->toCSS($this->env); + $args = []; + foreach ( $order as $a ) { + $args[] = $a->toCSS(); } - return new Less_Tree_Anonymous( ($isMin?'min(':'max(') . implode(Less_Environment::$_outputMap[','],$args).')'); + return new Less_Tree_Anonymous( ( $isMin ? 'min(' : 'max(' ) . implode( Less_Environment::$_outputMap[','], $args ) . ')' ); } - public function min(){ + public function min() { $args = func_get_args(); return $this->_minmax( true, $args ); } - public function max(){ + public function max() { $args = func_get_args(); return $this->_minmax( false, $args ); } - public function getunit($n){ - return new Less_Tree_Anonymous($n->unit); + public function getunit( $n ) { + return new Less_Tree_Anonymous( $n->unit ); } - public function argb($color) { - if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to argb must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function argb( $color ) { + if ( !$color instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to argb must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return new Less_Tree_Anonymous($color->toARGB()); + return new Less_Tree_Anonymous( $color->toARGB() ); } - public function percentage($n) { - return new Less_Tree_Dimension($n->value * 100, '%'); + public function percentage( $n ) { + return new Less_Tree_Dimension( $n->value * 100, '%' ); } - public function color($n) { - - if( $n instanceof Less_Tree_Quoted ){ + public function color( $n ) { + if ( $n instanceof Less_Tree_Quoted ) { $colorCandidate = $n->value; - $returnColor = Less_Tree_Color::fromKeyword($colorCandidate); - if( $returnColor ){ + $returnColor = Less_Tree_Color::fromKeyword( $colorCandidate ); + if ( $returnColor ) { return $returnColor; } - if( preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/',$colorCandidate) ){ - return new Less_Tree_Color(substr($colorCandidate, 1)); + if ( preg_match( '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/', $colorCandidate ) ) { + return new Less_Tree_Color( substr( $colorCandidate, 1 ) ); } - throw new Less_Exception_Compiler("argument must be a color keyword or 3/6 digit hex e.g. #FFF"); + throw new Less_Exception_Compiler( "argument must be a color keyword or 3/6 digit hex e.g. #FFF" ); } else { - throw new Less_Exception_Compiler("argument must be a string"); + throw new Less_Exception_Compiler( "argument must be a string" ); } } - - public function iscolor($n) { - return $this->_isa($n, 'Less_Tree_Color'); + public function iscolor( $n ) { + return $this->_isa( $n, 'Less_Tree_Color' ); } - public function isnumber($n) { - return $this->_isa($n, 'Less_Tree_Dimension'); + public function isnumber( $n ) { + return $this->_isa( $n, 'Less_Tree_Dimension' ); } - public function isstring($n) { - return $this->_isa($n, 'Less_Tree_Quoted'); + public function isstring( $n ) { + return $this->_isa( $n, 'Less_Tree_Quoted' ); } - public function iskeyword($n) { - return $this->_isa($n, 'Less_Tree_Keyword'); + public function iskeyword( $n ) { + return $this->_isa( $n, 'Less_Tree_Keyword' ); } - public function isurl($n) { - return $this->_isa($n, 'Less_Tree_Url'); + public function isurl( $n ) { + return $this->_isa( $n, 'Less_Tree_Url' ); } - public function ispixel($n) { - return $this->isunit($n, 'px'); + public function ispixel( $n ) { + return $this->isunit( $n, 'px' ); } - public function ispercentage($n) { - return $this->isunit($n, '%'); + public function ispercentage( $n ) { + return $this->isunit( $n, '%' ); } - public function isem($n) { - return $this->isunit($n, 'em'); + public function isem( $n ) { + return $this->isunit( $n, 'em' ); } /** - * @param string $unit + * @param Less_Tree $n + * @param Less_Tree|string $unit */ - public function isunit( $n, $unit ){ - - if( is_object($unit) && property_exists($unit,'value') ){ + public function isunit( $n, $unit ) { + if ( is_object( $unit ) && property_exists( $unit, 'value' ) ) { + // @phan-suppress-next-line PhanUndeclaredProperty Checked Less_Tree->value $unit = $unit->value; } - return ($n instanceof Less_Tree_Dimension) && $n->unit->is($unit) ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false'); + return ( $n instanceof Less_Tree_Dimension ) && $n->unit->is( $unit ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); } /** + * @param Less_Tree $n * @param string $type */ - private function _isa($n, $type) { - return is_a($n, $type) ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false'); + private function _isa( $n, $type ) { + return is_a( $n, $type ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); } - public function tint($color, $amount = null) { - return $this->mix( $this->rgb(255,255,255), $color, $amount); + public function tint( $color, $amount = null ) { + return $this->mix( $this->rgb( 255, 255, 255 ), $color, $amount ); } - public function shade($color, $amount = null) { - return $this->mix($this->rgb(0, 0, 0), $color, $amount); + public function shade( $color, $amount = null ) { + return $this->mix( $this->rgb( 0, 0, 0 ), $color, $amount ); } - public function extract($values, $index ){ + public function extract( $values, $index ) { $index = (int)$index->value - 1; // (1-based index) // handle non-array values as an array of length 1 // return 'undefined' if index is invalid - if( property_exists($values,'value') && is_array($values->value) ){ - if( isset($values->value[$index]) ){ + if ( property_exists( $values, 'value' ) && is_array( $values->value ) ) { + if ( isset( $values->value[$index] ) ) { return $values->value[$index]; } return null; - }elseif( (int)$index === 0 ){ + } elseif ( (int)$index === 0 ) { return $values; } return null; } - public function length($values){ - $n = (property_exists($values,'value') && is_array($values->value)) ? count($values->value) : 1; - return new Less_Tree_Dimension($n); + public function length( $values ) { + $n = ( property_exists( $values, 'value' ) && is_array( $values->value ) ) ? count( $values->value ) : 1; + return new Less_Tree_Dimension( $n ); } - public function datauri($mimetypeNode, $filePathNode = null ) { - + public function datauri( $mimetypeNode, $filePathNode = null ) { $filePath = ( $filePathNode ? $filePathNode->value : null ); $mimetype = $mimetypeNode->value; $args = 2; - if( !$filePath ){ + if ( !$filePath ) { $filePath = $mimetype; $args = 1; } - $filePath = str_replace('\\','/',$filePath); - if( Less_Environment::isPathRelative($filePath) ){ - - if( Less_Parser::$options['relativeUrls'] ){ - $temp = $this->currentFileInfo['currentDirectory']; + $filePath = str_replace( '\\', '/', $filePath ); + if ( Less_Environment::isPathRelative( $filePath ) ) { + $currentFileInfo = $this->currentFileInfo; + '@phan-var array $currentFileInfo'; + if ( Less_Parser::$options['relativeUrls'] ) { + $temp = $currentFileInfo['currentDirectory']; } else { - $temp = $this->currentFileInfo['entryPath']; + $temp = $currentFileInfo['entryPath']; } - if( !empty($temp) ){ - $filePath = Less_Environment::normalizePath(rtrim($temp,'/').'/'.$filePath); + if ( !empty( $temp ) ) { + $filePath = Less_Environment::normalizePath( rtrim( $temp, '/' ) . '/' . $filePath ); } } - // detect the mimetype if not given - if( $args < 2 ){ + if ( $args < 2 ) { /* incomplete $mime = require('mime'); @@ -888,59 +927,56 @@ class Less_Functions{ if (useBase64) mimetype += ';base64'; */ - $mimetype = Less_Mime::lookup($filePath); + $mimetype = Less_Mime::lookup( $filePath ); - $charset = Less_Mime::charsets_lookup($mimetype); - $useBase64 = !in_array($charset,array('US-ASCII', 'UTF-8')); - if( $useBase64 ){ $mimetype .= ';base64'; } + $charset = Less_Mime::charsets_lookup( $mimetype ); + $useBase64 = !in_array( $charset, [ 'US-ASCII', 'UTF-8' ] ); + if ( $useBase64 ) { $mimetype .= ';base64'; + } - }else{ - $useBase64 = preg_match('/;base64$/',$mimetype); + } else { + $useBase64 = preg_match( '/;base64$/', $mimetype ); } - - if( file_exists($filePath) ){ - $buf = @file_get_contents($filePath); - }else{ + if ( file_exists( $filePath ) ) { + $buf = @file_get_contents( $filePath ); + } else { $buf = false; } - // IE8 cannot handle a data-uri larger than 32KB. If this is exceeded // and the --ieCompat flag is enabled, return a normal url() instead. $DATA_URI_MAX_KB = 32; - $fileSizeInKB = round( strlen($buf) / 1024 ); - if( $fileSizeInKB >= $DATA_URI_MAX_KB ){ - $url = new Less_Tree_Url( ($filePathNode ? $filePathNode : $mimetypeNode), $this->currentFileInfo); - return $url->compile($this); + $fileSizeInKB = round( strlen( $buf ) / 1024 ); + if ( $fileSizeInKB >= $DATA_URI_MAX_KB ) { + $url = new Less_Tree_Url( ( $filePathNode ?: $mimetypeNode ), $this->currentFileInfo ); + return $url->compile( $this->env ); } - if( $buf ){ - $buf = $useBase64 ? base64_encode($buf) : rawurlencode($buf); + if ( $buf ) { + $buf = $useBase64 ? base64_encode( $buf ) : rawurlencode( $buf ); $filePath = '"data:' . $mimetype . ',' . $buf . '"'; } - return new Less_Tree_Url( new Less_Tree_Anonymous($filePath) ); + return new Less_Tree_Url( new Less_Tree_Anonymous( $filePath ) ); } - //svg-gradient - public function svggradient( $direction ){ - + // svg-gradient + public function svggradient( $direction ) { $throw_message = 'svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]'; $arguments = func_get_args(); - if( count($arguments) < 3 ){ + if ( count( $arguments ) < 3 ) { throw new Less_Exception_Compiler( $throw_message ); } - $stops = array_slice($arguments,1); + $stops = array_slice( $arguments, 1 ); $gradientType = 'linear'; $rectangleDimension = 'x="0" y="0" width="1" height="1"'; $useBase64 = true; $directionValue = $direction->toCSS(); - - switch( $directionValue ){ + switch ( $directionValue ) { case "to bottom": $gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; break; @@ -967,220 +1003,218 @@ class Less_Functions{ '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">' . '<' . $gradientType . 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' . $gradientDirectionSvg . '>'; - for( $i = 0; $i < count($stops); $i++ ){ - if( is_object($stops[$i]) && property_exists($stops[$i],'value') ){ + for ( $i = 0; $i < count( $stops ); $i++ ) { + if ( is_object( $stops[$i] ) && property_exists( $stops[$i], 'value' ) ) { $color = $stops[$i]->value[0]; $position = $stops[$i]->value[1]; - }else{ + } else { $color = $stops[$i]; $position = null; } - if( !($color instanceof Less_Tree_Color) || (!(($i === 0 || $i+1 === count($stops)) && $position === null) && !($position instanceof Less_Tree_Dimension)) ){ + if ( !( $color instanceof Less_Tree_Color ) || ( !( ( $i === 0 || $i + 1 === count( $stops ) ) && $position === null ) && !( $position instanceof Less_Tree_Dimension ) ) ) { throw new Less_Exception_Compiler( $throw_message ); } - if( $position ){ + if ( $position ) { $positionValue = $position->toCSS(); - }elseif( $i === 0 ){ + } elseif ( $i === 0 ) { $positionValue = '0%'; - }else{ + } else { $positionValue = '100%'; } $alpha = $color->alpha; - $returner .= '<stop offset="' . $positionValue . '" stop-color="' . $color->toRGB() . '"' . ($alpha < 1 ? ' stop-opacity="' . $alpha . '"' : '') . '/>'; + $returner .= '<stop offset="' . $positionValue . '" stop-color="' . $color->toRGB() . '"' . ( $alpha < 1 ? ' stop-opacity="' . $alpha . '"' : '' ) . '/>'; } $returner .= '</' . $gradientType . 'Gradient><rect ' . $rectangleDimension . ' fill="url(#gradient)" /></svg>'; - - if( $useBase64 ){ - $returner = "'data:image/svg+xml;base64,".base64_encode($returner)."'"; - }else{ - $returner = "'data:image/svg+xml,".$returner."'"; + if ( $useBase64 ) { + $returner = "'data:image/svg+xml;base64," . base64_encode( $returner ) . "'"; + } else { + $returner = "'data:image/svg+xml," . $returner . "'"; } return new Less_Tree_URL( new Less_Tree_Anonymous( $returner ) ); } - /** * Php version of javascript's `encodeURIComponent` function * * @param string $string The string to encode * @return string The encoded string */ - public static function encodeURIComponent($string){ - $revert = array('%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'); - return strtr(rawurlencode($string), $revert); + public static function encodeURIComponent( $string ) { + $revert = [ '%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')' ]; + return strtr( rawurlencode( $string ), $revert ); } - // Color Blending - // ref: http://www.w3.org/TR/compositing-1 + // ref: https://www.w3.org/TR/compositing-1/ + public function colorBlend( $mode, $color1, $color2 ) { + // backdrop + $ab = $color1->alpha; + // source + $as = $color2->alpha; + $result = []; - public function colorBlend( $mode, $color1, $color2 ){ - $ab = $color1->alpha; // backdrop - $as = $color2->alpha; // source - $r = array(); // result - - $ar = $as + $ab * (1 - $as); - for( $i = 0; $i < 3; $i++ ){ + $ar = $as + $ab * ( 1 - $as ); + for ( $i = 0; $i < 3; $i++ ) { $cb = $color1->rgb[$i] / 255; $cs = $color2->rgb[$i] / 255; $cr = call_user_func( $mode, $cb, $cs ); - if( $ar ){ - $cr = ($as * $cs + $ab * ($cb - $as * ($cb + $cs - $cr))) / $ar; + if ( $ar ) { + $cr = ( $as * $cs + $ab * ( $cb - $as * ( $cb + $cs - $cr ) ) ) / $ar; } - $r[$i] = $cr * 255; + $result[$i] = $cr * 255; } - return new Less_Tree_Color($r, $ar); + return new Less_Tree_Color( $result, $ar ); } - public function multiply($color1 = null, $color2 = null ){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to multiply must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function multiply( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to multiply must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to multiply must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to multiply must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendMultiply'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendMultiply' ], $color1, $color2 ); } - private function colorBlendMultiply($cb, $cs){ + private function colorBlendMultiply( $cb, $cs ) { return $cb * $cs; } - public function screen($color1 = null, $color2 = null ){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to screen must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function screen( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to screen must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to screen must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to screen must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendScreen'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendScreen' ], $color1, $color2 ); } - private function colorBlendScreen( $cb, $cs){ + private function colorBlendScreen( $cb, $cs ) { return $cb + $cs - $cb * $cs; } - public function overlay($color1 = null, $color2 = null){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to overlay must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function overlay( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to overlay must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to overlay must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to overlay must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendOverlay'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendOverlay' ], $color1, $color2 ); } - private function colorBlendOverlay($cb, $cs ){ + private function colorBlendOverlay( $cb, $cs ) { $cb *= 2; - return ($cb <= 1) - ? $this->colorBlendMultiply($cb, $cs) - : $this->colorBlendScreen($cb - 1, $cs); + return ( $cb <= 1 ) + ? $this->colorBlendMultiply( $cb, $cs ) + : $this->colorBlendScreen( $cb - 1, $cs ); } - public function softlight($color1 = null, $color2 = null){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to softlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function softlight( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to softlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to softlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to softlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendSoftlight'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendSoftlight' ], $color1, $color2 ); } - private function colorBlendSoftlight($cb, $cs ){ + private function colorBlendSoftlight( $cb, $cs ) { $d = 1; $e = $cb; - if( $cs > 0.5 ){ + if ( $cs > 0.5 ) { $e = 1; - $d = ($cb > 0.25) ? sqrt($cb) - : ((16 * $cb - 12) * $cb + 4) * $cb; + $d = ( $cb > 0.25 ) ? sqrt( $cb ) + : ( ( 16 * $cb - 12 ) * $cb + 4 ) * $cb; } - return $cb - (1 - 2 * $cs) * $e * ($d - $cb); + return $cb - ( 1 - 2 * $cs ) * $e * ( $d - $cb ); } - public function hardlight($color1 = null, $color2 = null){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hardlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function hardlight( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to hardlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to hardlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to hardlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendHardlight'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendHardlight' ], $color1, $color2 ); } - private function colorBlendHardlight( $cb, $cs ){ - return $this->colorBlendOverlay($cs, $cb); + private function colorBlendHardlight( $cb, $cs ) { + return $this->colorBlendOverlay( $cs, $cb ); } - public function difference($color1 = null, $color2 = null) { - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to difference must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function difference( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to difference must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to difference must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to difference must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendDifference'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendDifference' ], $color1, $color2 ); } - private function colorBlendDifference( $cb, $cs ){ - return abs($cb - $cs); + private function colorBlendDifference( $cb, $cs ) { + return abs( $cb - $cs ); } - public function exclusion( $color1 = null, $color2 = null ){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to exclusion must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function exclusion( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to exclusion must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to exclusion must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to exclusion must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendExclusion'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendExclusion' ], $color1, $color2 ); } - private function colorBlendExclusion( $cb, $cs ){ + private function colorBlendExclusion( $cb, $cs ) { return $cb + $cs - 2 * $cb * $cs; } - public function average($color1 = null, $color2 = null){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to average must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function average( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to average must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to average must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to average must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendAverage'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendAverage' ], $color1, $color2 ); } // non-w3c functions: - public function colorBlendAverage($cb, $cs ){ - return ($cb + $cs) / 2; + public function colorBlendAverage( $cb, $cs ) { + return ( $cb + $cs ) / 2; } - public function negation($color1 = null, $color2 = null ){ - if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to negation must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + public function negation( $color1 = null, $color2 = null ) { + if ( !$color1 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The first argument to negation must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to negation must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + if ( !$color2 instanceof Less_Tree_Color ) { + throw new Less_Exception_Compiler( 'The second argument to negation must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) ); } - return $this->colorBlend( array($this,'colorBlendNegation'), $color1, $color2 ); + return $this->colorBlend( [ $this,'colorBlendNegation' ], $color1, $color2 ); } - public function colorBlendNegation($cb, $cs){ - return 1 - abs($cb + $cs - 1); + public function colorBlendNegation( $cb, $cs ) { + return 1 - abs( $cb + $cs - 1 ); } // ~ End of Color Blending diff --git a/vendor/wikimedia/less.php/lib/Less/Less.php.combine b/vendor/wikimedia/less.php/lib/Less/Less.php.combine old mode 100755 new mode 100644 diff --git a/vendor/wikimedia/less.php/lib/Less/Mime.php b/vendor/wikimedia/less.php/lib/Less/Mime.php index 109ecd3f8..45a7bf3d1 100644 --- a/vendor/wikimedia/less.php/lib/Less/Mime.php +++ b/vendor/wikimedia/less.php/lib/Less/Mime.php @@ -1,41 +1,36 @@ <?php - /** * Mime lookup * - * @package Less - * @subpackage node + * @private */ -class Less_Mime{ +class Less_Mime { // this map is intentionally incomplete // if you want more, install 'mime' dep - static $_types = array( - '.htm' => 'text/html', - '.html'=> 'text/html', - '.gif' => 'image/gif', - '.jpg' => 'image/jpeg', - '.jpeg'=> 'image/jpeg', - '.png' => 'image/png', - '.ttf' => 'application/x-font-ttf', - '.otf' => 'application/x-font-otf', - '.eot' => 'application/vnd.ms-fontobject', - '.woff' => 'application/x-font-woff', - '.svg' => 'image/svg+xml', - ); + private static $types = [ + '.htm' => 'text/html', + '.html' => 'text/html', + '.gif' => 'image/gif', + '.jpg' => 'image/jpeg', + '.jpeg' => 'image/jpeg', + '.png' => 'image/png', + '.ttf' => 'application/x-font-ttf', + '.otf' => 'application/x-font-otf', + '.eot' => 'application/vnd.ms-fontobject', + '.woff' => 'application/x-font-woff', + '.svg' => 'image/svg+xml', + ]; - public static function lookup( $filepath ){ - $parts = explode('.',$filepath); - $ext = '.'.strtolower(array_pop($parts)); + public static function lookup( $filepath ) { + $parts = explode( '.', $filepath ); + $ext = '.' . strtolower( array_pop( $parts ) ); - if( !isset(self::$_types[$ext]) ){ - return null; - } - return self::$_types[$ext]; + return self::$types[$ext] ?? null; } - public static function charsets_lookup( $type = null ){ + public static function charsets_lookup( $type = null ) { // assumes all text types are UTF-8 - return $type && preg_match('/^text\//',$type) ? 'UTF-8' : ''; + return $type && preg_match( '/^text\//', $type ) ? 'UTF-8' : ''; } } diff --git a/vendor/wikimedia/less.php/lib/Less/Output.php b/vendor/wikimedia/less.php/lib/Less/Output.php index f1b2b2a99..be6c160f3 100644 --- a/vendor/wikimedia/less.php/lib/Less/Output.php +++ b/vendor/wikimedia/less.php/lib/Less/Output.php @@ -1,49 +1,46 @@ <?php - /** * Parser output * - * @package Less - * @subpackage output + * @private */ -class Less_Output{ +class Less_Output { /** * Output holder * - * @var string + * @var string[] */ - protected $strs = array(); + protected $strs = []; /** * Adds a chunk to the stack * * @param string $chunk The chunk to output - * @param Less_FileInfo $fileInfo The file information - * @param integer $index The index + * @param array|null $fileInfo The file information + * @param int $index The index * @param mixed $mapLines */ - public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){ + public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) { $this->strs[] = $chunk; } /** * Is the output empty? * - * @return boolean + * @return bool */ - public function isEmpty(){ - return count($this->strs) === 0; + public function isEmpty() { + return count( $this->strs ) === 0; } - /** * Converts the output to string * * @return string */ - public function toString(){ - return implode('',$this->strs); + public function toString() { + return implode( '', $this->strs ); } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php b/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php index 884490a20..ece517204 100644 --- a/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php +++ b/vendor/wikimedia/less.php/lib/Less/Output/Mapped.php @@ -1,10 +1,8 @@ <?php - /** * Parser output with source map * - * @package Less - * @subpackage Output + * @private */ class Less_Output_Mapped extends Less_Output { @@ -18,14 +16,14 @@ class Less_Output_Mapped extends Less_Output { /** * Current line * - * @var integer + * @var int */ protected $lineNumber = 0; /** * Current column * - * @var integer + * @var int */ protected $column = 0; @@ -34,7 +32,7 @@ class Less_Output_Mapped extends Less_Output { * * @var array */ - protected $contentsMap = array(); + protected $contentsMap = []; /** * Constructor @@ -42,7 +40,7 @@ class Less_Output_Mapped extends Less_Output { * @param array $contentsMap Array of filename to contents map * @param Less_SourceMap_Generator $generator */ - public function __construct(array $contentsMap, $generator){ + public function __construct( array $contentsMap, $generator ) { $this->contentsMap = $contentsMap; $this->generator = $generator; } @@ -52,71 +50,68 @@ class Less_Output_Mapped extends Less_Output { * The $index for less.php may be different from less.js since less.php does not chunkify inputs * * @param string $chunk - * @param string $fileInfo - * @param integer $index + * @param array|null $fileInfo + * @param int $index * @param mixed $mapLines */ - public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){ - - //ignore adding empty strings - if( $chunk === '' ){ + public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) { + // ignore adding empty strings + if ( $chunk === '' ) { return; } - - $sourceLines = array(); + $sourceLines = []; $sourceColumns = ' '; - - if( $fileInfo ){ + if ( $fileInfo ) { $url = $fileInfo['currentUri']; - if( isset($this->contentsMap[$url]) ){ - $inputSource = substr($this->contentsMap[$url], 0, $index); - $sourceLines = explode("\n", $inputSource); - $sourceColumns = end($sourceLines); - }else{ - throw new Exception('Filename '.$url.' not in contentsMap'); + if ( isset( $this->contentsMap[$url] ) ) { + $inputSource = substr( $this->contentsMap[$url], 0, $index ); + $sourceLines = explode( "\n", $inputSource ); + $sourceColumns = end( $sourceLines ); + } else { + throw new Exception( 'Filename ' . $url . ' not in contentsMap' ); } } - $lines = explode("\n", $chunk); - $columns = end($lines); + $lines = explode( "\n", $chunk ); + $columns = end( $lines ); - if($fileInfo){ + if ( $fileInfo ) { - if(!$mapLines){ + if ( !$mapLines ) { $this->generator->addMapping( $this->lineNumber + 1, // generated_line $this->column, // generated_column - count($sourceLines), // original_line - strlen($sourceColumns), // original_column + count( $sourceLines ), // original_line + strlen( $sourceColumns ), // original_column $fileInfo ); - }else{ - for($i = 0, $count = count($lines); $i < $count; $i++){ + } else { + for ( $i = 0, $count = count( $lines ); $i < $count; $i++ ) { $this->generator->addMapping( $this->lineNumber + $i + 1, // generated_line $i === 0 ? $this->column : 0, // generated_column - count($sourceLines) + $i, // original_line - $i === 0 ? strlen($sourceColumns) : 0, // original_column + count( $sourceLines ) + $i, // original_line + $i === 0 ? strlen( $sourceColumns ) : 0, // original_column $fileInfo ); } } } - if(count($lines) === 1){ - $this->column += strlen($columns); - }else{ - $this->lineNumber += count($lines) - 1; - $this->column = strlen($columns); + if ( count( $lines ) === 1 ) { + $this->column += strlen( $columns ); + } else { + $this->lineNumber += count( $lines ) - 1; + $this->column = strlen( $columns ); } // add only chunk - parent::add($chunk); + parent::add( $chunk ); } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Parser.php b/vendor/wikimedia/less.php/lib/Less/Parser.php index 1c3ad5f12..b05bf1472 100644 --- a/vendor/wikimedia/less.php/lib/Less/Parser.php +++ b/vendor/wikimedia/less.php/lib/Less/Parser.php @@ -1,21 +1,14 @@ <?php -require_once( dirname(__FILE__).'/Cache.php'); - /** - * Class for parsing and compiling less files into css - * - * @package Less - * @subpackage parser - * + * Parse and compile Less files into CSS */ -class Less_Parser{ - +class Less_Parser { /** * Default parser options */ - public static $default_options = array( + public static $default_options = [ 'compress' => false, // option - whether to compress 'strictUnits' => false, // whether units need to evaluate correctly 'strictMath' => false, // whether math has to be within parenthesis @@ -23,7 +16,7 @@ class Less_Parser{ 'urlArgs' => '', // whether to add args into url tokens 'numPrecision' => 8, - 'import_dirs' => array(), + 'import_dirs' => [], 'import_callback' => null, 'cache_dir' => null, 'cache_method' => 'php', // false, 'serialize', 'php', 'var_export', 'callback'; @@ -37,17 +30,17 @@ class Less_Parser{ 'indentation' => ' ', - 'plugins' => array(), + 'plugins' => [], - ); - - public static $options = array(); + ]; + /** @var array{compress:bool,strictUnits:bool,strictMath:bool,numPrecision:int,import_dirs:array,import_callback:null|callable,indentation:string} */ + public static $options = []; private $input; // Less input string private $input_len; // input string length private $pos; // current index in `input` - private $saveStack = array(); // holds state for backtracking + private $saveStack = []; // holds state for backtracking private $furthest; private $mb_internal_encoding = ''; // for remember exists value of mbstring.internal_encoding @@ -56,9 +49,9 @@ class Less_Parser{ */ private $env; - protected $rules = array(); + protected $rules = []; - private static $imports = array(); + private static $imports = []; public static $has_extends = false; @@ -69,51 +62,46 @@ class Less_Parser{ * * @var array */ - public static $contentsMap = array(); - + public static $contentsMap = []; /** * @param Less_Environment|array|null $env */ - public function __construct( $env = null ){ - + public function __construct( $env = null ) { // Top parser on an import tree must be sure there is one "env" // which will then be passed around by reference. - if( $env instanceof Less_Environment ){ + if ( $env instanceof Less_Environment ) { $this->env = $env; - }else{ - $this->SetOptions(Less_Parser::$default_options); + } else { + $this->SetOptions( self::$default_options ); $this->Reset( $env ); } // mbstring.func_overload > 1 bugfix // The encoding value must be set for each source file, // therefore, to conserve resources and improve the speed of this design is taken here - if (ini_get('mbstring.func_overload')) { - $this->mb_internal_encoding = ini_get('mbstring.internal_encoding'); - @ini_set('mbstring.internal_encoding', 'ascii'); + if ( ini_get( 'mbstring.func_overload' ) ) { + $this->mb_internal_encoding = ini_get( 'mbstring.internal_encoding' ); + @ini_set( 'mbstring.internal_encoding', 'ascii' ); } - } - /** * Reset the parser state completely - * */ - public function Reset( $options = null ){ - $this->rules = array(); - self::$imports = array(); + public function Reset( $options = null ) { + $this->rules = []; + self::$imports = []; self::$has_extends = false; - self::$imports = array(); - self::$contentsMap = array(); + self::$imports = []; + self::$contentsMap = []; - $this->env = new Less_Environment($options); + $this->env = new Less_Environment(); - //set new options - if( is_array($options) ){ - $this->SetOptions(Less_Parser::$default_options); - $this->SetOptions($options); + // set new options + if ( is_array( $options ) ) { + $this->SetOptions( self::$default_options ); + $this->SetOptions( $options ); } $this->env->Init(); @@ -122,174 +110,163 @@ class Less_Parser{ /** * Set one or more compiler options * options: import_dirs, cache_dir, cache_method - * */ - public function SetOptions( $options ){ - foreach($options as $option => $value){ - $this->SetOption($option,$value); + public function SetOptions( $options ) { + foreach ( $options as $option => $value ) { + $this->SetOption( $option, $value ); } } /** * Set one compiler option - * */ - public function SetOption($option,$value){ - - switch($option){ + public function SetOption( $option, $value ) { + switch ( $option ) { case 'import_dirs': - $this->SetImportDirs($value); - return; + $this->SetImportDirs( $value ); + return; case 'cache_dir': - if( is_string($value) ){ - Less_Cache::SetCacheDir($value); + if ( is_string( $value ) ) { + Less_Cache::SetCacheDir( $value ); Less_Cache::CheckCacheDir(); } - return; + return; } - Less_Parser::$options[$option] = $value; + self::$options[$option] = $value; } /** * Registers a new custom function * - * @param string $name function name - * @param callable $callback callback + * @param string $name function name + * @param callable $callback callback */ - public function registerFunction($name, $callback) { + public function registerFunction( $name, $callback ) { $this->env->functions[$name] = $callback; } /** * Removed an already registered function * - * @param string $name function name + * @param string $name function name */ - public function unregisterFunction($name) { - if( isset($this->env->functions[$name]) ) - unset($this->env->functions[$name]); + public function unregisterFunction( $name ) { + if ( isset( $this->env->functions[$name] ) ) { + unset( $this->env->functions[$name] ); + } } - /** * Get the current css buffer * * @return string */ - public function getCss(){ - - $precision = ini_get('precision'); - @ini_set('precision',16); - $locale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + public function getCss() { + $precision = ini_get( 'precision' ); + @ini_set( 'precision', '16' ); + $locale = setlocale( LC_NUMERIC, 0 ); + setlocale( LC_NUMERIC, "C" ); try { - - $root = new Less_Tree_Ruleset(array(), $this->rules ); + $root = new Less_Tree_Ruleset( null, $this->rules ); $root->root = true; $root->firstRoot = true; - - $this->PreVisitors($root); + $this->PreVisitors( $root ); self::$has_extends = false; - $evaldRoot = $root->compile($this->env); + $evaldRoot = $root->compile( $this->env ); + $this->PostVisitors( $evaldRoot ); - - $this->PostVisitors($evaldRoot); - - if( Less_Parser::$options['sourceMap'] ){ - $generator = new Less_SourceMap_Generator($evaldRoot, Less_Parser::$contentsMap, Less_Parser::$options ); + if ( self::$options['sourceMap'] ) { + $generator = new Less_SourceMap_Generator( $evaldRoot, self::$contentsMap, self::$options ); // will also save file // FIXME: should happen somewhere else? $css = $generator->generateCSS(); - }else{ + } else { $css = $evaldRoot->toCSS(); } - if( Less_Parser::$options['compress'] ){ - $css = preg_replace('/(^(\s)+)|((\s)+$)/', '', $css); + if ( self::$options['compress'] ) { + $css = preg_replace( '/(^(\s)+)|((\s)+$)/', '', $css ); } - } catch (Exception $exc) { + } catch ( Exception $exc ) { // Intentional fall-through so we can reset environment } - //reset php settings - @ini_set('precision',$precision); - setlocale(LC_NUMERIC, $locale); + // reset php settings + @ini_set( 'precision', $precision ); + setlocale( LC_NUMERIC, $locale ); // If you previously defined $this->mb_internal_encoding // is required to return the encoding as it was before - if ($this->mb_internal_encoding != '') { - @ini_set("mbstring.internal_encoding", $this->mb_internal_encoding); + if ( $this->mb_internal_encoding != '' ) { + @ini_set( "mbstring.internal_encoding", $this->mb_internal_encoding ); $this->mb_internal_encoding = ''; } // Rethrow exception after we handled resetting the environment - if (!empty($exc)) { + if ( !empty( $exc ) ) { throw $exc; } return $css; } - public function findValueOf($varName) - { - foreach($this->rules as $rule){ - if(isset($rule->variable) && ($rule->variable == true) && (str_replace("@","",$rule->name) == $varName)){ - return $this->getVariableValue($rule); + public function findValueOf( $varName ) { + foreach ( $this->rules as $rule ) { + if ( isset( $rule->variable ) && ( $rule->variable == true ) && ( str_replace( "@", "", $rule->name ) == $varName ) ) { + return $this->getVariableValue( $rule ); } } return null; } /** - * - * this function gets the private rules variable and returns an array of the found variables - * it uses a helper method getVariableValue() that contains the logic ot fetch the value from the rule object + * Gets the private rules variable and returns an array of the found variables + * it uses a helper method getVariableValue() that contains the logic ot fetch the value + * from the rule object * * @return array */ - public function getVariables() - { - $variables = array(); + public function getVariables() { + $variables = []; - $not_variable_type = array( + $not_variable_type = [ 'Comment', // this include less comments ( // ) and css comments (/* */) 'Import', // do not search variables in included files @import 'Ruleset', // selectors (.someclass, #someid, …) 'Operation', // - ); + ]; // @TODO run compilation if not runned yet - foreach ($this->rules as $key => $rule) { - if (in_array($rule->type, $not_variable_type)) { + foreach ( $this->rules as $key => $rule ) { + if ( in_array( $rule->type, $not_variable_type ) ) { continue; } // Note: it seems rule->type is always Rule when variable = true - if ($rule->type == 'Rule' && $rule->variable) { - $variables[$rule->name] = $this->getVariableValue($rule); + if ( $rule->type == 'Rule' && $rule->variable ) { + $variables[$rule->name] = $this->getVariableValue( $rule ); } else { - if ($rule->type == 'Comment') { - $variables[] = $this->getVariableValue($rule); + if ( $rule->type == 'Comment' ) { + $variables[] = $this->getVariableValue( $rule ); } } } return $variables; } - public function findVarByName($var_name) - { - foreach($this->rules as $rule){ - if(isset($rule->variable) && ($rule->variable == true)){ - if($rule->name == $var_name){ - return $this->getVariableValue($rule); + public function findVarByName( $var_name ) { + foreach ( $this->rules as $rule ) { + if ( isset( $rule->variable ) && ( $rule->variable == true ) ) { + if ( $rule->name == $var_name ) { + return $this->getVariableValue( $rule ); } } } @@ -297,411 +274,381 @@ class Less_Parser{ } /** - * * This method gets the value of the less variable from the rules object. * Since the objects vary here we add the logic for extracting the css/less value. * - * @param $var - * - * @return bool|string + * @param Less_Tree $var + * @return string */ - private function getVariableValue($var) - { - if (!is_a($var, 'Less_Tree')) { - throw new Exception('var is not a Less_Tree object'); - } - - switch ($var->type) { - case 'Color': - return $this->rgb2html($var->rgb); - case 'Unit': - return $var->value. $var->unit->numerator[0]; - case 'Variable': - return $this->findVarByName($var->name); - case 'Keyword': + private function getVariableValue( Less_Tree $var ) { + switch ( get_class( $var ) ) { + case Less_Tree_Color::class: + return $this->rgb2html( $var->rgb ); + case Less_Tree_Variable::class: + return $this->findVarByName( $var->name ); + case Less_Tree_Keyword::class: return $var->value; - case 'Rule': - return $this->getVariableValue($var->value); - case 'Value': + case Less_Tree_Url::class: + // Based on Less_Tree_Url::genCSS() + // Recurse to serialize the Less_Tree_Quoted value + return 'url(' . $this->getVariableValue( $var->value ) . ')'; + case Less_Tree_Rule::class: + return $this->getVariableValue( $var->value ); + case Less_Tree_Value::class: $value = ''; - foreach ($var->value as $sub_value) { - $value .= $this->getVariableValue($sub_value).' '; + foreach ( $var->value as $sub_value ) { + $value .= $this->getVariableValue( $sub_value ) . ' '; } return $value; - case 'Quoted': - return $var->quote.$var->value.$var->quote; - case 'Dimension': + case Less_Tree_Quoted::class: + return $var->quote . $var->value . $var->quote; + case Less_Tree_Dimension::class: $value = $var->value; - if ($var->unit && $var->unit->numerator) { + if ( $var->unit && $var->unit->numerator ) { $value .= $var->unit->numerator[0]; } return $value; - case 'Expression': - $value = ""; - foreach($var->value as $item) { - $value .= $this->getVariableValue($item)." "; + case Less_Tree_Expression::class: + $value = ''; + foreach ( $var->value as $item ) { + $value .= $this->getVariableValue( $item ) . " "; } return $value; - case 'Operation': - throw new Exception('getVariables() require Less to be compiled. please use $parser->getCss() before calling getVariables()'); - case 'Comment': - case 'Import': - case 'Ruleset': + case Less_Tree_Operation::class: + throw new Exception( 'getVariables() require Less to be compiled. please use $parser->getCss() before calling getVariables()' ); + case Less_Tree_Unit::class: + case Less_Tree_Comment::class: + case Less_Tree_Import::class: + case Less_Tree_Ruleset::class: default: - throw new Exception("type missing in switch/case getVariableValue for ".$var->type); + throw new Exception( "type missing in switch/case getVariableValue for " . $var->type ); } - return false; } - private function rgb2html($r, $g=-1, $b=-1) - { - if (is_array($r) && sizeof($r) == 3) - list($r, $g, $b) = $r; + private function rgb2html( $r, $g = -1, $b = -1 ) { + if ( is_array( $r ) && count( $r ) == 3 ) { + list( $r, $g, $b ) = $r; + } - $r = intval($r); $g = intval($g); - $b = intval($b); + $r = intval( $r ); +$g = intval( $g ); + $b = intval( $b ); - $r = dechex($r<0?0:($r>255?255:$r)); - $g = dechex($g<0?0:($g>255?255:$g)); - $b = dechex($b<0?0:($b>255?255:$b)); + $r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) ); + $g = dechex( $g < 0 ? 0 : ( $g > 255 ? 255 : $g ) ); + $b = dechex( $b < 0 ? 0 : ( $b > 255 ? 255 : $b ) ); - $color = (strlen($r) < 2?'0':'').$r; - $color .= (strlen($g) < 2?'0':'').$g; - $color .= (strlen($b) < 2?'0':'').$b; - return '#'.$color; + $color = ( strlen( $r ) < 2 ? '0' : '' ) . $r; + $color .= ( strlen( $g ) < 2 ? '0' : '' ) . $g; + $color .= ( strlen( $b ) < 2 ? '0' : '' ) . $b; + return '#' . $color; } /** * Run pre-compile visitors - * */ - private function PreVisitors($root){ - - if( Less_Parser::$options['plugins'] ){ - foreach(Less_Parser::$options['plugins'] as $plugin){ - if( !empty($plugin->isPreEvalVisitor) ){ - $plugin->run($root); + private function PreVisitors( $root ) { + if ( self::$options['plugins'] ) { + foreach ( self::$options['plugins'] as $plugin ) { + if ( !empty( $plugin->isPreEvalVisitor ) ) { + $plugin->run( $root ); } } } } - /** * Run post-compile visitors - * */ - private function PostVisitors($evaldRoot){ - - $visitors = array(); + private function PostVisitors( $evaldRoot ) { + $visitors = []; $visitors[] = new Less_Visitor_joinSelector(); - if( self::$has_extends ){ + if ( self::$has_extends ) { $visitors[] = new Less_Visitor_processExtends(); } $visitors[] = new Less_Visitor_toCSS(); - - if( Less_Parser::$options['plugins'] ){ - foreach(Less_Parser::$options['plugins'] as $plugin){ - if( property_exists($plugin,'isPreEvalVisitor') && $plugin->isPreEvalVisitor ){ + if ( self::$options['plugins'] ) { + foreach ( self::$options['plugins'] as $plugin ) { + if ( property_exists( $plugin, 'isPreEvalVisitor' ) && $plugin->isPreEvalVisitor ) { continue; } - if( property_exists($plugin,'isPreVisitor') && $plugin->isPreVisitor ){ - array_unshift( $visitors, $plugin); - }else{ + if ( property_exists( $plugin, 'isPreVisitor' ) && $plugin->isPreVisitor ) { + array_unshift( $visitors, $plugin ); + } else { $visitors[] = $plugin; } } } - - for($i = 0; $i < count($visitors); $i++ ){ - $visitors[$i]->run($evaldRoot); + for ( $i = 0; $i < count( $visitors ); $i++ ) { + $visitors[$i]->run( $evaldRoot ); } - } - /** - * Parse a Less string into css + * Parse a Less string * + * @throws Less_Exception_Parser If the compiler encounters invalid syntax * @param string $str The string to convert - * @param string $uri_root The url of the file - * @return Less_Tree_Ruleset|Less_Parser + * @param string|null $file_uri The url of the file + * @return Less_Parser */ - public function parse( $str, $file_uri = null ){ - - if( !$file_uri ){ + public function parse( $str, $file_uri = null ) { + if ( !$file_uri ) { $uri_root = ''; - $filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less'; - }else{ - $file_uri = self::WinPath($file_uri); + $filename = 'anonymous-file-' . self::$next_id++ . '.less'; + } else { + $file_uri = self::WinPath( $file_uri ); $filename = $file_uri; - $uri_root = dirname($file_uri); + $uri_root = dirname( $file_uri ); } $previousFileInfo = $this->env->currentFileInfo; - $uri_root = self::WinPath($uri_root); - $this->SetFileInfo($filename, $uri_root); + $uri_root = self::WinPath( $uri_root ); + $this->SetFileInfo( $filename, $uri_root ); $this->input = $str; $this->_parse(); - if( $previousFileInfo ){ + if ( $previousFileInfo ) { $this->env->currentFileInfo = $previousFileInfo; } return $this; } - /** * Parse a Less string from a given file * - * @throws Less_Exception_Parser + * @throws Less_Exception_Parser If the compiler encounters invalid syntax * @param string $filename The file to parse * @param string $uri_root The url of the file * @param bool $returnRoot Indicates whether the return value should be a css string a root node * @return Less_Tree_Ruleset|Less_Parser */ - public function parseFile( $filename, $uri_root = '', $returnRoot = false){ - - if( !file_exists($filename) ){ - $this->Error(sprintf('File `%s` not found.', $filename)); + public function parseFile( $filename, $uri_root = '', $returnRoot = false ) { + if ( !file_exists( $filename ) ) { + $this->Error( sprintf( 'File `%s` not found.', $filename ) ); } - // fix uri_root? // Instead of The mixture of file path for the first argument and directory path for the second argument has bee - if( !$returnRoot && !empty($uri_root) && basename($uri_root) == basename($filename) ){ - $uri_root = dirname($uri_root); + if ( !$returnRoot && !empty( $uri_root ) && basename( $uri_root ) == basename( $filename ) ) { + $uri_root = dirname( $uri_root ); } - $previousFileInfo = $this->env->currentFileInfo; - - if( $filename ){ - $filename = self::AbsPath($filename, true); + if ( $filename ) { + $filename = self::AbsPath( $filename, true ); } - $uri_root = self::WinPath($uri_root); + $uri_root = self::WinPath( $uri_root ); - $this->SetFileInfo($filename, $uri_root); + $this->SetFileInfo( $filename, $uri_root ); - self::AddParsedFile($filename); + self::AddParsedFile( $filename ); - if( $returnRoot ){ + if ( $returnRoot ) { $rules = $this->GetRules( $filename ); - $return = new Less_Tree_Ruleset(array(), $rules ); - }else{ + $return = new Less_Tree_Ruleset( null, $rules ); + } else { $this->_parse( $filename ); $return = $this; } - if( $previousFileInfo ){ + if ( $previousFileInfo ) { $this->env->currentFileInfo = $previousFileInfo; } return $return; } - /** * Allows a user to set variables values * @param array $vars * @return Less_Parser */ - public function ModifyVars( $vars ){ - - $this->input = Less_Parser::serializeVars( $vars ); + public function ModifyVars( $vars ) { + $this->input = self::serializeVars( $vars ); $this->_parse(); return $this; } - /** * @param string $filename + * @param string $uri_root */ - public function SetFileInfo( $filename, $uri_root = ''){ + public function SetFileInfo( $filename, $uri_root = '' ) { + $filename = Less_Environment::normalizePath( $filename ); + $dirname = preg_replace( '/[^\/\\\\]*$/', '', $filename ); - $filename = Less_Environment::normalizePath($filename); - $dirname = preg_replace('/[^\/\\\\]*$/','',$filename); - - if( !empty($uri_root) ){ - $uri_root = rtrim($uri_root,'/').'/'; + if ( !empty( $uri_root ) ) { + $uri_root = rtrim( $uri_root, '/' ) . '/'; } - $currentFileInfo = array(); + $currentFileInfo = []; - //entry info - if( isset($this->env->currentFileInfo) ){ + // entry info + if ( isset( $this->env->currentFileInfo ) ) { $currentFileInfo['entryPath'] = $this->env->currentFileInfo['entryPath']; $currentFileInfo['entryUri'] = $this->env->currentFileInfo['entryUri']; $currentFileInfo['rootpath'] = $this->env->currentFileInfo['rootpath']; - }else{ + } else { $currentFileInfo['entryPath'] = $dirname; $currentFileInfo['entryUri'] = $uri_root; $currentFileInfo['rootpath'] = $dirname; } $currentFileInfo['currentDirectory'] = $dirname; - $currentFileInfo['currentUri'] = $uri_root.basename($filename); + $currentFileInfo['currentUri'] = $uri_root . basename( $filename ); $currentFileInfo['filename'] = $filename; $currentFileInfo['uri_root'] = $uri_root; - - //inherit reference - if( isset($this->env->currentFileInfo['reference']) && $this->env->currentFileInfo['reference'] ){ + // inherit reference + if ( isset( $this->env->currentFileInfo['reference'] ) && $this->env->currentFileInfo['reference'] ) { $currentFileInfo['reference'] = true; } $this->env->currentFileInfo = $currentFileInfo; } - /** * @deprecated 1.5.1.2 - * */ - public function SetCacheDir( $dir ){ - - if( !file_exists($dir) ){ - if( mkdir($dir) ){ + public function SetCacheDir( $dir ) { + if ( !file_exists( $dir ) ) { + if ( mkdir( $dir ) ) { return true; } - throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.$dir); + throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: ' . $dir ); - }elseif( !is_dir($dir) ){ - throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.$dir); + } elseif ( !is_dir( $dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: ' . $dir ); - }elseif( !is_writable($dir) ){ - throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.$dir); + } elseif ( !is_writable( $dir ) ) { + throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: ' . $dir ); - }else{ - $dir = self::WinPath($dir); - Less_Cache::$cache_dir = rtrim($dir,'/').'/'; + } else { + $dir = self::WinPath( $dir ); + Less_Cache::$cache_dir = rtrim( $dir, '/' ) . '/'; return true; } } - /** * Set a list of directories or callbacks the parser should use for determining import paths * * @param array $dirs */ - public function SetImportDirs( $dirs ){ - Less_Parser::$options['import_dirs'] = array(); + public function SetImportDirs( $dirs ) { + self::$options['import_dirs'] = []; - foreach($dirs as $path => $uri_root){ + foreach ( $dirs as $path => $uri_root ) { - $path = self::WinPath($path); - if( !empty($path) ){ - $path = rtrim($path,'/').'/'; + $path = self::WinPath( $path ); + if ( !empty( $path ) ) { + $path = rtrim( $path, '/' ) . '/'; } - if ( !is_callable($uri_root) ){ - $uri_root = self::WinPath($uri_root); - if( !empty($uri_root) ){ - $uri_root = rtrim($uri_root,'/').'/'; + if ( !is_callable( $uri_root ) ) { + $uri_root = self::WinPath( $uri_root ); + if ( !empty( $uri_root ) ) { + $uri_root = rtrim( $uri_root, '/' ) . '/'; } } - Less_Parser::$options['import_dirs'][$path] = $uri_root; + self::$options['import_dirs'][$path] = $uri_root; } } /** - * @param string $file_path + * @param string|null $file_path */ - private function _parse( $file_path = null ){ - $this->rules = array_merge($this->rules, $this->GetRules( $file_path )); + private function _parse( $file_path = null ) { + $this->rules = array_merge( $this->rules, $this->GetRules( $file_path ) ); } - /** * Return the results of parsePrimary for $file_path * Use cache and save cached results if possible * * @param string|null $file_path */ - private function GetRules( $file_path ){ - - $this->SetInput($file_path); + private function GetRules( $file_path ) { + $this->SetInput( $file_path ); $cache_file = $this->CacheFile( $file_path ); - if( $cache_file ){ - if( Less_Parser::$options['cache_method'] == 'callback' ){ - if( is_callable(Less_Parser::$options['cache_callback_get']) ){ + if ( $cache_file ) { + if ( self::$options['cache_method'] == 'callback' ) { + if ( is_callable( self::$options['cache_callback_get'] ) ) { $cache = call_user_func_array( - Less_Parser::$options['cache_callback_get'], - array($this, $file_path, $cache_file) + self::$options['cache_callback_get'], + [ $this, $file_path, $cache_file ] ); - if( $cache ){ + if ( $cache ) { $this->UnsetInput(); return $cache; } } - }elseif( file_exists($cache_file) ){ - switch(Less_Parser::$options['cache_method']){ + } elseif ( file_exists( $cache_file ) ) { + switch ( self::$options['cache_method'] ) { // Using serialize // Faster but uses more memory case 'serialize': - $cache = unserialize(file_get_contents($cache_file)); - if( $cache ){ - touch($cache_file); + $cache = unserialize( file_get_contents( $cache_file ) ); + if ( $cache ) { + touch( $cache_file ); $this->UnsetInput(); return $cache; } break; - // Using generated php code case 'var_export': case 'php': $this->UnsetInput(); - return include($cache_file); + return include $cache_file; } } } $rules = $this->parsePrimary(); - if( $this->pos < $this->input_len ){ - throw new Less_Exception_Chunk($this->input, null, $this->furthest, $this->env->currentFileInfo); + if ( $this->pos < $this->input_len ) { + throw new Less_Exception_Chunk( $this->input, null, $this->furthest, $this->env->currentFileInfo ); } $this->UnsetInput(); - - //save the cache - if( $cache_file ){ - if( Less_Parser::$options['cache_method'] == 'callback' ){ - if( is_callable(Less_Parser::$options['cache_callback_set']) ){ + // save the cache + if ( $cache_file ) { + if ( self::$options['cache_method'] == 'callback' ) { + if ( is_callable( self::$options['cache_callback_set'] ) ) { call_user_func_array( - Less_Parser::$options['cache_callback_set'], - array($this, $file_path, $cache_file, $rules) + self::$options['cache_callback_set'], + [ $this, $file_path, $cache_file, $rules ] ); } - }else{ - //msg('write cache file'); - switch(Less_Parser::$options['cache_method']){ + } else { + switch ( self::$options['cache_method'] ) { case 'serialize': - file_put_contents( $cache_file, serialize($rules) ); + file_put_contents( $cache_file, serialize( $rules ) ); break; case 'php': - file_put_contents( $cache_file, '<?php return '.self::ArgString($rules).'; ?>' ); + // Mask PHP open tag to avoid breaking Doxygen + file_put_contents( $cache_file, '<' . '?php return ' . self::ArgString( $rules ) . '; ?>' ); break; case 'var_export': - //Requires __set_state() - file_put_contents( $cache_file, '<?php return '.var_export($rules,true).'; ?>' ); + // Requires __set_state() + file_put_contents( $cache_file, '<' . '?php return ' . var_export( $rules, true ) . '; ?>' ); break; } @@ -712,135 +659,126 @@ class Less_Parser{ return $rules; } - /** * Set up the input buffer - * */ - public function SetInput( $file_path ){ - - if( $file_path ){ + public function SetInput( $file_path ) { + if ( $file_path ) { $this->input = file_get_contents( $file_path ); } $this->pos = $this->furthest = 0; // Remove potential UTF Byte Order Mark - $this->input = preg_replace('/\\G\xEF\xBB\xBF/', '', $this->input); - $this->input_len = strlen($this->input); + $this->input = preg_replace( '/\\G\xEF\xBB\xBF/', '', $this->input ); + $this->input_len = strlen( $this->input ); - - if( Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo ){ + if ( self::$options['sourceMap'] && $this->env->currentFileInfo ) { $uri = $this->env->currentFileInfo['currentUri']; - Less_Parser::$contentsMap[$uri] = $this->input; + self::$contentsMap[$uri] = $this->input; } - } - /** * Free up some memory - * */ - public function UnsetInput(){ - unset($this->input, $this->pos, $this->input_len, $this->furthest); - $this->saveStack = array(); + public function UnsetInput() { + $this->input = $this->pos = $this->input_len = $this->furthest = null; + $this->saveStack = []; } + public function CacheFile( $file_path ) { + if ( $file_path && $this->CacheEnabled() ) { - public function CacheFile( $file_path ){ + $env = get_object_vars( $this->env ); + unset( $env['frames'] ); - if( $file_path && $this->CacheEnabled() ){ - - $env = get_object_vars($this->env); - unset($env['frames']); - - $parts = array(); + $parts = []; $parts[] = $file_path; $parts[] = filesize( $file_path ); $parts[] = filemtime( $file_path ); $parts[] = $env; $parts[] = Less_Version::cache_version; - $parts[] = Less_Parser::$options['cache_method']; - return Less_Cache::$cache_dir . Less_Cache::$prefix . base_convert( sha1(json_encode($parts) ), 16, 36) . '.lesscache'; + $parts[] = self::$options['cache_method']; + return Less_Cache::$cache_dir . Less_Cache::$prefix . base_convert( sha1( json_encode( $parts ) ), 16, 36 ) . '.lesscache'; } } - - static function AddParsedFile($file){ + static function AddParsedFile( $file ) { self::$imports[] = $file; } - static function AllParsedFiles(){ + static function AllParsedFiles() { return self::$imports; } /** * @param string $file */ - static function FileParsed($file){ - return in_array($file,self::$imports); + static function FileParsed( $file ) { + return in_array( $file, self::$imports ); } - function save() { $this->saveStack[] = $this->pos; } private function restore() { - $this->pos = array_pop($this->saveStack); + if ( $this->pos > $this->furthest ) { + $this->furthest = $this->pos; + } + $this->pos = array_pop( $this->saveStack ); } - private function forget(){ - array_pop($this->saveStack); + private function forget() { + array_pop( $this->saveStack ); } /** * Determine if the character at the specified offset from the current position is a white space. * * @param int $offset - * * @return bool */ - private function isWhitespace($offset = 0) { - return strpos(" \t\n\r\v\f", $this->input[$this->pos + $offset]) !== false; + private function isWhitespace( $offset = 0 ) { + // @phan-suppress-next-line PhanParamSuspiciousOrder False positive + return strpos( " \t\n\r\v\f", $this->input[$this->pos + $offset] ) !== false; } /** * Parse from a token, regexp or string, and move forward if match * * @param array $toks - * @return array + * @return null|string|array|Less_Tree */ - private function match($toks){ - + private function matcher( $toks ) { // The match is confirmed, add the match length to `this::pos`, // and consume any extra white-space characters (' ' || '\n') // which come after that. The reason for this is that LeSS's // grammar is mostly white-space insensitive. // - foreach($toks as $tok){ + foreach ( $toks as $tok ) { $char = $tok[0]; - if( $char === '/' ){ - $match = $this->MatchReg($tok); + if ( $char === '/' ) { + $match = $this->MatchReg( $tok ); - if( $match ){ - return count($match) === 1 ? $match[0] : $match; + if ( $match ) { + return count( $match ) === 1 ? $match[0] : $match; } - }elseif( $char === '#' ){ - $match = $this->MatchChar($tok[1]); + } elseif ( $char === '#' ) { + $match = $this->MatchChar( $tok[1] ); - }else{ + } else { // Non-terminal, match using a function call $match = $this->$tok(); } - if( $match ){ + if ( $match ) { return $match; } } @@ -848,85 +786,86 @@ class Less_Parser{ /** * @param string[] $toks - * - * @return string + * @return null|string|array|Less_Tree */ - private function MatchFuncs($toks){ - - if( $this->pos < $this->input_len ){ - foreach($toks as $tok){ + private function MatchFuncs( $toks ) { + if ( $this->pos < $this->input_len ) { + foreach ( $toks as $tok ) { $match = $this->$tok(); - if( $match ){ + if ( $match ) { return $match; } } } - } - // Match a single character in the input, - private function MatchChar($tok){ - if( ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok) ){ - $this->skipWhitespace(1); + /** + * Match a single character in the input. + * + * @param string $tok + * @see less-2.5.3.js#parserInput.$char + */ + private function MatchChar( $tok ) { + if ( ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok ) ) { + $this->skipWhitespace( 1 ); return $tok; } } - // Match a regexp from the current start point - private function MatchReg($tok){ - - if( preg_match($tok, $this->input, $match, 0, $this->pos) ){ - $this->skipWhitespace(strlen($match[0])); + /** + * Match a regexp from the current start point + * + * @return array|null + */ + private function MatchReg( $tok ) { + if ( preg_match( $tok, $this->input, $match, 0, $this->pos ) ) { + $this->skipWhitespace( strlen( $match[0] ) ); return $match; } } - /** * Same as match(), but don't change the state of the parser, * just return the match. * * @param string $tok - * @return integer + * @return int|false */ - public function PeekReg($tok){ - return preg_match($tok, $this->input, $match, 0, $this->pos); + public function PeekReg( $tok ) { + return preg_match( $tok, $this->input, $match, 0, $this->pos ); } /** * @param string $tok */ - public function PeekChar($tok){ - //return ($this->input[$this->pos] === $tok ); - return ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok ); + public function PeekChar( $tok ) { + return ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok ); } - /** - * @param integer $length + * @param int $length + * @see less-2.5.3.js#skipWhitespace */ - public function skipWhitespace($length){ - + public function skipWhitespace( $length ) { $this->pos += $length; - for(; $this->pos < $this->input_len; $this->pos++ ){ + for ( ; $this->pos < $this->input_len; $this->pos++ ) { $c = $this->input[$this->pos]; - if( ($c !== "\n") && ($c !== "\r") && ($c !== "\t") && ($c !== ' ') ){ + if ( ( $c !== "\n" ) && ( $c !== "\r" ) && ( $c !== "\t" ) && ( $c !== ' ' ) ) { break; } } } - /** * @param string $tok * @param string|null $msg */ - public function expect($tok, $msg = NULL) { - $result = $this->match( array($tok) ); - if (!$result) { - $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); + public function expect( $tok, $msg = null ) { + $result = $this->matcher( [ $tok ] ); + if ( !$result ) { + $this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg ); } else { return $result; } @@ -934,13 +873,14 @@ class Less_Parser{ /** * @param string $tok + * @param string|null $msg */ - public function expectChar($tok, $msg = null ){ - $result = $this->MatchChar($tok); - if( !$result ){ - $msg = $msg ? $msg : "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'"; + public function expectChar( $tok, $msg = null ) { + $result = $this->MatchChar( $tok ); + if ( !$result ) { + $msg = $msg ?: "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'"; $this->Error( $msg ); - }else{ + } else { return $result; } } @@ -990,31 +930,40 @@ class Less_Parser{ // Only at one point is the primary rule not called from the // block rule: at the root level. // - private function parsePrimary(){ - $root = array(); + // @see less-2.5.3.js#parsers.primary + private function parsePrimary() { + $root = []; - while( true ){ + while ( true ) { - if( $this->pos >= $this->input_len ){ + if ( $this->pos >= $this->input_len ) { break; } - $node = $this->parseExtend(true); - if( $node ){ - $root = array_merge($root,$node); + $node = $this->parseExtend( true ); + if ( $node ) { + $root = array_merge( $root, $node ); continue; } - //$node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseDirective')); - $node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseNameValue', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseRulesetCall', 'parseDirective')); + $node = $this->MatchFuncs( [ + 'parseMixinDefinition', + 'parseNameValue', + 'parseRule', + 'parseRuleset', + 'parseMixinCall', + 'parseComment', + 'parseRulesetCall', + 'parseDirective' + ] ); - if( $node ){ + if ( $node ) { $root[] = $node; - }elseif( !$this->MatchReg('/\\G[\s\n;]+/') ){ + } elseif ( !$this->MatchReg( '/\\G[\s\n;]+/' ) ) { break; } - if( $this->PeekChar('}') ){ + if ( $this->PeekChar( '}' ) ) { break; } } @@ -1022,35 +971,32 @@ class Less_Parser{ return $root; } - - // We create a Comment node for CSS comments `/* */`, // but keep the LeSS comments `//` silent, by just skipping // over them. - private function parseComment(){ - - if( $this->input[$this->pos] !== '/' ){ + private function parseComment() { + if ( $this->input[$this->pos] !== '/' ) { return; } - if( $this->input[$this->pos+1] === '/' ){ - $match = $this->MatchReg('/\\G\/\/.*/'); - return $this->NewObj4('Less_Tree_Comment',array($match[0], true, $this->pos, $this->env->currentFileInfo)); + if ( $this->input[$this->pos + 1] === '/' ) { + $match = $this->MatchReg( '/\\G\/\/.*/' ); + return $this->NewObj( 'Less_Tree_Comment', [ $match[0], true, $this->pos, $this->env->currentFileInfo ] ); } - //$comment = $this->MatchReg('/\\G\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/'); - $comment = $this->MatchReg('/\\G\/\*(?s).*?\*+\/\n?/');//not the same as less.js to prevent fatal errors - if( $comment ){ - return $this->NewObj4('Less_Tree_Comment',array($comment[0], false, $this->pos, $this->env->currentFileInfo)); + // $comment = $this->MatchReg('/\\G\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/'); + $comment = $this->MatchReg( '/\\G\/\*(?s).*?\*+\/\n?/' );// not the same as less.js to prevent fatal errors + if ( $comment ) { + return $this->NewObj( 'Less_Tree_Comment', [ $comment[0], false, $this->pos, $this->env->currentFileInfo ] ); } } - private function parseComments(){ - $comments = array(); + private function parseComments() { + $comments = []; - while( $this->pos < $this->input_len ){ + while ( $this->pos < $this->input_len ) { $comment = $this->parseComment(); - if( !$comment ){ + if ( !$comment ) { break; } @@ -1060,43 +1006,41 @@ class Less_Parser{ return $comments; } - - - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // + /** + * A string, which supports escaping " and ' + * + * "milky way" 'he\'s the one!' + * + * @return Less_Tree_Quoted|null + */ private function parseEntitiesQuoted() { $j = $this->pos; $e = false; $index = $this->pos; - if( $this->input[$this->pos] === '~' ){ + if ( $this->input[$this->pos] === '~' ) { $j++; $e = true; // Escaped strings } $char = $this->input[$j]; - if( $char !== '"' && $char !== "'" ){ + if ( $char !== '"' && $char !== "'" ) { return; } - if ($e) { - $this->MatchChar('~'); + if ( $e ) { + $this->MatchChar( '~' ); } - - $matched = $this->MatchQuoted($char, $j+1); - if( $matched === false ){ + $matched = $this->MatchQuoted( $char, $j + 1 ); + if ( $matched === false ) { return; } - $quoted = $char.$matched.$char; - return $this->NewObj5('Less_Tree_Quoted',array($quoted, $matched, $e, $index, $this->env->currentFileInfo) ); + $quoted = $char . $matched . $char; + return $this->NewObj( 'Less_Tree_Quoted', [ $quoted, $matched, $e, $index, $this->env->currentFileInfo ] ); } - /** * When PCRE JIT is enabled in php, regular expressions don't work for matching quoted strings * @@ -1104,26 +1048,25 @@ class Less_Parser{ * $regex = '/\\G"((?:[^"\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)"/'; * */ - private function MatchQuoted($quote_char, $i){ - + private function MatchQuoted( $quote_char, $i ) { $matched = ''; - while( $i < $this->input_len ){ + while ( $i < $this->input_len ) { $c = $this->input[$i]; - //escaped character - if( $c === '\\' ){ - $matched .= $c . $this->input[$i+1]; + // escaped character + if ( $c === '\\' ) { + $matched .= $c . $this->input[$i + 1]; $i += 2; continue; } - if( $c === $quote_char ){ - $this->pos = $i+1; - $this->skipWhitespace(0); + if ( $c === $quote_char ) { + $this->pos = $i + 1; + $this->skipWhitespace( 0 ); return $matched; } - if( $c === "\r" || $c === "\n" ){ + if ( $c === "\r" || $c === "\n" ) { return false; } @@ -1134,37 +1077,37 @@ class Less_Parser{ return false; } - - // - // A catch-all word, such as: - // - // black border-collapse - // - private function parseEntitiesKeyword(){ - - //$k = $this->MatchReg('/\\G[_A-Za-z-][_A-Za-z0-9-]*/'); - $k = $this->MatchReg('/\\G%|\\G[_A-Za-z-][_A-Za-z0-9-]*/'); - if( $k ){ + /** + * A catch-all word, such as: + * + * black border-collapse + * + * @return Less_Tree_Keyword|Less_Tree_Color|null + */ + private function parseEntitiesKeyword() { + // $k = $this->MatchReg('/\\G[_A-Za-z-][_A-Za-z0-9-]*/'); + $k = $this->MatchReg( '/\\G%|\\G[_A-Za-z-][_A-Za-z0-9-]*/' ); + if ( $k ) { $k = $k[0]; - $color = $this->fromKeyword($k); - if( $color ){ + $color = $this->fromKeyword( $k ); + if ( $color ) { return $color; } - return $this->NewObj1('Less_Tree_Keyword',$k); + return $this->NewObj( 'Less_Tree_Keyword', [ $k ] ); } } // duplicate of Less_Tree_Color::FromKeyword - private function FromKeyword( $keyword ){ - $keyword = strtolower($keyword); + private function FromKeyword( $keyword ) { + $keyword = strtolower( $keyword ); - if( Less_Colors::hasOwnProperty($keyword) ){ + if ( Less_Colors::hasOwnProperty( $keyword ) ) { // detect named color - return $this->NewObj1('Less_Tree_Color',substr(Less_Colors::color($keyword), 1)); + return $this->NewObj( 'Less_Tree_Color', [ substr( Less_Colors::color( $keyword ), 1 ) ] ); } - if( $keyword === 'transparent' ){ - return $this->NewObj3('Less_Tree_Color', array( array(0, 0, 0), 0, true)); + if ( $keyword === 'transparent' ) { + return $this->NewObj( 'Less_Tree_Color', [ [ 0, 0, 0 ], 0, true ] ); } } @@ -1178,86 +1121,89 @@ class Less_Parser{ // // The arguments are parsed with the `entities.arguments` parser. // - private function parseEntitiesCall(){ + private function parseEntitiesCall() { $index = $this->pos; - if( !preg_match('/\\G([\w-]+|%|progid:[\w\.]+)\(/', $this->input, $name,0,$this->pos) ){ + if ( !preg_match( '/\\G([\w-]+|%|progid:[\w\.]+)\(/', $this->input, $name, 0, $this->pos ) ) { return; } $name = $name[1]; - $nameLC = strtolower($name); + $nameLC = strtolower( $name ); - if ($nameLC === 'url') { + if ( $nameLC === 'url' ) { return null; } - $this->pos += strlen($name); + $this->pos += strlen( $name ); - if( $nameLC === 'alpha' ){ + if ( $nameLC === 'alpha' ) { $alpha_ret = $this->parseAlpha(); - if( $alpha_ret ){ + if ( $alpha_ret ) { return $alpha_ret; } } - $this->MatchChar('('); // Parse the '(' and consume whitespace. + $this->MatchChar( '(' ); // Parse the '(' and consume whitespace. $args = $this->parseEntitiesArguments(); - if( !$this->MatchChar(')') ){ + if ( !$this->MatchChar( ')' ) ) { return; } - if ($name) { - return $this->NewObj4('Less_Tree_Call',array($name, $args, $index, $this->env->currentFileInfo) ); + if ( $name ) { + return $this->NewObj( 'Less_Tree_Call', [ $name, $args, $index, $this->env->currentFileInfo ] ); } } /** * Parse a list of arguments * - * @return array + * @return array<Less_Tree_Assignment|Less_Tree_Expression> */ - private function parseEntitiesArguments(){ - - $args = array(); - while( true ){ - $arg = $this->MatchFuncs( array('parseEntitiesAssignment','parseExpression') ); - if( !$arg ){ + private function parseEntitiesArguments() { + $args = []; + while ( true ) { + $arg = $this->MatchFuncs( [ 'parseEntitiesAssignment', 'parseExpression' ] ); + if ( !$arg ) { break; } $args[] = $arg; - if( !$this->MatchChar(',') ){ + if ( !$this->MatchChar( ',' ) ) { break; } } return $args; } - private function parseEntitiesLiteral(){ - return $this->MatchFuncs( array('parseEntitiesDimension','parseEntitiesColor','parseEntitiesQuoted','parseUnicodeDescriptor') ); + /** @return Less_Tree_Dimension|Less_Tree_Color|Less_Tree_Quoted|Less_Tree_UnicodeDescriptor|null */ + private function parseEntitiesLiteral() { + return $this->MatchFuncs( [ 'parseEntitiesDimension','parseEntitiesColor','parseEntitiesQuoted','parseUnicodeDescriptor' ] ); } - // Assignments are argument entities for calls. - // They are present in ie filter properties as shown below. - // - // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) - // + /** + * Assignments are argument entities for calls. + * + * They are present in IE filter properties as shown below. + * + * filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) + * + * @return Less_Tree_Assignment|null + */ private function parseEntitiesAssignment() { - - $key = $this->MatchReg('/\\G\w+(?=\s?=)/'); - if( !$key ){ + $key = $this->MatchReg( '/\\G\w+(?=\s?=)/' ); + if ( !$key ) { return; } - if( !$this->MatchChar('=') ){ + if ( !$this->MatchChar( '=' ) ) { return; } $value = $this->parseEntity(); - if( $value ){ - return $this->NewObj2('Less_Tree_Assignment',array($key[0], $value)); + if ( $value ) { + return $this->NewObj( 'Less_Tree_Assignment', [ $key[0], $value ] ); } } @@ -1268,196 +1214,197 @@ class Less_Parser{ // standard function calls. The difference is that the argument doesn't have // to be enclosed within a string, so it can't be parsed as an Expression. // - private function parseEntitiesUrl(){ - - - if( $this->input[$this->pos] !== 'u' || !$this->matchReg('/\\Gurl\(/') ){ + private function parseEntitiesUrl() { + if ( $this->input[$this->pos] !== 'u' || !$this->matchReg( '/\\Gurl\(/' ) ) { return; } - $value = $this->match( array('parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/') ); - if( !$value ){ + $value = $this->matcher( [ 'parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/' ] ); + if ( !$value ) { $value = ''; } + $this->expectChar( ')' ); - $this->expectChar(')'); - - - if( isset($value->value) || $value instanceof Less_Tree_Variable ){ - return $this->NewObj2('Less_Tree_Url',array($value, $this->env->currentFileInfo)); + // @phan-suppress-next-line PhanUndeclaredProperty + if ( isset( $value->value ) || $value instanceof Less_Tree_Variable ) { + return $this->NewObj( 'Less_Tree_Url', [ $value, $this->env->currentFileInfo ] ); } - return $this->NewObj2('Less_Tree_Url', array( $this->NewObj1('Less_Tree_Anonymous',$value), $this->env->currentFileInfo) ); + return $this->NewObj( 'Less_Tree_Url', [ $this->NewObj( 'Less_Tree_Anonymous', [ $value ] ), $this->env->currentFileInfo ] ); } - - // - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - // - private function parseEntitiesVariable(){ + /** + * A Variable entity, such as `@fink`, in + * + * width: @fink + 2px + * + * We use a different parser for variable definitions, + * see `parsers.variable`. + * + * @return Less_Tree_Variable|null + */ + private function parseEntitiesVariable() { $index = $this->pos; - if ($this->PeekChar('@') && ($name = $this->MatchReg('/\\G@@?[\w-]+/'))) { - return $this->NewObj3('Less_Tree_Variable', array( $name[0], $index, $this->env->currentFileInfo)); + if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G@@?[\w-]+/' ) ) ) { + return $this->NewObj( 'Less_Tree_Variable', [ $name[0], $index, $this->env->currentFileInfo ] ); } } - - // A variable entity using the protective {} e.g. @{var} + /** + * A variable entity using the protective `{}` e.g. `@{var}`. + * + * @return Less_Tree_Variable|null + */ private function parseEntitiesVariableCurly() { $index = $this->pos; - if( $this->input_len > ($this->pos+1) && $this->input[$this->pos] === '@' && ($curly = $this->MatchReg('/\\G@\{([\w-]+)\}/')) ){ - return $this->NewObj3('Less_Tree_Variable',array('@'.$curly[1], $index, $this->env->currentFileInfo)); + if ( $this->input_len > ( $this->pos + 1 ) && $this->input[$this->pos] === '@' && ( $curly = $this->MatchReg( '/\\G@\{([\w-]+)\}/' ) ) ) { + return $this->NewObj( 'Less_Tree_Variable', [ '@' . $curly[1], $index, $this->env->currentFileInfo ] ); } } - // - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - // - private function parseEntitiesColor(){ - if ($this->PeekChar('#') && ($rgb = $this->MatchReg('/\\G#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/'))) { - return $this->NewObj1('Less_Tree_Color',$rgb[1]); + /** + * A Hexadecimal color + * + * #4F3C2F + * + * `rgb` and `hsl` colors are parsed through the `entities.call` parser. + * + * @return Less_Tree_Color|null + */ + private function parseEntitiesColor() { + if ( $this->PeekChar( '#' ) && ( $rgb = $this->MatchReg( '/\\G#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/' ) ) ) { + return $this->NewObj( 'Less_Tree_Color', [ $rgb[1] ] ); } } - // - // A Dimension, that is, a number and a unit - // - // 0.5em 95% - // - private function parseEntitiesDimension(){ + /** + * A Dimension, that is, a number and a unit + * + * 0.5em 95% + * + * @return Less_Tree_Dimension|null + */ + private function parseEntitiesDimension() { + $c = @ord( $this->input[$this->pos] ); - $c = @ord($this->input[$this->pos]); - - //Is the first char of the dimension 0-9, '.', '+' or '-' - if (($c > 57 || $c < 43) || $c === 47 || $c == 44){ + // Is the first char of the dimension 0-9, '.', '+' or '-' + if ( ( $c > 57 || $c < 43 ) || $c === 47 || $c == 44 ) { return; } - $value = $this->MatchReg('/\\G([+-]?\d*\.?\d+)(%|[a-z]+)?/'); - if( $value ){ - - if( isset($value[2]) ){ - return $this->NewObj2('Less_Tree_Dimension', array($value[1],$value[2])); + $value = $this->MatchReg( '/\\G([+-]?\d*\.?\d+)(%|[a-z]+)?/' ); + if ( $value ) { + if ( isset( $value[2] ) ) { + return $this->NewObj( 'Less_Tree_Dimension', [ $value[1],$value[2] ] ); } - return $this->NewObj1('Less_Tree_Dimension',$value[1]); + return $this->NewObj( 'Less_Tree_Dimension', [ $value[1] ] ); } } - - // - // A unicode descriptor, as is used in unicode-range - // - // U+0?? or U+00A1-00A9 - // + /** + * A unicode descriptor, as is used in unicode-range + * + * U+0?? or U+00A1-00A9 + * + * @return Less_Tree_UnicodeDescriptor|null + */ function parseUnicodeDescriptor() { - $ud = $this->MatchReg('/\\G(U\+[0-9a-fA-F?]+)(\-[0-9a-fA-F?]+)?/'); - if( $ud ){ - return $this->NewObj1('Less_Tree_UnicodeDescriptor', $ud[0]); + $ud = $this->MatchReg( '/\\G(U\+[0-9a-fA-F?]+)(\-[0-9a-fA-F?]+)?/' ); + if ( $ud ) { + return $this->NewObj( 'Less_Tree_UnicodeDescriptor', [ $ud[0] ] ); } } - // // JavaScript code to be evaluated // // `window.location.href` // - private function parseEntitiesJavascript(){ + private function parseEntitiesJavascript() { $e = false; $j = $this->pos; - if( $this->input[$j] === '~' ){ + if ( $this->input[$j] === '~' ) { $j++; $e = true; } - if( $this->input[$j] !== '`' ){ + if ( $this->input[$j] !== '`' ) { return; } - if( $e ){ - $this->MatchChar('~'); + if ( $e ) { + $this->MatchChar( '~' ); } - $str = $this->MatchReg('/\\G`([^`]*)`/'); - if( $str ){ - return $this->NewObj3('Less_Tree_Javascript', array($str[1], $this->pos, $e)); + $str = $this->MatchReg( '/\\G`([^`]*)`/' ); + if ( $str ) { + return $this->NewObj( 'Less_Tree_Javascript', [ $str[1], $this->pos, $e ] ); } } - // // The variable part of a variable definition. Used in the `rule` parser // // @fink: // - private function parseVariable(){ - if ($this->PeekChar('@') && ($name = $this->MatchReg('/\\G(@[\w-]+)\s*:/'))) { + private function parseVariable() { + if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*:/' ) ) ) { return $name[1]; } } - // // The variable part of a variable definition. Used in the `rule` parser // // @fink(); // - private function parseRulesetCall(){ - - if( $this->input[$this->pos] === '@' && ($name = $this->MatchReg('/\\G(@[\w-]+)\s*\(\s*\)\s*;/')) ){ - return $this->NewObj1('Less_Tree_RulesetCall', $name[1] ); + private function parseRulesetCall() { + if ( $this->input[$this->pos] === '@' && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*\(\s*\)\s*;/' ) ) ) { + return $this->NewObj( 'Less_Tree_RulesetCall', [ $name[1] ] ); } } - // // extend syntax - used to extend selectors // - function parseExtend($isRule = false){ - + function parseExtend( $isRule = false ) { $index = $this->pos; - $extendList = array(); + $extendList = []; + if ( !$this->MatchReg( $isRule ? '/\\G&:extend\(/' : '/\\G:extend\(/' ) ) { + return; + } - if( !$this->MatchReg( $isRule ? '/\\G&:extend\(/' : '/\\G:extend\(/' ) ){ return; } - - do{ + do { $option = null; - $elements = array(); - while( true ){ - $option = $this->MatchReg('/\\G(all)(?=\s*(\)|,))/'); - if( $option ){ break; } + $elements = []; + while ( true ) { + $option = $this->MatchReg( '/\\G(all)(?=\s*(\)|,))/' ); + if ( $option ) { break; + } $e = $this->parseElement(); - if( !$e ){ break; } + if ( !$e ) { + break; + } $elements[] = $e; } - if( $option ){ + if ( $option ) { $option = $option[1]; } - $extendList[] = $this->NewObj3('Less_Tree_Extend', array( $this->NewObj1('Less_Tree_Selector',$elements), $option, $index )); + $extendList[] = $this->NewObj( 'Less_Tree_Extend', [ $this->NewObj( 'Less_Tree_Selector', [ $elements ] ), $option, $index ] ); - }while( $this->MatchChar(",") ); + } while ( $this->MatchChar( "," ) ); - $this->expect('/\\G\)/'); + $this->expect( '/\\G\)/' ); - if( $isRule ){ - $this->expect('/\\G;/'); + if ( $isRule ) { + $this->expect( '/\\G;/' ); } return $extendList; } - // // A Mixin call, with an optional argument list // @@ -1469,10 +1416,9 @@ class Less_Parser{ // namespaced, but we only support the child and descendant // selector for now. // - private function parseMixinCall(){ - + private function parseMixinCall() { $char = $this->input[$this->pos]; - if( $char !== '.' && $char !== '#' ){ + if ( $char !== '.' && $char !== '#' ) { return; } @@ -1481,110 +1427,106 @@ class Less_Parser{ $elements = $this->parseMixinCallElements(); - if( $elements ){ + if ( $elements ) { - if( $this->MatchChar('(') ){ - $returned = $this->parseMixinArgs(true); + if ( $this->MatchChar( '(' ) ) { + $returned = $this->parseMixinArgs( true ); $args = $returned['args']; - $this->expectChar(')'); - }else{ - $args = array(); + $this->expectChar( ')' ); + } else { + $args = []; } $important = $this->parseImportant(); - if( $this->parseEnd() ){ + if ( $this->parseEnd() ) { $this->forget(); - return $this->NewObj5('Less_Tree_Mixin_Call', array( $elements, $args, $index, $this->env->currentFileInfo, $important)); + return $this->NewObj( 'Less_Tree_Mixin_Call', [ $elements, $args, $index, $this->env->currentFileInfo, $important ] ); } } $this->restore(); } - - private function parseMixinCallElements(){ - $elements = array(); + private function parseMixinCallElements() { + $elements = []; $c = null; - while( true ){ + while ( true ) { $elemIndex = $this->pos; - $e = $this->MatchReg('/\\G[#.](?:[\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/'); - if( !$e ){ + $e = $this->MatchReg( '/\\G[#.](?:[\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/' ); + if ( !$e ) { break; } - $elements[] = $this->NewObj4('Less_Tree_Element', array($c, $e[0], $elemIndex, $this->env->currentFileInfo)); - $c = $this->MatchChar('>'); + $elements[] = $this->NewObj( 'Less_Tree_Element', [ $c, $e[0], $elemIndex, $this->env->currentFileInfo ] ); + $c = $this->MatchChar( '>' ); } return $elements; } - - /** - * @param boolean $isCall + * @param bool $isCall */ - private function parseMixinArgs( $isCall ){ - $expressions = array(); - $argsSemiColon = array(); + private function parseMixinArgs( $isCall ) { + $expressions = []; + $argsSemiColon = []; $isSemiColonSeperated = null; - $argsComma = array(); + $argsComma = []; $expressionContainsNamed = null; $name = null; - $returner = array('args'=>array(), 'variadic'=> false); + $returner = [ 'args' => [], 'variadic' => false ]; $this->save(); - while( true ){ - if( $isCall ){ - $arg = $this->MatchFuncs( array( 'parseDetachedRuleset','parseExpression' ) ); + while ( true ) { + if ( $isCall ) { + $arg = $this->MatchFuncs( [ 'parseDetachedRuleset', 'parseExpression' ] ); } else { $this->parseComments(); - if( $this->input[ $this->pos ] === '.' && $this->MatchReg('/\\G\.{3}/') ){ + if ( $this->input[ $this->pos ] === '.' && $this->MatchReg( '/\\G\.{3}/' ) ) { $returner['variadic'] = true; - if( $this->MatchChar(";") && !$isSemiColonSeperated ){ + if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) { $isSemiColonSeperated = true; } - if( $isSemiColonSeperated ){ - $argsSemiColon[] = array('variadic'=>true); - }else{ - $argsComma[] = array('variadic'=>true); + if ( $isSemiColonSeperated ) { + $argsSemiColon[] = [ 'variadic' => true ]; + } else { + $argsComma[] = [ 'variadic' => true ]; } break; } - $arg = $this->MatchFuncs( array('parseEntitiesVariable','parseEntitiesLiteral','parseEntitiesKeyword') ); + $arg = $this->MatchFuncs( [ 'parseEntitiesVariable', 'parseEntitiesLiteral', 'parseEntitiesKeyword' ] ); } + '@phan-var Less_Tree_DetachedRuleset|Less_Tree_Expression|Less_Tree_Variable|Less_Tree_Dimension|Less_Tree_Color|Less_Tree_Quoted|Less_Tree_UnicodeDescriptor|Less_Tree_Keyword|null $arg'; - if( !$arg ){ + if ( !$arg ) { break; } - $nameLoop = null; - if( $arg instanceof Less_Tree_Expression ){ + if ( $arg instanceof Less_Tree_Expression ) { $arg->throwAwayComments(); } $value = $arg; $val = null; - if( $isCall ){ + if ( $isCall ) { // Variable - if( property_exists($arg,'value') && count($arg->value) == 1 ){ + if ( property_exists( $arg, 'value' ) && count( $arg->value ) == 1 ) { $val = $arg->value[0]; } } else { $val = $arg; } + if ( $val instanceof Less_Tree_Variable ) { - if( $val instanceof Less_Tree_Variable ){ - - if( $this->MatchChar(':') ){ - if( $expressions ){ - if( $isSemiColonSeperated ){ - $this->Error('Cannot mix ; and , as delimiter types'); + if ( $this->MatchChar( ':' ) ) { + if ( $expressions ) { + if ( $isSemiColonSeperated ) { + $this->Error( 'Cannot mix ; and , as delimiter types' ); } $expressionContainsNamed = true; } @@ -1593,77 +1535,75 @@ class Less_Parser{ // However if we do want to add it, there is nothing blocking it, just don't error // and remove isCall dependency below $value = null; - if( $isCall ){ + if ( $isCall ) { $value = $this->parseDetachedRuleset(); } - if( !$value ){ + if ( !$value ) { $value = $this->parseExpression(); } - if( !$value ){ - if( $isCall ){ - $this->Error('could not understand value for named argument'); + if ( !$value ) { + if ( $isCall ) { + $this->Error( 'could not understand value for named argument' ); } else { $this->restore(); - $returner['args'] = array(); + $returner['args'] = []; return $returner; } } - $nameLoop = ($name = $val->name); - }elseif( !$isCall && $this->MatchReg('/\\G\.{3}/') ){ + $nameLoop = ( $name = $val->name ); + } elseif ( !$isCall && $this->MatchReg( '/\\G\.{3}/' ) ) { $returner['variadic'] = true; - if( $this->MatchChar(";") && !$isSemiColonSeperated ){ + if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) { $isSemiColonSeperated = true; } - if( $isSemiColonSeperated ){ - $argsSemiColon[] = array('name'=> $arg->name, 'variadic' => true); - }else{ - $argsComma[] = array('name'=> $arg->name, 'variadic' => true); + if ( $isSemiColonSeperated ) { + $argsSemiColon[] = [ 'name' => $arg->name, 'variadic' => true ]; + } else { + $argsComma[] = [ 'name' => $arg->name, 'variadic' => true ]; } break; - }elseif( !$isCall ){ + } elseif ( !$isCall ) { $name = $nameLoop = $val->name; $value = null; } } - if( $value ){ + if ( $value ) { $expressions[] = $value; } - $argsComma[] = array('name'=>$nameLoop, 'value'=>$value ); + $argsComma[] = [ 'name' => $nameLoop, 'value' => $value ]; - if( $this->MatchChar(',') ){ + if ( $this->MatchChar( ',' ) ) { continue; } - if( $this->MatchChar(';') || $isSemiColonSeperated ){ + if ( $this->MatchChar( ';' ) || $isSemiColonSeperated ) { - if( $expressionContainsNamed ){ - $this->Error('Cannot mix ; and , as delimiter types'); + if ( $expressionContainsNamed ) { + $this->Error( 'Cannot mix ; and , as delimiter types' ); } $isSemiColonSeperated = true; - if( count($expressions) > 1 ){ - $value = $this->NewObj1('Less_Tree_Value', $expressions); + if ( count( $expressions ) > 1 ) { + $value = $this->NewObj( 'Less_Tree_Value', [ $expressions ] ); } - $argsSemiColon[] = array('name'=>$name, 'value'=>$value ); + $argsSemiColon[] = [ 'name' => $name, 'value' => $value ]; $name = null; - $expressions = array(); + $expressions = []; $expressionContainsNamed = false; } } $this->forget(); - $returner['args'] = ($isSemiColonSeperated ? $argsSemiColon : $argsComma); + $returner['args'] = ( $isSemiColonSeperated ? $argsSemiColon : $argsComma ); return $returner; } - - // // A Mixin definition, with a list of parameters // @@ -1683,52 +1623,50 @@ class Less_Parser{ // Once we've got our params list, and a closing `)`, we parse // the `{...}` block. // - private function parseMixinDefinition(){ + private function parseMixinDefinition() { $cond = null; $char = $this->input[$this->pos]; - if( ($char !== '.' && $char !== '#') || ($char === '{' && $this->PeekReg('/\\G[^{]*\}/')) ){ + // TODO: Less.js doesn't limit this to $char == '{'. + if ( ( $char !== '.' && $char !== '#' ) || ( $char === '{' && $this->PeekReg( '/\\G[^{]*\}/' ) ) ) { return; } $this->save(); - $match = $this->MatchReg('/\\G([#.](?:[\w-]|\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/'); - if( $match ){ + $match = $this->MatchReg( '/\\G([#.](?:[\w-]|\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/' ); + if ( $match ) { $name = $match[1]; $argInfo = $this->parseMixinArgs( false ); $params = $argInfo['args']; $variadic = $argInfo['variadic']; - // .mixincall("@{a}"); // looks a bit like a mixin definition.. // also // .mixincall(@a: {rule: set;}); // so we have to be nice and restore - if( !$this->MatchChar(')') ){ - $this->furthest = $this->pos; + if ( !$this->MatchChar( ')' ) ) { $this->restore(); return; } - $this->parseComments(); - if ($this->MatchReg('/\\Gwhen/')) { // Guard - $cond = $this->expect('parseConditions', 'Expected conditions'); + if ( $this->MatchReg( '/\\Gwhen/' ) ) { // Guard + $cond = $this->expect( 'parseConditions', 'Expected conditions' ); } $ruleset = $this->parseBlock(); - if( is_array($ruleset) ){ + if ( $ruleset !== null ) { $this->forget(); - return $this->NewObj5('Less_Tree_Mixin_Definition', array( $name, $params, $ruleset, $cond, $variadic)); + return $this->NewObj( 'Less_Tree_Mixin_Definition', [ $name, $params, $ruleset, $cond, $variadic ] ); } $this->restore(); - }else{ + } else { $this->forget(); } } @@ -1737,9 +1675,8 @@ class Less_Parser{ // Entities are the smallest recognized token, // and can be found inside a rule's value. // - private function parseEntity(){ - - return $this->MatchFuncs( array('parseEntitiesLiteral','parseEntitiesVariable','parseEntitiesUrl','parseEntitiesCall','parseEntitiesKeyword','parseEntitiesJavascript','parseComment') ); + private function parseEntity() { + return $this->MatchFuncs( [ 'parseEntitiesLiteral','parseEntitiesVariable','parseEntitiesUrl','parseEntitiesCall','parseEntitiesKeyword','parseEntitiesJavascript','parseComment' ] ); } // @@ -1747,8 +1684,8 @@ class Less_Parser{ // because the `block` rule will be expecting it, but we still need to make sure // it's there, if ';' was omitted. // - private function parseEnd(){ - return $this->MatchChar(';') || $this->PeekChar('}'); + private function parseEnd() { + return $this->MatchChar( ';' ) || $this->PeekChar( '}' ); } // @@ -1756,62 +1693,72 @@ class Less_Parser{ // // alpha(opacity=88) // - private function parseAlpha(){ - - if ( ! $this->MatchReg('/\\G\(opacity=/i')) { + private function parseAlpha() { + if ( !$this->MatchReg( '/\\G\(opacity=/i' ) ) { return; } - $value = $this->MatchReg('/\\G[0-9]+/'); - if( $value ){ + $value = $this->MatchReg( '/\\G[0-9]+/' ); + if ( $value ) { $value = $value[0]; - }else{ + } else { $value = $this->parseEntitiesVariable(); - if( !$value ){ + if ( !$value ) { return; } } - $this->expectChar(')'); - return $this->NewObj1('Less_Tree_Alpha',$value); + $this->expectChar( ')' ); + return $this->NewObj( 'Less_Tree_Alpha', [ $value ] ); } - - // - // A Selector Element - // - // div - // + h1 - // #socks - // input[type="text"] - // - // Elements are the building blocks for Selectors, - // they are made out of a `Combinator` (see combinator rule), - // and an element name, such as a tag a class, or `*`. - // - private function parseElement(){ + /** + * A Selector Element + * + * div + * + h1 + * #socks + * input[type="text"] + * + * Elements are the building blocks for Selectors, + * they are made out of a `Combinator` (see combinator rule), + * and an element name, such as a tag a class, or `*`. + * + * @return Less_Tree_Element|null + * @see less-2.5.3.js#parsers.element + */ + private function parseElement() { $c = $this->parseCombinator(); $index = $this->pos; - $e = $this->match( array('/\\G(?:\d+\.\d+|\d+)%/', '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/', - '#*', '#&', 'parseAttribute', '/\\G\([^()@]+\)/', '/\\G[\.#](?=@)/', 'parseEntitiesVariableCurly') ); + // TODO: Speed up by calling MatchChar directly, like less.js does + $e = $this->matcher( [ + '/\\G(?:\d+\.\d+|\d+)%/', + '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/', + '#*', + '#&', + 'parseAttribute', + '/\\G\([^&()@]+\)/', + '/\\G[\.#:](?=@)/', + 'parseEntitiesVariableCurly' + ] ); - if( is_null($e) ){ + if ( $e === null ) { $this->save(); - if( $this->MatchChar('(') ){ - if( ($v = $this->parseSelector()) && $this->MatchChar(')') ){ - $e = $this->NewObj1('Less_Tree_Paren',$v); + if ( $this->MatchChar( '(' ) ) { + if ( ( $v = $this->parseSelector() ) && $this->MatchChar( ')' ) ) { + $e = $this->NewObj( 'Less_Tree_Paren', [ $v ] ); $this->forget(); - }else{ + } else { $this->restore(); } - }else{ + } else { $this->forget(); } } - if( !is_null($e) ){ - return $this->NewObj4('Less_Tree_Element',array( $c, $e, $index, $this->env->currentFileInfo)); + if ( $e !== null ) { + return $this->NewObj( 'Less_Tree_Element', [ $c, $e, $index, $this->env->currentFileInfo ] ); } } @@ -1823,47 +1770,55 @@ class Less_Parser{ // as it's an empty space. We have to check the previous character // in the input, to see if it's a ` ` character. // - private function parseCombinator(){ - if( $this->pos < $this->input_len ){ + // @see less-2.5.3.js#parsers.combinator + private function parseCombinator() { + if ( $this->pos < $this->input_len ) { $c = $this->input[$this->pos]; - if ($c === '>' || $c === '+' || $c === '~' || $c === '|' || $c === '^' ){ + // TODO: Figure out why less.js also handles '/' here, and implement with regression test. + if ( $c === '>' || $c === '+' || $c === '~' || $c === '|' || $c === '^' ) { $this->pos++; - if( $this->input[$this->pos] === '^' ){ + if ( $this->input[$this->pos] === '^' ) { $c = '^^'; $this->pos++; } - $this->skipWhitespace(0); + $this->skipWhitespace( 0 ); return $c; } - if( $this->pos > 0 && $this->isWhitespace(-1) ){ + if ( $this->pos > 0 && $this->isWhitespace( -1 ) ) { return ' '; } } } - // - // A CSS selector (see selector below) - // with less extensions e.g. the ability to extend and guard - // - private function parseLessSelector(){ - return $this->parseSelector(true); + /** + * A CSS selector (see selector below) + * with less extensions e.g. the ability to extend and guard + * + * @return Less_Tree_Selector|null + * @see less-2.5.3.js#parsers.lessSelector + */ + private function parseLessSelector() { + return $this->parseSelector( true ); } - // - // A CSS Selector - // - // .class > div + h1 - // li a:hover - // - // Selectors are made out of one or more Elements, see above. - // - private function parseSelector( $isLess = false ){ - $elements = array(); - $extendList = array(); + /** + * A CSS Selector + * + * .class > div + h1 + * li a:hover + * + * Selectors are made out of one or more Elements, see ::parseElement. + * + * @return Less_Tree_Selector|null + * @see less-2.5.3.js#parsers.selector + */ + private function parseSelector( $isLess = false ) { + $elements = []; + $extendList = []; $condition = null; $when = false; $extend = false; @@ -1871,233 +1826,241 @@ class Less_Parser{ $c = null; $index = $this->pos; - while( ($isLess && ($extend = $this->parseExtend())) || ($isLess && ($when = $this->MatchReg('/\\Gwhen/') )) || ($e = $this->parseElement()) ){ - if( $when ){ - $condition = $this->expect('parseConditions', 'expected condition'); - }elseif( $condition ){ - //error("CSS guard can only be used at the end of selector"); - }elseif( $extend ){ - $extendList = array_merge($extendList,$extend); - }else{ - //if( count($extendList) ){ + while ( ( $isLess && ( $extend = $this->parseExtend() ) ) || ( $isLess && ( $when = $this->MatchReg( '/\\Gwhen/' ) ) ) || ( $e = $this->parseElement() ) ) { + if ( $when ) { + $condition = $this->expect( 'parseConditions', 'expected condition' ); + } elseif ( $condition ) { + // error("CSS guard can only be used at the end of selector"); + } elseif ( $extend ) { + $extendList = array_merge( $extendList, $extend ); + } else { + // if( count($extendList) ){ //error("Extend can only be used at the end of selector"); //} - if( $this->pos < $this->input_len ){ + if ( $this->pos < $this->input_len ) { $c = $this->input[ $this->pos ]; } $elements[] = $e; $e = null; } - if( $c === '{' || $c === '}' || $c === ';' || $c === ',' || $c === ')') { break; } + if ( $c === '{' || $c === '}' || $c === ';' || $c === ',' || $c === ')' ) { + break; + } } - if( $elements ){ - return $this->NewObj5('Less_Tree_Selector',array($elements, $extendList, $condition, $index, $this->env->currentFileInfo)); + if ( $elements ) { + return $this->NewObj( 'Less_Tree_Selector', [ $elements, $extendList, $condition, $index, $this->env->currentFileInfo ] ); } - if( $extendList ) { - $this->Error('Extend must be used to extend a selector, it cannot be used on its own'); + if ( $extendList ) { + $this->Error( 'Extend must be used to extend a selector, it cannot be used on its own' ); } } - private function parseTag(){ - return ( $tag = $this->MatchReg('/\\G[A-Za-z][A-Za-z-]*[0-9]?/') ) ? $tag : $this->MatchChar('*'); + private function parseTag() { + return ( $tag = $this->MatchReg( '/\\G[A-Za-z][A-Za-z-]*[0-9]?/' ) ) ? $tag : $this->MatchChar( '*' ); } - private function parseAttribute(){ - + private function parseAttribute() { $val = null; - if( !$this->MatchChar('[') ){ + if ( !$this->MatchChar( '[' ) ) { return; } $key = $this->parseEntitiesVariableCurly(); - if( !$key ){ - $key = $this->expect('/\\G(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\\\.)+/'); + if ( !$key ) { + $key = $this->expect( '/\\G(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\\\.)+/' ); } - $op = $this->MatchReg('/\\G[|~*$^]?=/'); - if( $op ){ - $val = $this->match( array('parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly') ); + $op = $this->MatchReg( '/\\G[|~*$^]?=/' ); + if ( $op ) { + $val = $this->matcher( [ 'parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly' ] ); } - $this->expectChar(']'); + $this->expectChar( ']' ); - return $this->NewObj3('Less_Tree_Attribute',array( $key, $op === null ? null : $op[0], $val)); + return $this->NewObj( 'Less_Tree_Attribute', [ $key, $op === null ? null : $op[0], $val ] ); } - // - // The `block` rule is used by `ruleset` and `mixin.definition`. - // It's a wrapper around the `primary` rule, with added `{}`. - // - private function parseBlock(){ - if( $this->MatchChar('{') ){ + /** + * The `block` rule is used by `ruleset` and `mixin.definition`. + * It's a wrapper around the `primary` rule, with added `{}`. + * + * @return array<Less_Tree>|null + * @see less-2.5.3.js#parsers.block + */ + private function parseBlock() { + if ( $this->MatchChar( '{' ) ) { $content = $this->parsePrimary(); - if( $this->MatchChar('}') ){ + if ( $this->MatchChar( '}' ) ) { return $content; } } } - private function parseBlockRuleset(){ + private function parseBlockRuleset() { $block = $this->parseBlock(); - if( $block ){ - $block = $this->NewObj2('Less_Tree_Ruleset',array( null, $block)); + if ( $block ) { + $block = $this->NewObj( 'Less_Tree_Ruleset', [ null, $block ] ); } return $block; } - private function parseDetachedRuleset(){ + /** @return Less_Tree_DetachedRuleset|null */ + private function parseDetachedRuleset() { $blockRuleset = $this->parseBlockRuleset(); - if( $blockRuleset ){ - return $this->NewObj1('Less_Tree_DetachedRuleset',$blockRuleset); + if ( $blockRuleset ) { + return $this->NewObj( 'Less_Tree_DetachedRuleset', [ $blockRuleset ] ); } } - // - // div, .class, body > p {...} - // - private function parseRuleset(){ - $selectors = array(); + /** + * Ruleset such as: + * + * div, .class, body > p { + * } + * + * @return Less_Tree_Ruleset|null + * @see less-2.5.3.js#parsers.ruleset + */ + private function parseRuleset() { + $selectors = []; $this->save(); - while( true ){ + while ( true ) { $s = $this->parseLessSelector(); - if( !$s ){ + if ( !$s ) { break; } $selectors[] = $s; $this->parseComments(); - if( $s->condition && count($selectors) > 1 ){ - $this->Error('Guards are only currently allowed on a single selector.'); + if ( $s->condition && count( $selectors ) > 1 ) { + $this->Error( 'Guards are only currently allowed on a single selector.' ); } - if( !$this->MatchChar(',') ){ + if ( !$this->MatchChar( ',' ) ) { break; } - if( $s->condition ){ - $this->Error('Guards are only currently allowed on a single selector.'); + if ( $s->condition ) { + $this->Error( 'Guards are only currently allowed on a single selector.' ); } $this->parseComments(); } - - if( $selectors ){ + if ( $selectors ) { $rules = $this->parseBlock(); - if( is_array($rules) ){ + if ( is_array( $rules ) ) { $this->forget(); - return $this->NewObj2('Less_Tree_Ruleset',array( $selectors, $rules)); //Less_Environment::$strictImports + // TODO: Less_Environment::$strictImports is not yet ported + // It is passed here by less.js + return $this->NewObj( 'Less_Tree_Ruleset', [ $selectors, $rules ] ); } } // Backtrack - $this->furthest = $this->pos; $this->restore(); } /** * Custom less.php parse function for finding simple name-value css pairs * ex: width:100px; - * */ - private function parseNameValue(){ - + private function parseNameValue() { $index = $this->pos; $this->save(); + $match = $this->MatchReg( '/\\G([a-zA-Z\-]+)\s*:\s*([\'"]?[#a-zA-Z0-9\-%\.,]+?[\'"]?) *(! *important)?\s*([;}])/' ); + if ( $match ) { - //$match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*((?:\'")?[a-zA-Z0-9\-% \.,!]+?(?:\'")?)\s*([;}])/'); - $match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*([\'"]?[#a-zA-Z0-9\-%\.,]+?[\'"]?) *(! *important)?\s*([;}])/'); - if( $match ){ - - if( $match[4] == '}' ){ - $this->pos = $index + strlen($match[0])-1; + if ( $match[4] == '}' ) { + $this->pos = $index + strlen( $match[0] ) - 1; } - if( $match[3] ){ + if ( $match[3] ) { $match[2] .= ' !important'; } - return $this->NewObj4('Less_Tree_NameValue',array( $match[1], $match[2], $index, $this->env->currentFileInfo)); + return $this->NewObj( 'Less_Tree_NameValue', [ $match[1], $match[2], $index, $this->env->currentFileInfo ] ); } $this->restore(); } - - private function parseRule( $tryAnonymous = null ){ - - $merge = false; + // @see less-2.5.3.js#parsers.rule + private function parseRule( $tryAnonymous = null ) { + $value = null; $startOfRule = $this->pos; - $c = $this->input[$this->pos]; - if( $c === '.' || $c === '#' || $c === '&' ){ + $important = null; + $merge = false; + + // TODO: Figure out why less.js also handles ':' here, and implement with regression test. + if ( $c === '.' || $c === '#' || $c === '&' ) { return; } $this->save(); - $name = $this->MatchFuncs( array('parseVariable','parseRuleProperty')); + $name = $this->MatchFuncs( [ 'parseVariable', 'parseRuleProperty' ] ); - if( $name ){ + if ( $name ) { + $isVariable = is_string( $name ); - $isVariable = is_string($name); - - $value = null; - if( $isVariable ){ + if ( $isVariable ) { $value = $this->parseDetachedRuleset(); } - $important = null; - if( !$value ){ - - // prefer to try to parse first if its a variable or we are compressing - // but always fallback on the other one - //if( !$tryAnonymous && is_string($name) && $name[0] === '@' ){ - if( !$tryAnonymous && (Less_Parser::$options['compress'] || $isVariable) ){ - $value = $this->MatchFuncs( array('parseValue','parseAnonymousValue')); - }else{ - $value = $this->MatchFuncs( array('parseAnonymousValue','parseValue')); - } - - $important = $this->parseImportant(); - + if ( !$value ) { // a name returned by this.ruleProperty() is always an array of the form: // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] // where each item is a tree.Keyword or tree.Variable - if( !$isVariable && is_array($name) ){ - $nm = array_pop($name); - if( $nm->value ){ - $merge = $nm->value; + if ( !$isVariable && count( $name ) > 1 ) { + $merge = array_pop( $name )->value; + } + + // prefer to try to parse first if its a variable or we are compressing + // but always fallback on the other one + $tryValueFirst = ( !$tryAnonymous && ( self::$options['compress'] || $isVariable ) ); + if ( $tryValueFirst ) { + $value = $this->parseValue(); + } + if ( !$value ) { + $value = $this->parseAnonymousValue(); + if ( $value ) { + $this->forget(); + // anonymous values absorb the end ';' which is required for them to work + return $this->NewObj( 'Less_Tree_Rule', [ $name, $value, false, $merge, $startOfRule, $this->env->currentFileInfo ] ); } } + if ( !$tryValueFirst && !$value ) { + $value = $this->parseValue(); + } + + $important = $this->parseImportant(); } - - if( $value && $this->parseEnd() ){ + if ( $value && $this->parseEnd() ) { $this->forget(); - return $this->NewObj6('Less_Tree_Rule',array( $name, $value, $important, $merge, $startOfRule, $this->env->currentFileInfo)); - }else{ - $this->furthest = $this->pos; + return $this->NewObj( 'Less_Tree_Rule', [ $name, $value, $important, $merge, $startOfRule, $this->env->currentFileInfo ] ); + } else { $this->restore(); - if( $value && !$tryAnonymous ){ - return $this->parseRule(true); + if ( $value && !$tryAnonymous ) { + return $this->parseRule( true ); } } - }else{ + } else { $this->forget(); } } - function parseAnonymousValue(){ - - if( preg_match('/\\G([^@+\/\'"*`(;{}-]*);/',$this->input, $match, 0, $this->pos) ){ - $this->pos += strlen($match[1]); - return $this->NewObj1('Less_Tree_Anonymous',$match[1]); + function parseAnonymousValue() { + $match = $this->MatchReg( '/\\G([^@+\/\'"*`(;{}-]*);/' ); + if ( $match ) { + return $this->NewObj( 'Less_Tree_Anonymous', [ $match[1] ] ); } } @@ -2111,25 +2074,24 @@ class Less_Parser{ // file-system operation. The function used for importing is // stored in `import`, which we pass to the Import constructor. // - private function parseImport(){ - + private function parseImport() { $this->save(); - $dir = $this->MatchReg('/\\G@import?\s+/'); + $dir = $this->MatchReg( '/\\G@import?\s+/' ); - if( $dir ){ + if ( $dir ) { $options = $this->parseImportOptions(); - $path = $this->MatchFuncs( array('parseEntitiesQuoted','parseEntitiesUrl')); + $path = $this->MatchFuncs( [ 'parseEntitiesQuoted','parseEntitiesUrl' ] ); - if( $path ){ + if ( $path ) { $features = $this->parseMediaFeatures(); - if( $this->MatchChar(';') ){ - if( $features ){ - $features = $this->NewObj1('Less_Tree_Value',$features); + if ( $this->MatchChar( ';' ) ) { + if ( $features ) { + $features = $this->NewObj( 'Less_Tree_Value', [ $features ] ); } $this->forget(); - return $this->NewObj5('Less_Tree_Import',array( $path, $features, $options, $this->pos, $this->env->currentFileInfo)); + return $this->NewObj( 'Less_Tree_Import', [ $path, $features, $options, $this->pos, $this->env->currentFileInfo ] ); } } } @@ -2137,19 +2099,18 @@ class Less_Parser{ $this->restore(); } - private function parseImportOptions(){ - - $options = array(); + private function parseImportOptions() { + $options = []; // list of options, surrounded by parens - if( !$this->MatchChar('(') ){ + if ( !$this->MatchChar( '(' ) ) { return $options; } do{ $optionName = $this->parseImportOption(); - if( $optionName ){ + if ( $optionName ) { $value = true; - switch( $optionName ){ + switch ( $optionName ) { case "css": $optionName = "less"; $value = false; @@ -2160,89 +2121,99 @@ class Less_Parser{ break; } $options[$optionName] = $value; - if( !$this->MatchChar(',') ){ break; } + if ( !$this->MatchChar( ',' ) ) { break; + } } - }while( $optionName ); - $this->expectChar(')'); + }while ( $optionName ); + $this->expectChar( ')' ); return $options; } - private function parseImportOption(){ - $opt = $this->MatchReg('/\\G(less|css|multiple|once|inline|reference|optional)/'); - if( $opt ){ + private function parseImportOption() { + $opt = $this->MatchReg( '/\\G(less|css|multiple|once|inline|reference|optional)/' ); + if ( $opt ) { return $opt[1]; } } private function parseMediaFeature() { - $nodes = array(); + $nodes = []; do{ - $e = $this->MatchFuncs(array('parseEntitiesKeyword','parseEntitiesVariable')); - if( $e ){ + $e = $this->MatchFuncs( [ 'parseEntitiesKeyword','parseEntitiesVariable' ] ); + if ( $e ) { $nodes[] = $e; - } elseif ($this->MatchChar('(')) { + } elseif ( $this->MatchChar( '(' ) ) { $p = $this->parseProperty(); $e = $this->parseValue(); - if ($this->MatchChar(')')) { - if ($p && $e) { - $r = $this->NewObj7('Less_Tree_Rule', array( $p, $e, null, null, $this->pos, $this->env->currentFileInfo, true)); - $nodes[] = $this->NewObj1('Less_Tree_Paren',$r); - } elseif ($e) { - $nodes[] = $this->NewObj1('Less_Tree_Paren',$e); + if ( $this->MatchChar( ')' ) ) { + if ( $p && $e ) { + $r = $this->NewObj( 'Less_Tree_Rule', [ $p, $e, null, null, $this->pos, $this->env->currentFileInfo, true ] ); + $nodes[] = $this->NewObj( 'Less_Tree_Paren', [ $r ] ); + } elseif ( $e ) { + $nodes[] = $this->NewObj( 'Less_Tree_Paren', [ $e ] ); } else { return null; } - } else + } else { return null; + } } - } while ($e); + } while ( $e ); - if ($nodes) { - return $this->NewObj1('Less_Tree_Expression',$nodes); + if ( $nodes ) { + return $this->NewObj( 'Less_Tree_Expression', [ $nodes ] ); } } private function parseMediaFeatures() { - $features = array(); + $features = []; - do{ + do { $e = $this->parseMediaFeature(); - if( $e ){ + if ( $e ) { $features[] = $e; - if (!$this->MatchChar(',')) break; - }else{ + if ( !$this->MatchChar( ',' ) ) { + break; + } + } else { $e = $this->parseEntitiesVariable(); - if( $e ){ + if ( $e ) { $features[] = $e; - if (!$this->MatchChar(',')) break; + if ( !$this->MatchChar( ',' ) ) { + break; + } } } - } while ($e); + } while ( $e ); - return $features ? $features : null; + return $features ?: null; } private function parseMedia() { - if( $this->MatchReg('/\\G@media/') ){ + if ( $this->MatchReg( '/\\G@media/' ) ) { + $this->save(); + $features = $this->parseMediaFeatures(); $rules = $this->parseBlock(); - if( is_array($rules) ){ - return $this->NewObj4('Less_Tree_Media',array( $rules, $features, $this->pos, $this->env->currentFileInfo)); + if ( $rules === null ) { + $this->restore(); + return; } + + $this->forget(); + return $this->NewObj( 'Less_Tree_Media', [ $rules, $features, $this->pos, $this->env->currentFileInfo ] ); } } - // // A CSS Directive // // @charset "utf-8"; // - private function parseDirective(){ - - if( !$this->PeekChar('@') ){ + private function parseDirective() { + if ( !$this->PeekChar( '@' ) ) { return; } @@ -2253,28 +2224,30 @@ class Less_Parser{ $hasExpression = false; $hasUnknown = false; - - $value = $this->MatchFuncs(array('parseImport','parseMedia')); - if( $value ){ + $value = $this->MatchFuncs( [ + 'parseImport', + 'parseMedia' + ] ); + if ( $value ) { return $value; } $this->save(); - $name = $this->MatchReg('/\\G@[a-z-]+/'); + $name = $this->MatchReg( '/\\G@[a-z-]+/' ); - if( !$name ) return; + if ( !$name ) { + return; + } $name = $name[0]; - $nonVendorSpecificName = $name; - $pos = strpos($name,'-', 2); - if( $name[1] == '-' && $pos > 0 ){ - $nonVendorSpecificName = "@" . substr($name, $pos + 1); + $pos = strpos( $name, '-', 2 ); + if ( $name[1] == '-' && $pos > 0 ) { + $nonVendorSpecificName = "@" . substr( $name, $pos + 1 ); } - - switch( $nonVendorSpecificName ){ + switch ( $nonVendorSpecificName ) { /* case "@font-face": case "@viewport": @@ -2316,37 +2289,36 @@ class Less_Parser{ break; } - if( $hasIdentifier ){ + if ( $hasIdentifier ) { $value = $this->parseEntity(); - if( !$value ){ - $this->error("expected " . $name . " identifier"); + if ( !$value ) { + $this->error( "expected " . $name . " identifier" ); } - } else if( $hasExpression ){ + } elseif ( $hasExpression ) { $value = $this->parseExpression(); - if( !$value ){ - $this->error("expected " . $name. " expression"); + if ( !$value ) { + $this->error( "expected " . $name . " expression" ); } - } else if ($hasUnknown) { + } elseif ( $hasUnknown ) { - $value = $this->MatchReg('/\\G[^{;]+/'); - if( $value ){ - $value = $this->NewObj1('Less_Tree_Anonymous',trim($value[0])); + $value = $this->MatchReg( '/\\G[^{;]+/' ); + if ( $value ) { + $value = $this->NewObj( 'Less_Tree_Anonymous', [ trim( $value[0] ) ] ); } } - if( $hasBlock ){ + if ( $hasBlock ) { $rules = $this->parseBlockRuleset(); } - if( $rules || (!$hasBlock && $value && $this->MatchChar(';'))) { + if ( $rules || ( !$hasBlock && $value && $this->MatchChar( ';' ) ) ) { $this->forget(); - return $this->NewObj5('Less_Tree_Directive',array($name, $value, $rules, $index, $this->env->currentFileInfo)); + return $this->NewObj( 'Less_Tree_Directive', [ $name, $value, $rules, $index, $this->env->currentFileInfo ] ); } $this->restore(); } - // // A Value is a comma-delimited list of Expressions // @@ -2355,121 +2327,115 @@ class Less_Parser{ // In a Rule, a Value represents everything after the `:`, // and before the `;`. // - private function parseValue(){ - $expressions = array(); + private function parseValue() { + $expressions = []; do{ $e = $this->parseExpression(); - if( $e ){ + if ( $e ) { $expressions[] = $e; - if (! $this->MatchChar(',')) { + if ( !$this->MatchChar( ',' ) ) { break; } } - }while($e); + } while ( $e ); - if( $expressions ){ - return $this->NewObj1('Less_Tree_Value',$expressions); + if ( $expressions ) { + return $this->NewObj( 'Less_Tree_Value', [ $expressions ] ); } } - private function parseImportant (){ - if( $this->PeekChar('!') && $this->MatchReg('/\\G! *important/') ){ + private function parseImportant() { + if ( $this->PeekChar( '!' ) && $this->MatchReg( '/\\G! *important/' ) ) { return ' !important'; } } - private function parseSub (){ - - if( $this->MatchChar('(') ){ + private function parseSub() { + if ( $this->MatchChar( '(' ) ) { $a = $this->parseAddition(); - if( $a ){ - $this->expectChar(')'); - return $this->NewObj2('Less_Tree_Expression',array( array($a), true) ); //instead of $e->parens = true so the value is cached + if ( $a ) { + $this->expectChar( ')' ); + return $this->NewObj( 'Less_Tree_Expression', [ [ $a ], true ] ); // instead of $e->parens = true so the value is cached } } } - /** * Parses multiplication operation * * @return Less_Tree_Operation|null */ - function parseMultiplication(){ - + function parseMultiplication() { $return = $m = $this->parseOperand(); - if( $return ){ - while( true ){ + if ( $return ) { + while ( true ) { $isSpaced = $this->isWhitespace( -1 ); - if( $this->PeekReg('/\\G\/[*\/]/') ){ + if ( $this->PeekReg( '/\\G\/[*\/]/' ) ) { break; } - $op = $this->MatchChar('/'); - if( !$op ){ - $op = $this->MatchChar('*'); - if( !$op ){ + $op = $this->MatchChar( '/' ); + if ( !$op ) { + $op = $this->MatchChar( '*' ); + if ( !$op ) { break; } } $a = $this->parseOperand(); - if(!$a) { break; } + if ( !$a ) { break; + } $m->parensInOp = true; $a->parensInOp = true; - $return = $this->NewObj3('Less_Tree_Operation',array( $op, array( $return, $a ), $isSpaced) ); + $return = $this->NewObj( 'Less_Tree_Operation', [ $op, [ $return, $a ], $isSpaced ] ); } } return $return; - } - /** * Parses an addition operation * * @return Less_Tree_Operation|null */ - private function parseAddition (){ - + private function parseAddition() { $return = $m = $this->parseMultiplication(); - if( $return ){ - while( true ){ + if ( $return ) { + while ( true ) { $isSpaced = $this->isWhitespace( -1 ); - $op = $this->MatchReg('/\\G[-+]\s+/'); - if( $op ){ + $op = $this->MatchReg( '/\\G[-+]\s+/' ); + if ( $op ) { $op = $op[0]; - }else{ - if( !$isSpaced ){ - $op = $this->match(array('#+','#-')); + } else { + if ( !$isSpaced ) { + $op = $this->matcher( [ '#+','#-' ] ); } - if( !$op ){ + if ( !$op ) { break; } } $a = $this->parseMultiplication(); - if( !$a ){ + if ( !$a ) { break; } $m->parensInOp = true; $a->parensInOp = true; - $return = $this->NewObj3('Less_Tree_Operation',array($op, array($return, $a), $isSpaced)); + $return = $this->NewObj( 'Less_Tree_Operation', [ $op, [ $return, $a ], $isSpaced ] ); } } return $return; } - /** * Parses the conditions * @@ -2478,17 +2444,17 @@ class Less_Parser{ private function parseConditions() { $index = $this->pos; $return = $a = $this->parseCondition(); - if( $a ){ - while( true ){ - if( !$this->PeekReg('/\\G,\s*(not\s*)?\(/') || !$this->MatchChar(',') ){ + if ( $a ) { + while ( true ) { + if ( !$this->PeekReg( '/\\G,\s*(not\s*)?\(/' ) || !$this->MatchChar( ',' ) ) { break; } $b = $this->parseCondition(); - if( !$b ){ + if ( !$b ) { break; } - $return = $this->NewObj4('Less_Tree_Condition',array('or', $return, $b, $index)); + $return = $this->NewObj( 'Less_Tree_Condition', [ 'or', $return, $b, $index ] ); } return $return; } @@ -2499,318 +2465,265 @@ class Less_Parser{ $negate = false; $c = null; - if ($this->MatchReg('/\\Gnot/')) $negate = true; - $this->expectChar('('); - $a = $this->MatchFuncs(array('parseAddition','parseEntitiesKeyword','parseEntitiesQuoted')); + if ( $this->MatchReg( '/\\Gnot/' ) ) { + $negate = true; + } + $this->expectChar( '(' ); + $a = $this->MatchFuncs( [ 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ] ); - if( $a ){ - $op = $this->MatchReg('/\\G(?:>=|<=|=<|[<=>])/'); - if( $op ){ - $b = $this->MatchFuncs(array('parseAddition','parseEntitiesKeyword','parseEntitiesQuoted')); - if( $b ){ - $c = $this->NewObj5('Less_Tree_Condition',array($op[0], $a, $b, $index, $negate)); + if ( $a ) { + $op = $this->MatchReg( '/\\G(?:>=|<=|=<|[<=>])/' ); + if ( $op ) { + $b = $this->MatchFuncs( [ 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ] ); + if ( $b ) { + $c = $this->NewObj( 'Less_Tree_Condition', [ $op[0], $a, $b, $index, $negate ] ); } else { - $this->Error('Unexpected expression'); + $this->Error( 'Unexpected expression' ); } } else { - $k = $this->NewObj1('Less_Tree_Keyword','true'); - $c = $this->NewObj5('Less_Tree_Condition',array('=', $a, $k, $index, $negate)); + $k = $this->NewObj( 'Less_Tree_Keyword', [ 'true' ] ); + $c = $this->NewObj( 'Less_Tree_Condition', [ '=', $a, $k, $index, $negate ] ); } - $this->expectChar(')'); - return $this->MatchReg('/\\Gand/') ? $this->NewObj3('Less_Tree_Condition',array('and', $c, $this->parseCondition())) : $c; + $this->expectChar( ')' ); + // @phan-suppress-next-line PhanPossiblyInfiniteRecursionSameParams + return $this->MatchReg( '/\\Gand/' ) ? $this->NewObj( 'Less_Tree_Condition', [ 'and', $c, $this->parseCondition() ] ) : $c; } } /** * An operand is anything that can be part of an operation, * such as a Color, or a Variable - * */ - private function parseOperand (){ - + private function parseOperand() { $negate = false; - $offset = $this->pos+1; - if( $offset >= $this->input_len ){ + $offset = $this->pos + 1; + if ( $offset >= $this->input_len ) { return; } $char = $this->input[$offset]; - if( $char === '@' || $char === '(' ){ - $negate = $this->MatchChar('-'); + if ( $char === '@' || $char === '(' ) { + $negate = $this->MatchChar( '-' ); } - $o = $this->MatchFuncs(array('parseSub','parseEntitiesDimension','parseEntitiesColor','parseEntitiesVariable','parseEntitiesCall')); + $o = $this->MatchFuncs( [ 'parseSub','parseEntitiesDimension','parseEntitiesColor','parseEntitiesVariable','parseEntitiesCall' ] ); - if( $negate ){ + if ( $negate ) { $o->parensInOp = true; - $o = $this->NewObj1('Less_Tree_Negative',$o); + $o = $this->NewObj( 'Less_Tree_Negative', [ $o ] ); } return $o; } - /** * Expressions either represent mathematical operations, * or white-space delimited Entities. * - * 1px solid black - * @var * 2 - * * @return Less_Tree_Expression|null */ - private function parseExpression (){ - $entities = array(); + private function parseExpression() { + $entities = []; - do{ - $e = $this->MatchFuncs(array('parseAddition','parseEntity')); - if( $e ){ + do { + $e = $this->MatchFuncs( [ 'parseAddition','parseEntity' ] ); + if ( $e ) { $entities[] = $e; // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here - if( !$this->PeekReg('/\\G\/[\/*]/') ){ - $delim = $this->MatchChar('/'); - if( $delim ){ - $entities[] = $this->NewObj1('Less_Tree_Anonymous',$delim); + if ( !$this->PeekReg( '/\\G\/[\/*]/' ) ) { + $delim = $this->MatchChar( '/' ); + if ( $delim ) { + $entities[] = $this->NewObj( 'Less_Tree_Anonymous', [ $delim ] ); } } } - }while($e); + } while ( $e ); - if( $entities ){ - return $this->NewObj1('Less_Tree_Expression',$entities); + if ( $entities ) { + return $this->NewObj( 'Less_Tree_Expression', [ $entities ] ); } } - /** * Parse a property * eg: 'min-width', 'orientation', etc * * @return string */ - private function parseProperty (){ - $name = $this->MatchReg('/\\G(\*?-?[_a-zA-Z0-9-]+)\s*:/'); - if( $name ){ + private function parseProperty() { + $name = $this->MatchReg( '/\\G(\*?-?[_a-zA-Z0-9-]+)\s*:/' ); + if ( $name ) { return $name[1]; } } - /** * Parse a rule property * eg: 'color', 'width', 'height', etc * - * @return string + * @return array<Less_Tree_Keyword|Less_Tree_Variable> */ - private function parseRuleProperty(){ - $offset = $this->pos; - $name = array(); - $index = array(); - $length = 0; + private function parseRuleProperty() { + $name = []; + $index = []; + $this->save(); - $this->rulePropertyMatch('/\\G(\*?)/', $offset, $length, $index, $name ); - while( $this->rulePropertyMatch('/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $offset, $length, $index, $name )); // ! - - if( (count($name) > 1) && $this->rulePropertyMatch('/\\G\s*((?:\+_|\+)?)\s*:/', $offset, $length, $index, $name) ){ - // at last, we have the complete match now. move forward, - // convert name particles to tree objects and return: - $this->skipWhitespace($length); - - if( $name[0] === '' ){ - array_shift($name); - array_shift($index); - } - foreach($name as $k => $s ){ - if( !$s || $s[0] !== '@' ){ - $name[$k] = $this->NewObj1('Less_Tree_Keyword',$s); - }else{ - $name[$k] = $this->NewObj3('Less_Tree_Variable',array('@' . substr($s,2,-1), $index[$k], $this->env->currentFileInfo)); - } - } + $simpleProperty = $this->MatchReg( '/\\G([_a-zA-Z0-9-]+)\s*:/' ); + if ( $simpleProperty ) { + $name[] = $this->NewObj( 'Less_Tree_Keyword', [ $simpleProperty[1] ] ); + $this->forget(); return $name; } + $this->rulePropertyMatch( '/\\G(\*?)/', $index, $name ); + // Consume! + // @phan-suppress-next-line PhanPluginEmptyStatementWhileLoop + while ( $this->rulePropertyMatch( '/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $index, $name ) ); + + if ( ( count( $name ) > 1 ) && $this->rulePropertyMatch( '/\\G\s*((?:\+_|\+)?)\s*:/', $index, $name ) ) { + $this->forget(); + + // at last, we have the complete match now. move forward, + // convert name particles to tree objects and return: + if ( $name[0] === '' ) { + array_shift( $name ); + array_shift( $index ); + } + foreach ( $name as $k => $s ) { + if ( !$s || $s[0] !== '@' ) { + $name[$k] = $this->NewObj( 'Less_Tree_Keyword', [ $s ] ); + } else { + $name[$k] = $this->NewObj( 'Less_Tree_Variable', [ '@' . substr( $s, 2, -1 ), $index[$k], $this->env->currentFileInfo ] ); + } + } + return $name; + } else { + $this->restore(); + } } - private function rulePropertyMatch( $re, &$offset, &$length, &$index, &$name ){ - preg_match($re, $this->input, $a, 0, $offset); - if( $a ){ - $index[] = $this->pos + $length; - $length += strlen($a[0]); - $offset += strlen($a[0]); - $name[] = $a[1]; + private function rulePropertyMatch( $re, &$index, &$name ) { + $i = $this->pos; + $chunk = $this->MatchReg( $re ); + if ( $chunk ) { + $index[] = $i; + $name[] = $chunk[1]; return true; } } - public static function serializeVars( $vars ){ + public static function serializeVars( $vars ) { $s = ''; - foreach($vars as $name => $value){ - $s .= (($name[0] === '@') ? '' : '@') . $name .': '. $value . ((substr($value,-1) === ';') ? '' : ';'); + foreach ( $vars as $name => $value ) { + $s .= ( ( $name[0] === '@' ) ? '' : '@' ) . $name . ': ' . $value . ( ( substr( $value, -1 ) === ';' ) ? '' : ';' ); } return $s; } - /** - * Some versions of php have trouble with method_exists($a,$b) if $a is not an object + * Some versions of PHP have trouble with method_exists($a,$b) if $a is not an object * + * @param mixed $a * @param string $b */ - public static function is_method($a,$b){ - return is_object($a) && method_exists($a,$b); + public static function is_method( $a, $b ) { + return is_object( $a ) && method_exists( $a, $b ); } - /** * Round numbers similarly to javascript * eg: 1.499999 to 1 instead of 2 - * */ - public static function round($i, $precision = 0){ + public static function round( $input, $precision = 0 ) { + $precision = pow( 10, $precision ); + $i = $input * $precision; - $precision = pow(10,$precision); - $i = $i*$precision; - - $ceil = ceil($i); - $floor = floor($i); - if( ($ceil - $i) <= ($i - $floor) ){ - return $ceil/$precision; - }else{ - return $floor/$precision; + $ceil = ceil( $i ); + $floor = floor( $i ); + if ( ( $ceil - $i ) <= ( $i - $floor ) ) { + return $ceil / $precision; + } else { + return $floor / $precision; } } - /** - * Create Less_Tree_* objects and optionally generate a cache string + * Create a new instance of $class with args $args, and optionally generates a cache string. + * $class should be a Less_Tree_* class. * - * @return mixed + * @phan-template TClassName + * @phan-param class-string<TClassName> $class + * @phan-param array<int,mixed> $args + * @phan-return TClassName + * + * @param string $class + * @param mixed[] $args + * @return Less_Tree Instance of $class subclass created with $args */ - public function NewObj0($class){ - $obj = new $class(); - if( $this->CacheEnabled() ){ - $obj->cache_string = ' new '.$class.'()'; + public function NewObj( $class, $args = [] ) { + $obj = new $class( ...$args ); + if ( $this->CacheEnabled() ) { + $argStrings = array_map( + [ __CLASS__, 'ArgString' ], + $args + ); + $argCache = implode( ',', $argStrings ); + // @phan-suppress-next-line PhanTypeExpectedObjectPropAccess False positive + $obj->cache_string = " new $class($argCache)"; } return $obj; } - public function NewObj1($class, $arg){ - $obj = new $class( $arg ); - if( $this->CacheEnabled() ){ - $obj->cache_string = ' new '.$class.'('.Less_Parser::ArgString($arg).')'; - } - return $obj; - } - - public function NewObj2($class, $args){ - $obj = new $class( $args[0], $args[1] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - public function NewObj3($class, $args){ - $obj = new $class( $args[0], $args[1], $args[2] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - public function NewObj4($class, $args){ - $obj = new $class( $args[0], $args[1], $args[2], $args[3] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - public function NewObj5($class, $args){ - $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - public function NewObj6($class, $args){ - $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - public function NewObj7($class, $args){ - $obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6] ); - if( $this->CacheEnabled() ){ - $this->ObjCache( $obj, $class, $args); - } - return $obj; - } - - //caching - public function ObjCache($obj, $class, $args=array()){ - $obj->cache_string = ' new '.$class.'('. self::ArgCache($args).')'; - } - - public function ArgCache($args){ - return implode(',',array_map( array('Less_Parser','ArgString'),$args)); - } - - /** * Convert an argument to a string for use in the parser cache * * @return string */ - public static function ArgString($arg){ + public static function ArgString( $arg ) { + $type = gettype( $arg ); - $type = gettype($arg); - - if( $type === 'object'){ + if ( $type === 'object' ) { $string = $arg->cache_string; - unset($arg->cache_string); + unset( $arg->cache_string ); return $string; - }elseif( $type === 'array' ){ + } elseif ( $type === 'array' ) { $string = ' Array('; - foreach($arg as $k => $a){ - $string .= var_export($k,true).' => '.self::ArgString($a).','; + foreach ( $arg as $k => $a ) { + $string .= var_export( $k, true ) . ' => ' . self::ArgString( $a ) . ','; } return $string . ')'; } - return var_export($arg,true); + return var_export( $arg, true ); } - public function Error($msg){ - throw new Less_Exception_Parser($msg, null, $this->furthest, $this->env->currentFileInfo); + /** @return never */ + public function Error( $msg ) { + throw new Less_Exception_Parser( $msg, null, $this->furthest, $this->env->currentFileInfo ); } - public static function WinPath($path){ - return str_replace('\\', '/', $path); + public static function WinPath( $path ) { + return str_replace( '\\', '/', $path ); } - public static function AbsPath($path, $winPath = false){ - if (strpos($path, '//') !== false && preg_match('_^(https?:)?//\\w+(\\.\\w+)+/\\w+_i', $path)) { + public static function AbsPath( $path, $winPath = false ) { + if ( strpos( $path, '//' ) !== false && preg_match( '/^(https?:)?\/\//i', $path ) ) { return $winPath ? '' : false; } else { - $path = realpath($path); - if ($winPath) { - $path = self::WinPath($path); + $path = realpath( $path ); + if ( $winPath ) { + $path = self::WinPath( $path ); } return $path; } } - public function CacheEnabled(){ - return (Less_Parser::$options['cache_method'] && (Less_Cache::$cache_dir || (Less_Parser::$options['cache_method'] == 'callback'))); + public function CacheEnabled() { + return ( self::$options['cache_method'] && ( Less_Cache::$cache_dir || ( self::$options['cache_method'] == 'callback' ) ) ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php b/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php index f5b200c35..c27c6ed56 100644 --- a/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php +++ b/vendor/wikimedia/less.php/lib/Less/SourceMap/Base64VLQ.php @@ -1,31 +1,29 @@ <?php - /** * Encode / Decode Base64 VLQ. * - * @package Less - * @subpackage SourceMap + * @private */ class Less_SourceMap_Base64VLQ { /** * Shift * - * @var integer + * @var int */ private $shift = 5; /** * Mask * - * @var integer + * @var int */ private $mask = 0x1F; // == (1 << shift) == 0b00011111 /** * Continuation bit * - * @var integer + * @var int */ private $continuationBit = 0x20; // == (mask - 1 ) == 0b00100000 @@ -34,7 +32,7 @@ class Less_SourceMap_Base64VLQ { * * @var array */ - private $charToIntMap = array( + private $charToIntMap = [ 'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7,'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, @@ -44,14 +42,14 @@ class Less_SourceMap_Base64VLQ { 'q' => 42, 'r' => 43, 's' => 44, 't' => 45, 'u' => 46, 'v' => 47, 'w' => 48, 'x' => 49, 'y' => 50, 'z' => 51, 0 => 52, 1 => 53, 2 => 54, 3 => 55, 4 => 56, 5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63, - ); + ]; /** * Integer to char map * * @var array */ - private $intToCharMap = array( + private $intToCharMap = [ 0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 5 => 'F', 6 => 'G', 7 => 'H', 8 => 'I', 9 => 'J', 10 => 'K', 11 => 'L', 12 => 'M', 13 => 'N', 14 => 'O', 15 => 'P', 16 => 'Q', 17 => 'R', 18 => 'S', 19 => 'T', 20 => 'U', @@ -62,12 +60,12 @@ class Less_SourceMap_Base64VLQ { 49 => 'x', 50 => 'y', 51 => 'z', 52 => '0', 53 => '1', 54 => '2', 55 => '3', 56 => '4', 57 => '5', 58 => '6', 59 => '7', 60 => '8', 61 => '9', 62 => '+', 63 => '/', - ); + ]; /** * Constructor */ - public function __construct(){ + public function __construct() { // I leave it here for future reference // foreach(str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') as $i => $char) // { @@ -83,10 +81,10 @@ class Less_SourceMap_Base64VLQ { * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) * We generate the value for 32 bit machines, hence -2147483648 becomes 1, not 4294967297, * even on a 64 bit machine. - * @param string $aValue + * @param int $aValue */ - public function toVLQSigned($aValue){ - return 0xffffffff & ($aValue < 0 ? ((-$aValue) << 1) + 1 : ($aValue << 1) + 0); + public function toVLQSigned( $aValue ) { + return 0xffffffff & ( $aValue < 0 ? ( ( -$aValue ) << 1 ) + 1 : ( $aValue << 1 ) + 0 ); } /** @@ -98,30 +96,30 @@ class Less_SourceMap_Base64VLQ { * Hence * 1 becomes -2147483648 * even on a 64 bit machine. - * @param integer $aValue + * @param int $aValue */ - public function fromVLQSigned($aValue){ - return $aValue & 1 ? $this->zeroFill(~$aValue + 2, 1) | (-1 - 0x7fffffff) : $this->zeroFill($aValue, 1); + public function fromVLQSigned( $aValue ) { + return $aValue & 1 ? $this->zeroFill( ~$aValue + 2, 1 ) | ( -1 - 0x7fffffff ) : $this->zeroFill( $aValue, 1 ); } /** * Return the base 64 VLQ encoded value. * - * @param string $aValue The value to encode + * @param int $aValue The value to encode * @return string The encoded value */ - public function encode($aValue){ + public function encode( $aValue ) { $encoded = ''; - $vlq = $this->toVLQSigned($aValue); + $vlq = $this->toVLQSigned( $aValue ); do { $digit = $vlq & $this->mask; - $vlq = $this->zeroFill($vlq, $this->shift); - if($vlq > 0){ + $vlq = $this->zeroFill( $vlq, $this->shift ); + if ( $vlq > 0 ) { $digit |= $this->continuationBit; } - $encoded .= $this->base64Encode($digit); - } while($vlq > 0); + $encoded .= $this->base64Encode( $digit ); + } while ( $vlq > 0 ); return $encoded; } @@ -130,42 +128,42 @@ class Less_SourceMap_Base64VLQ { * Return the value decoded from base 64 VLQ. * * @param string $encoded The encoded value to decode - * @return integer The decoded value + * @return int The decoded value */ - public function decode($encoded){ + public function decode( $encoded ) { $vlq = 0; $i = 0; do { - $digit = $this->base64Decode($encoded[$i]); - $vlq |= ($digit & $this->mask) << ($i * $this->shift); + $digit = $this->base64Decode( $encoded[$i] ); + $vlq |= ( $digit & $this->mask ) << ( $i * $this->shift ); $i++; - } while($digit & $this->continuationBit); + } while ( $digit & $this->continuationBit ); - return $this->fromVLQSigned($vlq); + return $this->fromVLQSigned( $vlq ); } /** * Right shift with zero fill. * - * @param integer $a number to shift - * @param integer $b number of bits to shift - * @return integer + * @param int $a number to shift + * @param int $b number of bits to shift + * @return int */ - public function zeroFill($a, $b){ - return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> ($b - 1)); + public function zeroFill( $a, $b ) { + return ( $a >= 0 ) ? ( $a >> $b ) : ( $a >> $b ) & ( PHP_INT_MAX >> ( $b - 1 ) ); } /** * Encode single 6-bit digit as base64. * - * @param integer $number + * @param int $number * @return string * @throws Exception If the number is invalid */ - public function base64Encode($number){ - if($number < 0 || $number > 63){ - throw new Exception(sprintf('Invalid number "%s" given. Must be between 0 and 63.', $number)); + public function base64Encode( $number ) { + if ( $number < 0 || $number > 63 ) { + throw new Exception( sprintf( 'Invalid number "%s" given. Must be between 0 and 63.', (string)$number ) ); } return $this->intToCharMap[$number]; } @@ -174,12 +172,12 @@ class Less_SourceMap_Base64VLQ { * Decode single 6-bit digit from base64 * * @param string $char - * @return number + * @return int * @throws Exception If the number is invalid */ - public function base64Decode($char){ - if(!array_key_exists($char, $this->charToIntMap)){ - throw new Exception(sprintf('Invalid base 64 digit "%s" given.', $char)); + public function base64Decode( $char ) { + if ( !array_key_exists( $char, $this->charToIntMap ) ) { + throw new Exception( sprintf( 'Invalid base 64 digit "%s" given.', $char ) ); } return $this->charToIntMap[$char]; } diff --git a/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php b/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php index 9509aea71..7da960991 100644 --- a/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php +++ b/vendor/wikimedia/less.php/lib/Less/SourceMap/Generator.php @@ -1,24 +1,22 @@ <?php - /** * Source map generator * - * @package Less - * @subpackage Output + * @private */ class Less_SourceMap_Generator extends Less_Configurable { /** * What version of source map does the generator generate? */ - const VERSION = 3; + private const VERSION = 3; /** * Array of default options * * @var array */ - protected $defaultOptions = array( + protected $defaultOptions = [ // an optional source root, useful for relocating source files // on a server or removing repeated values in the 'sources' entry. // This value is prepended to the individual entries in the 'source' field. @@ -41,7 +39,7 @@ class Less_SourceMap_Generator extends Less_Configurable { // base path for filename normalization 'sourceMapBasepath' => '' - ); + ]; /** * The base64 VLQ encoder @@ -55,7 +53,7 @@ class Less_SourceMap_Generator extends Less_Configurable { * * @var array */ - protected $mappings = array(); + protected $mappings = []; /** * The root node @@ -69,31 +67,32 @@ class Less_SourceMap_Generator extends Less_Configurable { * * @var array */ - protected $contentsMap = array(); + protected $contentsMap = []; /** * File to content map * * @var array */ - protected $sources = array(); - protected $source_keys = array(); + protected $sources = []; + protected $source_keys = []; /** * Constructor * * @param Less_Tree_Ruleset $root The root node + * @param array $contentsMap * @param array $options Array of options */ - public function __construct(Less_Tree_Ruleset $root, $contentsMap, $options = array()){ + public function __construct( Less_Tree_Ruleset $root, $contentsMap, $options = [] ) { $this->root = $root; $this->contentsMap = $contentsMap; $this->encoder = new Less_SourceMap_Base64VLQ(); - $this->SetOptions($options); - - $this->options['sourceMapRootpath'] = $this->fixWindowsPath($this->options['sourceMapRootpath'], true); - $this->options['sourceMapBasepath'] = $this->fixWindowsPath($this->options['sourceMapBasepath'], true); + $this->SetOptions( $options ); + + $this->options['sourceMapRootpath'] = $this->fixWindowsPath( $this->options['sourceMapRootpath'], true ); + $this->options['sourceMapBasepath'] = $this->fixWindowsPath( $this->options['sourceMapBasepath'], true ); } /** @@ -101,34 +100,33 @@ class Less_SourceMap_Generator extends Less_Configurable { * * @return string */ - public function generateCSS(){ - $output = new Less_Output_Mapped($this->contentsMap, $this); + public function generateCSS() { + $output = new Less_Output_Mapped( $this->contentsMap, $this ); // catch the output - $this->root->genCSS($output); + $this->root->genCSS( $output ); - - $sourceMapUrl = $this->getOption('sourceMapURL'); - $sourceMapFilename = $this->getOption('sourceMapFilename'); + $sourceMapUrl = $this->getOption( 'sourceMapURL' ); + $sourceMapFilename = $this->getOption( 'sourceMapFilename' ); $sourceMapContent = $this->generateJson(); - $sourceMapWriteTo = $this->getOption('sourceMapWriteTo'); + $sourceMapWriteTo = $this->getOption( 'sourceMapWriteTo' ); - if( !$sourceMapUrl && $sourceMapFilename ){ - $sourceMapUrl = $this->normalizeFilename($sourceMapFilename); + if ( !$sourceMapUrl && $sourceMapFilename ) { + $sourceMapUrl = $this->normalizeFilename( $sourceMapFilename ); } // write map to a file - if( $sourceMapWriteTo ){ - $this->saveMap($sourceMapWriteTo, $sourceMapContent); + if ( $sourceMapWriteTo ) { + $this->saveMap( $sourceMapWriteTo, $sourceMapContent ); } // inline the map - if( !$sourceMapUrl ){ - $sourceMapUrl = sprintf('data:application/json,%s', Less_Functions::encodeURIComponent($sourceMapContent)); + if ( !$sourceMapUrl ) { + $sourceMapUrl = sprintf( 'data:application/json,%s', Less_Functions::encodeURIComponent( $sourceMapContent ) ); } - if( $sourceMapUrl ){ - $output->add( sprintf('/*# sourceMappingURL=%s */', $sourceMapUrl) ); + if ( $sourceMapUrl ) { + $output->add( sprintf( '/*# sourceMappingURL=%s */', $sourceMapUrl ) ); } return $output->toString(); @@ -141,16 +139,16 @@ class Less_SourceMap_Generator extends Less_Configurable { * @param string $content The content to write * @throws Exception If the file could not be saved */ - protected function saveMap($file, $content){ - $dir = dirname($file); + protected function saveMap( $file, $content ) { + $dir = dirname( $file ); // directory does not exist - if( !is_dir($dir) ){ + if ( !is_dir( $dir ) ) { // FIXME: create the dir automatically? - throw new Exception(sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir)); + throw new Exception( sprintf( 'The directory "%s" does not exist. Cannot save the source map.', $dir ) ); } // FIXME: proper saving, with dir write check! - if(file_put_contents($file, $content) === false){ - throw new Exception(sprintf('Cannot save the source map to "%s"', $file)); + if ( file_put_contents( $file, $content ) === false ) { + throw new Exception( sprintf( 'Cannot save the source map to "%s"', $file ) ); } return true; } @@ -161,21 +159,20 @@ class Less_SourceMap_Generator extends Less_Configurable { * @param string $filename * @return string */ - protected function normalizeFilename($filename){ + protected function normalizeFilename( $filename ) { + $filename = $this->fixWindowsPath( $filename ); - $filename = $this->fixWindowsPath($filename); - - $rootpath = $this->getOption('sourceMapRootpath'); - $basePath = $this->getOption('sourceMapBasepath'); + $rootpath = $this->getOption( 'sourceMapRootpath' ); + $basePath = $this->getOption( 'sourceMapBasepath' ); // "Trim" the 'sourceMapBasepath' from the output filename. - if (is_string($basePath) && strpos($filename, $basePath) === 0) { - $filename = substr($filename, strlen($basePath)); + if ( is_string( $basePath ) && strpos( $filename, $basePath ) === 0 ) { + $filename = substr( $filename, strlen( $basePath ) ); } // Remove extra leading path separators. - if(strpos($filename, '\\') === 0 || strpos($filename, '/') === 0){ - $filename = substr($filename, 1); + if ( strpos( $filename, '\\' ) === 0 || strpos( $filename, '/' ) === 0 ) { + $filename = substr( $filename, 1 ); } return $rootpath . $filename; @@ -184,69 +181,62 @@ class Less_SourceMap_Generator extends Less_Configurable { /** * Adds a mapping * - * @param integer $generatedLine The line number in generated file - * @param integer $generatedColumn The column number in generated file - * @param integer $originalLine The line number in original file - * @param integer $originalColumn The column number in original file - * @param string $sourceFile The original source file + * @param int $generatedLine The line number in generated file + * @param int $generatedColumn The column number in generated file + * @param int $originalLine The line number in original file + * @param int $originalColumn The column number in original file + * @param array $fileInfo The original source file */ - public function addMapping($generatedLine, $generatedColumn, $originalLine, $originalColumn, $fileInfo ){ - - $this->mappings[] = array( + public function addMapping( $generatedLine, $generatedColumn, $originalLine, $originalColumn, $fileInfo ) { + $this->mappings[] = [ 'generated_line' => $generatedLine, 'generated_column' => $generatedColumn, 'original_line' => $originalLine, 'original_column' => $originalColumn, 'source_file' => $fileInfo['currentUri'] - ); + ]; $this->sources[$fileInfo['currentUri']] = $fileInfo['filename']; } - /** * Generates the JSON source map * * @return string * @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit# */ - protected function generateJson(){ - - $sourceMap = array(); + protected function generateJson() { + $sourceMap = []; $mappings = $this->generateMappings(); // File version (always the first entry in the object) and must be a positive integer. $sourceMap['version'] = self::VERSION; - // An optional name of the generated code that this source map is associated with. - $file = $this->getOption('sourceMapFilename'); - if( $file ){ + $file = $this->getOption( 'sourceMapFilename' ); + if ( $file ) { $sourceMap['file'] = $file; } - // An optional source root, useful for relocating source files on a server or removing repeated values in the 'sources' entry. This value is prepended to the individual entries in the 'source' field. - $root = $this->getOption('sourceRoot'); - if( $root ){ + $root = $this->getOption( 'sourceRoot' ); + if ( $root ) { $sourceMap['sourceRoot'] = $root; } - // A list of original sources used by the 'mappings' entry. - $sourceMap['sources'] = array(); - foreach($this->sources as $source_uri => $source_filename){ - $sourceMap['sources'][] = $this->normalizeFilename($source_filename); + $sourceMap['sources'] = []; + foreach ( $this->sources as $source_uri => $source_filename ) { + $sourceMap['sources'][] = $this->normalizeFilename( $source_filename ); } - // A list of symbol names used by the 'mappings' entry. - $sourceMap['names'] = array(); + $sourceMap['names'] = []; // A string with the encoded mapping data. $sourceMap['mappings'] = $mappings; - if( $this->getOption('outputSourceFiles') ){ + if ( $this->getOption( 'outputSourceFiles' ) ) { // An optional list of source content, useful when the 'source' can't be hosted. // The contents are listed in the same order as the sources above. // 'null' may be used if some original sources should be retrieved by name. @@ -254,11 +244,11 @@ class Less_SourceMap_Generator extends Less_Configurable { } // less.js compat fixes - if( count($sourceMap['sources']) && empty($sourceMap['sourceRoot']) ){ - unset($sourceMap['sourceRoot']); + if ( count( $sourceMap['sources'] ) && empty( $sourceMap['sourceRoot'] ) ) { + unset( $sourceMap['sourceRoot'] ); } - return json_encode($sourceMap); + return json_encode( $sourceMap ); } /** @@ -266,13 +256,13 @@ class Less_SourceMap_Generator extends Less_Configurable { * * @return array|null */ - protected function getSourcesContent(){ - if(empty($this->sources)){ + protected function getSourcesContent() { + if ( empty( $this->sources ) ) { return; } - $content = array(); - foreach($this->sources as $sourceFile){ - $content[] = file_get_contents($sourceFile); + $content = []; + foreach ( $this->sources as $sourceFile ) { + $content[] = file_get_contents( $sourceFile ); } return $content; } @@ -282,48 +272,46 @@ class Less_SourceMap_Generator extends Less_Configurable { * * @return string */ - public function generateMappings(){ - - if( !count($this->mappings) ){ + public function generateMappings() { + if ( !count( $this->mappings ) ) { return ''; } - $this->source_keys = array_flip(array_keys($this->sources)); - + $this->source_keys = array_flip( array_keys( $this->sources ) ); // group mappings by generated line number. - $groupedMap = $groupedMapEncoded = array(); - foreach($this->mappings as $m){ + $groupedMap = $groupedMapEncoded = []; + foreach ( $this->mappings as $m ) { $groupedMap[$m['generated_line']][] = $m; } - ksort($groupedMap); + ksort( $groupedMap ); $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0; - foreach($groupedMap as $lineNumber => $line_map){ - while(++$lastGeneratedLine < $lineNumber){ + foreach ( $groupedMap as $lineNumber => $line_map ) { + while ( ++$lastGeneratedLine < $lineNumber ) { $groupedMapEncoded[] = ';'; } - $lineMapEncoded = array(); + $lineMapEncoded = []; $lastGeneratedColumn = 0; - foreach($line_map as $m){ - $mapEncoded = $this->encoder->encode($m['generated_column'] - $lastGeneratedColumn); + foreach ( $line_map as $m ) { + $mapEncoded = $this->encoder->encode( $m['generated_column'] - $lastGeneratedColumn ); $lastGeneratedColumn = $m['generated_column']; // find the index - if( $m['source_file'] ){ - $index = $this->findFileIndex($m['source_file']); - if( $index !== false ){ - $mapEncoded .= $this->encoder->encode($index - $lastOriginalIndex); + if ( $m['source_file'] ) { + $index = $this->findFileIndex( $m['source_file'] ); + if ( $index !== false ) { + $mapEncoded .= $this->encoder->encode( $index - $lastOriginalIndex ); $lastOriginalIndex = $index; // lines are stored 0-based in SourceMap spec version 3 - $mapEncoded .= $this->encoder->encode($m['original_line'] - 1 - $lastOriginalLine); + $mapEncoded .= $this->encoder->encode( $m['original_line'] - 1 - $lastOriginalLine ); $lastOriginalLine = $m['original_line'] - 1; - $mapEncoded .= $this->encoder->encode($m['original_column'] - $lastOriginalColumn); + $mapEncoded .= $this->encoder->encode( $m['original_column'] - $lastOriginalColumn ); $lastOriginalColumn = $m['original_column']; } } @@ -331,32 +319,33 @@ class Less_SourceMap_Generator extends Less_Configurable { $lineMapEncoded[] = $mapEncoded; } - $groupedMapEncoded[] = implode(',', $lineMapEncoded) . ';'; + $groupedMapEncoded[] = implode( ',', $lineMapEncoded ) . ';'; } - return rtrim(implode($groupedMapEncoded), ';'); + return rtrim( implode( $groupedMapEncoded ), ';' ); } /** * Finds the index for the filename * * @param string $filename - * @return integer|false + * @return int|false */ - protected function findFileIndex($filename){ + protected function findFileIndex( $filename ) { return $this->source_keys[$filename]; } /** * fix windows paths - * @param string $path - * @return string + * @param string $path + * @param bool $addEndSlash + * @return string */ - public function fixWindowsPath($path, $addEndSlash = false){ - $slash = ($addEndSlash) ? '/' : ''; - if( !empty($path) ){ - $path = str_replace('\\', '/', $path); - $path = rtrim($path,'/') . $slash; + public function fixWindowsPath( $path, $addEndSlash = false ) { + $slash = ( $addEndSlash ) ? '/' : ''; + if ( !empty( $path ) ) { + $path = str_replace( '\\', '/', $path ); + $path = rtrim( $path, '/' ) . $slash; } return $path; diff --git a/vendor/wikimedia/less.php/lib/Less/Tree.php b/vendor/wikimedia/less.php/lib/Less/Tree.php index 6fb104bc7..f606b5879 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree.php @@ -3,42 +3,50 @@ /** * Tree * - * @package Less - * @subpackage tree + * TODO: Callers often use `property_exists(, 'value')` to distinguish + * tree nodes that are considerd value-holding. Refactor this to move + * the 'value' property that most subclasses implement to there, and use + * something else (special value, method, or intermediate class?) to + * signal whether a subclass is considered value-holding. */ -class Less_Tree{ +class Less_Tree { public $cache_string; + public $parensInOp = false; + public $extendOnEveryPath; + public $allExtends; - public function toCSS(){ + public function toCSS() { $output = new Less_Output(); - $this->genCSS($output); + $this->genCSS( $output ); return $output->toString(); } + /** + * Generate CSS by adding it to the output object + * + * @param Less_Output $output The output + * @return void + */ + public function genCSS( $output ) { + } - /** - * Generate CSS by adding it to the output object - * - * @param Less_Output $output The output - * @return void - */ - public function genCSS($output){} - + public function compile( $env ) { + return $this; + } /** + * @param Less_Output $output * @param Less_Tree_Ruleset[] $rules */ - public static function outputRuleset( $output, $rules ){ - - $ruleCnt = count($rules); + public static function outputRuleset( $output, $rules ) { + $ruleCnt = count( $rules ); Less_Environment::$tabLevel++; - // Compressed - if( Less_Parser::$options['compress'] ){ - $output->add('{'); - for( $i = 0; $i < $ruleCnt; $i++ ){ + if ( Less_Parser::$options['compress'] ) { + $output->add( '{' ); + for ( $i = 0; $i < $ruleCnt; $i++ ) { $rules[$i]->genCSS( $output ); } @@ -47,41 +55,38 @@ class Less_Tree{ return; } - // Non-compressed - $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel-1 ); - $tabRuleStr = $tabSetStr.Less_Parser::$options['indentation']; + $tabSetStr = "\n" . str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 ); + $tabRuleStr = $tabSetStr . Less_Parser::$options['indentation']; $output->add( " {" ); - for($i = 0; $i < $ruleCnt; $i++ ){ + for ( $i = 0; $i < $ruleCnt; $i++ ) { $output->add( $tabRuleStr ); $rules[$i]->genCSS( $output ); } Less_Environment::$tabLevel--; - $output->add( $tabSetStr.'}' ); - + $output->add( $tabSetStr . '}' ); } - public function accept($visitor){} + public function accept( $visitor ) { + } - - public static function ReferencedArray($rules){ - foreach($rules as $rule){ - if( method_exists($rule, 'markReferenced') ){ + public static function ReferencedArray( $rules ) { + foreach ( $rules as $rule ) { + if ( method_exists( $rule, 'markReferenced' ) ) { + // @phan-suppress-next-line PhanUndeclaredMethod $rule->markReferenced(); } } } - /** * Requires php 5.3+ */ - public static function __set_state($args){ - + public static function __set_state( $args ) { $class = get_called_class(); - $obj = new $class(null,null,null,null); - foreach($args as $key => $val){ + $obj = new $class( null, null, null, null ); + foreach ( $args as $key => $val ) { $obj->$key = $val; } return $obj; diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php b/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php index 935377da3..bdf5dee75 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Alpha.php @@ -1,51 +1,44 @@ <?php - /** - * Alpha - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Alpha extends Less_Tree{ +class Less_Tree_Alpha extends Less_Tree { public $value; public $type = 'Alpha'; - public function __construct($val){ + public function __construct( $val ) { $this->value = $val; } - //function accept( $visitor ){ + // function accept( $visitor ){ // $this->value = $visitor->visit( $this->value ); //} - public function compile($env){ - - if( is_object($this->value) ){ - $this->value = $this->value->compile($env); + public function compile( $env ) { + if ( is_object( $this->value ) ) { + $this->value = $this->value->compile( $env ); } return $this; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( "alpha(opacity=" ); - if( is_string($this->value) ){ + if ( is_string( $this->value ) ) { $output->add( $this->value ); - }else{ - $this->value->genCSS( $output); + } else { + $this->value->genCSS( $output ); } $output->add( ')' ); } - public function toCSS(){ - return "alpha(opacity=" . (is_string($this->value) ? $this->value : $this->value->toCSS()) . ")"; + public function toCSS() { + return "alpha(opacity=" . ( is_string( $this->value ) ? $this->value : $this->value->toCSS() ) . ")"; } - -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php b/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php index 8889dc0f3..6d588e9ec 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Anonymous.php @@ -1,12 +1,8 @@ <?php - /** - * Anonymous - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Anonymous extends Less_Tree{ +class Less_Tree_Anonymous extends Less_Tree { public $value; public $quote; public $index; @@ -15,43 +11,43 @@ class Less_Tree_Anonymous extends Less_Tree{ public $type = 'Anonymous'; /** - * @param integer $index - * @param boolean $mapLines + * @param int $index + * @param bool|null $mapLines */ - public function __construct($value, $index = null, $currentFileInfo = null, $mapLines = null ){ + public function __construct( $value, $index = null, $currentFileInfo = null, $mapLines = null ) { $this->value = $value; $this->index = $index; $this->mapLines = $mapLines; $this->currentFileInfo = $currentFileInfo; } - public function compile(){ - return new Less_Tree_Anonymous($this->value, $this->index, $this->currentFileInfo, $this->mapLines); + public function compile( $env ) { + return new Less_Tree_Anonymous( $this->value, $this->index, $this->currentFileInfo, $this->mapLines ); } - public function compare($x){ - if( !is_object($x) ){ + public function compare( $x ) { + if ( !is_object( $x ) ) { return -1; } $left = $this->toCSS(); $right = $x->toCSS(); - if( $left === $right ){ + if ( $left === $right ) { return 0; } return $left < $right ? -1 : 1; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines ); } - public function toCSS(){ + public function toCSS() { return $this->value; } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php b/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php index 238000647..1f939a11f 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Assignment.php @@ -1,39 +1,35 @@ <?php - /** - * Assignment - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Assignment extends Less_Tree{ +class Less_Tree_Assignment extends Less_Tree { public $key; public $value; public $type = 'Assignment'; - public function __construct($key, $val) { + public function __construct( $key, $val ) { $this->key = $key; $this->value = $val; } - public function accept( $visitor ){ + public function accept( $visitor ) { $this->value = $visitor->visitObj( $this->value ); } - public function compile($env) { - return new Less_Tree_Assignment( $this->key, $this->value->compile($env)); + public function compile( $env ) { + return new Less_Tree_Assignment( $this->key, $this->value->compile( $env ) ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->key . '=' ); $this->value->genCSS( $output ); } - public function toCss(){ + public function toCss() { return $this->key . '=' . $this->value->toCSS(); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php b/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php index 32b8900d8..dd365959f 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Attribute.php @@ -1,54 +1,49 @@ <?php - /** - * Attribute - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Attribute extends Less_Tree{ +class Less_Tree_Attribute extends Less_Tree { public $key; public $op; public $value; public $type = 'Attribute'; - public function __construct($key, $op, $value){ + public function __construct( $key, $op, $value ) { $this->key = $key; $this->op = $op; $this->value = $value; } - public function compile($env){ + public function compile( $env ) { + $key_obj = is_object( $this->key ); + $val_obj = is_object( $this->value ); - $key_obj = is_object($this->key); - $val_obj = is_object($this->value); - - if( !$key_obj && !$val_obj ){ + if ( !$key_obj && !$val_obj ) { return $this; } return new Less_Tree_Attribute( - $key_obj ? $this->key->compile($env) : $this->key , + $key_obj ? $this->key->compile( $env ) : $this->key, $this->op, - $val_obj ? $this->value->compile($env) : $this->value); + $val_obj ? $this->value->compile( $env ) : $this->value ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->toCSS() ); } - public function toCSS(){ + public function toCSS() { $value = $this->key; - if( $this->op ){ + if ( $this->op ) { $value .= $this->op; - $value .= (is_object($this->value) ? $this->value->toCSS() : $this->value); + $value .= ( is_object( $this->value ) ? $this->value->toCSS() : $this->value ); } return '[' . $value . ']'; } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Call.php b/vendor/wikimedia/less.php/lib/Less/Tree/Call.php index 3c3382d10..28a3a192e 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Call.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Call.php @@ -1,111 +1,107 @@ <?php - - /** - * Call - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Call extends Less_Tree{ - public $value; +class Less_Tree_Call extends Less_Tree { + public $value; - public $name; - public $args; - public $index; - public $currentFileInfo; - public $type = 'Call'; + public $name; + public $args; + public $index; + public $currentFileInfo; + public $type = 'Call'; - public function __construct($name, $args, $index, $currentFileInfo = null ){ + public function __construct( $name, $args, $index, $currentFileInfo = null ) { $this->name = $name; $this->args = $args; $this->index = $index; $this->currentFileInfo = $currentFileInfo; } - public function accept( $visitor ){ + public function accept( $visitor ) { $this->args = $visitor->visitArray( $this->args ); } - // - // When evaluating a function call, - // we either find the function in `tree.functions` [1], - // in which case we call it, passing the evaluated arguments, - // or we simply print it out as it appeared originally [2]. - // - // The *functions.js* file contains the built-in functions. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - public function compile($env=null){ - $args = array(); - foreach($this->args as $a){ - $args[] = $a->compile($env); + // + // When evaluating a function call, + // we either find the function in `tree.functions` [1], + // in which case we call it, passing the evaluated arguments, + // or we simply print it out as it appeared originally [2]. + // + // The *functions.js* file contains the built-in functions. + // + // The reason why we evaluate the arguments, is in the case where + // we try to pass a variable to a function, like: `saturate(@color)`. + // The function should receive the value, not the variable. + // + public function compile( $env = null ) { + $args = []; + foreach ( $this->args as $a ) { + $args[] = $a->compile( $env ); } - $nameLC = strtolower($this->name); - switch($nameLC){ + $nameLC = strtolower( $this->name ); + switch ( $nameLC ) { case '%': $nameLC = '_percent'; - break; + break; case 'get-unit': $nameLC = 'getunit'; - break; + break; case 'data-uri': $nameLC = 'datauri'; - break; + break; case 'svg-gradient': $nameLC = 'svggradient'; - break; + break; } $result = null; - if( $nameLC === 'default' ){ + if ( $nameLC === 'default' ) { $result = Less_Tree_DefaultFunc::compile(); - - }else{ - - if( method_exists('Less_Functions',$nameLC) ){ // 1. + } else { + $func = null; + if ( method_exists( 'Less_Functions', $nameLC ) ) { + $functions = new Less_Functions( $env, $this->currentFileInfo ); + $func = [ $functions, $nameLC ]; + } elseif ( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) { + $func = $env->functions[$nameLC]; + } + // If the function name isn't known to LESS, output it unchanged as CSS. + if ( $func ) { try { - - $func = new Less_Functions($env, $this->currentFileInfo); - $result = call_user_func_array( array($func,$nameLC),$args); - - } catch (Exception $e) { - throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index); - } - } elseif( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) { - try { - $result = call_user_func_array( $env->functions[$nameLC], $args ); - } catch (Exception $e) { - throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index); + $result = call_user_func_array( $func, $args ); + } catch ( Exception $e ) { + // Preserve original trace, especially from custom functions. + // https://github.com/wikimedia/less.php/issues/38 + throw new Less_Exception_Compiler( + 'error evaluating function `' . $this->name . '` ' . $e->getMessage() + . ' index: ' . $this->index, + $e + ); } } } - if( $result !== null ){ + if ( $result !== null ) { return $result; } - return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo ); - } - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + } + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->name . '(', $this->currentFileInfo, $this->index ); - $args_len = count($this->args); - for($i = 0; $i < $args_len; $i++ ){ + $args_len = count( $this->args ); + for ( $i = 0; $i < $args_len; $i++ ) { $this->args[$i]->genCSS( $output ); - if( $i + 1 < $args_len ){ + if ( $i + 1 < $args_len ) { $output->add( ', ' ); } } @@ -113,9 +109,8 @@ class Less_Tree_Call extends Less_Tree{ $output->add( ')' ); } - - //public function toCSS(){ - // return $this->compile()->toCSS(); - //} + // public function toCSS(){ + // return $this->compile()->toCSS(); + //} } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Color.php b/vendor/wikimedia/less.php/lib/Less/Tree/Color.php index 77af07a6e..427f47dc4 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Color.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Color.php @@ -1,53 +1,44 @@ <?php - /** - * Color - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Color extends Less_Tree{ +class Less_Tree_Color extends Less_Tree { public $rgb; public $alpha; public $isTransparentKeyword; public $type = 'Color'; - public function __construct($rgb, $a = 1, $isTransparentKeyword = null ){ - - if( $isTransparentKeyword ){ + public function __construct( $rgb, $a = 1, $isTransparentKeyword = null ) { + if ( $isTransparentKeyword ) { $this->rgb = $rgb; $this->alpha = $a; $this->isTransparentKeyword = true; return; } - $this->rgb = array(); - if( is_array($rgb) ){ + $this->rgb = []; + if ( is_array( $rgb ) ) { $this->rgb = $rgb; - }else if( strlen($rgb) == 6 ){ - foreach(str_split($rgb, 2) as $c){ - $this->rgb[] = hexdec($c); + } elseif ( strlen( $rgb ) == 6 ) { + foreach ( str_split( $rgb, 2 ) as $c ) { + $this->rgb[] = hexdec( $c ); } - }else{ - foreach(str_split($rgb, 1) as $c){ - $this->rgb[] = hexdec($c.$c); + } else { + foreach ( str_split( $rgb, 1 ) as $c ) { + $this->rgb[] = hexdec( $c . $c ); } } - $this->alpha = is_numeric($a) ? $a : 1; + $this->alpha = is_numeric( $a ) ? $a : 1; } - public function compile(){ - return $this; - } - - public function luma(){ + public function luma() { $r = $this->rgb[0] / 255; $g = $this->rgb[1] / 255; $b = $this->rgb[2] / 255; - $r = ($r <= 0.03928) ? $r / 12.92 : pow((($r + 0.055) / 1.055), 2.4); - $g = ($g <= 0.03928) ? $g / 12.92 : pow((($g + 0.055) / 1.055), 2.4); - $b = ($b <= 0.03928) ? $b / 12.92 : pow((($b + 0.055) / 1.055), 2.4); + $r = ( $r <= 0.03928 ) ? $r / 12.92 : pow( ( ( $r + 0.055 ) / 1.055 ), 2.4 ); + $g = ( $g <= 0.03928 ) ? $g / 12.92 : pow( ( ( $g + 0.055 ) / 1.055 ), 2.4 ); + $b = ( $b <= 0.03928 ) ? $b / 12.92 : pow( ( ( $b + 0.055 ) / 1.055 ), 2.4 ); return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b; } @@ -55,43 +46,42 @@ class Less_Tree_Color extends Less_Tree{ /** * @see Less_Tree::genCSS */ - public function genCSS( $output ){ + public function genCSS( $output ) { $output->add( $this->toCSS() ); } - public function toCSS( $doNotCompress = false ){ + public function toCSS( $doNotCompress = false ) { $compress = Less_Parser::$options['compress'] && !$doNotCompress; $alpha = Less_Functions::fround( $this->alpha ); - // // If we have some transparency, the only way to represent it // is via `rgba`. Otherwise, we use the hex representation, // which has better compatibility with older browsers. // Values are capped between `0` and `255`, rounded and zero-padded. // - if( $alpha < 1 ){ - if( ( $alpha === 0 || $alpha === 0.0 ) && isset($this->isTransparentKeyword) && $this->isTransparentKeyword ){ + if ( $alpha < 1 ) { + if ( ( $alpha === 0 || $alpha === 0.0 ) && isset( $this->isTransparentKeyword ) && $this->isTransparentKeyword ) { return 'transparent'; } - $values = array(); - foreach($this->rgb as $c){ - $values[] = Less_Functions::clamp( round($c), 255); + $values = []; + foreach ( $this->rgb as $c ) { + $values[] = Less_Functions::clamp( round( $c ), 255 ); } $values[] = $alpha; - $glue = ($compress ? ',' : ', '); - return "rgba(" . implode($glue, $values) . ")"; - }else{ + $glue = ( $compress ? ',' : ', ' ); + return "rgba(" . implode( $glue, $values ) . ")"; + } else { $color = $this->toRGB(); - if( $compress ){ + if ( $compress ) { // Convert color to short format - if( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6]) { - $color = '#'.$color[1] . $color[3] . $color[5]; + if ( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6] ) { + $color = '#' . $color[1] . $color[3] . $color[5]; } } @@ -109,121 +99,129 @@ class Less_Tree_Color extends Less_Tree{ /** * @param string $op */ - public function operate( $op, $other) { - $rgb = array(); - $alpha = $this->alpha * (1 - $other->alpha) + $other->alpha; - for ($c = 0; $c < 3; $c++) { - $rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c]); + public function operate( $op, $other ) { + $rgb = []; + $alpha = $this->alpha * ( 1 - $other->alpha ) + $other->alpha; + for ( $c = 0; $c < 3; $c++ ) { + $rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c] ); } - return new Less_Tree_Color($rgb, $alpha); + return new Less_Tree_Color( $rgb, $alpha ); } - public function toRGB(){ - return $this->toHex($this->rgb); + public function toRGB() { + return $this->toHex( $this->rgb ); } - public function toHSL(){ + public function toHSL() { $r = $this->rgb[0] / 255; $g = $this->rgb[1] / 255; $b = $this->rgb[2] / 255; $a = $this->alpha; - $max = max($r, $g, $b); - $min = min($r, $g, $b); - $l = ($max + $min) / 2; + $max = max( $r, $g, $b ); + $min = min( $r, $g, $b ); + $l = ( $max + $min ) / 2; $d = $max - $min; $h = $s = 0; - if( $max !== $min ){ - $s = $l > 0.5 ? $d / (2 - $max - $min) : $d / ($max + $min); + if ( $max !== $min ) { + $s = $l > 0.5 ? $d / ( 2 - $max - $min ) : $d / ( $max + $min ); - switch ($max) { - case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; - case $g: $h = ($b - $r) / $d + 2; break; - case $b: $h = ($r - $g) / $d + 4; break; + switch ( $max ) { + case $r: + $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 ); + break; + case $g: + $h = ( $b - $r ) / $d + 2; + break; + case $b: + $h = ( $r - $g ) / $d + 4; + break; } $h /= 6; } - return array('h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a ); + return [ 'h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a ]; } - //Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - public function toHSV() { + // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + public function toHSV() { $r = $this->rgb[0] / 255; $g = $this->rgb[1] / 255; $b = $this->rgb[2] / 255; $a = $this->alpha; - $max = max($r, $g, $b); - $min = min($r, $g, $b); + $max = max( $r, $g, $b ); + $min = min( $r, $g, $b ); $v = $max; $d = $max - $min; - if ($max === 0) { + if ( $max === 0 ) { $s = 0; } else { $s = $d / $max; } $h = 0; - if( $max !== $min ){ - switch($max){ - case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; - case $g: $h = ($b - $r) / $d + 2; break; - case $b: $h = ($r - $g) / $d + 4; break; + if ( $max !== $min ) { + switch ( $max ) { + case $r: + $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 ); + break; + case $g: + $h = ( $b - $r ) / $d + 2; + break; + case $b: + $h = ( $r - $g ) / $d + 4; + break; } $h /= 6; } - return array('h'=> $h * 360, 's'=> $s, 'v'=> $v, 'a' => $a ); + return [ 'h' => $h * 360, 's' => $s, 'v' => $v, 'a' => $a ]; } - public function toARGB(){ - $argb = array_merge( (array) Less_Parser::round($this->alpha * 255), $this->rgb); + public function toARGB() { + $argb = array_merge( (array)Less_Parser::round( $this->alpha * 255 ), $this->rgb ); return $this->toHex( $argb ); } - public function compare($x){ - - if( !property_exists( $x, 'rgb' ) ){ + public function compare( $x ) { + if ( !property_exists( $x, 'rgb' ) ) { return -1; } - - return ($x->rgb[0] === $this->rgb[0] && + return ( $x->rgb[0] === $this->rgb[0] && $x->rgb[1] === $this->rgb[1] && $x->rgb[2] === $this->rgb[2] && - $x->alpha === $this->alpha) ? 0 : -1; + $x->alpha === $this->alpha ) ? 0 : -1; } - public function toHex( $v ){ - + public function toHex( $v ) { $ret = '#'; - foreach($v as $c){ - $c = Less_Functions::clamp( Less_Parser::round($c), 255); - if( $c < 16 ){ + foreach ( $v as $c ) { + $c = Less_Functions::clamp( Less_Parser::round( $c ), 255 ); + if ( $c < 16 ) { $ret .= '0'; } - $ret .= dechex($c); + $ret .= dechex( $c ); } return $ret; } - /** * @param string $keyword */ - public static function fromKeyword( $keyword ){ - $keyword = strtolower($keyword); + public static function fromKeyword( $keyword ) { + $keyword = strtolower( $keyword ); - if( Less_Colors::hasOwnProperty($keyword) ){ + if ( Less_Colors::hasOwnProperty( $keyword ) ) { // detect named color - return new Less_Tree_Color(substr(Less_Colors::color($keyword), 1)); + return new Less_Tree_Color( substr( Less_Colors::color( $keyword ), 1 ) ); } - if( $keyword === 'transparent' ){ - return new Less_Tree_Color( array(0, 0, 0), 0, true); + if ( $keyword === 'transparent' ) { + return new Less_Tree_Color( [ 0, 0, 0 ], 0, true ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php b/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php index 7261284a2..b4dd68c60 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Comment.php @@ -1,12 +1,8 @@ <?php - /** - * Comment - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Comment extends Less_Tree{ +class Less_Tree_Comment extends Less_Tree { public $value; public $silent; @@ -14,37 +10,33 @@ class Less_Tree_Comment extends Less_Tree{ public $currentFileInfo; public $type = 'Comment'; - public function __construct($value, $silent, $index = null, $currentFileInfo = null ){ + public function __construct( $value, $silent, $index = null, $currentFileInfo = null ) { $this->value = $value; - $this->silent = !! $silent; + $this->silent = (bool)$silent; $this->currentFileInfo = $currentFileInfo; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - //if( $this->debugInfo ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + // if( $this->debugInfo ){ //$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index); //} - $output->add( trim($this->value) );//TODO shouldn't need to trim, we shouldn't grab the \n + $output->add( trim( $this->value ) );// TODO shouldn't need to trim, we shouldn't grab the \n } - public function toCSS(){ + public function toCSS() { return Less_Parser::$options['compress'] ? '' : $this->value; } - public function isSilent(){ - $isReference = ($this->currentFileInfo && isset($this->currentFileInfo['reference']) && (!isset($this->isReferenced) || !$this->isReferenced) ); - $isCompressed = Less_Parser::$options['compress'] && !preg_match('/^\/\*!/', $this->value); + public function isSilent() { + $isReference = ( $this->currentFileInfo && isset( $this->currentFileInfo['reference'] ) && ( !isset( $this->isReferenced ) || !$this->isReferenced ) ); + $isCompressed = Less_Parser::$options['compress'] && !preg_match( '/^\/\*!/', $this->value ); return $this->silent || $isReference || $isCompressed; } - public function compile(){ - return $this; - } - - public function markReferenced(){ + public function markReferenced() { $this->isReferenced = true; } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php b/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php index 929d33be9..5204e838c 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Condition.php @@ -1,12 +1,8 @@ <?php - /** - * Condition - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Condition extends Less_Tree{ +class Less_Tree_Condition extends Less_Tree { public $op; public $lvalue; @@ -15,58 +11,58 @@ class Less_Tree_Condition extends Less_Tree{ public $negate; public $type = 'Condition'; - public function __construct($op, $l, $r, $i = 0, $negate = false) { - $this->op = trim($op); + public function __construct( $op, $l, $r, $i = 0, $negate = false ) { + $this->op = trim( $op ); $this->lvalue = $l; $this->rvalue = $r; $this->index = $i; $this->negate = $negate; } - public function accept($visitor){ + public function accept( $visitor ) { $this->lvalue = $visitor->visitObj( $this->lvalue ); $this->rvalue = $visitor->visitObj( $this->rvalue ); } - public function compile($env) { - $a = $this->lvalue->compile($env); - $b = $this->rvalue->compile($env); + public function compile( $env ) { + $a = $this->lvalue->compile( $env ); + $b = $this->rvalue->compile( $env ); - switch( $this->op ){ + switch ( $this->op ) { case 'and': $result = $a && $b; - break; + break; case 'or': $result = $a || $b; - break; + break; default: - if( Less_Parser::is_method($a, 'compare') ){ - $result = $a->compare($b); - }elseif( Less_Parser::is_method($b, 'compare') ){ - $result = $b->compare($a); - }else{ - throw new Less_Exception_Compiler('Unable to perform comparison', null, $this->index); + if ( Less_Parser::is_method( $a, 'compare' ) ) { + $result = $a->compare( $b ); + } elseif ( Less_Parser::is_method( $b, 'compare' ) ) { + $result = $b->compare( $a ); + } else { + throw new Less_Exception_Compiler( 'Unable to perform comparison', null, $this->index ); } - switch ($result) { + switch ( $result ) { case -1: $result = $this->op === '<' || $this->op === '=<' || $this->op === '<='; - break; + break; - case 0: + case 0: $result = $this->op === '=' || $this->op === '>=' || $this->op === '=<' || $this->op === '<='; - break; + break; - case 1: + case 1: $result = $this->op === '>' || $this->op === '>='; - break; + break; } - break; + break; } return $this->negate ? !$result : $result; - } + } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php b/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php index c2dbf7496..66f0008cc 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/DefaultFunc.php @@ -1,34 +1,30 @@ <?php - /** - * DefaultFunc - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_DefaultFunc{ +class Less_Tree_DefaultFunc { static $error_; static $value_; - public static function compile(){ - if( self::$error_ ){ - throw new Exception(self::$error_); + public static function compile() { + if ( self::$error_ ) { + throw new Exception( self::$error_ ); } - if( self::$value_ !== null ){ - return self::$value_ ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false'); + if ( self::$value_ !== null ) { + return self::$value_ ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); } } - public static function value( $v ){ + public static function value( $v ) { self::$value_ = $v; } - public static function error( $e ){ + public static function error( $e ) { self::$error_ = $e; } - public static function reset(){ + public static function reset() { self::$value_ = self::$error_ = null; } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/DetachedRuleset.php b/vendor/wikimedia/less.php/lib/Less/Tree/DetachedRuleset.php index c887e400f..6ba1ef30b 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/DetachedRuleset.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/DetachedRuleset.php @@ -1,40 +1,35 @@ <?php - /** - * DetachedRuleset - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_DetachedRuleset extends Less_Tree{ +class Less_Tree_DetachedRuleset extends Less_Tree { public $ruleset; public $frames; public $type = 'DetachedRuleset'; - public function __construct( $ruleset, $frames = null ){ + public function __construct( $ruleset, $frames = null ) { $this->ruleset = $ruleset; $this->frames = $frames; } - public function accept($visitor) { - $this->ruleset = $visitor->visitObj($this->ruleset); + public function accept( $visitor ) { + $this->ruleset = $visitor->visitObj( $this->ruleset ); } - public function compile($env){ - if( $this->frames ){ + public function compile( $env ) { + if ( $this->frames ) { $frames = $this->frames; - }else{ + } else { $frames = $env->frames; } - return new Less_Tree_DetachedRuleset($this->ruleset, $frames); + return new Less_Tree_DetachedRuleset( $this->ruleset, $frames ); } - public function callEval($env) { - if( $this->frames ){ - return $this->ruleset->compile( $env->copyEvalEnv( array_merge($this->frames,$env->frames) ) ); + public function callEval( $env ) { + if ( $this->frames ) { + return $this->ruleset->compile( $env->copyEvalEnv( array_merge( $this->frames, $env->frames ) ) ); } return $this->ruleset->compile( $env ); } } - diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php b/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php index 2bfb9d54b..4dd719834 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Dimension.php @@ -1,69 +1,60 @@ <?php - /** - * Dimension - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Dimension extends Less_Tree{ +class Less_Tree_Dimension extends Less_Tree { public $value; public $unit; public $type = 'Dimension'; - public function __construct($value, $unit = null){ - $this->value = floatval($value); + public function __construct( $value, $unit = null ) { + $this->value = floatval( $value ); - if( $unit && ($unit instanceof Less_Tree_Unit) ){ + if ( $unit && ( $unit instanceof Less_Tree_Unit ) ) { $this->unit = $unit; - }elseif( $unit ){ - $this->unit = new Less_Tree_Unit( array($unit) ); - }else{ - $this->unit = new Less_Tree_Unit( ); + } elseif ( $unit ) { + $this->unit = new Less_Tree_Unit( [ $unit ] ); + } else { + $this->unit = new Less_Tree_Unit(); } - } + } - public function accept( $visitor ){ + public function accept( $visitor ) { $this->unit = $visitor->visitObj( $this->unit ); } - public function compile(){ - return $this; - } + public function toColor() { + return new Less_Tree_Color( [ $this->value, $this->value, $this->value ] ); + } - public function toColor() { - return new Less_Tree_Color(array($this->value, $this->value, $this->value)); - } - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - - if( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ){ - throw new Less_Exception_Compiler("Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".$this->unit->toString()); + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ) { + throw new Less_Exception_Compiler( "Multiple units in dimension. Correct the units or use the unit function. Bad unit: " . $this->unit->toString() ); } $value = Less_Functions::fround( $this->value ); $strValue = (string)$value; - if( $value !== 0 && $value < 0.000001 && $value > -0.000001 ){ + if ( $value !== 0 && $value < 0.000001 && $value > -0.000001 ) { // would be output 1e-6 etc. - $strValue = number_format($strValue,10); - $strValue = preg_replace('/\.?0+$/','', $strValue); + $strValue = number_format( (float)$strValue, 10 ); + $strValue = preg_replace( '/\.?0+$/', '', $strValue ); } - if( Less_Parser::$options['compress'] ){ + if ( Less_Parser::$options['compress'] ) { // Zero values doesn't need a unit - if( $value === 0 && $this->unit->isLength() ){ + if ( $value === 0 && $this->unit->isLength() ) { $output->add( $strValue ); - return $strValue; + return; } // Float values doesn't need a leading zero - if( $value > 0 && $value < 1 && $strValue[0] === '0' ){ - $strValue = substr($strValue,1); + if ( $value > 0 && $value < 1 && $strValue[0] === '0' ) { + $strValue = substr( $strValue, 1 ); } } @@ -71,73 +62,72 @@ class Less_Tree_Dimension extends Less_Tree{ $this->unit->genCSS( $output ); } - public function __toString(){ - return $this->toCSS(); - } + public function __toString() { + return $this->toCSS(); + } - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2em` will yield `3px`. + // In an operation between two Dimensions, + // we default to the first Dimension's unit, + // so `1px + 2em` will yield `3px`. - /** - * @param string $op - */ - public function operate( $op, $other){ - - $value = Less_Functions::operate( $op, $this->value, $other->value); + /** + * @param string $op + */ + public function operate( $op, $other ) { + $value = Less_Functions::operate( $op, $this->value, $other->value ); $unit = clone $this->unit; - if( $op === '+' || $op === '-' ){ + if ( $op === '+' || $op === '-' ) { - if( !$unit->numerator && !$unit->denominator ){ + if ( !$unit->numerator && !$unit->denominator ) { $unit->numerator = $other->unit->numerator; $unit->denominator = $other->unit->denominator; - }elseif( !$other->unit->numerator && !$other->unit->denominator ){ + } elseif ( !$other->unit->numerator && !$other->unit->denominator ) { // do nothing - }else{ - $other = $other->convertTo( $this->unit->usedUnits()); + } else { + $other = $other->convertTo( $this->unit->usedUnits() ); - if( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ){ - throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'."); + if ( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ) { + throw new Less_Exception_Compiler( "Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'." ); } - $value = Less_Functions::operate( $op, $this->value, $other->value); + $value = Less_Functions::operate( $op, $this->value, $other->value ); } - }elseif( $op === '*' ){ - $unit->numerator = array_merge($unit->numerator, $other->unit->numerator); - $unit->denominator = array_merge($unit->denominator, $other->unit->denominator); - sort($unit->numerator); - sort($unit->denominator); + } elseif ( $op === '*' ) { + $unit->numerator = array_merge( $unit->numerator, $other->unit->numerator ); + $unit->denominator = array_merge( $unit->denominator, $other->unit->denominator ); + sort( $unit->numerator ); + sort( $unit->denominator ); $unit->cancel(); - }elseif( $op === '/' ){ - $unit->numerator = array_merge($unit->numerator, $other->unit->denominator); - $unit->denominator = array_merge($unit->denominator, $other->unit->numerator); - sort($unit->numerator); - sort($unit->denominator); + } elseif ( $op === '/' ) { + $unit->numerator = array_merge( $unit->numerator, $other->unit->denominator ); + $unit->denominator = array_merge( $unit->denominator, $other->unit->numerator ); + sort( $unit->numerator ); + sort( $unit->denominator ); $unit->cancel(); } - return new Less_Tree_Dimension( $value, $unit); - } + return new Less_Tree_Dimension( $value, $unit ); + } - public function compare($other) { - if ($other instanceof Less_Tree_Dimension) { + public function compare( $other ) { + if ( $other instanceof Less_Tree_Dimension ) { - if( $this->unit->isEmpty() || $other->unit->isEmpty() ){ + if ( $this->unit->isEmpty() || $other->unit->isEmpty() ) { $a = $this; $b = $other; } else { $a = $this->unify(); $b = $other->unify(); - if( $a->unit->compare($b->unit) !== 0 ){ + if ( $a->unit->compare( $b->unit ) !== 0 ) { return -1; } } $aValue = $a->value; $bValue = $b->value; - if ($bValue > $aValue) { + if ( $bValue > $aValue ) { return -1; - } elseif ($bValue < $aValue) { + } elseif ( $bValue < $aValue ) { return 1; } else { return 0; @@ -147,48 +137,47 @@ class Less_Tree_Dimension extends Less_Tree{ } } - public function unify() { - return $this->convertTo(array('length'=> 'px', 'duration'=> 's', 'angle' => 'rad' )); + public function unify() { + return $this->convertTo( [ 'length' => 'px', 'duration' => 's', 'angle' => 'rad' ] ); } - public function convertTo($conversions) { + public function convertTo( $conversions ) { $value = $this->value; $unit = clone $this->unit; - if( is_string($conversions) ){ - $derivedConversions = array(); - foreach( Less_Tree_UnitConversions::$groups as $i ){ - if( isset(Less_Tree_UnitConversions::${$i}[$conversions]) ){ - $derivedConversions = array( $i => $conversions); + if ( is_string( $conversions ) ) { + $derivedConversions = []; + foreach ( Less_Tree_UnitConversions::$groups as $i ) { + if ( isset( Less_Tree_UnitConversions::${$i}[$conversions] ) ) { + $derivedConversions = [ $i => $conversions ]; } } $conversions = $derivedConversions; } - - foreach($conversions as $groupName => $targetUnit){ + foreach ( $conversions as $groupName => $targetUnit ) { $group = Less_Tree_UnitConversions::${$groupName}; - //numerator - foreach($unit->numerator as $i => $atomicUnit){ + // numerator + foreach ( $unit->numerator as $i => $atomicUnit ) { $atomicUnit = $unit->numerator[$i]; - if( !isset($group[$atomicUnit]) ){ + if ( !isset( $group[$atomicUnit] ) ) { continue; } - $value = $value * ($group[$atomicUnit] / $group[$targetUnit]); + $value = $value * ( $group[$atomicUnit] / $group[$targetUnit] ); $unit->numerator[$i] = $targetUnit; } - //denominator - foreach($unit->denominator as $i => $atomicUnit){ + // denominator + foreach ( $unit->denominator as $i => $atomicUnit ) { $atomicUnit = $unit->denominator[$i]; - if( !isset($group[$atomicUnit]) ){ + if ( !isset( $group[$atomicUnit] ) ) { continue; } - $value = $value / ($group[$atomicUnit] / $group[$targetUnit]); + $value = $value / ( $group[$atomicUnit] / $group[$targetUnit] ); $unit->denominator[$i] = $targetUnit; } @@ -196,6 +185,6 @@ class Less_Tree_Dimension extends Less_Tree{ $unit->cancel(); - return new Less_Tree_Dimension( $value, $unit); - } + return new Less_Tree_Dimension( $value, $unit ); + } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php b/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php index 04a1e467e..dfada8437 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Directive.php @@ -1,12 +1,8 @@ <?php - /** - * Directive - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Directive extends Less_Tree{ +class Less_Tree_Directive extends Less_Tree { public $name; public $value; @@ -17,10 +13,10 @@ class Less_Tree_Directive extends Less_Tree{ public $debugInfo; public $type = 'Directive'; - public function __construct($name, $value = null, $rules, $index = null, $currentFileInfo = null, $debugInfo = null ){ + public function __construct( $name, $value = null, $rules = null, $index = null, $currentFileInfo = null, $debugInfo = null ) { $this->name = $name; $this->value = $value; - if( $rules ){ + if ( $rules ) { $this->rules = $rules; $this->rules->allowImports = true; } @@ -30,70 +26,66 @@ class Less_Tree_Directive extends Less_Tree{ $this->debugInfo = $debugInfo; } - - public function accept( $visitor ){ - if( $this->rules ){ + public function accept( $visitor ) { + if ( $this->rules ) { $this->rules = $visitor->visitObj( $this->rules ); } - if( $this->value ){ + if ( $this->value ) { $this->value = $visitor->visitObj( $this->value ); } } - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $value = $this->value; $rules = $this->rules; $output->add( $this->name, $this->currentFileInfo, $this->index ); - if( $this->value ){ - $output->add(' '); - $this->value->genCSS($output); + if ( $this->value ) { + $output->add( ' ' ); + $this->value->genCSS( $output ); } - if( $this->rules ){ - Less_Tree::outputRuleset( $output, array($this->rules)); + if ( $this->rules ) { + Less_Tree::outputRuleset( $output, [ $this->rules ] ); } else { - $output->add(';'); + $output->add( ';' ); } } - public function compile($env){ - + public function compile( $env ) { $value = $this->value; $rules = $this->rules; - if( $value ){ - $value = $value->compile($env); + if ( $value ) { + $value = $value->compile( $env ); } - if( $rules ){ - $rules = $rules->compile($env); + if ( $rules ) { + $rules = $rules->compile( $env ); $rules->root = true; } return new Less_Tree_Directive( $this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo ); } - - public function variable($name){ - if( $this->rules ){ - return $this->rules->variable($name); + public function variable( $name ) { + if ( $this->rules ) { + return $this->rules->variable( $name ); } } - public function find($selector){ - if( $this->rules ){ - return $this->rules->find($selector, $this); + public function find( $selector ) { + if ( $this->rules ) { + return $this->rules->find( $selector, $this ); } } - //rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); }, + // rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); }, - public function markReferenced(){ + public function markReferenced() { $this->isReferenced = true; - if( $this->rules ){ - Less_Tree::ReferencedArray($this->rules->rules); + if ( $this->rules ) { + Less_Tree::ReferencedArray( $this->rules->rules ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Element.php b/vendor/wikimedia/less.php/lib/Less/Tree/Element.php index 9cea5e43c..11b9ce40a 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Element.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Element.php @@ -1,74 +1,72 @@ <?php - /** - * Element - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Element extends Less_Tree{ +class Less_Tree_Element extends Less_Tree { - public $combinator = ''; - public $value = ''; + /** @var string */ + public $combinator; + /** @var bool Whether combinator is null (represented by empty string) or child (single space) */ + public $combinatorIsEmptyOrWhitespace; + /** @var string|Less_Tree */ + public $value; public $index; public $currentFileInfo; public $type = 'Element'; public $value_is_object = false; - public function __construct($combinator, $value, $index = null, $currentFileInfo = null ){ - + /** + * @param null|string $combinator + * @param string|Less_Tree $value + * @param int|null $index + * @param array|null $currentFileInfo + */ + public function __construct( $combinator, $value, $index = null, $currentFileInfo = null ) { $this->value = $value; - $this->value_is_object = is_object($value); + $this->value_is_object = is_object( $value ); - if( $combinator ){ - $this->combinator = $combinator; - } + // see less-2.5.3.js#Combinator + $this->combinator = $combinator ?? ''; + $this->combinatorIsEmptyOrWhitespace = ( $combinator === null || trim( $combinator ) === '' ); $this->index = $index; $this->currentFileInfo = $currentFileInfo; } - public function accept( $visitor ){ - if( $this->value_is_object ){ //object or string + public function accept( $visitor ) { + if ( $this->value_is_object ) { // object or string $this->value = $visitor->visitObj( $this->value ); } } - public function compile($env){ - - if( Less_Environment::$mixin_stack ){ - return new Less_Tree_Element($this->combinator, ($this->value_is_object ? $this->value->compile($env) : $this->value), $this->index, $this->currentFileInfo ); - } - - if( $this->value_is_object ){ - $this->value = $this->value->compile($env); - } - - return $this; + public function compile( $env ) { + return new Less_Tree_Element( + $this->combinator, + ( $this->value_is_object ? $this->value->compile( $env ) : $this->value ), + $this->index, + $this->currentFileInfo + ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->toCSS(), $this->currentFileInfo, $this->index ); } - public function toCSS(){ - - if( $this->value_is_object ){ + public function toCSS() { + if ( $this->value_is_object ) { $value = $this->value->toCSS(); - }else{ + } else { $value = $this->value; } - - if( $value === '' && $this->combinator && $this->combinator === '&' ){ + if ( $value === '' && $this->combinator && $this->combinator === '&' ) { return ''; } - return Less_Environment::$_outputMap[$this->combinator] . $value; } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php b/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php index d834354a1..832414102 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Expression.php @@ -1,92 +1,85 @@ <?php - /** - * Expression - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Expression extends Less_Tree{ - - public $value = array(); +class Less_Tree_Expression extends Less_Tree { + /** @var array */ + public $value = []; public $parens = false; - public $parensInOp = false; public $type = 'Expression'; - public function __construct( $value, $parens = null ){ + public function __construct( $value, $parens = null ) { $this->value = $value; $this->parens = $parens; } - public function accept( $visitor ){ + public function accept( $visitor ) { $this->value = $visitor->visitArray( $this->value ); } - public function compile($env) { - + public function compile( $env ) { $doubleParen = false; - if( $this->parens && !$this->parensInOp ){ + if ( $this->parens && !$this->parensInOp ) { Less_Environment::$parensStack++; } $returnValue = null; - if( $this->value ){ + if ( $this->value ) { - $count = count($this->value); + $count = count( $this->value ); - if( $count > 1 ){ + if ( $count > 1 ) { - $ret = array(); - foreach($this->value as $e){ - $ret[] = $e->compile($env); + $ret = []; + foreach ( $this->value as $e ) { + $ret[] = $e->compile( $env ); } - $returnValue = new Less_Tree_Expression($ret); + $returnValue = new Less_Tree_Expression( $ret ); - }else{ + } else { - if( ($this->value[0] instanceof Less_Tree_Expression) && $this->value[0]->parens && !$this->value[0]->parensInOp ){ + if ( ( $this->value[0] instanceof Less_Tree_Expression ) && $this->value[0]->parens && !$this->value[0]->parensInOp ) { $doubleParen = true; } - $returnValue = $this->value[0]->compile($env); + $returnValue = $this->value[0]->compile( $env ); } } else { $returnValue = $this; } - if( $this->parens ){ - if( !$this->parensInOp ){ + if ( $this->parens ) { + if ( !$this->parensInOp ) { Less_Environment::$parensStack--; - }elseif( !Less_Environment::isMathOn() && !$doubleParen ){ - $returnValue = new Less_Tree_Paren($returnValue); + } elseif ( !Less_Environment::isMathOn() && !$doubleParen ) { + $returnValue = new Less_Tree_Paren( $returnValue ); } } return $returnValue; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - $val_len = count($this->value); - for( $i = 0; $i < $val_len; $i++ ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $val_len = count( $this->value ); + for ( $i = 0; $i < $val_len; $i++ ) { $this->value[$i]->genCSS( $output ); - if( $i + 1 < $val_len ){ + if ( $i + 1 < $val_len ) { $output->add( ' ' ); } } } - public function throwAwayComments() { - - if( is_array($this->value) ){ - $new_value = array(); - foreach($this->value as $v){ - if( $v instanceof Less_Tree_Comment ){ + public function throwAwayComments() { + if ( is_array( $this->value ) ) { + $new_value = []; + foreach ( $this->value as $v ) { + if ( $v instanceof Less_Tree_Comment ) { continue; } $new_value[] = $v; diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php b/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php index 8f21e939d..362e284ff 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Extend.php @@ -1,77 +1,76 @@ <?php - /** - * Extend - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Extend extends Less_Tree{ +class Less_Tree_Extend extends Less_Tree { public $selector; public $option; public $index; - public $selfSelectors = array(); + public $selfSelectors = []; public $allowBefore; public $allowAfter; public $firstExtendOnThisSelectorPath; public $type = 'Extend'; public $ruleset; - public $object_id; - public $parent_ids = array(); + public $parent_ids = []; /** - * @param integer $index + * @param int $index */ - public function __construct($selector, $option, $index){ + public function __construct( $selector, $option, $index ) { static $i = 0; $this->selector = $selector; $this->option = $option; $this->index = $index; - switch($option){ + switch ( $option ) { case "all": $this->allowBefore = true; $this->allowAfter = true; - break; + break; default: $this->allowBefore = false; $this->allowAfter = false; - break; + break; } - $this->object_id = $i++; - $this->parent_ids = array($this->object_id); + // This must use a string (instead of int) so that array_merge() + // preserves keys on arrays that use IDs in their keys. + $this->object_id = 'id_' . $i++; + + $this->parent_ids = [ + $this->object_id => true + ]; } - public function accept( $visitor ){ + public function accept( $visitor ) { $this->selector = $visitor->visitObj( $this->selector ); } - public function compile( $env ){ + public function compile( $env ) { Less_Parser::$has_extends = true; - $this->selector = $this->selector->compile($env); + $this->selector = $this->selector->compile( $env ); return $this; - //return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index); + // return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index); } - public function findSelfSelectors( $selectors ){ - $selfElements = array(); + public function findSelfSelectors( $selectors ) { + $selfElements = []; - - for( $i = 0, $selectors_len = count($selectors); $i < $selectors_len; $i++ ){ + for ( $i = 0, $selectors_len = count( $selectors ); $i < $selectors_len; $i++ ) { $selectorElements = $selectors[$i]->elements; // duplicate the logic in genCSS function inside the selector node. // future TODO - move both logics into the selector joiner visitor - if( $i && $selectorElements && $selectorElements[0]->combinator === "") { + if ( $i && $selectorElements && $selectorElements[0]->combinator === "" ) { $selectorElements[0]->combinator = ' '; } $selfElements = array_merge( $selfElements, $selectors[$i]->elements ); } - $this->selfSelectors = array(new Less_Tree_Selector($selfElements)); + $this->selfSelectors = [ new Less_Tree_Selector( $selfElements ) ]; } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Import.php b/vendor/wikimedia/less.php/lib/Less/Tree/Import.php index 49ffbf636..fc5e81d56 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Import.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Import.php @@ -1,7 +1,6 @@ <?php - /** - * CSS @import node + * CSS `@import` node * * The general strategy here is that we don't want to wait * for the parsing to be completed, before we start importing @@ -12,10 +11,9 @@ * `import,push`, we also pass it a callback, which it'll call once * the file has been fetched, and parsed. * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Import extends Less_Tree{ +class Less_Tree_Import extends Less_Tree { public $options; public $index; @@ -27,21 +25,24 @@ class Less_Tree_Import extends Less_Tree{ public $root; public $type = 'Import'; - public function __construct($path, $features, $options, $index, $currentFileInfo = null ){ + public function __construct( $path, $features, $options, $index, $currentFileInfo = null ) { $this->options = $options; $this->index = $index; $this->path = $path; $this->features = $features; $this->currentFileInfo = $currentFileInfo; - if( is_array($options) ){ - $this->options += array('inline'=>false); + if ( is_array( $options ) ) { + $this->options += [ 'inline' => false ]; - if( isset($this->options['less']) || $this->options['inline'] ){ - $this->css = !isset($this->options['less']) || !$this->options['less'] || $this->options['inline']; + if ( isset( $this->options['less'] ) || $this->options['inline'] ) { + $this->css = !isset( $this->options['less'] ) || !$this->options['less'] || $this->options['inline']; } else { $pathValue = $this->getPath(); - if( $pathValue && preg_match('/css([\?;].*)?$/',$pathValue) ){ + // Leave any ".css" file imports as literals for the browser. + // Also leave any remote HTTP resources as literals regardless of whether + // they contain ".css" in their filename. + if ( $pathValue && preg_match( '/^(https?:)?\/\/|\.css$/i', $pathValue ) ) { $this->css = true; } } @@ -58,28 +59,27 @@ class Less_Tree_Import extends Less_Tree{ // ruleset. // - public function accept($visitor){ - - if( $this->features ){ - $this->features = $visitor->visitObj($this->features); + public function accept( $visitor ) { + if ( $this->features ) { + $this->features = $visitor->visitObj( $this->features ); } - $this->path = $visitor->visitObj($this->path); + $this->path = $visitor->visitObj( $this->path ); - if( !$this->options['inline'] && $this->root ){ - $this->root = $visitor->visit($this->root); + if ( !$this->options['inline'] && $this->root ) { + $this->root = $visitor->visit( $this->root ); } } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - if( $this->css ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->css ) { $output->add( '@import ', $this->currentFileInfo, $this->index ); $this->path->genCSS( $output ); - if( $this->features ){ + if ( $this->features ) { $output->add( ' ' ); $this->features->genCSS( $output ); } @@ -87,10 +87,10 @@ class Less_Tree_Import extends Less_Tree{ } } - public function toCSS(){ + public function toCSS() { $features = $this->features ? ' ' . $this->features->toCSS() : ''; - if ($this->css) { + if ( $this->css ) { return "@import " . $this->path->toCSS() . $features . ";\n"; } else { return ""; @@ -98,132 +98,126 @@ class Less_Tree_Import extends Less_Tree{ } /** - * @return string + * @return string|null */ - public function getPath(){ - if ($this->path instanceof Less_Tree_Quoted) { + public function getPath() { + if ( $this->path instanceof Less_Tree_Quoted ) { $path = $this->path->value; - $path = ( isset($this->css) || preg_match('/(\.[a-z]*$)|([\?;].*)$/',$path)) ? $path : $path . '.less'; - } else if ($this->path instanceof Less_Tree_URL) { + $path = ( isset( $this->css ) || preg_match( '/(\.[a-z]*$)|([\?;].*)$/', $path ) ) ? $path : $path . '.less'; + + // During the first pass, Less_Tree_URL may contain a Less_Tree_Variable (not yet expanded), + // and thus has no value property defined yet. Return null until we reach the next phase. + // https://github.com/wikimedia/less.php/issues/29 + } elseif ( $this->path instanceof Less_Tree_URL && !( $this->path->value instanceof Less_Tree_Variable ) ) { $path = $this->path->value->value; - }else{ + } else { return null; } - //remove query string and fragment - return preg_replace('/[\?#][^\?]*$/','',$path); + // remove query string and fragment + return preg_replace( '/[\?#][^\?]*$/', '', $path ); } - public function compileForImport( $env ){ - return new Less_Tree_Import( $this->path->compile($env), $this->features, $this->options, $this->index, $this->currentFileInfo); + public function compileForImport( $env ) { + return new Less_Tree_Import( $this->path->compile( $env ), $this->features, $this->options, $this->index, $this->currentFileInfo ); } - public function compilePath($env) { - $path = $this->path->compile($env); + public function compilePath( $env ) { + $path = $this->path->compile( $env ); $rootpath = ''; - if( $this->currentFileInfo && $this->currentFileInfo['rootpath'] ){ + if ( $this->currentFileInfo && $this->currentFileInfo['rootpath'] ) { $rootpath = $this->currentFileInfo['rootpath']; } - - if( !($path instanceof Less_Tree_URL) ){ - if( $rootpath ){ + if ( !( $path instanceof Less_Tree_URL ) ) { + if ( $rootpath ) { $pathValue = $path->value; // Add the base path if the import is relative - if( $pathValue && Less_Environment::isPathRelative($pathValue) ){ - $path->value = $this->currentFileInfo['uri_root'].$pathValue; + if ( $pathValue && Less_Environment::isPathRelative( $pathValue ) ) { + $path->value = $this->currentFileInfo['uri_root'] . $pathValue; } } - $path->value = Less_Environment::normalizePath($path->value); + $path->value = Less_Environment::normalizePath( $path->value ); } - - return $path; } - public function compile( $env ){ + public function compile( $env ) { + $evald = $this->compileForImport( $env ); - $evald = $this->compileForImport($env); - - //get path & uri + // get path & uri $path_and_uri = null; - if( is_callable(Less_Parser::$options['import_callback']) ){ - $path_and_uri = call_user_func(Less_Parser::$options['import_callback'],$evald); + if ( is_callable( Less_Parser::$options['import_callback'] ) ) { + $path_and_uri = call_user_func( Less_Parser::$options['import_callback'], $evald ); } - if( !$path_and_uri ){ + if ( !$path_and_uri ) { $path_and_uri = $evald->PathAndUri(); } - if( $path_and_uri ){ - list($full_path, $uri) = $path_and_uri; - }else{ + if ( $path_and_uri ) { + list( $full_path, $uri ) = $path_and_uri; + } else { $full_path = $uri = $evald->getPath(); } - - //import once - if( $evald->skip( $full_path, $env) ){ - return array(); + // import once + if ( $evald->skip( $full_path, $env ) ) { + return []; } + '@phan-var string $full_path'; - if( $this->options['inline'] ){ - //todo needs to reference css file not import + if ( $this->options['inline'] ) { + // todo needs to reference css file not import //$contents = new Less_Tree_Anonymous($this->root, 0, array('filename'=>$this->importedFilename), true ); - Less_Parser::AddParsedFile($full_path); - $contents = new Less_Tree_Anonymous( file_get_contents($full_path), 0, array(), true ); + Less_Parser::AddParsedFile( $full_path ); + $contents = new Less_Tree_Anonymous( file_get_contents( $full_path ), 0, [], true ); - if( $this->features ){ - return new Less_Tree_Media( array($contents), $this->features->value ); + if ( $this->features ) { + return new Less_Tree_Media( [ $contents ], $this->features->value ); } - return array( $contents ); + return [ $contents ]; } // optional (need to be before "CSS" to support optional CSS imports. CSS should be checked only if empty($this->currentFileInfo)) - if( isset($this->options['optional']) && $this->options['optional'] && !file_exists($full_path) && (!$evald->css || !empty($this->currentFileInfo))) { - return array(); + if ( isset( $this->options['optional'] ) && $this->options['optional'] && !file_exists( $full_path ) && ( !$evald->css || !empty( $this->currentFileInfo ) ) ) { + return []; } - // css ? - if( $evald->css ){ - $features = ( $evald->features ? $evald->features->compile($env) : null ); - return new Less_Tree_Import( $this->compilePath( $env), $features, $this->options, $this->index); + if ( $evald->css ) { + $features = ( $evald->features ? $evald->features->compile( $env ) : null ); + return new Less_Tree_Import( $this->compilePath( $env ), $features, $this->options, $this->index ); } - return $this->ParseImport( $full_path, $uri, $env ); } - /** * Using the import directories, get the full absolute path and uri of the import - * - * @param Less_Tree_Import $evald */ - public function PathAndUri(){ - + public function PathAndUri() { $evald_path = $this->getPath(); - if( $evald_path ){ + if ( $evald_path ) { - $import_dirs = array(); + $import_dirs = []; - if( Less_Environment::isPathRelative($evald_path) ){ - //if the path is relative, the file should be in the current directory - if ( $this->currentFileInfo ){ + if ( Less_Environment::isPathRelative( $evald_path ) ) { + // if the path is relative, the file should be in the current directory + if ( $this->currentFileInfo ) { $import_dirs[ $this->currentFileInfo['currentDirectory'] ] = $this->currentFileInfo['uri_root']; } - }else{ - //otherwise, the file should be relative to the server root - if( $this->currentFileInfo ) { + } else { + // otherwise, the file should be relative to the server root + if ( $this->currentFileInfo ) { $import_dirs[ $this->currentFileInfo['entryPath'] ] = $this->currentFileInfo['entryUri']; } - //if the user supplied entryPath isn't the actual root + // if the user supplied entryPath isn't the actual root $import_dirs[ $_SERVER['DOCUMENT_ROOT'] ] = ''; } @@ -231,77 +225,75 @@ class Less_Tree_Import extends Less_Tree{ // always look in user supplied import directories $import_dirs = array_merge( $import_dirs, Less_Parser::$options['import_dirs'] ); - - foreach( $import_dirs as $rootpath => $rooturi){ - if( is_callable($rooturi) ){ - list($path, $uri) = call_user_func($rooturi, $evald_path); - if( is_string($path) ){ + foreach ( $import_dirs as $rootpath => $rooturi ) { + if ( is_callable( $rooturi ) ) { + list( $path, $uri ) = call_user_func( $rooturi, $evald_path ); + if ( is_string( $path ) ) { $full_path = $path; - return array( $full_path, $uri ); + return [ $full_path, $uri ]; } - }elseif( !empty($rootpath) ){ + } elseif ( !empty( $rootpath ) ) { - $path = rtrim($rootpath,'/\\').'/'.ltrim($evald_path,'/\\'); + $path = rtrim( $rootpath, '/\\' ) . '/' . ltrim( $evald_path, '/\\' ); - if( file_exists($path) ){ - $full_path = Less_Environment::normalizePath($path); - $uri = Less_Environment::normalizePath(dirname($rooturi.$evald_path)); - return array( $full_path, $uri ); - } elseif( file_exists($path.'.less') ){ - $full_path = Less_Environment::normalizePath($path.'.less'); - $uri = Less_Environment::normalizePath(dirname($rooturi.$evald_path.'.less')); - return array( $full_path, $uri ); + if ( file_exists( $path ) ) { + $full_path = Less_Environment::normalizePath( $path ); + $uri = Less_Environment::normalizePath( dirname( $rooturi . $evald_path ) ); + return [ $full_path, $uri ]; + } elseif ( file_exists( $path . '.less' ) ) { + $full_path = Less_Environment::normalizePath( $path . '.less' ); + $uri = Less_Environment::normalizePath( dirname( $rooturi . $evald_path . '.less' ) ); + return [ $full_path, $uri ]; } } } } } - /** * Parse the import url and return the rules * + * @param string $full_path + * @param string|null $uri + * @param mixed $env * @return Less_Tree_Media|array */ - public function ParseImport( $full_path, $uri, $env ){ - + public function ParseImport( $full_path, $uri, $env ) { $import_env = clone $env; - if( (isset($this->options['reference']) && $this->options['reference']) || isset($this->currentFileInfo['reference']) ){ + if ( ( isset( $this->options['reference'] ) && $this->options['reference'] ) || isset( $this->currentFileInfo['reference'] ) ) { $import_env->currentFileInfo['reference'] = true; } - if( (isset($this->options['multiple']) && $this->options['multiple']) ){ + if ( ( isset( $this->options['multiple'] ) && $this->options['multiple'] ) ) { $import_env->importMultiple = true; } - $parser = new Less_Parser($import_env); - $root = $parser->parseFile($full_path, $uri, true); + $parser = new Less_Parser( $import_env ); + $root = $parser->parseFile( $full_path, $uri, true ); + $ruleset = new Less_Tree_Ruleset( null, $root->rules ); + $ruleset->evalImports( $import_env ); - $ruleset = new Less_Tree_Ruleset(array(), $root->rules ); - $ruleset->evalImports($import_env); - - return $this->features ? new Less_Tree_Media($ruleset->rules, $this->features->value) : $ruleset->rules; + return $this->features ? new Less_Tree_Media( $ruleset->rules, $this->features->value ) : $ruleset->rules; } - /** * Should the import be skipped? * - * @return boolean|null + * @param string|null $path + * @param Less_Environment $env + * @return bool|null */ - private function Skip($path, $env){ + private function skip( $path, $env ) { + $path = Less_Parser::AbsPath( $path, true ); - $path = Less_Parser::AbsPath($path, true); + if ( $path && Less_Parser::FileParsed( $path ) ) { - if( $path && Less_Parser::FileParsed($path) ){ - - if( isset($this->currentFileInfo['reference']) ){ + if ( isset( $this->currentFileInfo['reference'] ) ) { return true; } - return !isset($this->options['multiple']) && !$env->importMultiple; + return !isset( $this->options['multiple'] ) && !$env->importMultiple; } - } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php b/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php index 1b03183d9..218d48178 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Javascript.php @@ -1,12 +1,8 @@ <?php - /** - * Javascript - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Javascript extends Less_Tree{ +class Less_Tree_Javascript extends Less_Tree { public $type = 'Javascript'; public $escaped; @@ -14,17 +10,17 @@ class Less_Tree_Javascript extends Less_Tree{ public $index; /** - * @param boolean $index - * @param boolean $escaped + * @param bool $index + * @param bool $escaped */ - public function __construct($string, $index, $escaped){ + public function __construct( $string, $index, $escaped ) { $this->escaped = $escaped; $this->expression = $string; $this->index = $index; } - public function compile(){ - return new Less_Tree_Anonymous('/* Sorry, can not do JavaScript evaluation in PHP... :( */'); + public function compile( $env ) { + return new Less_Tree_Anonymous( '/* Sorry, can not do JavaScript evaluation in PHP... :( */' ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php b/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php index e1d98c456..60663f04c 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Keyword.php @@ -1,12 +1,8 @@ <?php - /** - * Keyword - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Keyword extends Less_Tree{ +class Less_Tree_Keyword extends Less_Tree { public $value; public $type = 'Keyword'; @@ -14,28 +10,23 @@ class Less_Tree_Keyword extends Less_Tree{ /** * @param string $value */ - public function __construct($value){ + public function __construct( $value ) { $this->value = $value; } - public function compile(){ - return $this; - } - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - - if( $this->value === '%') { - throw new Less_Exception_Compiler("Invalid % without number"); + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->value === '%' ) { + throw new Less_Exception_Compiler( "Invalid % without number" ); } $output->add( $this->value ); } - public function compare($other) { - if ($other instanceof Less_Tree_Keyword) { + public function compare( $other ) { + if ( $other instanceof Less_Tree_Keyword ) { return $other->value === $this->value ? 0 : 1; } else { return -1; diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Media.php b/vendor/wikimedia/less.php/lib/Less/Tree/Media.php index f9ee9d421..3cb1fc4d1 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Media.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Media.php @@ -1,12 +1,8 @@ <?php - /** - * Media - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Media extends Less_Tree{ +class Less_Tree_Media extends Less_Tree { public $features; public $rules; @@ -15,108 +11,115 @@ class Less_Tree_Media extends Less_Tree{ public $isReferenced; public $type = 'Media'; - public function __construct($value = array(), $features = array(), $index = null, $currentFileInfo = null ){ - + public function __construct( $value = [], $features = [], $index = null, $currentFileInfo = null ) { $this->index = $index; $this->currentFileInfo = $currentFileInfo; $selectors = $this->emptySelectors(); - $this->features = new Less_Tree_Value($features); + $this->features = new Less_Tree_Value( $features ); - $this->rules = array(new Less_Tree_Ruleset($selectors, $value)); + $this->rules = [ new Less_Tree_Ruleset( $selectors, $value ) ]; $this->rules[0]->allowImports = true; } - public function accept( $visitor ){ - $this->features = $visitor->visitObj($this->features); - $this->rules = $visitor->visitArray($this->rules); + public function accept( $visitor ) { + $this->features = $visitor->visitObj( $this->features ); + $this->rules = $visitor->visitArray( $this->rules ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( '@media ', $this->currentFileInfo, $this->index ); $this->features->genCSS( $output ); - Less_Tree::outputRuleset( $output, $this->rules); - + Less_Tree::outputRuleset( $output, $this->rules ); } - public function compile($env) { - - $media = new Less_Tree_Media(array(), array(), $this->index, $this->currentFileInfo ); + /** + * @param Less_Environment $env + * @return Less_Tree_Media|Less_Tree_Ruleset + * @see less-2.5.3.js#Media.prototype.eval + */ + public function compile( $env ) { + $media = new Less_Tree_Media( [], [], $this->index, $this->currentFileInfo ); $strictMathBypass = false; - if( Less_Parser::$options['strictMath'] === false) { + if ( Less_Parser::$options['strictMath'] === false ) { $strictMathBypass = true; Less_Parser::$options['strictMath'] = true; } - $media->features = $this->features->compile($env); + $media->features = $this->features->compile( $env ); - if( $strictMathBypass ){ + if ( $strictMathBypass ) { Less_Parser::$options['strictMath'] = false; } $env->mediaPath[] = $media; $env->mediaBlocks[] = $media; - array_unshift($env->frames, $this->rules[0]); - $media->rules = array($this->rules[0]->compile($env)); - array_shift($env->frames); + array_unshift( $env->frames, $this->rules[0] ); + $media->rules = [ $this->rules[0]->compile( $env ) ]; + array_shift( $env->frames ); - array_pop($env->mediaPath); + array_pop( $env->mediaPath ); - return !$env->mediaPath ? $media->compileTop($env) : $media->compileNested($env); + return !$env->mediaPath ? $media->compileTop( $env ) : $media->compileNested( $env ); } - public function variable($name) { - return $this->rules[0]->variable($name); + public function variable( $name ) { + return $this->rules[0]->variable( $name ); } - public function find($selector) { - return $this->rules[0]->find($selector, $this); + public function find( $selector ) { + return $this->rules[0]->find( $selector, $this ); } - public function emptySelectors(){ - $el = new Less_Tree_Element('','&', $this->index, $this->currentFileInfo ); - $sels = array( new Less_Tree_Selector(array($el), array(), null, $this->index, $this->currentFileInfo) ); + public function emptySelectors() { + $el = new Less_Tree_Element( '', '&', $this->index, $this->currentFileInfo ); + $sels = [ new Less_Tree_Selector( [ $el ], [], null, $this->index, $this->currentFileInfo ) ]; $sels[0]->mediaEmpty = true; - return $sels; + return $sels; } - public function markReferenced(){ + public function markReferenced() { $this->rules[0]->markReferenced(); $this->isReferenced = true; - Less_Tree::ReferencedArray($this->rules[0]->rules); + Less_Tree::ReferencedArray( $this->rules[0]->rules ); } // evaltop - public function compileTop($env) { + public function compileTop( $env ) { $result = $this; - if (count($env->mediaBlocks) > 1) { + if ( count( $env->mediaBlocks ) > 1 ) { $selectors = $this->emptySelectors(); - $result = new Less_Tree_Ruleset($selectors, $env->mediaBlocks); + $result = new Less_Tree_Ruleset( $selectors, $env->mediaBlocks ); $result->multiMedia = true; } - $env->mediaBlocks = array(); - $env->mediaPath = array(); + $env->mediaBlocks = []; + $env->mediaPath = []; return $result; } - public function compileNested($env) { - $path = array_merge($env->mediaPath, array($this)); + /** + * @param Less_Environment $env + * @return Less_Tree_Ruleset + */ + public function compileNested( $env ) { + $path = array_merge( $env->mediaPath, [ $this ] ); + '@phan-var array<Less_Tree_Media> $path'; // Extract the media-query conditions separated with `,` (OR). - foreach ($path as $key => $p) { + foreach ( $path as $key => $p ) { $value = $p->features instanceof Less_Tree_Value ? $p->features->value : $p->features; - $path[$key] = is_array($value) ? $value : array($value); + $path[$key] = is_array( $value ) ? $value : [ $value ]; } + '@phan-var array<array<Less_Tree>> $path'; // Trace all permutations to generate the resulting media-query. // @@ -126,42 +129,42 @@ class Less_Tree_Media extends Less_Tree{ // b and c and d // b and c and e - $permuted = $this->permute($path); - $expressions = array(); - foreach($permuted as $path){ + $permuted = $this->permute( $path ); + $expressions = []; + foreach ( $permuted as $path ) { - for( $i=0, $len=count($path); $i < $len; $i++){ - $path[$i] = Less_Parser::is_method($path[$i], 'toCSS') ? $path[$i] : new Less_Tree_Anonymous($path[$i]); + for ( $i = 0, $len = count( $path ); $i < $len; $i++ ) { + $path[$i] = Less_Parser::is_method( $path[$i], 'toCSS' ) ? $path[$i] : new Less_Tree_Anonymous( $path[$i] ); } - for( $i = count($path) - 1; $i > 0; $i-- ){ - array_splice($path, $i, 0, array(new Less_Tree_Anonymous('and'))); + for ( $i = count( $path ) - 1; $i > 0; $i-- ) { + array_splice( $path, $i, 0, [ new Less_Tree_Anonymous( 'and' ) ] ); } - $expressions[] = new Less_Tree_Expression($path); + $expressions[] = new Less_Tree_Expression( $path ); } - $this->features = new Less_Tree_Value($expressions); - - + $this->features = new Less_Tree_Value( $expressions ); // Fake a tree-node that doesn't output anything. - return new Less_Tree_Ruleset(array(), array()); + return new Less_Tree_Ruleset( [], [] ); } - public function permute($arr) { - if (!$arr) - return array(); + public function permute( $arr ) { + if ( !$arr ) { + return []; + } - if (count($arr) == 1) + if ( count( $arr ) == 1 ) { return $arr[0]; + } - $result = array(); - $rest = $this->permute(array_slice($arr, 1)); - foreach ($rest as $r) { - foreach ($arr[0] as $a) { + $result = []; + $rest = $this->permute( array_slice( $arr, 1 ) ); + foreach ( $rest as $r ) { + foreach ( $arr[0] as $a ) { $result[] = array_merge( - is_array($a) ? $a : array($a), - is_array($r) ? $r : array($r) + is_array( $a ) ? $a : [ $a ], + is_array( $r ) ? $r : [ $r ] ); } } @@ -169,11 +172,12 @@ class Less_Tree_Media extends Less_Tree{ return $result; } - public function bubbleSelectors($selectors) { + public function bubbleSelectors( $selectors ) { + if ( !$selectors ) { + return; + } - if( !$selectors) return; - - $this->rules = array(new Less_Tree_Ruleset( $selectors, array($this->rules[0]))); + $this->rules = [ new Less_Tree_Ruleset( $selectors, [ $this->rules[0] ] ) ]; } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php index 04eb426d9..61e10fefb 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Call.php @@ -1,7 +1,8 @@ <?php - - -class Less_Tree_Mixin_Call extends Less_Tree{ +/** + * @private + */ +class Less_Tree_Mixin_Call extends Less_Tree { public $selector; public $arguments; @@ -15,39 +16,37 @@ class Less_Tree_Mixin_Call extends Less_Tree{ * less.js: tree.mixin.Call * */ - public function __construct($elements, $args, $index, $currentFileInfo, $important = false){ - $this->selector = new Less_Tree_Selector($elements); + public function __construct( $elements, $args, $index, $currentFileInfo, $important = false ) { + $this->selector = new Less_Tree_Selector( $elements ); $this->arguments = $args; $this->index = $index; $this->currentFileInfo = $currentFileInfo; $this->important = $important; } - //function accept($visitor){ + // function accept($visitor){ // $this->selector = $visitor->visit($this->selector); // $this->arguments = $visitor->visit($this->arguments); //} - - public function compile($env){ - - $rules = array(); + public function compile( $env ) { + $rules = []; $match = false; $isOneFound = false; - $candidates = array(); + $candidates = []; $defaultUsed = false; - $conditionResult = array(); + $conditionResult = []; - $args = array(); - foreach($this->arguments as $a){ - $args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env) ); + $args = []; + foreach ( $this->arguments as $a ) { + $args[] = [ 'name' => $a['name'], 'value' => $a['value']->compile( $env ) ]; } - foreach($env->frames as $frame){ + foreach ( $env->frames as $frame ) { - $mixins = $frame->find($this->selector); + $mixins = $frame->find( $this->selector ); - if( !$mixins ){ + if ( !$mixins ) { continue; } @@ -61,32 +60,35 @@ class Less_Tree_Mixin_Call extends Less_Tree{ // and build candidate list with corresponding flags. Then, when we know all possible matches, // we make a final decision. - $mixins_len = count($mixins); - for( $m = 0; $m < $mixins_len; $m++ ){ + $mixins_len = count( $mixins ); + for ( $m = 0; $m < $mixins_len; $m++ ) { $mixin = $mixins[$m]; - if( $this->IsRecursive( $env, $mixin ) ){ + if ( $this->IsRecursive( $env, $mixin ) ) { continue; } - if( $mixin->matchArgs($args, $env) ){ + if ( $mixin->matchArgs( $args, $env ) ) { - $candidate = array('mixin' => $mixin, 'group' => $defNone); + $candidate = [ 'mixin' => $mixin, 'group' => $defNone ]; - if( $mixin instanceof Less_Tree_Ruleset ){ - - for( $f = 0; $f < 2; $f++ ){ - Less_Tree_DefaultFunc::value($f); - $conditionResult[$f] = $mixin->matchCondition( $args, $env); + if ( $mixin instanceof Less_Tree_Ruleset ) { + for ( $f = 0; $f < 2; $f++ ) { + Less_Tree_DefaultFunc::value( $f ); + $conditionResult[$f] = $mixin->matchCondition( $args, $env ); } - if( $conditionResult[0] || $conditionResult[1] ){ - if( $conditionResult[0] != $conditionResult[1] ){ + + // PhanTypeInvalidDimOffset -- False positive + '@phan-var array{0:bool,1:bool} $conditionResult'; + + if ( $conditionResult[0] || $conditionResult[1] ) { + if ( $conditionResult[0] != $conditionResult[1] ) { $candidate['group'] = $conditionResult[1] ? $defTrue : $defFalse; } $candidates[] = $candidate; } - }else{ + } else { $candidates[] = $candidate; } @@ -96,99 +98,94 @@ class Less_Tree_Mixin_Call extends Less_Tree{ Less_Tree_DefaultFunc::reset(); - - $count = array(0, 0, 0); - for( $m = 0; $m < count($candidates); $m++ ){ + $count = [ 0, 0, 0 ]; + for ( $m = 0; $m < count( $candidates ); $m++ ) { $count[ $candidates[$m]['group'] ]++; } - if( $count[$defNone] > 0 ){ + if ( $count[$defNone] > 0 ) { $defaultResult = $defFalse; } else { $defaultResult = $defTrue; - if( ($count[$defTrue] + $count[$defFalse]) > 1 ){ - throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format($args) . '`' ); + if ( ( $count[$defTrue] + $count[$defFalse] ) > 1 ) { + throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format( $args ) . '`' ); } } + $candidates_length = count( $candidates ); + $length_1 = ( $candidates_length == 1 ); - $candidates_length = count($candidates); - $length_1 = ($candidates_length == 1); - - for( $m = 0; $m < $candidates_length; $m++){ + for ( $m = 0; $m < $candidates_length; $m++ ) { $candidate = $candidates[$m]['group']; - if( ($candidate === $defNone) || ($candidate === $defaultResult) ){ + if ( ( $candidate === $defNone ) || ( $candidate === $defaultResult ) ) { try{ $mixin = $candidates[$m]['mixin']; - if( !($mixin instanceof Less_Tree_Mixin_Definition) ){ - $mixin = new Less_Tree_Mixin_Definition('', array(), $mixin->rules, null, false); + if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) { + $mixin = new Less_Tree_Mixin_Definition( '', [], $mixin->rules, null, false ); $mixin->originalRuleset = $mixins[$m]->originalRuleset; } - $rules = array_merge($rules, $mixin->evalCall($env, $args, $this->important)->rules); - } catch (Exception $e) { - //throw new Less_Exception_Compiler($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']); - throw new Less_Exception_Compiler($e->getMessage(), null, null, $this->currentFileInfo); + $rules = array_merge( $rules, $mixin->evalCall( $env, $args, $this->important )->rules ); + } catch ( Exception $e ) { + // throw new Less_Exception_Compiler($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']); + throw new Less_Exception_Compiler( $e->getMessage(), null, null, $this->currentFileInfo ); } } } - if( $match ){ - if( !$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] ){ - Less_Tree::ReferencedArray($rules); + if ( $match ) { + if ( !$this->currentFileInfo || !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] ) { + Less_Tree::ReferencedArray( $rules ); } return $rules; } } - if( $isOneFound ){ - throw new Less_Exception_Compiler('No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo); + if ( $isOneFound ) { + throw new Less_Exception_Compiler( 'No matching definition was found for `' . $this->Format( $args ) . '`', null, $this->index, $this->currentFileInfo ); - }else{ - throw new Less_Exception_Compiler(trim($this->selector->toCSS()) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index); + } else { + throw new Less_Exception_Compiler( trim( $this->selector->toCSS() ) . " is undefined in " . $this->currentFileInfo['filename'], null, $this->index ); } - } /** * Format the args for use in exception messages * */ - private function Format($args){ - $message = array(); - if( $args ){ - foreach($args as $a){ + private function Format( $args ) { + $message = []; + if ( $args ) { + foreach ( $args as $a ) { $argValue = ''; - if( $a['name'] ){ + if ( $a['name'] ) { $argValue .= $a['name'] . ':'; } - if( is_object($a['value']) ){ + if ( is_object( $a['value'] ) ) { $argValue .= $a['value']->toCSS(); - }else{ + } else { $argValue .= '???'; } $message[] = $argValue; } } - return implode(', ',$message); + return implode( ', ', $message ); } - /** * Are we in a recursive mixin call? * * @return bool */ - private function IsRecursive( $env, $mixin ){ + private function IsRecursive( $env, $mixin ) { + foreach ( $env->frames as $recur_frame ) { + if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) { - foreach($env->frames as $recur_frame){ - if( !($mixin instanceof Less_Tree_Mixin_Definition) ){ - - if( $mixin === $recur_frame ){ + if ( $mixin === $recur_frame ) { return true; } - if( isset($recur_frame->originalRuleset) && $mixin->ruleset_id === $recur_frame->originalRuleset ){ + if ( isset( $recur_frame->originalRuleset ) && $mixin->ruleset_id === $recur_frame->originalRuleset ) { return true; } } @@ -198,5 +195,3 @@ class Less_Tree_Mixin_Call extends Less_Tree{ } } - - diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php index b16d68871..08bcd7af2 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Mixin/Definition.php @@ -1,33 +1,34 @@ <?php - -class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{ +/** + * @private + */ +class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset { public $name; public $selectors; public $params; - public $arity = 0; + public $arity = 0; public $rules; - public $lookups = array(); + public $lookups = []; public $required = 0; - public $frames = array(); + public $frames = []; public $condition; public $variadic; - public $type = 'MixinDefinition'; - + public $type = 'MixinDefinition'; // less.js : /lib/less/tree/mixin.js : tree.mixin.Definition - public function __construct($name, $params, $rules, $condition, $variadic = false, $frames = array() ){ + public function __construct( $name, $params, $rules, $condition, $variadic = false, $frames = [] ) { $this->name = $name; - $this->selectors = array(new Less_Tree_Selector(array( new Less_Tree_Element(null, $name)))); + $this->selectors = [ new Less_Tree_Selector( [ new Less_Tree_Element( null, $name ) ] ) ]; $this->params = $params; $this->condition = $condition; $this->variadic = $variadic; $this->rules = $rules; - if( $params ){ - $this->arity = count($params); - foreach( $params as $p ){ - if (! isset($p['name']) || ($p['name'] && !isset($p['value']))) { + if ( $params ) { + $this->arity = count( $params ); + foreach ( $params as $p ) { + if ( !isset( $p['name'] ) || ( $p['name'] && !isset( $p['value'] ) ) ) { $this->required++; } } @@ -37,144 +38,139 @@ class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{ $this->SetRulesetIndex(); } - - - //function accept( $visitor ){ + // function accept( $visitor ){ // $this->params = $visitor->visit($this->params); // $this->rules = $visitor->visit($this->rules); // $this->condition = $visitor->visit($this->condition); //} - - public function toCSS(){ + public function toCSS() { return ''; } // less.js : /lib/less/tree/mixin.js : tree.mixin.Definition.evalParams - public function compileParams($env, $mixinFrames, $args = array() , &$evaldArguments = array() ){ - $frame = new Less_Tree_Ruleset(null, array()); + public function compileParams( $env, $mixinFrames, $args = [], &$evaldArguments = [] ) { + $frame = new Less_Tree_Ruleset( null, [] ); $params = $this->params; $mixinEnv = null; $argsLength = 0; - if( $args ){ - $argsLength = count($args); - for($i = 0; $i < $argsLength; $i++ ){ + if ( $args ) { + $argsLength = count( $args ); + for ( $i = 0; $i < $argsLength; $i++ ) { $arg = $args[$i]; - if( $arg && $arg['name'] ){ + if ( $arg && $arg['name'] ) { $isNamedFound = false; - foreach($params as $j => $param){ - if( !isset($evaldArguments[$j]) && $arg['name'] === $params[$j]['name']) { - $evaldArguments[$j] = $arg['value']->compile($env); - array_unshift($frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile($env) ) ); + foreach ( $params as $j => $param ) { + if ( !isset( $evaldArguments[$j] ) && $arg['name'] === $params[$j]['name'] ) { + $evaldArguments[$j] = $arg['value']->compile( $env ); + array_unshift( $frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile( $env ) ) ); $isNamedFound = true; break; } } - if ($isNamedFound) { - array_splice($args, $i, 1); + if ( $isNamedFound ) { + array_splice( $args, $i, 1 ); $i--; $argsLength--; continue; } else { - throw new Less_Exception_Compiler("Named argument for " . $this->name .' '.$args[$i]['name'] . ' not found'); + throw new Less_Exception_Compiler( "Named argument for " . $this->name . ' ' . $args[$i]['name'] . ' not found' ); } } } } $argIndex = 0; - foreach($params as $i => $param){ + foreach ( $params as $i => $param ) { - if ( isset($evaldArguments[$i]) ){ continue; } + if ( isset( $evaldArguments[$i] ) ) { continue; + } $arg = null; - if( isset($args[$argIndex]) ){ + if ( isset( $args[$argIndex] ) ) { $arg = $args[$argIndex]; } - if (isset($param['name']) && $param['name']) { + if ( isset( $param['name'] ) && $param['name'] ) { - if( isset($param['variadic']) ){ - $varargs = array(); - for ($j = $argIndex; $j < $argsLength; $j++) { - $varargs[] = $args[$j]['value']->compile($env); + if ( isset( $param['variadic'] ) ) { + $varargs = []; + for ( $j = $argIndex; $j < $argsLength; $j++ ) { + $varargs[] = $args[$j]['value']->compile( $env ); } - $expression = new Less_Tree_Expression($varargs); - array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $expression->compile($env))); - }else{ - $val = ($arg && $arg['value']) ? $arg['value'] : false; + $expression = new Less_Tree_Expression( $varargs ); + array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $expression->compile( $env ) ) ); + } else { + $val = ( $arg && $arg['value'] ) ? $arg['value'] : false; - if ($val) { - $val = $val->compile($env); - } else if ( isset($param['value']) ) { + if ( $val ) { + $val = $val->compile( $env ); + } elseif ( isset( $param['value'] ) ) { - if( !$mixinEnv ){ + if ( !$mixinEnv ) { $mixinEnv = new Less_Environment(); - $mixinEnv->frames = array_merge( array($frame), $mixinFrames); + $mixinEnv->frames = array_merge( [ $frame ], $mixinFrames ); } - $val = $param['value']->compile($mixinEnv); + $val = $param['value']->compile( $mixinEnv ); $frame->resetCache(); } else { - throw new Less_Exception_Compiler("Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")"); + throw new Less_Exception_Compiler( "Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")" ); } - array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $val)); + array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $val ) ); $evaldArguments[$i] = $val; } } - if ( isset($param['variadic']) && $args) { - for ($j = $argIndex; $j < $argsLength; $j++) { - $evaldArguments[$j] = $args[$j]['value']->compile($env); + if ( isset( $param['variadic'] ) && $args ) { + for ( $j = $argIndex; $j < $argsLength; $j++ ) { + $evaldArguments[$j] = $args[$j]['value']->compile( $env ); } } $argIndex++; } - ksort($evaldArguments); - $evaldArguments = array_values($evaldArguments); + ksort( $evaldArguments ); + $evaldArguments = array_values( $evaldArguments ); return $frame; } - public function compile($env) { - if( $this->frames ){ - return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames ); + public function compile( $env ) { + if ( $this->frames ) { + return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames ); } - return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames ); + return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames ); } - public function evalCall($env, $args = NULL, $important = NULL) { - + public function evalCall( $env, $args = null, $important = null ) { Less_Environment::$mixin_stack++; - $_arguments = array(); + $_arguments = []; - if( $this->frames ){ - $mixinFrames = array_merge($this->frames, $env->frames); - }else{ + if ( $this->frames ) { + $mixinFrames = array_merge( $this->frames, $env->frames ); + } else { $mixinFrames = $env->frames; } - $frame = $this->compileParams($env, $mixinFrames, $args, $_arguments); + $frame = $this->compileParams( $env, $mixinFrames, $args, $_arguments ); - $ex = new Less_Tree_Expression($_arguments); - array_unshift($frame->rules, new Less_Tree_Rule('@arguments', $ex->compile($env))); + $ex = new Less_Tree_Expression( $_arguments ); + array_unshift( $frame->rules, new Less_Tree_Rule( '@arguments', $ex->compile( $env ) ) ); - - $ruleset = new Less_Tree_Ruleset(null, $this->rules); + $ruleset = new Less_Tree_Ruleset( null, $this->rules ); $ruleset->originalRuleset = $this->ruleset_id; - $ruleSetEnv = new Less_Environment(); - $ruleSetEnv->frames = array_merge( array($this, $frame), $mixinFrames ); + $ruleSetEnv->frames = array_merge( [ $this, $frame ], $mixinFrames ); $ruleset = $ruleset->compile( $ruleSetEnv ); - if( $important ){ + if ( $important ) { $ruleset = $ruleset->makeImportant(); } @@ -183,53 +179,52 @@ class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{ return $ruleset; } - - public function matchCondition($args, $env) { - - if( !$this->condition ){ + /** @return bool */ + public function matchCondition( $args, $env ) { + if ( !$this->condition ) { return true; } // set array to prevent error on array_merge - if(!is_array($this->frames)) { - $this->frames = array(); - } + if ( !is_array( $this->frames ) ) { + $this->frames = []; + } - $frame = $this->compileParams($env, array_merge($this->frames,$env->frames), $args ); + $frame = $this->compileParams( $env, array_merge( $this->frames, $env->frames ), $args ); $compile_env = new Less_Environment(); $compile_env->frames = array_merge( - array($frame) // the parameter variables - , $this->frames // the parent namespace/mixin frames - , $env->frames // the current environment frames + [ $frame ], // the parameter variables + $this->frames, // the parent namespace/mixin frames + $env->frames // the current environment frames ); $compile_env->functions = $env->functions; - return (bool)$this->condition->compile($compile_env); + return (bool)$this->condition->compile( $compile_env ); } - public function matchArgs($args, $env = NULL){ - $argsLength = count($args); + public function matchArgs( $args, $env = null ) { + $argsLength = count( $args ); - if( !$this->variadic ){ - if( $argsLength < $this->required ){ + if ( !$this->variadic ) { + if ( $argsLength < $this->required ) { return false; } - if( $argsLength > count($this->params) ){ + if ( $argsLength > count( $this->params ) ) { return false; } - }else{ - if( $argsLength < ($this->required - 1)){ + } else { + if ( $argsLength < ( $this->required - 1 ) ) { return false; } } - $len = min($argsLength, $this->arity); + $len = min( $argsLength, $this->arity ); - for( $i = 0; $i < $len; $i++ ){ - if( !isset($this->params[$i]['name']) && !isset($this->params[$i]['variadic']) ){ - if( $args[$i]['value']->compile($env)->toCSS() != $this->params[$i]['value']->compile($env)->toCSS() ){ + for ( $i = 0; $i < $len; $i++ ) { + if ( !isset( $this->params[$i]['name'] ) && !isset( $this->params[$i]['variadic'] ) ) { + if ( $args[$i]['value']->compile( $env )->toCSS() != $this->params[$i]['value']->compile( $env )->toCSS() ) { return false; } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php b/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php index 31cbe03ed..88a229641 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/NameValue.php @@ -1,16 +1,16 @@ <?php - /** - * A simple css name-value pair - * ex: width:100px; + * A simple CSS name-value pair, e.g. `width: 100px;` * - * In bootstrap, there are about 600-1,000 simple name-value pairs (depending on how forgiving the match is) -vs- 6,020 dynamic rules (Less_Tree_Rule) - * Using the name-value object can speed up bootstrap compilation slightly, but it breaks color keyword interpretation: color:red -> color:#FF0000; + * In bootstrap, there are about 600-1000 simple name-value pairs (depending on + * how forgiving the match is) -vs- 6,020 dynamic rules (Less_Tree_Rule). * - * @package Less - * @subpackage tree + * Using the name-value object can speed up bootstrap compilation slightly, but + * it breaks color keyword interpretation: `color: red` -> `color: #FF0000`. + * + * @private */ -class Less_Tree_NameValue extends Less_Tree{ +class Less_Tree_NameValue extends Less_Tree { public $name; public $value; @@ -19,33 +19,31 @@ class Less_Tree_NameValue extends Less_Tree{ public $type = 'NameValue'; public $important = ''; - public function __construct($name, $value = null, $index = null, $currentFileInfo = null ){ + public function __construct( $name, $value = null, $index = null, $currentFileInfo = null ) { $this->name = $name; $this->value = $value; $this->index = $index; $this->currentFileInfo = $currentFileInfo; } - public function genCSS( $output ){ - + public function genCSS( $output ) { $output->add( $this->name . Less_Environment::$_outputMap[': '] . $this->value . $this->important - . (((Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";") - , $this->currentFileInfo, $this->index); + . ( ( ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), + $this->currentFileInfo, $this->index ); } - public function compile ($env){ + public function compile( $env ) { return $this; } - public function makeImportant(){ - $new = new Less_Tree_NameValue($this->name, $this->value, $this->index, $this->currentFileInfo); + public function makeImportant() { + $new = new Less_Tree_NameValue( $this->name, $this->value, $this->index, $this->currentFileInfo ); $new->important = ' !important'; return $new; } - } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php b/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php index 507443ecf..516f1ee7c 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Negative.php @@ -1,37 +1,33 @@ <?php - /** - * Negative - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Negative extends Less_Tree{ +class Less_Tree_Negative extends Less_Tree { public $value; public $type = 'Negative'; - public function __construct($node){ + public function __construct( $node ) { $this->value = $node; } - //function accept($visitor) { + // function accept($visitor) { // $this->value = $visitor->visit($this->value); //} - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( '-' ); $this->value->genCSS( $output ); } - public function compile($env) { - if( Less_Environment::isMathOn() ){ - $ret = new Less_Tree_Operation('*', array( new Less_Tree_Dimension(-1), $this->value ) ); - return $ret->compile($env); + public function compile( $env ) { + if ( Less_Environment::isMathOn() ) { + $ret = new Less_Tree_Operation( '*', [ new Less_Tree_Dimension( -1 ), $this->value ] ); + return $ret->compile( $env ); } - return new Less_Tree_Negative( $this->value->compile($env) ); + return new Less_Tree_Negative( $this->value->compile( $env ) ); } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php b/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php index e69e0da6e..4d79dc0ba 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Operation.php @@ -1,12 +1,8 @@ <?php - /** - * Operation - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Operation extends Less_Tree{ +class Less_Tree_Operation extends Less_Tree { public $op; public $operands; @@ -16,52 +12,50 @@ class Less_Tree_Operation extends Less_Tree{ /** * @param string $op */ - public function __construct($op, $operands, $isSpaced = false){ - $this->op = trim($op); + public function __construct( $op, $operands, $isSpaced = false ) { + $this->op = trim( $op ); $this->operands = $operands; $this->isSpaced = $isSpaced; } - public function accept($visitor) { - $this->operands = $visitor->visitArray($this->operands); + public function accept( $visitor ) { + $this->operands = $visitor->visitArray( $this->operands ); } - public function compile($env){ - $a = $this->operands[0]->compile($env); - $b = $this->operands[1]->compile($env); + public function compile( $env ) { + $a = $this->operands[0]->compile( $env ); + $b = $this->operands[1]->compile( $env ); + if ( Less_Environment::isMathOn() ) { - if( Less_Environment::isMathOn() ){ - - if( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ){ + if ( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ) { $a = $a->toColor(); - }elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){ + } elseif ( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ) { $b = $b->toColor(); } - if( !method_exists($a,'operate') ){ - throw new Less_Exception_Compiler("Operation on an invalid type"); + if ( !method_exists( $a, 'operate' ) ) { + throw new Less_Exception_Compiler( "Operation on an invalid type" ); } - return $a->operate( $this->op, $b); + return $a->operate( $this->op, $b ); } - return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced ); + return new Less_Tree_Operation( $this->op, [ $a, $b ], $this->isSpaced ); } - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $this->operands[0]->genCSS( $output ); - if( $this->isSpaced ){ + if ( $this->isSpaced ) { $output->add( " " ); } $output->add( $this->op ); - if( $this->isSpaced ){ + if ( $this->isSpaced ) { $output->add( ' ' ); } $this->operands[1]->genCSS( $output ); diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php b/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php index 01864550a..d659b84c2 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Paren.php @@ -1,35 +1,35 @@ <?php - /** - * Paren - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Paren extends Less_Tree{ +class Less_Tree_Paren extends Less_Tree { + /** @var Less_Tree $value */ public $value; public $type = 'Paren'; - public function __construct($value) { + /** + * @param Less_Tree $value + */ + public function __construct( $value ) { $this->value = $value; } - public function accept($visitor){ - $this->value = $visitor->visitObj($this->value); + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( '(' ); $this->value->genCSS( $output ); $output->add( ')' ); } - public function compile($env) { - return new Less_Tree_Paren($this->value->compile($env)); + public function compile( $env ) { + return new Less_Tree_Paren( $this->value->compile( $env ) ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php b/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php index 80063b5ef..0c5e190a6 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Quoted.php @@ -1,12 +1,8 @@ <?php - /** - * Quoted - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Quoted extends Less_Tree{ +class Less_Tree_Quoted extends Less_Tree { public $escaped; public $value; public $quote; @@ -17,62 +13,60 @@ class Less_Tree_Quoted extends Less_Tree{ /** * @param string $str */ - public function __construct($str, $content = '', $escaped = false, $index = false, $currentFileInfo = null ){ + public function __construct( $str, $content = '', $escaped = false, $index = false, $currentFileInfo = null ) { $this->escaped = $escaped; $this->value = $content; - if( $str ){ + if ( $str ) { $this->quote = $str[0]; } $this->index = $index; $this->currentFileInfo = $currentFileInfo; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - if( !$this->escaped ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( !$this->escaped ) { $output->add( $this->quote, $this->currentFileInfo, $this->index ); - } - $output->add( $this->value ); - if( !$this->escaped ){ + } + $output->add( $this->value ); + if ( !$this->escaped ) { $output->add( $this->quote ); - } - } - - public function compile($env){ - - $value = $this->value; - if( preg_match_all('/`([^`]+)`/', $this->value, $matches) ){ - foreach($matches as $i => $match){ - $js = new Less_Tree_JavaScript($matches[1], $this->index, true); - $js = $js->compile()->value; - $value = str_replace($matches[0][$i], $js, $value); - } } - - if( preg_match_all('/@\{([\w-]+)\}/',$value,$matches) ){ - foreach($matches[1] as $i => $match){ - $v = new Less_Tree_Variable('@' . $match, $this->index, $this->currentFileInfo ); - $v = $v->compile($env); - $v = ($v instanceof Less_Tree_Quoted) ? $v->value : $v->toCSS(); - $value = str_replace($matches[0][$i], $v, $value); - } - } - - return new Less_Tree_Quoted($this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo); } - public function compare($x) { + public function compile( $env ) { + $value = $this->value; + if ( preg_match_all( '/`([^`]+)`/', $this->value, $matches ) ) { + foreach ( $matches as $i => $match ) { + $js = new Less_Tree_JavaScript( $matches[1], $this->index, true ); + $js = $js->compile( $env )->value; + $value = str_replace( $matches[0][$i], $js, $value ); + } + } - if( !Less_Parser::is_method($x, 'toCSS') ){ + if ( preg_match_all( '/@\{([\w-]+)\}/', $value, $matches ) ) { + foreach ( $matches[1] as $i => $match ) { + $v = new Less_Tree_Variable( '@' . $match, $this->index, $this->currentFileInfo ); + $v = $v->compile( $env ); + $v = ( $v instanceof Less_Tree_Quoted ) ? $v->value : $v->toCSS(); + $value = str_replace( $matches[0][$i], $v, $value ); + } + } + + return new Less_Tree_Quoted( $this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo ); + } + + public function compare( $x ) { + if ( !Less_Parser::is_method( $x, 'toCSS' ) ) { return -1; } $left = $this->toCSS(); $right = $x->toCSS(); - if ($left === $right) { + if ( $left === $right ) { return 0; } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php b/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php index ee4a9e257..842ad0cc0 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Rule.php @@ -1,14 +1,11 @@ <?php - /** - * Rule - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Rule extends Less_Tree{ +class Less_Tree_Rule extends Less_Tree { public $name; + /** @var Less_Tree $value */ public $value; public $important; public $merge; @@ -21,73 +18,77 @@ class Less_Tree_Rule extends Less_Tree{ /** * @param string $important */ - public function __construct($name, $value = null, $important = null, $merge = null, $index = null, $currentFileInfo = null, $inline = false){ + public function __construct( $name, $value = null, $important = null, $merge = null, $index = null, $currentFileInfo = null, $inline = false ) { $this->name = $name; - $this->value = ($value instanceof Less_Tree_Value || $value instanceof Less_Tree_Ruleset) ? $value : new Less_Tree_Value(array($value)); - $this->important = $important ? ' ' . trim($important) : ''; + $this->value = ( $value instanceof Less_Tree ) + ? $value + : new Less_Tree_Value( [ $value ] ); + $this->important = $important ? ' ' . trim( $important ) : ''; $this->merge = $merge; $this->index = $index; $this->currentFileInfo = $currentFileInfo; $this->inline = $inline; - $this->variable = ( is_string($name) && $name[0] === '@'); + $this->variable = ( is_string( $name ) && $name[0] === '@' ); } - public function accept($visitor) { + public function accept( $visitor ) { $this->value = $visitor->visitObj( $this->value ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - - $output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index); + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + $output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index ); try{ - $this->value->genCSS( $output); + $this->value->genCSS( $output ); - }catch( Less_Exception_Parser $e ){ + }catch ( Less_Exception_Parser $e ) { $e->index = $this->index; $e->currentFile = $this->currentFileInfo; throw $e; } - $output->add( $this->important . (($this->inline || (Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";"), $this->currentFileInfo, $this->index); + $output->add( $this->important . ( ( $this->inline || ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), $this->currentFileInfo, $this->index ); } - public function compile ($env){ - + /** + * @param Less_Environment $env + * @return Less_Tree_Rule + */ + public function compile( $env ) { $name = $this->name; - if( is_array($name) ){ + if ( is_array( $name ) ) { // expand 'primitive' name directly to get // things faster (~10% for benchmark.less): - if( count($name) === 1 && $name[0] instanceof Less_Tree_Keyword ){ + if ( count( $name ) === 1 && $name[0] instanceof Less_Tree_Keyword ) { $name = $name[0]->value; - }else{ - $name = $this->CompileName($env,$name); + } else { + $name = $this->CompileName( $env, $name ); } } $strictMathBypass = Less_Parser::$options['strictMath']; - if( $name === "font" && !Less_Parser::$options['strictMath'] ){ + if ( $name === "font" && !Less_Parser::$options['strictMath'] ) { Less_Parser::$options['strictMath'] = true; } try { - $evaldValue = $this->value->compile($env); + $evaldValue = $this->value->compile( $env ); - if( !$this->variable && $evaldValue->type === "DetachedRuleset") { - throw new Less_Exception_Compiler("Rulesets cannot be evaluated on a property.", null, $this->index, $this->currentFileInfo); + if ( !$this->variable && $evaldValue->type === "DetachedRuleset" ) { + throw new Less_Exception_Compiler( "Rulesets cannot be evaluated on a property.", null, $this->index, $this->currentFileInfo ); } - if( Less_Environment::$mixin_stack ){ - $return = new Less_Tree_Rule($name, $evaldValue, $this->important, $this->merge, $this->index, $this->currentFileInfo, $this->inline); - }else{ + if ( Less_Environment::$mixin_stack ) { + $return = new Less_Tree_Rule( $name, $evaldValue, $this->important, $this->merge, $this->index, $this->currentFileInfo, $this->inline ); + } else { $this->name = $name; $this->value = $evaldValue; $return = $this; } - }catch( Less_Exception_Parser $e ){ - if( !is_numeric($e->index) ){ + } catch ( Less_Exception_Parser $e ) { + if ( !is_numeric( $e->index ) ) { $e->index = $this->index; $e->currentFile = $this->currentFileInfo; } @@ -99,17 +100,16 @@ class Less_Tree_Rule extends Less_Tree{ return $return; } - - public function CompileName( $env, $name ){ + public function CompileName( $env, $name ) { $output = new Less_Output(); - foreach($name as $n){ - $n->compile($env)->genCSS($output); + foreach ( $name as $n ) { + $n->compile( $env )->genCSS( $output ); } return $output->toString(); } - public function makeImportant(){ - return new Less_Tree_Rule($this->name, $this->value, '!important', $this->merge, $this->index, $this->currentFileInfo, $this->inline); + public function makeImportant() { + return new Less_Tree_Rule( $this->name, $this->value, '!important', $this->merge, $this->index, $this->currentFileInfo, $this->inline ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php b/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php index bdf9fec79..7acc6af8c 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php @@ -1,12 +1,8 @@ <?php - /** - * Ruleset - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Ruleset extends Less_Tree{ +class Less_Tree_Ruleset extends Less_Tree { protected $lookups; public $_variables; @@ -29,104 +25,108 @@ class Less_Tree_Ruleset extends Less_Tree{ public $first_oelements; - public function SetRulesetIndex(){ + public function SetRulesetIndex() { $this->ruleset_id = Less_Parser::$next_id++; $this->originalRuleset = $this->ruleset_id; - if( $this->selectors ){ - foreach($this->selectors as $sel){ - if( $sel->_oelements ){ + if ( $this->selectors ) { + foreach ( $this->selectors as $sel ) { + if ( $sel->_oelements ) { $this->first_oelements[$sel->_oelements[0]] = true; } } } } - public function __construct($selectors, $rules, $strictImports = null){ + /** + * @param null|Less_Tree_Selector[] $selectors + * @param Less_Tree[] $rules + * @param null|bool $strictImports + */ + public function __construct( $selectors, $rules, $strictImports = null ) { $this->selectors = $selectors; $this->rules = $rules; - $this->lookups = array(); + $this->lookups = []; $this->strictImports = $strictImports; $this->SetRulesetIndex(); } - public function accept( $visitor ){ - if( $this->paths ){ - $paths_len = count($this->paths); - for($i = 0,$paths_len; $i < $paths_len; $i++ ){ - $this->paths[$i] = $visitor->visitArray($this->paths[$i]); + public function accept( $visitor ) { + if ( $this->paths !== null ) { + $paths_len = count( $this->paths ); + for ( $i = 0; $i < $paths_len; $i++ ) { + $this->paths[$i] = $visitor->visitArray( $this->paths[$i] ); } - }elseif( $this->selectors ){ - $this->selectors = $visitor->visitArray($this->selectors); + } elseif ( $this->selectors ) { + $this->selectors = $visitor->visitArray( $this->selectors ); } - if( $this->rules ){ - $this->rules = $visitor->visitArray($this->rules); + if ( $this->rules ) { + $this->rules = $visitor->visitArray( $this->rules ); } } - public function compile($env){ - - $ruleset = $this->PrepareRuleset($env); - + /** + * @param Less_Environment $env + * @return Less_Tree_Ruleset + * @see less-2.5.3.js#Ruleset.prototype.eval + */ + public function compile( $env ) { + $ruleset = $this->PrepareRuleset( $env ); // Store the frames around mixin definitions, // so they can be evaluated like closures when the time comes. - $rsRuleCnt = count($ruleset->rules); - for( $i = 0; $i < $rsRuleCnt; $i++ ){ - if( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ){ - $ruleset->rules[$i] = $ruleset->rules[$i]->compile($env); + $rsRuleCnt = count( $ruleset->rules ); + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + // These checks are the equivalent of the rule.evalFirst property in less.js + if ( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) { + $ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env ); } } - $mediaBlockCount = 0; - if( $env instanceof Less_Environment ){ - $mediaBlockCount = count($env->mediaBlocks); - } + $mediaBlockCount = count( $env->mediaBlocks ); // Evaluate mixin calls. $this->EvalMixinCalls( $ruleset, $env, $rsRuleCnt ); - // Evaluate everything else - for( $i=0; $i<$rsRuleCnt; $i++ ){ - if(! ($ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset) ){ - $ruleset->rules[$i] = $ruleset->rules[$i]->compile($env); + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { + if ( !( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) ) { + $ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env ); } } - // Evaluate everything else - for( $i=0; $i<$rsRuleCnt; $i++ ){ + // Evaluate everything else + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { $rule = $ruleset->rules[$i]; - // for rulesets, check if it is a css guard and can be removed - if( $rule instanceof Less_Tree_Ruleset && $rule->selectors && count($rule->selectors) === 1 ){ + // for rulesets, check if it is a css guard and can be removed + if ( $rule instanceof Less_Tree_Ruleset && $rule->selectors && count( $rule->selectors ) === 1 ) { - // check if it can be folded in (e.g. & where) - if( $rule->selectors[0]->isJustParentSelector() ){ - array_splice($ruleset->rules,$i--,1); + // check if it can be folded in (e.g. & where) + if ( $rule->selectors[0]->isJustParentSelector() ) { + array_splice( $ruleset->rules, $i--, 1 ); $rsRuleCnt--; - for($j = 0; $j < count($rule->rules); $j++ ){ + for ( $j = 0; $j < count( $rule->rules ); $j++ ) { $subRule = $rule->rules[$j]; - if( !($subRule instanceof Less_Tree_Rule) || !$subRule->variable ){ - array_splice($ruleset->rules, ++$i, 0, array($subRule)); + if ( !( $subRule instanceof Less_Tree_Rule ) || !$subRule->variable ) { + array_splice( $ruleset->rules, ++$i, 0, [ $subRule ] ); $rsRuleCnt++; } } - } - } - } - + } + } + } // Pop the stack $env->shiftFrame(); - if ($mediaBlockCount) { - $len = count($env->mediaBlocks); - for($i = $mediaBlockCount; $i < $len; $i++ ){ - $env->mediaBlocks[$i]->bubbleSelectors($ruleset->selectors); + if ( $mediaBlockCount ) { + $len = count( $env->mediaBlocks ); + for ( $i = $mediaBlockCount; $i < $len; $i++ ) { + $env->mediaBlocks[$i]->bubbleSelectors( $ruleset->selectors ); } } @@ -137,71 +137,76 @@ class Less_Tree_Ruleset extends Less_Tree{ * Compile Less_Tree_Mixin_Call objects * * @param Less_Tree_Ruleset $ruleset - * @param integer $rsRuleCnt + * @param int $rsRuleCnt */ - private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ){ - for($i=0; $i < $rsRuleCnt; $i++){ + private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ) { + for ( $i = 0; $i < $rsRuleCnt; $i++ ) { $rule = $ruleset->rules[$i]; - if( $rule instanceof Less_Tree_Mixin_Call ){ - $rule = $rule->compile($env); + if ( $rule instanceof Less_Tree_Mixin_Call ) { + $rule = $rule->compile( $env ); - $temp = array(); - foreach($rule as $r){ - if( ($r instanceof Less_Tree_Rule) && $r->variable ){ + $temp = []; + foreach ( $rule as $r ) { + if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) { // do not pollute the scope if the variable is // already there. consider returning false here // but we need a way to "return" variable from mixins - if( !$ruleset->variable($r->name) ){ + if ( !$ruleset->variable( $r->name ) ) { $temp[] = $r; } - }else{ + } else { $temp[] = $r; } } - $temp_count = count($temp)-1; - array_splice($ruleset->rules, $i, 1, $temp); + $temp_count = count( $temp ) - 1; + array_splice( $ruleset->rules, $i, 1, $temp ); $rsRuleCnt += $temp_count; $i += $temp_count; $ruleset->resetCache(); - }elseif( $rule instanceof Less_Tree_RulesetCall ){ + } elseif ( $rule instanceof Less_Tree_RulesetCall ) { - $rule = $rule->compile($env); - $rules = array(); - foreach($rule->rules as $r){ - if( ($r instanceof Less_Tree_Rule) && $r->variable ){ + $rule = $rule->compile( $env ); + $rules = []; + foreach ( $rule->rules as $r ) { + if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) { continue; } $rules[] = $r; } - array_splice($ruleset->rules, $i, 1, $rules); - $temp_count = count($rules); + array_splice( $ruleset->rules, $i, 1, $rules ); + $temp_count = count( $rules ); $rsRuleCnt += $temp_count - 1; - $i += $temp_count-1; + $i += $temp_count - 1; $ruleset->resetCache(); } } } - /** * Compile the selectors and create a new ruleset object for the compile() method * + * @param Less_Environment $env + * @return Less_Tree_Ruleset */ - private function PrepareRuleset($env){ - + private function PrepareRuleset( $env ) { + // NOTE: Preserve distinction between null and empty array when compiling + // $this->selectors to $selectors + $thisSelectors = $this->selectors; + $selectors = null; $hasOnePassingSelector = false; - $selectors = array(); - if( $this->selectors ){ - Less_Tree_DefaultFunc::error("it is currently only allowed in parametric mixin guards,"); - foreach($this->selectors as $s){ - $selector = $s->compile($env); + if ( $thisSelectors ) { + Less_Tree_DefaultFunc::error( "it is currently only allowed in parametric mixin guards," ); + + $selectors = []; + foreach ( $thisSelectors as $s ) { + $selector = $s->compile( $env ); $selectors[] = $selector; - if( $selector->evaldCondition ){ + if ( $selector->evaldCondition ) { $hasOnePassingSelector = true; } } @@ -211,48 +216,45 @@ class Less_Tree_Ruleset extends Less_Tree{ $hasOnePassingSelector = true; } - if( $this->rules && $hasOnePassingSelector ){ + if ( $this->rules && $hasOnePassingSelector ) { + // Copy the array (no need for slice in PHP) $rules = $this->rules; - }else{ - $rules = array(); + } else { + $rules = []; } - $ruleset = new Less_Tree_Ruleset($selectors, $rules, $this->strictImports); + $ruleset = new Less_Tree_Ruleset( $selectors, $rules, $this->strictImports ); $ruleset->originalRuleset = $this->ruleset_id; - $ruleset->root = $this->root; $ruleset->firstRoot = $this->firstRoot; $ruleset->allowImports = $this->allowImports; - // push the current ruleset to the frames stack - $env->unshiftFrame($ruleset); - + $env->unshiftFrame( $ruleset ); // Evaluate imports - if( $ruleset->root || $ruleset->allowImports || !$ruleset->strictImports ){ - $ruleset->evalImports($env); + if ( $ruleset->root || $ruleset->allowImports || !$ruleset->strictImports ) { + $ruleset->evalImports( $env ); } return $ruleset; } - function evalImports($env) { - - $rules_len = count($this->rules); - for($i=0; $i < $rules_len; $i++){ + function evalImports( $env ) { + $rules_len = count( $this->rules ); + for ( $i = 0; $i < $rules_len; $i++ ) { $rule = $this->rules[$i]; - if( $rule instanceof Less_Tree_Import ){ - $rules = $rule->compile($env); - if( is_array($rules) ){ - array_splice($this->rules, $i, 1, $rules); - $temp_count = count($rules)-1; + if ( $rule instanceof Less_Tree_Import ) { + $rules = $rule->compile( $env ); + if ( is_array( $rules ) ) { + array_splice( $this->rules, $i, 1, $rules ); + $temp_count = count( $rules ) - 1; $i += $temp_count; $rules_len += $temp_count; - }else{ - array_splice($this->rules, $i, 1, array($rules)); + } else { + array_splice( $this->rules, $i, 1, [ $rules ] ); } $this->resetCache(); @@ -260,84 +262,85 @@ class Less_Tree_Ruleset extends Less_Tree{ } } - function makeImportant(){ - - $important_rules = array(); - foreach($this->rules as $rule){ - if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ){ + function makeImportant() { + $important_rules = []; + foreach ( $this->rules as $rule ) { + if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ) { $important_rules[] = $rule->makeImportant(); - }else{ + } else { $important_rules[] = $rule; } } - return new Less_Tree_Ruleset($this->selectors, $important_rules, $this->strictImports ); + return new Less_Tree_Ruleset( $this->selectors, $important_rules, $this->strictImports ); } - public function matchArgs($args){ + public function matchArgs( $args, $env = null ) { return !$args; } // lets you call a css selector with a guard - public function matchCondition( $args, $env ){ - $lastSelector = end($this->selectors); + public function matchCondition( $args, $env ) { + $lastSelector = end( $this->selectors ); - if( !$lastSelector->evaldCondition ){ + if ( !$lastSelector->evaldCondition ) { return false; } - if( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ){ + if ( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ) { return false; } return true; } - function resetCache(){ + function resetCache() { $this->_rulesets = null; $this->_variables = null; - $this->lookups = array(); + $this->lookups = []; } - public function variables(){ - $this->_variables = array(); - foreach( $this->rules as $r){ - if ($r instanceof Less_Tree_Rule && $r->variable === true) { + public function variables() { + $this->_variables = []; + foreach ( $this->rules as $r ) { + if ( $r instanceof Less_Tree_Rule && $r->variable === true ) { $this->_variables[$r->name] = $r; } } } - public function variable($name){ - - if( is_null($this->_variables) ){ + /** + * @param string $name + * @return Less_Tree_Rule|null + */ + public function variable( $name ) { + if ( $this->_variables === null ) { $this->variables(); } - return isset($this->_variables[$name]) ? $this->_variables[$name] : null; + return $this->_variables[$name] ?? null; } - public function find( $selector, $self = null ){ + public function find( $selector, $self = null ) { + $key = implode( ' ', $selector->_oelements ); - $key = implode(' ',$selector->_oelements); + if ( !isset( $this->lookups[$key] ) ) { - if( !isset($this->lookups[$key]) ){ - - if( !$self ){ + if ( !$self ) { $self = $this->ruleset_id; } - $this->lookups[$key] = array(); + $this->lookups[$key] = []; $first_oelement = $selector->_oelements[0]; - foreach($this->rules as $rule){ - if( $rule instanceof Less_Tree_Ruleset && $rule->ruleset_id != $self ){ + foreach ( $this->rules as $rule ) { + if ( $rule instanceof Less_Tree_Ruleset && $rule->ruleset_id != $self ) { - if( isset($rule->first_oelements[$first_oelement]) ){ + if ( isset( $rule->first_oelements[$first_oelement] ) ) { - foreach( $rule->selectors as $ruleSelector ){ - $match = $selector->match($ruleSelector); - if( $match ){ - if( $selector->elements_len > $match ){ - $this->lookups[$key] = array_merge($this->lookups[$key], $rule->find( new Less_Tree_Selector(array_slice($selector->elements, $match)), $self)); + foreach ( $rule->selectors as $ruleSelector ) { + $match = $selector->match( $ruleSelector ); + if ( $match ) { + if ( $selector->elements_len > $match ) { + $this->lookups[$key] = array_merge( $this->lookups[$key], $rule->find( new Less_Tree_Selector( array_slice( $selector->elements, $match ) ), $self ) ); } else { $this->lookups[$key][] = $rule; } @@ -352,156 +355,160 @@ class Less_Tree_Ruleset extends Less_Tree{ return $this->lookups[$key]; } - /** * @see Less_Tree::genCSS */ - public function genCSS( $output ){ - - if( !$this->root ){ + public function genCSS( $output ) { + if ( !$this->root ) { Less_Environment::$tabLevel++; } $tabRuleStr = $tabSetStr = ''; - if( !Less_Parser::$options['compress'] ){ - if( Less_Environment::$tabLevel ){ - $tabRuleStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel ); - $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel-1 ); - }else{ + if ( !Less_Parser::$options['compress'] ) { + if ( Less_Environment::$tabLevel ) { + $tabRuleStr = "\n" . str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel ); + $tabSetStr = "\n" . str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 ); + } else { $tabSetStr = $tabRuleStr = "\n"; } } + $ruleNodes = []; + $rulesetNodes = []; + foreach ( $this->rules as $rule ) { - $ruleNodes = array(); - $rulesetNodes = array(); - foreach($this->rules as $rule){ - - $class = get_class($rule); - if( ($class === 'Less_Tree_Media') || ($class === 'Less_Tree_Directive') || ($this->root && $class === 'Less_Tree_Comment') || ($class === 'Less_Tree_Ruleset' && $rule->rules) ){ + $class = get_class( $rule ); + if ( + ( $class === 'Less_Tree_Media' ) || + ( $class === 'Less_Tree_Directive' ) || + ( $this->root && $class === 'Less_Tree_Comment' ) || + ( $rule instanceof Less_Tree_Ruleset && $rule->rules ) + ) { $rulesetNodes[] = $rule; - }else{ + } else { $ruleNodes[] = $rule; } } // If this is the root node, we don't render // a selector, or {}. - if( !$this->root ){ - - /* - debugInfo = tree.debugInfo(env, this, tabSetStr); - - if (debugInfo) { - output.add(debugInfo); - output.add(tabSetStr); - } - */ - - $paths_len = count($this->paths); - for( $i = 0; $i < $paths_len; $i++ ){ + if ( !$this->root ) { + $paths_len = count( $this->paths ); + for ( $i = 0; $i < $paths_len; $i++ ) { $path = $this->paths[$i]; $firstSelector = true; - foreach($path as $p){ + foreach ( $path as $p ) { $p->genCSS( $output, $firstSelector ); $firstSelector = false; } - if( $i + 1 < $paths_len ){ + if ( $i + 1 < $paths_len ) { $output->add( ',' . $tabSetStr ); } } - $output->add( (Less_Parser::$options['compress'] ? '{' : " {") . $tabRuleStr ); + $output->add( ( Less_Parser::$options['compress'] ? '{' : " {" ) . $tabRuleStr ); } // Compile rules and rulesets - $ruleNodes_len = count($ruleNodes); - $rulesetNodes_len = count($rulesetNodes); - for( $i = 0; $i < $ruleNodes_len; $i++ ){ + $ruleNodes_len = count( $ruleNodes ); + $rulesetNodes_len = count( $rulesetNodes ); + for ( $i = 0; $i < $ruleNodes_len; $i++ ) { $rule = $ruleNodes[$i]; // @page{ directive ends up with root elements inside it, a mix of rules and rulesets // In this instance we do not know whether it is the last property - if( $i + 1 === $ruleNodes_len && (!$this->root || $rulesetNodes_len === 0 || $this->firstRoot ) ){ + if ( $i + 1 === $ruleNodes_len && ( !$this->root || $rulesetNodes_len === 0 || $this->firstRoot ) ) { Less_Environment::$lastRule = true; } $rule->genCSS( $output ); - if( !Less_Environment::$lastRule ){ + if ( !Less_Environment::$lastRule ) { $output->add( $tabRuleStr ); - }else{ + } else { Less_Environment::$lastRule = false; } } - if( !$this->root ){ + if ( !$this->root ) { $output->add( $tabSetStr . '}' ); Less_Environment::$tabLevel--; } $firstRuleset = true; - $space = ($this->root ? $tabRuleStr : $tabSetStr); - for( $i = 0; $i < $rulesetNodes_len; $i++ ){ + $space = ( $this->root ? $tabRuleStr : $tabSetStr ); + for ( $i = 0; $i < $rulesetNodes_len; $i++ ) { - if( $ruleNodes_len && $firstRuleset ){ + if ( $ruleNodes_len && $firstRuleset ) { $output->add( $space ); - }elseif( !$firstRuleset ){ + } elseif ( !$firstRuleset ) { $output->add( $space ); } $firstRuleset = false; - $rulesetNodes[$i]->genCSS( $output); + $rulesetNodes[$i]->genCSS( $output ); } - if( !Less_Parser::$options['compress'] && $this->firstRoot ){ + if ( !Less_Parser::$options['compress'] && $this->firstRoot ) { $output->add( "\n" ); } - } - - function markReferenced(){ - if( !$this->selectors ){ + function markReferenced() { + if ( !$this->selectors ) { return; } - foreach($this->selectors as $selector){ + foreach ( $this->selectors as $selector ) { $selector->markReferenced(); } } - public function joinSelectors( $context, $selectors ){ - $paths = array(); - if( is_array($selectors) ){ - foreach($selectors as $selector) { - $this->joinSelector( $paths, $context, $selector); + /** + * @param Less_Tree_Selector[][] $context + * @param Less_Tree_Selector[]|null $selectors + * @return Less_Tree_Selector[][] + */ + public function joinSelectors( $context, $selectors ) { + $paths = []; + if ( $selectors !== null ) { + foreach ( $selectors as $selector ) { + $this->joinSelector( $paths, $context, $selector ); } } return $paths; } - public function joinSelector( &$paths, $context, $selector){ + public function joinSelector( array &$paths, array $context, Less_Tree_Selector $selector ) { + $newPaths = []; + $hadParentSelector = $this->replaceParentSelector( $newPaths, $context, $selector ); - $hasParentSelector = false; - - foreach($selector->elements as $el) { - if( $el->value === '&') { - $hasParentSelector = true; - } - } - - if( !$hasParentSelector ){ - if( $context ){ - foreach($context as $context_el){ - $paths[] = array_merge($context_el, array($selector) ); + if ( !$hadParentSelector ) { + if ( $context ) { + $newPaths = []; + foreach ( $context as $path ) { + $newPaths[] = array_merge( $path, [ $selector ] ); } - }else { - $paths[] = array($selector); + } else { + $newPaths = [ [ $selector ] ]; } - return; } + foreach ( $newPaths as $newPath ) { + $paths[] = $newPath; + } + } + + /** + * Replace all parent selectors inside $inSelector with $context. + * + * @param array &$paths Resulting selectors are appended to $paths. + * @param mixed $context + * @param Less_Tree_Selector $inSelector Inner selector from Less_Tree_Paren + * @return bool True if $inSelector contained at least one parent selector + */ + private function replaceParentSelector( array &$paths, $context, Less_Tree_Selector $inSelector ) { + $hadParentSelector = false; // The paths are [[Selector]] // The first list is a list of comma separated selectors @@ -515,88 +522,70 @@ class Less_Tree_Ruleset extends Less_Tree{ // // the elements from the current selector so far - $currentElements = array(); + $currentElements = []; // the current list of new selectors to add to the path. // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors // by the parents - $newSelectors = array(array()); + $newSelectors = [ + [] + ]; + foreach ( $inSelector->elements as $el ) { + // non-parent reference elements just get added + if ( $el->value !== '&' ) { + $nestedSelector = $this->findNestedSelector( $el ); + if ( $nestedSelector !== null ) { + $this->mergeElementsOnToSelectors( $currentElements, $newSelectors ); - foreach( $selector->elements as $el){ + $nestedPaths = []; + $replacedNewSelectors = []; + $replaced = $this->replaceParentSelector( $nestedPaths, $context, $nestedSelector ); + $hadParentSelector = $hadParentSelector || $replaced; + // $nestedPaths is populated by replaceParentSelector() + // $nestedPaths should have exactly one TODO, replaceParentSelector does not multiply selectors + foreach ( $nestedPaths as $nestedPath ) { + $replacementSelector = $this->createSelector( $nestedPath, $el ); - // non parent reference elements just get added - if( $el->value !== '&' ){ - $currentElements[] = $el; + // join selector path from $newSelectors with every selector path in $addPaths array. + // $el contains the element that is being replaced by $addPaths + // + // @see less-2.5.3.js#Ruleset-addAllReplacementsIntoPath + $addPaths = [ $replacementSelector ]; + foreach ( $newSelectors as $newSelector ) { + $replacedNewSelectors[] = $this->addReplacementIntoPath( $newSelector, $addPaths, $el, $inSelector ); + } + } + $newSelectors = $replacedNewSelectors; + $currentElements = []; + } else { + $currentElements[] = $el; + } } else { + $hadParentSelector = true; + // the new list of selectors to add - $selectorsMultiplied = array(); + $selectorsMultiplied = []; // merge the current list of non parent selector elements // on to the current list of selectors to add - if( $currentElements ){ - $this->mergeElementsOnToSelectors( $currentElements, $newSelectors); - } - - // loop through our current selectors - foreach($newSelectors as $sel){ + $this->mergeElementsOnToSelectors( $currentElements, $newSelectors ); + foreach ( $newSelectors as $sel ) { // if we don't have any parent paths, the & might be in a mixin so that it can be used // whether there are parents or not - if( !$context ){ + if ( !$context ) { // the combinator used on el should now be applied to the next element instead so that // it is not lost - if( $sel ){ - $sel[0]->elements = array_slice($sel[0]->elements,0); - $sel[0]->elements[] = new Less_Tree_Element($el->combinator, '', $el->index, $el->currentFileInfo ); + if ( $sel ) { + $sel[0]->elements[] = new Less_Tree_Element( $el->combinator, '', $el->index, $el->currentFileInfo ); } $selectorsMultiplied[] = $sel; - }else { - + } else { // and the parent selectors - foreach($context as $parentSel){ + foreach ( $context as $parentSel ) { // We need to put the current selectors // then join the last selector's elements on to the parents selectors - - // our new selector path - $newSelectorPath = array(); - // selectors from the parent after the join - $afterParentJoin = array(); - $newJoinedSelectorEmpty = true; - - //construct the joined selector - if & is the first thing this will be empty, - // if not newJoinedSelector will be the last set of elements in the selector - if( $sel ){ - $newSelectorPath = $sel; - $lastSelector = array_pop($newSelectorPath); - $newJoinedSelector = $selector->createDerived( array_slice($lastSelector->elements,0) ); - $newJoinedSelectorEmpty = false; - } - else { - $newJoinedSelector = $selector->createDerived(array()); - } - - //put together the parent selectors after the join - if ( count($parentSel) > 1) { - $afterParentJoin = array_merge($afterParentJoin, array_slice($parentSel,1) ); - } - - if ( $parentSel ){ - $newJoinedSelectorEmpty = false; - - // join the elements so far with the first part of the parent - $newJoinedSelector->elements[] = new Less_Tree_Element( $el->combinator, $parentSel[0]->elements[0]->value, $el->index, $el->currentFileInfo); - - $newJoinedSelector->elements = array_merge( $newJoinedSelector->elements, array_slice($parentSel[0]->elements, 1) ); - } - - if (!$newJoinedSelectorEmpty) { - // now add the joined selector - $newSelectorPath[] = $newJoinedSelector; - } - - // and the rest of the parent - $newSelectorPath = array_merge($newSelectorPath, $afterParentJoin); - + $newSelectorPath = $this->addReplacementIntoPath( $sel, $parentSel, $el, $inSelector ); // add that to our new set of selectors $selectorsMultiplied[] = $newSelectorPath; } @@ -605,37 +594,135 @@ class Less_Tree_Ruleset extends Less_Tree{ // our new selectors has been multiplied, so reset the state $newSelectors = $selectorsMultiplied; - $currentElements = array(); + $currentElements = []; } } // if we have any elements left over (e.g. .a& .b == .b) // add them on to all the current selectors - if( $currentElements ){ - $this->mergeElementsOnToSelectors($currentElements, $newSelectors); - } - foreach( $newSelectors as $new_sel){ - if( $new_sel ){ - $paths[] = $new_sel; + $this->mergeElementsOnToSelectors( $currentElements, $newSelectors ); + + foreach ( $newSelectors as &$sel ) { + $length = count( $sel ); + if ( $length ) { + $paths[] = $sel; + $lastSelector = $sel[$length - 1]; + $sel[$length - 1] = $lastSelector->createDerived( $lastSelector->elements, $inSelector->extendList ); } } + + return $hadParentSelector; } - function mergeElementsOnToSelectors( $elements, &$selectors){ + /** + * @param array $elementsToPak + * @param Less_Tree_Element $originalElement + * @return Less_Tree_Selector + */ + private function createSelector( array $elementsToPak, $originalElement ) { + if ( !$elementsToPak ) { + // This is an invalid call. Kept to match less.js. Appears unreachable. + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal + $containedElement = new Less_Tree_Paren( null ); + } else { + $insideParent = []; + foreach ( $elementsToPak as $elToPak ) { + $insideParent[] = new Less_Tree_Element( null, $elToPak, $originalElement->index, $originalElement->currentFileInfo ); + } + $containedElement = new Less_Tree_Paren( new Less_Tree_Selector( $insideParent ) ); + } - if( !$selectors ){ - $selectors[] = array( new Less_Tree_Selector($elements) ); + $element = new Less_Tree_Element( null, $containedElement, $originalElement->index, $originalElement->currentFileInfo ); + return new Less_Tree_Selector( [ $element ] ); + } + + /** + * @param Less_Tree_Element $element + * @return Less_Tree_Selector|null + */ + private function findNestedSelector( $element ) { + $maybeParen = $element->value; + if ( !( $maybeParen instanceof Less_Tree_Paren ) ) { + return null; + } + $maybeSelector = $maybeParen->value; + if ( !( $maybeSelector instanceof Less_Tree_Selector ) ) { + return null; + } + return $maybeSelector; + } + + /** + * joins selector path from $beginningPath with selector path in $addPath. + * + * $replacedElement contains the element that is being replaced by $addPath + * + * @param Less_Tree_Selector[] $beginningPath + * @param Less_Tree_Selector[] $addPath + * @param Less_Tree_Element $replacedElement + * @param Less_Tree_Selector $originalSelector + * @return Less_Tree_Selector[] Concatenated path + * @see less-2.5.3.js#Ruleset-addReplacementIntoPath + */ + private function addReplacementIntoPath( array $beginningPath, array $addPath, $replacedElement, $originalSelector ) { + // our new selector path + $newSelectorPath = []; + + // construct the joined selector - if `&` is the first thing this will be empty, + // if not newJoinedSelector will be the last set of elements in the selector + if ( $beginningPath ) { + // NOTE: less.js uses Array slice() to copy. In PHP, arrays are naturally copied by value. + $newSelectorPath = $beginningPath; + $lastSelector = array_pop( $newSelectorPath ); + $newJoinedSelector = $originalSelector->createDerived( $lastSelector->elements ); + } else { + $newJoinedSelector = $originalSelector->createDerived( [] ); + } + + if ( $addPath ) { + // if the & does not have a combinator that is "" or " " then + // and there is a combinator on the parent, then grab that. + // this also allows `+ a { & .b { .a & { ...` + $combinator = $replacedElement->combinator; + $parentEl = $addPath[0]->elements[0]; + if ( $replacedElement->combinatorIsEmptyOrWhitespace && !$parentEl->combinatorIsEmptyOrWhitespace ) { + $combinator = $parentEl->combinator; + } + // join the elements so far with the first part of the parent + $newJoinedSelector->elements[] = new Less_Tree_Element( $combinator, $parentEl->value, $replacedElement->index, $replacedElement->currentFileInfo ); + $newJoinedSelector->elements = array_merge( + $newJoinedSelector->elements, + array_slice( $addPath[0]->elements, 1 ) + ); + } + + // now add the joined selector - but only if it is not empty + if ( $newJoinedSelector->elements ) { + $newSelectorPath[] = $newJoinedSelector; + } + + // put together the parent selectors after the join (e.g. the rest of the parent) + if ( count( $addPath ) > 1 ) { + $newSelectorPath = array_merge( $newSelectorPath, array_slice( $addPath, 1 ) ); + } + return $newSelectorPath; + } + + function mergeElementsOnToSelectors( $elements, &$selectors ) { + if ( !$elements ) { + return; + } + if ( !$selectors ) { + $selectors[] = [ new Less_Tree_Selector( $elements ) ]; return; } - - foreach( $selectors as &$sel){ - + foreach ( $selectors as &$sel ) { // if the previous thing in sel is a parent this needs to join on to it - if( $sel ){ - $last = count($sel)-1; - $sel[$last] = $sel[$last]->createDerived( array_merge($sel[$last]->elements, $elements) ); - }else{ + if ( $sel ) { + $last = count( $sel ) - 1; + $sel[$last] = $sel[$last]->createDerived( array_merge( $sel[$last]->elements, $elements ) ); + } else { $sel[] = new Less_Tree_Selector( $elements ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php b/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php index ed4c72373..9c162b8c9 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/RulesetCall.php @@ -1,26 +1,26 @@ <?php - /** - * RulesetCall - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_RulesetCall extends Less_Tree{ +class Less_Tree_RulesetCall extends Less_Tree { public $variable; public $type = "RulesetCall"; - public function __construct($variable){ + /** + * @param string $variable + */ + public function __construct( $variable ) { $this->variable = $variable; } - public function accept($visitor) {} + public function accept( $visitor ) { + } - public function compile( $env ){ - $variable = new Less_Tree_Variable($this->variable); - $detachedRuleset = $variable->compile($env); - return $detachedRuleset->callEval($env); + public function compile( $env ) { + $variable = new Less_Tree_Variable( $this->variable ); + $detachedRuleset = $variable->compile( $env ); + '@phan-var Less_Tree_DetachedRuleset $detachedRuleset'; + return $detachedRuleset->callEval( $env ); } } - diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php b/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php index 6b9dae612..71182da80 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Selector.php @@ -1,77 +1,79 @@ <?php - /** - * Selector - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Selector extends Less_Tree{ +class Less_Tree_Selector extends Less_Tree { public $elements; public $condition; - public $extendList = array(); + public $extendList = []; public $_css; public $index; public $evaldCondition = false; public $type = 'Selector'; - public $currentFileInfo = array(); + public $currentFileInfo = []; public $isReferenced; public $mediaEmpty; public $elements_len = 0; public $_oelements; + public $_oelements_assoc; public $_oelements_len; public $cacheable = true; /** - * @param boolean $isReferenced + * @param bool $isReferenced */ - public function __construct( $elements, $extendList = array() , $condition = null, $index=null, $currentFileInfo=null, $isReferenced=null ){ - + public function __construct( $elements, $extendList = [], $condition = null, $index = null, $currentFileInfo = null, $isReferenced = null ) { $this->elements = $elements; - $this->elements_len = count($elements); + $this->elements_len = count( $elements ); $this->extendList = $extendList; $this->condition = $condition; - if( $currentFileInfo ){ + if ( $currentFileInfo ) { $this->currentFileInfo = $currentFileInfo; } $this->isReferenced = $isReferenced; - if( !$condition ){ + if ( !$condition ) { $this->evaldCondition = true; } $this->CacheElements(); } - public function accept($visitor) { - $this->elements = $visitor->visitArray($this->elements); - $this->extendList = $visitor->visitArray($this->extendList); - if( $this->condition ){ - $this->condition = $visitor->visitObj($this->condition); + public function accept( $visitor ) { + $this->elements = $visitor->visitArray( $this->elements ); + $this->extendList = $visitor->visitArray( $this->extendList ); + if ( $this->condition ) { + $this->condition = $visitor->visitObj( $this->condition ); } - if( $visitor instanceof Less_Visitor_extendFinder ){ + if ( $visitor instanceof Less_Visitor_extendFinder ) { $this->CacheElements(); } } - public function createDerived( $elements, $extendList = null, $evaldCondition = null ){ - $newSelector = new Less_Tree_Selector( $elements, ($extendList ? $extendList : $this->extendList), null, $this->index, $this->currentFileInfo, $this->isReferenced); - $newSelector->evaldCondition = $evaldCondition ? $evaldCondition : $this->evaldCondition; + public function createDerived( $elements, $extendList = null, $evaldCondition = null ) { + $newSelector = new Less_Tree_Selector( + $elements, + ( $extendList ?: $this->extendList ), + null, + $this->index, + $this->currentFileInfo, + $this->isReferenced + ); + $newSelector->evaldCondition = $evaldCondition ?: $this->evaldCondition; + $newSelector->mediaEmpty = $this->mediaEmpty; return $newSelector; } - - public function match( $other ){ - - if( !$other->_oelements || ($this->elements_len < $other->_oelements_len) ){ + public function match( $other ) { + if ( !$other->_oelements || ( $this->elements_len < $other->_oelements_len ) ) { return 0; } - for( $i = 0; $i < $other->_oelements_len; $i++ ){ - if( $this->elements[$i]->value !== $other->_oelements[$i]) { + for ( $i = 0; $i < $other->_oelements_len; $i++ ) { + if ( $this->elements[$i]->value !== $other->_oelements[$i] ) { return 0; } } @@ -79,89 +81,88 @@ class Less_Tree_Selector extends Less_Tree{ return $other->_oelements_len; // return number of matched elements } + public function CacheElements() { + $this->_oelements = []; + $this->_oelements_assoc = []; - public function CacheElements(){ - - $this->_oelements = array(); $css = ''; - foreach($this->elements as $v){ + foreach ( $this->elements as $v ) { $css .= $v->combinator; - if( !$v->value_is_object ){ + if ( !$v->value_is_object ) { $css .= $v->value; continue; } - if( !property_exists($v->value,'value') || !is_string($v->value->value) ){ + if ( !property_exists( $v->value, 'value' ) || !is_string( $v->value->value ) ) { $this->cacheable = false; return; } $css .= $v->value->value; } - $this->_oelements_len = preg_match_all('/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches); - if( $this->_oelements_len ){ + $this->_oelements_len = preg_match_all( '/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches ); + if ( $this->_oelements_len ) { $this->_oelements = $matches[0]; - if( $this->_oelements[0] === '&' ){ - array_shift($this->_oelements); + if ( $this->_oelements[0] === '&' ) { + array_shift( $this->_oelements ); $this->_oelements_len--; } + + $this->_oelements_assoc = array_fill_keys( $this->_oelements, true ); } } - public function isJustParentSelector(){ + public function isJustParentSelector() { return !$this->mediaEmpty && - count($this->elements) === 1 && + count( $this->elements ) === 1 && $this->elements[0]->value === '&' && - ($this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === ''); + ( $this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === '' ); } - public function compile($env) { - - $elements = array(); - foreach($this->elements as $el){ - $elements[] = $el->compile($env); + public function compile( $env ) { + $elements = []; + foreach ( $this->elements as $el ) { + $elements[] = $el->compile( $env ); } - $extendList = array(); - foreach($this->extendList as $el){ - $extendList[] = $el->compile($el); + $extendList = []; + foreach ( $this->extendList as $el ) { + $extendList[] = $el->compile( $el ); } $evaldCondition = false; - if( $this->condition ){ - $evaldCondition = $this->condition->compile($env); + if ( $this->condition ) { + $evaldCondition = $this->condition->compile( $env ); } return $this->createDerived( $elements, $extendList, $evaldCondition ); } - /** * @see Less_Tree::genCSS */ - public function genCSS( $output, $firstSelector = true ){ - - if( !$firstSelector && $this->elements[0]->combinator === "" ){ - $output->add(' ', $this->currentFileInfo, $this->index); + public function genCSS( $output, $firstSelector = true ) { + if ( !$firstSelector && $this->elements[0]->combinator === "" ) { + $output->add( ' ', $this->currentFileInfo, $this->index ); } - foreach($this->elements as $element){ + foreach ( $this->elements as $element ) { $element->genCSS( $output ); } } - public function markReferenced(){ + public function markReferenced() { $this->isReferenced = true; } - public function getIsReferenced(){ - return !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] || $this->isReferenced; + public function getIsReferenced() { + return !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] || $this->isReferenced; } - public function getIsOutput(){ + public function getIsOutput() { return $this->evaldCondition; } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php b/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php index 8c4707efd..304d191e8 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/UnicodeDescriptor.php @@ -1,29 +1,20 @@ <?php - /** - * UnicodeDescriptor - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_UnicodeDescriptor extends Less_Tree{ +class Less_Tree_UnicodeDescriptor extends Less_Tree { public $value; public $type = 'UnicodeDescriptor'; - public function __construct($value){ + public function __construct( $value ) { $this->value = $value; } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( $this->value ); } - - public function compile(){ - return $this; - } } - diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php b/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php index e13b100e2..2fd892766 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Unit.php @@ -1,98 +1,91 @@ <?php - /** - * Unit - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Unit extends Less_Tree{ +class Less_Tree_Unit extends Less_Tree { - var $numerator = array(); - var $denominator = array(); + var $numerator = []; + var $denominator = []; public $backupUnit; public $type = 'Unit'; - public function __construct($numerator = array(), $denominator = array(), $backupUnit = null ){ + public function __construct( $numerator = [], $denominator = [], $backupUnit = null ) { $this->numerator = $numerator; $this->denominator = $denominator; $this->backupUnit = $backupUnit; } - public function __clone(){ + public function __clone() { } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ - - if( $this->numerator ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { + if ( $this->numerator ) { $output->add( $this->numerator[0] ); - }elseif( $this->denominator ){ + } elseif ( $this->denominator ) { $output->add( $this->denominator[0] ); - }elseif( !Less_Parser::$options['strictUnits'] && $this->backupUnit ){ + } elseif ( !Less_Parser::$options['strictUnits'] && $this->backupUnit ) { $output->add( $this->backupUnit ); - return ; + return; } } - public function toString(){ - $returnStr = implode('*',$this->numerator); - foreach($this->denominator as $d){ - $returnStr .= '/'.$d; + public function toString() { + $returnStr = implode( '*', $this->numerator ); + foreach ( $this->denominator as $d ) { + $returnStr .= '/' . $d; } return $returnStr; } - public function __toString(){ + public function __toString() { return $this->toString(); } - /** * @param Less_Tree_Unit $other */ - public function compare($other) { + public function compare( $other ) { return $this->is( $other->toString() ) ? 0 : -1; } - public function is($unitString){ + public function is( $unitString ) { return $this->toString() === $unitString; } - public function isLength(){ + public function isLength() { $css = $this->toCSS(); - return !!preg_match('/px|em|%|in|cm|mm|pc|pt|ex/',$css); + return (bool)preg_match( '/px|em|%|in|cm|mm|pc|pt|ex/', $css ); } - public function isAngle() { + public function isAngle() { return isset( Less_Tree_UnitConversions::$angle[$this->toCSS()] ); } - public function isEmpty(){ + public function isEmpty() { return !$this->numerator && !$this->denominator; } - public function isSingular() { - return count($this->numerator) <= 1 && !$this->denominator; + public function isSingular() { + return count( $this->numerator ) <= 1 && !$this->denominator; } + public function usedUnits() { + $result = []; - public function usedUnits(){ - $result = array(); - - foreach(Less_Tree_UnitConversions::$groups as $groupName){ + foreach ( Less_Tree_UnitConversions::$groups as $groupName ) { $group = Less_Tree_UnitConversions::${$groupName}; - foreach($this->numerator as $atomicUnit){ - if( isset($group[$atomicUnit]) && !isset($result[$groupName]) ){ + foreach ( $this->numerator as $atomicUnit ) { + if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) { $result[$groupName] = $atomicUnit; } } - foreach($this->denominator as $atomicUnit){ - if( isset($group[$atomicUnit]) && !isset($result[$groupName]) ){ + foreach ( $this->denominator as $atomicUnit ) { + if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) { $result[$groupName] = $atomicUnit; } } @@ -101,47 +94,45 @@ class Less_Tree_Unit extends Less_Tree{ return $result; } - public function cancel(){ - $counter = array(); + public function cancel() { + $counter = []; $backup = null; - foreach($this->numerator as $atomicUnit){ - if( !$backup ){ + foreach ( $this->numerator as $atomicUnit ) { + if ( !$backup ) { $backup = $atomicUnit; } - $counter[$atomicUnit] = ( isset($counter[$atomicUnit]) ? $counter[$atomicUnit] : 0) + 1; + $counter[$atomicUnit] = ( $counter[$atomicUnit] ?? 0 ) + 1; } - foreach($this->denominator as $atomicUnit){ - if( !$backup ){ + foreach ( $this->denominator as $atomicUnit ) { + if ( !$backup ) { $backup = $atomicUnit; } - $counter[$atomicUnit] = ( isset($counter[$atomicUnit]) ? $counter[$atomicUnit] : 0) - 1; + $counter[$atomicUnit] = ( $counter[$atomicUnit] ?? 0 ) - 1; } - $this->numerator = array(); - $this->denominator = array(); + $this->numerator = []; + $this->denominator = []; - foreach($counter as $atomicUnit => $count){ - if( $count > 0 ){ - for( $i = 0; $i < $count; $i++ ){ + foreach ( $counter as $atomicUnit => $count ) { + if ( $count > 0 ) { + for ( $i = 0; $i < $count; $i++ ) { $this->numerator[] = $atomicUnit; } - }elseif( $count < 0 ){ - for( $i = 0; $i < -$count; $i++ ){ + } elseif ( $count < 0 ) { + for ( $i = 0; $i < -$count; $i++ ) { $this->denominator[] = $atomicUnit; } } } - if( !$this->numerator && !$this->denominator && $backup ){ + if ( !$this->numerator && !$this->denominator && $backup ) { $this->backupUnit = $backup; } - sort($this->numerator); - sort($this->denominator); + sort( $this->numerator ); + sort( $this->denominator ); } - } - diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php b/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php index c86b2907b..31efe1ccf 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/UnitConversions.php @@ -1,35 +1,31 @@ <?php - /** - * UnitConversions - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_UnitConversions{ +class Less_Tree_UnitConversions { - public static $groups = array('length','duration','angle'); + public static $groups = [ 'length','duration','angle' ]; - public static $length = array( - 'm'=> 1, - 'cm'=> 0.01, - 'mm'=> 0.001, - 'in'=> 0.0254, - 'px'=> 0.000264583, // 0.0254 / 96, - 'pt'=> 0.000352778, // 0.0254 / 72, - 'pc'=> 0.004233333, // 0.0254 / 72 * 12 - ); + public static $length = [ + 'm' => 1, + 'cm' => 0.01, + 'mm' => 0.001, + 'in' => 0.0254, + 'px' => 0.000264583, // 0.0254 / 96, + 'pt' => 0.000352778, // 0.0254 / 72, + 'pc' => 0.004233333, // 0.0254 / 72 * 12 + ]; - public static $duration = array( - 's'=> 1, - 'ms'=> 0.001 - ); + public static $duration = [ + 's' => 1, + 'ms' => 0.001 + ]; - public static $angle = array( + public static $angle = [ 'rad' => 0.1591549430919, // 1/(2*M_PI), 'deg' => 0.002777778, // 1/360, - 'grad'=> 0.0025, // 1/400, - 'turn'=> 1 - ); + 'grad' => 0.0025, // 1/400, + 'turn' => 1 + ]; -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Url.php b/vendor/wikimedia/less.php/lib/Less/Tree/Url.php index ef9c3c68c..6ae3518e9 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Url.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Url.php @@ -1,12 +1,8 @@ <?php - /** - * Url - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Url extends Less_Tree{ +class Less_Tree_Url extends Less_Tree { public $attrs; public $value; @@ -14,63 +10,68 @@ class Less_Tree_Url extends Less_Tree{ public $isEvald; public $type = 'Url'; - public function __construct($value, $currentFileInfo = null, $isEvald = null){ + /** + * @param Less_Tree_Variable|Less_Tree_Quoted|Less_Tree_Anonymous $value + * @param array|null $currentFileInfo + * @param bool|null $isEvald + */ + public function __construct( $value, $currentFileInfo = null, $isEvald = null ) { $this->value = $value; $this->currentFileInfo = $currentFileInfo; $this->isEvald = $isEvald; } - public function accept( $visitor ){ - $this->value = $visitor->visitObj($this->value); + public function accept( $visitor ) { + $this->value = $visitor->visitObj( $this->value ); } - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output ){ + /** + * @see Less_Tree::genCSS + */ + public function genCSS( $output ) { $output->add( 'url(' ); $this->value->genCSS( $output ); $output->add( ')' ); } /** - * @param Less_Functions $ctx + * @param Less_Environment $ctx */ - public function compile($ctx){ - $val = $this->value->compile($ctx); + public function compile( $ctx ) { + $val = $this->value->compile( $ctx ); - if( !$this->isEvald ){ + if ( !$this->isEvald ) { // Add the base path if the URL is relative - if( Less_Parser::$options['relativeUrls'] + if ( Less_Parser::$options['relativeUrls'] && $this->currentFileInfo - && is_string($val->value) - && Less_Environment::isPathRelative($val->value) - ){ + && is_string( $val->value ) + && Less_Environment::isPathRelative( $val->value ) + ) { $rootpath = $this->currentFileInfo['uri_root']; - if ( !$val->quote ){ - $rootpath = preg_replace('/[\(\)\'"\s]/', '\\$1', $rootpath ); + if ( !$val->quote ) { + $rootpath = preg_replace( '/[\(\)\'"\s]/', '\\$1', $rootpath ); } $val->value = $rootpath . $val->value; } - $val->value = Less_Environment::normalizePath( $val->value); + $val->value = Less_Environment::normalizePath( $val->value ); } // Add cache buster if enabled - if( Less_Parser::$options['urlArgs'] ){ - if( !preg_match('/^\s*data:/',$val->value) ){ - $delimiter = strpos($val->value,'?') === false ? '?' : '&'; + if ( Less_Parser::$options['urlArgs'] ) { + if ( !preg_match( '/^\s*data:/', $val->value ) ) { + $delimiter = strpos( $val->value, '?' ) === false ? '?' : '&'; $urlArgs = $delimiter . Less_Parser::$options['urlArgs']; - $hash_pos = strpos($val->value,'#'); - if( $hash_pos !== false ){ - $val->value = substr_replace($val->value,$urlArgs, $hash_pos, 0); + $hash_pos = strpos( $val->value, '#' ); + if ( $hash_pos !== false ) { + $val->value = substr_replace( $val->value, $urlArgs, $hash_pos, 0 ); } else { $val->value .= $urlArgs; } } } - return new Less_Tree_URL($val, $this->currentFileInfo, true); + return new Less_Tree_URL( $val, $this->currentFileInfo, true ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Value.php b/vendor/wikimedia/less.php/lib/Less/Tree/Value.php index 9f077bc56..bf45caf36 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Value.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Value.php @@ -1,45 +1,43 @@ <?php - /** - * Value - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Value extends Less_Tree{ +class Less_Tree_Value extends Less_Tree { public $type = 'Value'; public $value; - public function __construct($value){ + /** + * @param array<Less_Tree> $value + */ + public function __construct( $value ) { $this->value = $value; } - public function accept($visitor) { - $this->value = $visitor->visitArray($this->value); + public function accept( $visitor ) { + $this->value = $visitor->visitArray( $this->value ); } - public function compile($env){ - - $ret = array(); + public function compile( $env ) { + $ret = []; $i = 0; - foreach($this->value as $i => $v){ - $ret[] = $v->compile($env); + foreach ( $this->value as $i => $v ) { + $ret[] = $v->compile( $env ); } - if( $i > 0 ){ - return new Less_Tree_Value($ret); + if ( $i > 0 ) { + return new Less_Tree_Value( $ret ); } return $ret[0]; } - /** - * @see Less_Tree::genCSS - */ - function genCSS( $output ){ - $len = count($this->value); - for($i = 0; $i < $len; $i++ ){ + /** + * @see Less_Tree::genCSS + */ + function genCSS( $output ) { + $len = count( $this->value ); + for ( $i = 0; $i < $len; $i++ ) { $this->value[$i]->genCSS( $output ); - if( $i+1 < $len ){ + if ( $i + 1 < $len ) { $output->add( Less_Environment::$_outputMap[','] ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php b/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php index cc0182cde..dcb1823ad 100644 --- a/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php +++ b/vendor/wikimedia/less.php/lib/Less/Tree/Variable.php @@ -1,12 +1,8 @@ <?php - /** - * Variable - * - * @package Less - * @subpackage tree + * @private */ -class Less_Tree_Variable extends Less_Tree{ +class Less_Tree_Variable extends Less_Tree { public $name; public $index; @@ -14,39 +10,47 @@ class Less_Tree_Variable extends Less_Tree{ public $evaluating = false; public $type = 'Variable'; - /** - * @param string $name - */ - public function __construct($name, $index = null, $currentFileInfo = null) { - $this->name = $name; - $this->index = $index; + /** + * @param string $name + */ + public function __construct( $name, $index = null, $currentFileInfo = null ) { + $this->name = $name; + $this->index = $index; $this->currentFileInfo = $currentFileInfo; - } + } - public function compile($env) { - - if( $this->name[1] === '@' ){ - $v = new Less_Tree_Variable(substr($this->name, 1), $this->index + 1, $this->currentFileInfo); - $name = '@' . $v->compile($env)->value; - }else{ + /** + * @param Less_Environment $env + * @return Less_Tree + * @see less-2.5.3.js#Ruleset.prototype.eval + */ + public function compile( $env ) { + if ( $this->name[1] === '@' ) { + $v = new Less_Tree_Variable( substr( $this->name, 1 ), $this->index + 1, $this->currentFileInfo ); + // While some Less_Tree nodes have no 'value', we know these can't ocurr after a variable + // assignment (would have been a ParseError). + // TODO: Solve better (https://phabricator.wikimedia.org/T327082). + // @phan-suppress-next-line PhanUndeclaredProperty + $name = '@' . $v->compile( $env )->value; + } else { $name = $this->name; } - if ($this->evaluating) { - throw new Less_Exception_Compiler("Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo); + if ( $this->evaluating ) { + throw new Less_Exception_Compiler( "Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo ); } $this->evaluating = true; - foreach($env->frames as $frame){ - if( $v = $frame->variable($name) ){ - $r = $v->value->compile($env); + foreach ( $env->frames as $frame ) { + if ( $v = $frame->variable( $name ) ) { + $r = $v->value->compile( $env ); $this->evaluating = false; return $r; } } - throw new Less_Exception_Compiler("variable " . $name . " is undefined in file ".$this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo); + throw new Less_Exception_Compiler( "variable " . $name . " is undefined in file " . $this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo ); } } diff --git a/vendor/wikimedia/less.php/lib/Less/Version.php b/vendor/wikimedia/less.php/lib/Less/Version.php index 388594983..1c96e8e08 100644 --- a/vendor/wikimedia/less.php/lib/Less/Version.php +++ b/vendor/wikimedia/less.php/lib/Less/Version.php @@ -2,14 +2,11 @@ /** * Release numbers - * - * @package Less - * @subpackage version */ -class Less_Version{ +class Less_Version { - const version = '1.8.3'; // The current build number of less.php - const less_version = '2.5.3'; // The less.js version that this build should be compatible with - const cache_version = '253'; // The parser cache version + public const version = '3.2.1'; // The current build number of less.php + public const less_version = '2.5.3'; // The less.js version that this build should be compatible with + public const cache_version = '253'; // The parser cache version } diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor.php b/vendor/wikimedia/less.php/lib/Less/Visitor.php index d85f1d910..582f3233c 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor.php @@ -1,49 +1,44 @@ <?php - /** - * Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_Visitor{ +class Less_Visitor { - protected $methods = array(); - protected $_visitFnCache = array(); + protected $methods = []; + protected $_visitFnCache = []; - public function __construct(){ - $this->_visitFnCache = get_class_methods(get_class($this)); - $this->_visitFnCache = array_flip($this->_visitFnCache); + public function __construct() { + $this->_visitFnCache = get_class_methods( get_class( $this ) ); + $this->_visitFnCache = array_flip( $this->_visitFnCache ); } - public function visitObj( $node ){ - - $funcName = 'visit'.$node->type; - if( isset($this->_visitFnCache[$funcName]) ){ + public function visitObj( $node ) { + $funcName = 'visit' . $node->type; + if ( isset( $this->_visitFnCache[$funcName] ) ) { $visitDeeper = true; $this->$funcName( $node, $visitDeeper ); - if( $visitDeeper ){ - $node->accept($this); + if ( $visitDeeper ) { + $node->accept( $this ); } - $funcName = $funcName . "Out"; - if( isset($this->_visitFnCache[$funcName]) ){ + $funcName .= "Out"; + if ( isset( $this->_visitFnCache[$funcName] ) ) { $this->$funcName( $node ); } - }else{ - $node->accept($this); + } else { + $node->accept( $this ); } return $node; } - public function visitArray( $nodes ){ - - array_map( array($this,'visitObj'), $nodes); + public function visitArray( $nodes ) { + foreach ( $nodes as $node ) { + $this->visitObj( $node ); + } return $nodes; } } - diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php b/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php index 22b3aac99..8b3238da3 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/extendFinder.php @@ -1,114 +1,105 @@ <?php - /** - * Extend Finder Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_Visitor_extendFinder extends Less_Visitor{ +class Less_Visitor_extendFinder extends Less_Visitor { - public $contexts = array(); + public $contexts = []; public $allExtendsStack; public $foundExtends; - public function __construct(){ - $this->contexts = array(); - $this->allExtendsStack = array(array()); + public function __construct() { + $this->contexts = []; + $this->allExtendsStack = [ [] ]; parent::__construct(); } /** * @param Less_Tree_Ruleset $root */ - public function run($root){ - $root = $this->visitObj($root); + public function run( $root ) { + $root = $this->visitObj( $root ); $root->allExtends =& $this->allExtendsStack[0]; return $root; } - public function visitRule($ruleNode, &$visitDeeper ){ + public function visitRule( $ruleNode, &$visitDeeper ) { $visitDeeper = false; } - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { $visitDeeper = false; } - public function visitRuleset($rulesetNode){ - - if( $rulesetNode->root ){ + public function visitRuleset( $rulesetNode ) { + if ( $rulesetNode->root ) { return; } - $allSelectorsExtendList = array(); + $allSelectorsExtendList = []; // get &:extend(.a); rules which apply to all selectors in this ruleset - if( $rulesetNode->rules ){ - foreach($rulesetNode->rules as $rule){ - if( $rule instanceof Less_Tree_Extend ){ + if ( $rulesetNode->rules ) { + foreach ( $rulesetNode->rules as $rule ) { + if ( $rule instanceof Less_Tree_Extend ) { $allSelectorsExtendList[] = $rule; $rulesetNode->extendOnEveryPath = true; } } } - // now find every selector and apply the extends that apply to all extends // and the ones which apply to an individual extend - foreach($rulesetNode->paths as $selectorPath){ - $selector = end($selectorPath); //$selectorPath[ count($selectorPath)-1]; + foreach ( $rulesetNode->paths as $selectorPath ) { + $selector = end( $selectorPath ); // $selectorPath[ count($selectorPath)-1]; $j = 0; - foreach($selector->extendList as $extend){ - $this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j); + foreach ( $selector->extendList as $extend ) { + $this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j ); } - foreach($allSelectorsExtendList as $extend){ - $this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j); + foreach ( $allSelectorsExtendList as $extend ) { + $this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j ); } } $this->contexts[] = $rulesetNode->selectors; } - public function allExtendsStackPush($rulesetNode, $selectorPath, $extend, &$j){ + public function allExtendsStackPush( $rulesetNode, $selectorPath, $extend, &$j ) { $this->foundExtends = true; $extend = clone $extend; $extend->findSelfSelectors( $selectorPath ); $extend->ruleset = $rulesetNode; - if( $j === 0 ){ + if ( $j === 0 ) { $extend->firstExtendOnThisSelectorPath = true; } - $end_key = count($this->allExtendsStack)-1; + $end_key = count( $this->allExtendsStack ) - 1; $this->allExtendsStack[$end_key][] = $extend; $j++; } - - public function visitRulesetOut( $rulesetNode ){ - if( !is_object($rulesetNode) || !$rulesetNode->root ){ - array_pop($this->contexts); + public function visitRulesetOut( $rulesetNode ) { + if ( !is_object( $rulesetNode ) || !$rulesetNode->root ) { + array_pop( $this->contexts ); } } - public function visitMedia( $mediaNode ){ - $mediaNode->allExtends = array(); + public function visitMedia( $mediaNode ) { + $mediaNode->allExtends = []; $this->allExtendsStack[] =& $mediaNode->allExtends; } - public function visitMediaOut(){ - array_pop($this->allExtendsStack); + public function visitMediaOut() { + array_pop( $this->allExtendsStack ); } - public function visitDirective( $directiveNode ){ - $directiveNode->allExtends = array(); + public function visitDirective( $directiveNode ) { + $directiveNode->allExtends = []; $this->allExtendsStack[] =& $directiveNode->allExtends; } - public function visitDirectiveOut(){ - array_pop($this->allExtendsStack); + public function visitDirectiveOut() { + array_pop( $this->allExtendsStack ); } } - - diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/import.php b/vendor/wikimedia/less.php/lib/Less/Visitor/import.php index f79a36dac..7af96ebd1 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor/import.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/import.php @@ -135,5 +135,3 @@ class Less_Visitor_import extends Less_VisitorReplacing{ } */ - - diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php b/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php index f62af1a98..a10683048 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/joinSelector.php @@ -1,70 +1,67 @@ <?php - /** - * Join Selector Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_Visitor_joinSelector extends Less_Visitor{ +class Less_Visitor_joinSelector extends Less_Visitor { - public $contexts = array( array() ); + public $contexts = [ [] ]; /** * @param Less_Tree_Ruleset $root */ - public function run( $root ){ - return $this->visitObj($root); + public function run( $root ) { + return $this->visitObj( $root ); } - public function visitRule( $ruleNode, &$visitDeeper ){ + public function visitRule( $ruleNode, &$visitDeeper ) { $visitDeeper = false; } - public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ + public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { $visitDeeper = false; } - public function visitRuleset( $rulesetNode ){ + public function visitRuleset( $rulesetNode ) { + $context = end( $this->contexts ); + $paths = []; - $paths = array(); - - if( !$rulesetNode->root ){ - $selectors = array(); - - if( $rulesetNode->selectors && $rulesetNode->selectors ){ - foreach($rulesetNode->selectors as $selector){ - if( $selector->getIsOutput() ){ - $selectors[] = $selector; + if ( !$rulesetNode->root ) { + $selectors = $rulesetNode->selectors; + if ( $selectors !== null ) { + $filtered = []; + foreach ( $selectors as $selector ) { + if ( $selector->getIsOutput() ) { + $filtered[] = $selector; } } + $selectors = $rulesetNode->selectors = $filtered ?: null; + if ( $selectors ) { + $paths = $rulesetNode->joinSelectors( $context, $selectors ); + } } - if( !$selectors ){ - $rulesetNode->selectors = null; + if ( $selectors === null ) { $rulesetNode->rules = null; - }else{ - $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; - $paths = $rulesetNode->joinSelectors( $context, $selectors); } $rulesetNode->paths = $paths; } - $this->contexts[] = $paths; //different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths + // NOTE: Assigned here instead of at the start like less.js, + // because PHP arrays aren't by-ref + $this->contexts[] = $paths; } - public function visitRulesetOut(){ - array_pop($this->contexts); + public function visitRulesetOut() { + array_pop( $this->contexts ); } - public function visitMedia($mediaNode) { - $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; + public function visitMedia( $mediaNode ) { + $context = end( $this->contexts ); - if( !count($context) || (is_object($context[0]) && $context[0]->multiMedia) ){ + if ( count( $context ) === 0 || ( is_object( $context[0] ) && $context[0]->multiMedia ) ) { $mediaNode->rules[0]->root = true; } } } - diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php b/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php index bb5f08246..9491f3c65 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/processExtends.php @@ -1,34 +1,30 @@ <?php - /** - * Process Extends Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_Visitor_processExtends extends Less_Visitor{ +class Less_Visitor_processExtends extends Less_Visitor { public $allExtendsStack; /** * @param Less_Tree_Ruleset $root */ - public function run( $root ){ + public function run( $root ) { $extendFinder = new Less_Visitor_extendFinder(); $extendFinder->run( $root ); - if( !$extendFinder->foundExtends){ + if ( !$extendFinder->foundExtends ) { return $root; } - $root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends); + $root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends ); - $this->allExtendsStack = array(); + $this->allExtendsStack = []; $this->allExtendsStack[] = &$root->allExtends; return $this->visitObj( $root ); } - private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0){ + private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0 ) { // // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting // the selector we would do normally, but we are also adding an extend with the same target selector @@ -38,59 +34,57 @@ class Less_Visitor_processExtends extends Less_Visitor{ // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already processed if // we look at each selector at a time, as is done in visitRuleset - $extendsToAdd = array(); + $extendsToAdd = []; - - //loop through comparing every extend with every target extend. + // loop through comparing every extend with every target extend. // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one // and the second is the target. // the separation into two lists allows us to process a subset of chains with a bigger set, as is the // case when processing media queries - for( $extendIndex = 0, $extendsList_len = count($extendsList); $extendIndex < $extendsList_len; $extendIndex++ ){ - for( $targetExtendIndex = 0; $targetExtendIndex < count($extendsListTarget); $targetExtendIndex++ ){ + for ( $extendIndex = 0, $extendsList_len = count( $extendsList ); $extendIndex < $extendsList_len; $extendIndex++ ) { + for ( $targetExtendIndex = 0; $targetExtendIndex < count( $extendsListTarget ); $targetExtendIndex++ ) { $extend = $extendsList[$extendIndex]; $targetExtend = $extendsListTarget[$targetExtendIndex]; - // look for circular references - if( in_array($targetExtend->object_id, $extend->parent_ids,true) ){ + // Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14> + if ( \array_key_exists( $targetExtend->object_id, $extend->parent_ids ) ) { + // ignore circular references continue; } // find a match in the target extends self selector (the bit before :extend) - $selectorPath = array( $targetExtend->selfSelectors[0] ); - $matches = $this->findMatch( $extend, $selectorPath); + $selectorPath = [ $targetExtend->selfSelectors[0] ]; + $matches = $this->findMatch( $extend, $selectorPath ); - - if( $matches ){ + if ( $matches ) { // we found a match, so for each self selector.. - foreach($extend->selfSelectors as $selfSelector ){ - + foreach ( $extend->selfSelectors as $selfSelector ) { // process the extend as usual - $newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector); + $newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector ); // but now we create a new extend from it - $newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0); + $newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0 ); $newExtend->selfSelectors = $newSelector; // add the extend onto the list of extends for that selector - end($newSelector)->extendList = array($newExtend); - //$newSelector[ count($newSelector)-1]->extendList = array($newExtend); + end( $newSelector )->extendList = [ $newExtend ]; + // $newSelector[ count($newSelector)-1]->extendList = array($newExtend); // record that we need to add it. $extendsToAdd[] = $newExtend; $newExtend->ruleset = $targetExtend->ruleset; - //remember its parents for circular references - $newExtend->parent_ids = array_merge($newExtend->parent_ids,$targetExtend->parent_ids,$extend->parent_ids); + // remember its parents for circular references + $newExtend->parent_ids = array_merge( $newExtend->parent_ids, $targetExtend->parent_ids, $extend->parent_ids ); // only process the selector once.. if we have :extend(.a,.b) then multiple // extends will look at the same selector path, so when extending // we know that any others will be duplicates in terms of what is added to the css - if( $targetExtend->firstExtendOnThisSelectorPath ){ + if ( $targetExtend->firstExtendOnThisSelectorPath ) { $newExtend->firstExtendOnThisSelectorPath = true; $targetExtend->ruleset->paths[] = $newSelector; } @@ -99,151 +93,144 @@ class Less_Visitor_processExtends extends Less_Visitor{ } } - if( $extendsToAdd ){ + if ( $extendsToAdd ) { // try to detect circular references to stop a stack overflow. // may no longer be needed. $this->extendChainCount++; - if( $iterationCount > 100) { + if ( $iterationCount > 100 ) { try{ $selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS(); $selectorTwo = $extendsToAdd[0]->selector->toCSS(); - }catch(Exception $e){ + }catch ( Exception $e ) { $selectorOne = "{unable to calculate}"; $selectorTwo = "{unable to calculate}"; } - throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")"); + throw new Less_Exception_Parser( "extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")" ); } // now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e... - $extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount+1); + $extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount + 1 ); } - return array_merge($extendsList, $extendsToAdd); + return array_merge( $extendsList, $extendsToAdd ); } - - protected function visitRule( $ruleNode, &$visitDeeper ){ + protected function visitRule( $ruleNode, &$visitDeeper ) { $visitDeeper = false; } - protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ + protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) { $visitDeeper = false; } - protected function visitSelector( $selectorNode, &$visitDeeper ){ + protected function visitSelector( $selectorNode, &$visitDeeper ) { $visitDeeper = false; } - protected function visitRuleset($rulesetNode){ - - - if( $rulesetNode->root ){ + protected function visitRuleset( $rulesetNode ) { + if ( $rulesetNode->root ) { return; } - $allExtends = end($this->allExtendsStack); - $paths_len = count($rulesetNode->paths); + $allExtends = end( $this->allExtendsStack ); + $paths_len = count( $rulesetNode->paths ); // look at each selector path in the ruleset, find any extend matches and then copy, find and replace - foreach($allExtends as $allExtend){ - for($pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ){ + foreach ( $allExtends as $allExtend ) { + for ( $pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ) { // extending extends happens initially, before the main pass - if( isset($rulesetNode->extendOnEveryPath) && $rulesetNode->extendOnEveryPath ){ + if ( isset( $rulesetNode->extendOnEveryPath ) && $rulesetNode->extendOnEveryPath ) { continue; } $selectorPath = $rulesetNode->paths[$pathIndex]; - if( end($selectorPath)->extendList ){ + if ( end( $selectorPath )->extendList ) { continue; } - $this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath); + $this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath ); } } } + private function ExtendMatch( $rulesetNode, $extend, $selectorPath ) { + $matches = $this->findMatch( $extend, $selectorPath ); - private function ExtendMatch( $rulesetNode, $extend, $selectorPath ){ - $matches = $this->findMatch($extend, $selectorPath); - - if( $matches ){ - foreach($extend->selfSelectors as $selfSelector ){ - $rulesetNode->paths[] = $this->extendSelector($matches, $selectorPath, $selfSelector); + if ( $matches ) { + foreach ( $extend->selfSelectors as $selfSelector ) { + $rulesetNode->paths[] = $this->extendSelector( $matches, $selectorPath, $selfSelector ); } } } - - - private function findMatch($extend, $haystackSelectorPath ){ - - - if( !$this->HasMatches($extend, $haystackSelectorPath) ){ + /** + * @param Less_Tree_Extend $extend + * @param Less_Tree_Selector[] $haystackSelectorPath + * @return false|array<array{index:int,initialCombinator:string}> + */ + private function findMatch( $extend, $haystackSelectorPath ) { + if ( !$this->HasMatches( $extend, $haystackSelectorPath ) ) { return false; } - // // look through the haystack selector path to try and find the needle - extend.selector // returns an array of selector matches that can then be replaced // $needleElements = $extend->selector->elements; - $potentialMatches = array(); + $potentialMatches = []; $potentialMatches_len = 0; $potentialMatch = null; - $matches = array(); - - + $matches = []; // loop through the haystack elements - $haystack_path_len = count($haystackSelectorPath); - for($haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ){ + $haystack_path_len = count( $haystackSelectorPath ); + for ( $haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ) { $hackstackSelector = $haystackSelectorPath[$haystackSelectorIndex]; - $haystack_elements_len = count($hackstackSelector->elements); - for($hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ){ + $haystack_elements_len = count( $hackstackSelector->elements ); + for ( $hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ) { $haystackElement = $hackstackSelector->elements[$hackstackElementIndex]; // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. - if( $extend->allowBefore || ($haystackSelectorIndex === 0 && $hackstackElementIndex === 0) ){ - $potentialMatches[] = array('pathIndex'=> $haystackSelectorIndex, 'index'=> $hackstackElementIndex, 'matched'=> 0, 'initialCombinator'=> $haystackElement->combinator); + if ( $extend->allowBefore || ( $haystackSelectorIndex === 0 && $hackstackElementIndex === 0 ) ) { + $potentialMatches[] = [ 'pathIndex' => $haystackSelectorIndex, 'index' => $hackstackElementIndex, 'matched' => 0, 'initialCombinator' => $haystackElement->combinator ]; $potentialMatches_len++; } - for($i = 0; $i < $potentialMatches_len; $i++ ){ + for ( $i = 0; $i < $potentialMatches_len; $i++ ) { $potentialMatch = &$potentialMatches[$i]; $potentialMatch = $this->PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ); - // if we are still valid and have finished, test whether we have elements after and whether these are allowed - if( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ){ + if ( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ) { $potentialMatch['finished'] = true; - if( !$extend->allowAfter && ($hackstackElementIndex+1 < $haystack_elements_len || $haystackSelectorIndex+1 < $haystack_path_len) ){ + if ( !$extend->allowAfter && ( $hackstackElementIndex + 1 < $haystack_elements_len || $haystackSelectorIndex + 1 < $haystack_path_len ) ) { $potentialMatch = null; } } // if null we remove, if not, we are still valid, so either push as a valid match or continue - if( $potentialMatch ){ - if( $potentialMatch['finished'] ){ + if ( $potentialMatch ) { + if ( $potentialMatch['finished'] ) { $potentialMatch['length'] = $extend->selector->elements_len; $potentialMatch['endPathIndex'] = $haystackSelectorIndex; $potentialMatch['endPathElementIndex'] = $hackstackElementIndex + 1; // index after end of match - $potentialMatches = array(); // we don't allow matches to overlap, so start matching again + $potentialMatches = []; // we don't allow matches to overlap, so start matching again $potentialMatches_len = 0; $matches[] = $potentialMatch; } continue; } - array_splice($potentialMatches, $i, 1); + array_splice( $potentialMatches, $i, 1 ); $potentialMatches_len--; $i--; } @@ -253,23 +240,22 @@ class Less_Visitor_processExtends extends Less_Visitor{ return $matches; } - // Before going through all the nested loops, lets check to see if a match is possible // Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s - private function HasMatches($extend, $haystackSelectorPath){ - - if( !$extend->selector->cacheable ){ + private function HasMatches( $extend, $haystackSelectorPath ) { + if ( !$extend->selector->cacheable ) { return true; } $first_el = $extend->selector->_oelements[0]; - foreach($haystackSelectorPath as $hackstackSelector){ - if( !$hackstackSelector->cacheable ){ + foreach ( $haystackSelectorPath as $hackstackSelector ) { + if ( !$hackstackSelector->cacheable ) { return true; } - if( in_array($first_el, $hackstackSelector->_oelements) ){ + // Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14> + if ( \array_key_exists( $first_el, $hackstackSelector->_oelements_assoc ) ) { return true; } } @@ -277,30 +263,27 @@ class Less_Visitor_processExtends extends Less_Visitor{ return false; } - /** - * @param integer $hackstackElementIndex + * @param int $hackstackElementIndex */ - private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ){ - - - if( $potentialMatch['matched'] > 0 ){ + private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ) { + if ( $potentialMatch['matched'] > 0 ) { // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out // what the resulting combinator will be $targetCombinator = $haystackElement->combinator; - if( $targetCombinator === '' && $hackstackElementIndex === 0 ){ + if ( $targetCombinator === '' && $hackstackElementIndex === 0 ) { $targetCombinator = ' '; } - if( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ){ + if ( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ) { return null; } } // if we don't match, null our match to indicate failure - if( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value) ){ + if ( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value ) ) { return null; } @@ -310,49 +293,50 @@ class Less_Visitor_processExtends extends Less_Visitor{ return $potentialMatch; } - - private function isElementValuesEqual( $elementValue1, $elementValue2 ){ - - if( $elementValue1 === $elementValue2 ){ + /** + * @param string|Less_Tree_Attribute|Less_Tree_Dimension|Less_Tree_Keyword $elementValue1 + * @param string|Less_Tree_Attribute|Less_Tree_Dimension|Less_Tree_Keyword $elementValue2 + * @return bool + */ + private function isElementValuesEqual( $elementValue1, $elementValue2 ) { + if ( $elementValue1 === $elementValue2 ) { return true; } - if( is_string($elementValue1) || is_string($elementValue2) ) { + if ( is_string( $elementValue1 ) || is_string( $elementValue2 ) ) { return false; } - if( $elementValue1 instanceof Less_Tree_Attribute ){ + if ( $elementValue1 instanceof Less_Tree_Attribute ) { return $this->isAttributeValuesEqual( $elementValue1, $elementValue2 ); } $elementValue1 = $elementValue1->value; - if( $elementValue1 instanceof Less_Tree_Selector ){ + if ( $elementValue1 instanceof Less_Tree_Selector ) { return $this->isSelectorValuesEqual( $elementValue1, $elementValue2 ); } return false; } - /** * @param Less_Tree_Selector $elementValue1 */ - private function isSelectorValuesEqual( $elementValue1, $elementValue2 ){ - + private function isSelectorValuesEqual( $elementValue1, $elementValue2 ) { $elementValue2 = $elementValue2->value; - if( !($elementValue2 instanceof Less_Tree_Selector) || $elementValue1->elements_len !== $elementValue2->elements_len ){ + if ( !( $elementValue2 instanceof Less_Tree_Selector ) || $elementValue1->elements_len !== $elementValue2->elements_len ) { return false; } - for( $i = 0; $i < $elementValue1->elements_len; $i++ ){ + for ( $i = 0; $i < $elementValue1->elements_len; $i++ ) { - if( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ){ - if( $i !== 0 || ($elementValue1->elements[$i]->combinator || ' ') !== ($elementValue2->elements[$i]->combinator || ' ') ){ + if ( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ) { + if ( $i !== 0 || ( $elementValue1->elements[$i]->combinator || ' ' ) !== ( $elementValue2->elements[$i]->combinator || ' ' ) ) { return false; } } - if( !$this->isElementValuesEqual($elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value) ){ + if ( !$this->isElementValuesEqual( $elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value ) ) { return false; } } @@ -360,41 +344,36 @@ class Less_Visitor_processExtends extends Less_Visitor{ return true; } - /** * @param Less_Tree_Attribute $elementValue1 */ - private function isAttributeValuesEqual( $elementValue1, $elementValue2 ){ - - if( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ){ + private function isAttributeValuesEqual( $elementValue1, $elementValue2 ) { + if ( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ) { return false; } - if( !$elementValue1->value || !$elementValue2->value ){ - if( $elementValue1->value || $elementValue2->value ) { + if ( !$elementValue1->value || !$elementValue2->value ) { + if ( $elementValue1->value || $elementValue2->value ) { return false; } return true; } - $elementValue1 = ($elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value ); - $elementValue2 = ($elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value ); + $elementValue1 = ( $elementValue1->value->value ?: $elementValue1->value ); + $elementValue2 = ( $elementValue2->value->value ?: $elementValue2->value ); return $elementValue1 === $elementValue2; } - - private function extendSelector($matches, $selectorPath, $replacementSelector){ - - //for a set of matches, replace each match with the replacement selector + private function extendSelector( $matches, $selectorPath, $replacementSelector ) { + // for a set of matches, replace each match with the replacement selector $currentSelectorPathIndex = 0; $currentSelectorPathElementIndex = 0; - $path = array(); - $selectorPath_len = count($selectorPath); - - for($matchIndex = 0, $matches_len = count($matches); $matchIndex < $matches_len; $matchIndex++ ){ + $path = []; + $selectorPath_len = count( $selectorPath ); + for ( $matchIndex = 0, $matches_len = count( $matches ); $matchIndex < $matches_len; $matchIndex++ ) { $match = $matches[$matchIndex]; $selector = $selectorPath[ $match['pathIndex'] ]; @@ -406,64 +385,63 @@ class Less_Visitor_processExtends extends Less_Visitor{ $replacementSelector->elements[0]->currentFileInfo ); - if( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ){ - $last_path = end($path); - $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); + if ( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ) { + $last_path = end( $path ); + $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) ); $currentSelectorPathElementIndex = 0; $currentSelectorPathIndex++; } $newElements = array_merge( - array_slice($selector->elements, $currentSelectorPathElementIndex, ($match['index'] - $currentSelectorPathElementIndex) ) // last parameter of array_slice is different than the last parameter of javascript's slice - , array($firstElement) - , array_slice($replacementSelector->elements,1) + array_slice( $selector->elements, $currentSelectorPathElementIndex, ( $match['index'] - $currentSelectorPathElementIndex ) ), // last parameter of array_slice is different than the last parameter of javascript's slice + [ $firstElement ], + array_slice( $replacementSelector->elements, 1 ) ); - if( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ){ - $last_key = count($path)-1; - $path[$last_key]->elements = array_merge($path[$last_key]->elements,$newElements); - }else{ - $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] )); + if ( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ) { + $last_key = count( $path ) - 1; + $path[$last_key]->elements = array_merge( $path[$last_key]->elements, $newElements ); + } else { + $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] ) ); $path[] = new Less_Tree_Selector( $newElements ); } $currentSelectorPathIndex = $match['endPathIndex']; $currentSelectorPathElementIndex = $match['endPathElementIndex']; - if( $currentSelectorPathElementIndex >= count($selectorPath[$currentSelectorPathIndex]->elements) ){ + if ( $currentSelectorPathElementIndex >= count( $selectorPath[$currentSelectorPathIndex]->elements ) ) { $currentSelectorPathElementIndex = 0; $currentSelectorPathIndex++; } } - if( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ){ - $last_path = end($path); - $last_path->elements = array_merge( $last_path->elements, array_slice($selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex)); + if ( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ) { + $last_path = end( $path ); + $last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) ); $currentSelectorPathIndex++; } $slice_len = $selectorPath_len - $currentSelectorPathIndex; - $path = array_merge($path, array_slice($selectorPath, $currentSelectorPathIndex, $slice_len)); + $path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $slice_len ) ); return $path; } - - protected function visitMedia( $mediaNode ){ - $newAllExtends = array_merge( $mediaNode->allExtends, end($this->allExtendsStack) ); - $this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $mediaNode->allExtends); + protected function visitMedia( $mediaNode ) { + $newAllExtends = array_merge( $mediaNode->allExtends, end( $this->allExtendsStack ) ); + $this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $mediaNode->allExtends ); } - protected function visitMediaOut(){ + protected function visitMediaOut() { array_pop( $this->allExtendsStack ); } - protected function visitDirective( $directiveNode ){ - $newAllExtends = array_merge( $directiveNode->allExtends, end($this->allExtendsStack) ); - $this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $directiveNode->allExtends); + protected function visitDirective( $directiveNode ) { + $newAllExtends = array_merge( $directiveNode->allExtends, end( $this->allExtendsStack ) ); + $this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $directiveNode->allExtends ); } - protected function visitDirectiveOut(){ - array_pop($this->allExtendsStack); + protected function visitDirectiveOut() { + array_pop( $this->allExtendsStack ); } -} \ No newline at end of file +} diff --git a/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php b/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php index 8aaca9637..6c476d294 100644 --- a/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php +++ b/vendor/wikimedia/less.php/lib/Less/Visitor/toCSS.php @@ -1,188 +1,174 @@ <?php - /** - * toCSS Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_Visitor_toCSS extends Less_VisitorReplacing{ +class Less_Visitor_toCSS extends Less_VisitorReplacing { private $charset; - public function __construct(){ + public function __construct() { parent::__construct(); } /** * @param Less_Tree_Ruleset $root */ - public function run( $root ){ - return $this->visitObj($root); + public function run( $root ) { + return $this->visitObj( $root ); } - public function visitRule( $ruleNode ){ - if( $ruleNode->variable ){ - return array(); + public function visitRule( $ruleNode ) { + if ( $ruleNode->variable ) { + return []; } return $ruleNode; } - public function visitMixinDefinition($mixinNode){ + public function visitMixinDefinition( $mixinNode ) { // mixin definitions do not get eval'd - this means they keep state // so we have to clear that state here so it isn't used if toCSS is called twice - $mixinNode->frames = array(); - return array(); + $mixinNode->frames = []; + return []; } - public function visitExtend(){ - return array(); + public function visitExtend() { + return []; } - public function visitComment( $commentNode ){ - if( $commentNode->isSilent() ){ - return array(); + public function visitComment( $commentNode ) { + if ( $commentNode->isSilent() ) { + return []; } return $commentNode; } - public function visitMedia( $mediaNode, &$visitDeeper ){ - $mediaNode->accept($this); + public function visitMedia( $mediaNode, &$visitDeeper ) { + $mediaNode->accept( $this ); $visitDeeper = false; - if( !$mediaNode->rules ){ - return array(); + if ( !$mediaNode->rules ) { + return []; } return $mediaNode; } - public function visitDirective( $directiveNode ){ - if( isset($directiveNode->currentFileInfo['reference']) && (!property_exists($directiveNode,'isReferenced') || !$directiveNode->isReferenced) ){ - return array(); + public function visitDirective( $directiveNode ) { + if ( isset( $directiveNode->currentFileInfo['reference'] ) && ( !property_exists( $directiveNode, 'isReferenced' ) || !$directiveNode->isReferenced ) ) { + return []; } - if( $directiveNode->name === '@charset' ){ + if ( $directiveNode->name === '@charset' ) { // Only output the debug info together with subsequent @charset definitions // a comment (or @media statement) before the actual @charset directive would // be considered illegal css as it has to be on the first line - if( isset($this->charset) && $this->charset ){ + if ( isset( $this->charset ) && $this->charset ) { - //if( $directiveNode->debugInfo ){ + // if( $directiveNode->debugInfo ){ // $comment = new Less_Tree_Comment('/* ' . str_replace("\n",'',$directiveNode->toCSS())." */\n"); // $comment->debugInfo = $directiveNode->debugInfo; // return $this->visit($comment); //} - - return array(); + return []; } $this->charset = true; } return $directiveNode; } - public function checkPropertiesInRoot( $rulesetNode ){ - - if( !$rulesetNode->firstRoot ){ + public function checkPropertiesInRoot( $rulesetNode ) { + if ( !$rulesetNode->firstRoot ) { return; } - foreach($rulesetNode->rules as $ruleNode){ - if( $ruleNode instanceof Less_Tree_Rule && !$ruleNode->variable ){ - $msg = "properties must be inside selector blocks, they cannot be in the root. Index ".$ruleNode->index.($ruleNode->currentFileInfo ? (' Filename: '.$ruleNode->currentFileInfo['filename']) : null); - throw new Less_Exception_Compiler($msg); + foreach ( $rulesetNode->rules as $ruleNode ) { + if ( $ruleNode instanceof Less_Tree_Rule && !$ruleNode->variable ) { + $msg = "properties must be inside selector blocks, they cannot be in the root. Index " . $ruleNode->index . ( $ruleNode->currentFileInfo ? ( ' Filename: ' . $ruleNode->currentFileInfo['filename'] ) : null ); + throw new Less_Exception_Compiler( $msg ); } } } - - public function visitRuleset( $rulesetNode, &$visitDeeper ){ - + public function visitRuleset( $rulesetNode, &$visitDeeper ) { $visitDeeper = false; $this->checkPropertiesInRoot( $rulesetNode ); - if( $rulesetNode->root ){ + if ( $rulesetNode->root ) { return $this->visitRulesetRoot( $rulesetNode ); } - $rulesets = array(); - $rulesetNode->paths = $this->visitRulesetPaths($rulesetNode); - + $rulesets = []; + $rulesetNode->paths = $this->visitRulesetPaths( $rulesetNode ); // Compile rules and rulesets - $nodeRuleCnt = $rulesetNode->rules?count($rulesetNode->rules):0; - for( $i = 0; $i < $nodeRuleCnt; ){ + $nodeRuleCnt = $rulesetNode->rules ? count( $rulesetNode->rules ) : 0; + for ( $i = 0; $i < $nodeRuleCnt; ) { $rule = $rulesetNode->rules[$i]; - if( property_exists($rule,'rules') ){ + if ( property_exists( $rule, 'rules' ) ) { // visit because we are moving them out from being a child - $rulesets[] = $this->visitObj($rule); - array_splice($rulesetNode->rules,$i,1); + $rulesets[] = $this->visitObj( $rule ); + array_splice( $rulesetNode->rules, $i, 1 ); $nodeRuleCnt--; continue; } $i++; } - // accept the visitor to remove rules and refactor itself // then we can decide now whether we want it or not - if( $nodeRuleCnt > 0 ){ - $rulesetNode->accept($this); + if ( $nodeRuleCnt > 0 ) { + $rulesetNode->accept( $this ); - if( $rulesetNode->rules ){ + if ( $rulesetNode->rules ) { - if( count($rulesetNode->rules) > 1 ){ + if ( count( $rulesetNode->rules ) > 1 ) { $this->_mergeRules( $rulesetNode->rules ); $this->_removeDuplicateRules( $rulesetNode->rules ); } // now decide whether we keep the ruleset - if( $rulesetNode->paths ){ - //array_unshift($rulesets, $rulesetNode); - array_splice($rulesets,0,0,array($rulesetNode)); + if ( $rulesetNode->paths ) { + // array_unshift($rulesets, $rulesetNode); + array_splice( $rulesets, 0, 0, [ $rulesetNode ] ); } } } - - if( count($rulesets) === 1 ){ + if ( count( $rulesets ) === 1 ) { return $rulesets[0]; } return $rulesets; } - /** * Helper function for visitiRuleset * * return array|Less_Tree_Ruleset */ - private function visitRulesetRoot( $rulesetNode ){ + private function visitRulesetRoot( $rulesetNode ) { $rulesetNode->accept( $this ); - if( $rulesetNode->firstRoot || $rulesetNode->rules ){ + if ( $rulesetNode->firstRoot || $rulesetNode->rules ) { return $rulesetNode; } - return array(); + return []; } - /** * Helper function for visitRuleset() * * @return array */ - private function visitRulesetPaths($rulesetNode){ - - $paths = array(); - foreach($rulesetNode->paths as $p){ - if( $p[0]->elements[0]->combinator === ' ' ){ + private function visitRulesetPaths( $rulesetNode ) { + $paths = []; + foreach ( $rulesetNode->paths as $p ) { + if ( $p[0]->elements[0]->combinator === ' ' ) { $p[0]->elements[0]->combinator = ''; } - foreach($p as $pi){ - if( $pi->getIsReferenced() && $pi->getIsOutput() ){ + foreach ( $p as $pi ) { + if ( $pi->getIsReferenced() && $pi->getIsOutput() ) { $paths[] = $p; break; } @@ -192,26 +178,26 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{ return $paths; } - protected function _removeDuplicateRules( &$rules ){ + protected function _removeDuplicateRules( &$rules ) { // remove duplicates - $ruleCache = array(); - for( $i = count($rules)-1; $i >= 0 ; $i-- ){ + $ruleCache = []; + for ( $i = count( $rules ) - 1; $i >= 0; $i-- ) { $rule = $rules[$i]; - if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_NameValue ){ + if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_NameValue ) { - if( !isset($ruleCache[$rule->name]) ){ + if ( !isset( $ruleCache[$rule->name] ) ) { $ruleCache[$rule->name] = $rule; - }else{ + } else { $ruleList =& $ruleCache[$rule->name]; - if( $ruleList instanceof Less_Tree_Rule || $ruleList instanceof Less_Tree_NameValue ){ - $ruleList = $ruleCache[$rule->name] = array( $ruleCache[$rule->name]->toCSS() ); + if ( $ruleList instanceof Less_Tree_Rule || $ruleList instanceof Less_Tree_NameValue ) { + $ruleList = $ruleCache[$rule->name] = [ $ruleCache[$rule->name]->toCSS() ]; } $ruleCSS = $rule->toCSS(); - if( array_search($ruleCSS,$ruleList) !== false ){ - array_splice($rules,$i,1); - }else{ + if ( array_search( $ruleCSS, $ruleList ) !== false ) { + array_splice( $rules, $i, 1 ); + } else { $ruleList[] = $ruleCSS; } } @@ -219,26 +205,26 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{ } } - protected function _mergeRules( &$rules ){ - $groups = array(); + protected function _mergeRules( &$rules ) { + $groups = []; - //obj($rules); + // obj($rules); - $rules_len = count($rules); - for( $i = 0; $i < $rules_len; $i++ ){ + $rules_len = count( $rules ); + for ( $i = 0; $i < $rules_len; $i++ ) { $rule = $rules[$i]; - if( ($rule instanceof Less_Tree_Rule) && $rule->merge ){ + if ( ( $rule instanceof Less_Tree_Rule ) && $rule->merge ) { $key = $rule->name; - if( $rule->important ){ + if ( $rule->important ) { $key .= ',!'; } - if( !isset($groups[$key]) ){ - $groups[$key] = array(); - }else{ - array_splice($rules, $i--, 1); + if ( !isset( $groups[$key] ) ) { + $groups[$key] = []; + } else { + array_splice( $rules, $i--, 1 ); $rules_len--; } @@ -246,47 +232,44 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{ } } + foreach ( $groups as $parts ) { - foreach($groups as $parts){ - - if( count($parts) > 1 ){ + if ( count( $parts ) > 1 ) { $rule = $parts[0]; - $spacedGroups = array(); - $lastSpacedGroup = array(); - $parts_mapped = array(); - foreach($parts as $p){ - if( $p->merge === '+' ){ - if( $lastSpacedGroup ){ - $spacedGroups[] = self::toExpression($lastSpacedGroup); + $spacedGroups = []; + $lastSpacedGroup = []; + $parts_mapped = []; + foreach ( $parts as $p ) { + if ( $p->merge === '+' ) { + if ( $lastSpacedGroup ) { + $spacedGroups[] = self::toExpression( $lastSpacedGroup ); } - $lastSpacedGroup = array(); + $lastSpacedGroup = []; } $lastSpacedGroup[] = $p; } - $spacedGroups[] = self::toExpression($lastSpacedGroup); - $rule->value = self::toValue($spacedGroups); + $spacedGroups[] = self::toExpression( $lastSpacedGroup ); + $rule->value = self::toValue( $spacedGroups ); } } - } - public static function toExpression($values){ - $mapped = array(); - foreach($values as $p){ + public static function toExpression( $values ) { + $mapped = []; + foreach ( $values as $p ) { $mapped[] = $p->value; } return new Less_Tree_Expression( $mapped ); } - public static function toValue($values){ - //return new Less_Tree_Value($values); ?? + public static function toValue( $values ) { + // return new Less_Tree_Value($values); ?? - $mapped = array(); - foreach($values as $p){ + $mapped = []; + foreach ( $values as $p ) { $mapped[] = $p; } - return new Less_Tree_Value($mapped); + return new Less_Tree_Value( $mapped ); } } - diff --git a/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php b/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php index 5923170e2..ae8b82e3c 100644 --- a/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php +++ b/vendor/wikimedia/less.php/lib/Less/VisitorReplacing.php @@ -1,48 +1,42 @@ <?php - /** - * Replacing Visitor - * - * @package Less - * @subpackage visitor + * @private */ -class Less_VisitorReplacing extends Less_Visitor{ +class Less_VisitorReplacing extends Less_Visitor { - public function visitObj( $node ){ - - $funcName = 'visit'.$node->type; - if( isset($this->_visitFnCache[$funcName]) ){ + public function visitObj( $node ) { + $funcName = 'visit' . $node->type; + if ( isset( $this->_visitFnCache[$funcName] ) ) { $visitDeeper = true; $node = $this->$funcName( $node, $visitDeeper ); - if( $node ){ - if( $visitDeeper && is_object($node) ){ - $node->accept($this); + if ( $node ) { + if ( $visitDeeper && is_object( $node ) ) { + $node->accept( $this ); } - $funcName = $funcName . "Out"; - if( isset($this->_visitFnCache[$funcName]) ){ + $funcName .= "Out"; + if ( isset( $this->_visitFnCache[$funcName] ) ) { $this->$funcName( $node ); } } - }else{ - $node->accept($this); + } else { + $node->accept( $this ); } return $node; } - public function visitArray( $nodes ){ - - $newNodes = array(); - foreach($nodes as $node){ - $evald = $this->visitObj($node); - if( $evald ){ - if( is_array($evald) ){ - self::flatten($evald,$newNodes); - }else{ + public function visitArray( $nodes ) { + $newNodes = []; + foreach ( $nodes as $node ) { + $evald = $this->visitObj( $node ); + if ( $evald ) { + if ( is_array( $evald ) ) { + self::flatten( $evald, $newNodes ); + } else { $newNodes[] = $evald; } } @@ -50,18 +44,17 @@ class Less_VisitorReplacing extends Less_Visitor{ return $newNodes; } - public function flatten( $arr, &$out ){ - - foreach($arr as $item){ - if( !is_array($item) ){ + public function flatten( $arr, &$out ) { + foreach ( $arr as $item ) { + if ( !is_array( $item ) ) { $out[] = $item; continue; } - foreach($item as $nestedItem){ - if( is_array($nestedItem) ){ - self::flatten( $nestedItem, $out); - }else{ + foreach ( $item as $nestedItem ) { + if ( is_array( $nestedItem ) ) { + self::flatten( $nestedItem, $out ); + } else { $out[] = $nestedItem; } } @@ -71,5 +64,3 @@ class Less_VisitorReplacing extends Less_Visitor{ } } - -

+Build Status +Total Downloads +Latest Stable Version +License +