From 0c3373a573301450e83f16cd28d3f000f7192ee4 Mon Sep 17 00:00:00 2001 From: Alastair Mucklow Date: Mon, 19 Jun 2023 14:26:30 +0000 Subject: [PATCH 1/2] Merged PR 45662: Fix data field input types for widget ## What's being changed This PR repairs the HTML of the signup form widget by setting the expected input types according to each Dotdigital data field type. | Dotdigital data field type | HTML input type | | -- | -- | | Text | text | | Date | date | | Numeric | number | | Yes/No | radio | We also fixed a deprecated notice for `uasort` return type in PHP 8.1+, and cleaned up the method that outputs the field input HTML. ## Why it's being changed Previously the HTML was invalid and had e.g. ``. ## How to review / test this change - Check out the related branch on the SDK - Add a repositories path in composer.json to your local SDK - Run `composer update` in the plugin root folder - Test sorting for data fields - Test sorting for address books - Ensure you have selected a data field corresponding to each of the types from the table above - Add these to the widget - Check the HTML to confirm the input types match the appropriate data field type - Test form submission and mapping of data field values into Dotdigital ## Notes Since the previous version of this plugin, we have refactored our PHP SDK. As a result the code now respects the revised namespace (`Dotdigital\V2`) for the v2 API. Related work items: #212887 --- DotdigitalConnect.php | 22 +- composer.json | 5 +- composer.lock | 475 +++++++----------- dm_signup_form.php | 14 +- dm_widget.php | 2 +- functions.php | 92 ++-- vendor/autoload.php | 17 +- vendor/composer/ClassLoader.php | 41 +- vendor/composer/autoload_files.php | 1 - vendor/composer/autoload_psr4.php | 3 +- vendor/composer/autoload_real.php | 27 +- vendor/composer/autoload_static.php | 7 - vendor/composer/installed.json | 375 ++++++-------- vendor/composer/installed.php | 112 ++--- vendor/dotdigital/dotdigital-php/.gitignore | 1 + vendor/dotdigital/dotdigital-php/README.md | 23 +- .../dotdigital/dotdigital-php/composer.json | 17 +- .../docs/pull_request_template/develop.md | 16 + vendor/dotdigital/dotdigital-php/phpstan.neon | 2 + vendor/dotdigital/dotdigital-php/phpunit.xml | 7 +- .../src/{Client.php => AbstractClient.php} | 65 +-- .../src/Exception/ValidationException.php | 7 + .../Message/{ => V2}/ResponseMediator.php | 5 +- .../Message/V3/ResponseMediator.php | 32 ++ .../src/Models/AbstractModel.php | 2 - .../src/Resources/AbstractResource.php | 41 +- .../src/Resources/ResourceFactory.php | 52 +- .../dotdigital-php/src/V2/Client.php | 36 ++ .../src/{ => V2}/Models/AbstractListModel.php | 24 +- .../Models/AbstractSingletonModel.php | 2 +- .../src/{ => V2}/Models/AccountInfo.php | 4 +- .../{ => V2}/Models/AccountInfoProperty.php | 2 +- .../Models/AccountInfoPropertyList.php | 4 +- .../src/{ => V2}/Models/AddressBook.php | 2 +- .../src/{ => V2}/Models/AddressBookList.php | 4 +- .../src/{ => V2}/Models/Contact.php | 6 +- .../src/{ => V2}/Models/Contact/DataField.php | 4 +- .../{ => V2}/Models/Contact/DataFieldList.php | 4 +- .../src/{ => V2}/Models/ContactList.php | 4 +- .../src/{ => V2}/Models/DataField.php | 10 +- .../src/{ => V2}/Models/DataFieldList.php | 4 +- .../src/{ => V2}/Models/Enrolment.php | 2 +- .../src/{ => V2}/Models/EnrolmentList.php | 4 +- .../src/{ => V2}/Models/Program.php | 2 +- .../src/{ => V2}/Models/ProgramList.php | 4 +- .../src/{ => V2}/Resources/AccountInfo.php | 5 +- .../src/{ => V2}/Resources/AddressBooks.php | 10 +- .../src/{ => V2}/Resources/Contacts.php | 7 +- .../src/{ => V2}/Resources/DataFields.php | 6 +- .../src/{ => V2}/Resources/Programs.php | 11 +- .../dotdigital-php/src/V3/Client.php | 24 + .../src/V3/Models/AbstractSingletonModel.php | 100 ++++ .../src/V3/Models/Collection.php | 195 +++++++ .../src/V3/Models/ConsentRecordCollection.php | 14 + .../dotdigital-php/src/V3/Models/Contact.php | 163 ++++++ .../EmailChannelProperty.php | 23 + .../ChannelProperties/SmsChannelProperty.php | 13 + .../src/V3/Models/Contact/ChannelProperty.php | 42 ++ .../src/V3/Models/Contact/ConsentRecord.php | 38 ++ .../src/V3/Models/Contact/DataField.php | 62 +++ .../src/V3/Models/Contact/Identifier.php | 36 ++ .../src/V3/Models/Contact/Identifiers.php | 23 + .../src/V3/Models/Contact/Import.php | 131 +++++ .../src/V3/Models/Contact/Import/Failure.php | 54 ++ .../Contact/Import/FailureCollection.php | 16 + .../Models/Contact/Import/FailureDetail.php | 36 ++ .../Import/FailureDetailCollection.php | 16 + .../src/V3/Models/Contact/Import/Summary.php | 78 +++ .../src/V3/Models/Contact/Preference.php | 28 ++ .../src/V3/Models/ContactCollection.php | 13 + .../src/V3/Models/DataFieldCollection.php | 30 ++ .../src/V3/Models/PreferenceCollection.php | 14 + .../src/V3/Resources/Contacts.php | 98 ++++ .../tests/ApiConfigurationTrait.php | 8 +- .../tests/Resources/AddressBooksTest.php | 36 -- .../tests/Resources/DataFieldsTest.php | 36 -- .../Resources/AccountInfoTest.php | 15 +- .../Resources/AddressBooksTest.php | 35 ++ .../Integration}/Resources/ContactsTest.php | 71 ++- .../Integration/Resources/DataFieldsTest.php | 36 ++ .../tests/V3/Integration/.env.example | 3 + .../V3/Integration/ContactCreateTest.php | 96 ++++ .../Integration/ContactImportReportTest.php | 47 ++ .../V3/Integration/ContactImportTest.php | 164 ++++++ .../tests/V3/Integration/TestCase.php | 54 ++ .../V3/Traits/InteractsWithContactTrait.php | 151 ++++++ .../tests/V3/Unit/ContactImportTest.php | 191 +++++++ .../tests/V3/Unit/ContactsTest.php | 63 +++ .../dotdigital-php/tests/V3/Unit/TestCase.php | 60 +++ vendor/guzzlehttp/guzzle/CHANGELOG.md | 92 +++- vendor/guzzlehttp/guzzle/README.md | 14 +- vendor/guzzlehttp/guzzle/composer.json | 10 +- vendor/guzzlehttp/guzzle/src/Client.php | 38 +- .../guzzle/src/Cookie/CookieJar.php | 26 +- .../guzzle/src/Cookie/CookieJarInterface.php | 2 +- .../guzzle/src/Cookie/SessionCookieJar.php | 2 +- .../guzzle/src/Cookie/SetCookie.php | 84 +++- .../guzzle/src/Handler/CurlFactory.php | 79 ++- .../guzzle/src/Handler/CurlMultiHandler.php | 3 +- .../guzzle/src/Handler/EasyHandle.php | 2 +- .../guzzle/src/Handler/HeaderProcessor.php | 4 +- .../guzzle/src/Handler/MockHandler.php | 3 +- .../guzzle/src/Handler/StreamHandler.php | 66 ++- vendor/guzzlehttp/guzzle/src/HandlerStack.php | 12 +- .../guzzle/src/MessageFormatter.php | 15 +- vendor/guzzlehttp/guzzle/src/Middleware.php | 20 +- .../guzzle/src/PrepareBodyMiddleware.php | 1 + .../guzzle/src/RedirectMiddleware.php | 8 +- .../guzzlehttp/guzzle/src/RequestOptions.php | 16 +- .../guzzlehttp/guzzle/src/RetryMiddleware.php | 7 +- vendor/guzzlehttp/guzzle/src/Utils.php | 22 +- vendor/guzzlehttp/guzzle/src/functions.php | 8 +- .../guzzle/src/functions_include.php | 2 +- vendor/guzzlehttp/promises/CHANGELOG.md | 28 ++ vendor/guzzlehttp/promises/README.md | 21 +- vendor/guzzlehttp/promises/composer.json | 20 +- .../promises/src/AggregateException.php | 4 +- .../promises/src/CancellationException.php | 2 + vendor/guzzlehttp/promises/src/Coroutine.php | 39 +- vendor/guzzlehttp/promises/src/Create.php | 21 +- vendor/guzzlehttp/promises/src/Each.php | 26 +- .../guzzlehttp/promises/src/EachPromise.php | 43 +- .../promises/src/FulfilledPromise.php | 29 +- vendor/guzzlehttp/promises/src/Is.php | 18 +- vendor/guzzlehttp/promises/src/Promise.php | 51 +- .../promises/src/PromiseInterface.php | 34 +- .../promises/src/PromisorInterface.php | 6 +- .../promises/src/RejectedPromise.php | 30 +- .../promises/src/RejectionException.php | 13 +- vendor/guzzlehttp/promises/src/TaskQueue.php | 16 +- .../promises/src/TaskQueueInterface.php | 10 +- vendor/guzzlehttp/promises/src/Utils.php | 69 +-- vendor/guzzlehttp/promises/src/functions.php | 363 ------------- .../promises/src/functions_include.php | 6 - .../vendor-bin/php-cs-fixer/composer.json | 9 + .../promises/vendor-bin/phpstan/composer.json | 10 + .../promises/vendor-bin/psalm/composer.json | 9 + vendor/guzzlehttp/psr7/CHANGELOG.md | 34 +- vendor/guzzlehttp/psr7/README.md | 28 +- vendor/guzzlehttp/psr7/composer.json | 5 +- vendor/guzzlehttp/psr7/src/Header.php | 2 +- vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 10 +- vendor/guzzlehttp/psr7/src/Message.php | 2 +- vendor/guzzlehttp/psr7/src/MessageTrait.php | 13 +- .../guzzlehttp/psr7/src/MultipartStream.php | 2 +- vendor/guzzlehttp/psr7/src/ServerRequest.php | 8 +- vendor/guzzlehttp/psr7/src/Uri.php | 8 +- .../client-common/.php-cs-fixer.dist.php | 18 + vendor/php-http/client-common/CHANGELOG.md | 23 + vendor/php-http/client-common/README.md | 2 +- vendor/php-http/client-common/composer.json | 10 +- .../php-http/client-common/src/Deferred.php | 5 +- .../src/HttpClientPool/HttpClientPool.php | 4 +- .../src/Plugin/AddHostPlugin.php | 2 +- .../src/Plugin/AddPathPlugin.php | 2 +- .../src/Plugin/ContentTypePlugin.php | 2 +- .../src/Plugin/DecoderPlugin.php | 2 +- .../client-common/src/Plugin/ErrorPlugin.php | 6 +- .../src/Plugin/RedirectPlugin.php | 123 ++++- .../client-common/src/PluginChain.php | 3 +- .../client-common/src/PluginClient.php | 1 - .../client-common/src/PluginClientFactory.php | 4 +- vendor/php-http/discovery/CHANGELOG.md | 44 +- vendor/php-http/discovery/README.md | 86 +++- vendor/php-http/discovery/composer.json | 40 +- .../php-http/discovery/src/ClassDiscovery.php | 25 +- .../discovery/src/Composer/Plugin.php | 464 +++++++++++++++++ vendor/php-http/discovery/src/Exception.php | 4 +- .../discovery/src/HttpClientDiscovery.php | 2 + .../discovery/src/MessageFactoryDiscovery.php | 2 +- .../php-http/discovery/src/Psr17Factory.php | 303 +++++++++++ vendor/php-http/discovery/src/Psr18Client.php | 45 ++ .../src/Strategy/CommonClassesStrategy.php | 13 +- .../Strategy/CommonPsr17ClassesStrategy.php | 8 +- .../src/Strategy/PuliBetaStrategy.php | 1 + vendor/php-http/httplug/CHANGELOG.md | 7 +- vendor/php-http/httplug/README.md | 18 +- vendor/php-http/httplug/composer.json | 11 +- vendor/php-http/httplug/src/HttpClient.php | 2 + 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 - .../php-http/message/.php-cs-fixer.dist.php | 18 + vendor/php-http/message/CHANGELOG.md | 22 +- vendor/php-http/message/README.md | 2 +- vendor/php-http/message/composer.json | 15 +- .../message/src/Authentication/Wsse.php | 3 +- vendor/php-http/message/src/Cookie.php | 2 - vendor/php-http/message/src/CookieJar.php | 2 +- .../src/Decorator/MessageDecorator.php | 59 +-- .../src/Decorator/RequestDecorator.php | 34 +- .../src/Decorator/ResponseDecorator.php | 19 +- .../message/src/Decorator/StreamDecorator.php | 73 +-- .../message/src/Encoding/ChunkStream.php | 15 +- .../message/src/Encoding/CompressStream.php | 10 +- .../message/src/Encoding/DechunkStream.php | 10 +- .../message/src/Encoding/DecompressStream.php | 10 +- .../message/src/Encoding/DeflateStream.php | 4 +- .../message/src/Encoding/Filter/Chunk.php | 6 +- .../message/src/Encoding/FilteredStream.php | 49 +- .../message/src/Encoding/GzipDecodeStream.php | 4 +- .../message/src/Encoding/GzipEncodeStream.php | 4 +- .../message/src/Encoding/InflateStream.php | 10 +- .../DiactorosMessageFactory.php | 4 + .../MessageFactory/GuzzleMessageFactory.php | 4 + .../src/MessageFactory/SlimMessageFactory.php | 4 + .../message/src/Stream/BufferedStream.php | 95 ++-- .../StreamFactory/DiactorosStreamFactory.php | 4 + .../src/StreamFactory/GuzzleStreamFactory.php | 5 + .../src/StreamFactory/SlimStreamFactory.php | 4 + .../src/UriFactory/DiactorosUriFactory.php | 4 + .../src/UriFactory/GuzzleUriFactory.php | 7 +- .../message/src/UriFactory/SlimUriFactory.php | 4 + vendor/psr/http-client/README.md | 2 +- vendor/psr/http-client/composer.json | 4 +- vendor/psr/http-factory/.gitignore | 2 - vendor/psr/http-factory/.pullapprove.yml | 7 - vendor/psr/http-factory/README.md | 12 +- vendor/psr/http-factory/composer.json | 4 +- vendor/psr/http-message/README.md | 5 +- vendor/psr/http-message/composer.json | 6 +- .../psr/http-message/docs/PSR7-Interfaces.md | 130 +++++ vendor/psr/http-message/docs/PSR7-Usage.md | 159 ++++++ .../psr/http-message/src/MessageInterface.php | 22 +- .../psr/http-message/src/RequestInterface.php | 15 +- .../http-message/src/ResponseInterface.php | 6 +- .../src/ServerRequestInterface.php | 24 +- .../psr/http-message/src/StreamInterface.php | 30 +- .../src/UploadedFileInterface.php | 12 +- vendor/psr/http-message/src/UriInterface.php | 33 +- vendor/symfony/options-resolver/LICENSE | 2 +- vendor/symfony/polyfill-php73/composer.json | 2 +- .../Resources/stubs/Attribute.php | 9 + .../Resources/stubs/PhpToken.php | 11 +- .../Resources/stubs/Stringable.php | 9 + .../Resources/stubs/UnhandledMatchError.php | 9 + .../Resources/stubs/ValueError.php | 9 + vendor/symfony/polyfill-php80/composer.json | 2 +- 245 files changed, 5523 insertions(+), 2573 deletions(-) create mode 100644 vendor/dotdigital/dotdigital-php/docs/pull_request_template/develop.md create mode 100644 vendor/dotdigital/dotdigital-php/phpstan.neon rename vendor/dotdigital/dotdigital-php/src/{Client.php => AbstractClient.php} (67%) create mode 100644 vendor/dotdigital/dotdigital-php/src/Exception/ValidationException.php rename vendor/dotdigital/dotdigital-php/src/HttpClient/Message/{ => V2}/ResponseMediator.php (86%) create mode 100644 vendor/dotdigital/dotdigital-php/src/HttpClient/Message/V3/ResponseMediator.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V2/Client.php rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AbstractListModel.php (74%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AbstractSingletonModel.php (98%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AccountInfo.php (92%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AccountInfoProperty.php (92%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AccountInfoPropertyList.php (83%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AddressBook.php (96%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/AddressBookList.php (82%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/Contact.php (88%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/Contact/DataField.php (67%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/Contact/DataFieldList.php (79%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/ContactList.php (84%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/DataField.php (79%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/DataFieldList.php (82%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/Enrolment.php (95%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/EnrolmentList.php (82%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/Program.php (93%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Models/ProgramList.php (81%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Resources/AccountInfo.php (70%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Resources/AddressBooks.php (92%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Resources/Contacts.php (90%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Resources/DataFields.php (74%) rename vendor/dotdigital/dotdigital-php/src/{ => V2}/Resources/Programs.php (90%) create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Client.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/AbstractSingletonModel.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Collection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/ConsentRecordCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperties/EmailChannelProperty.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperties/SmsChannelProperty.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperty.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ConsentRecord.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/DataField.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifier.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifiers.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/Failure.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureDetail.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureDetailCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/Summary.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Preference.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/ContactCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/DataFieldCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Models/PreferenceCollection.php create mode 100644 vendor/dotdigital/dotdigital-php/src/V3/Resources/Contacts.php delete mode 100644 vendor/dotdigital/dotdigital-php/tests/Resources/AddressBooksTest.php delete mode 100644 vendor/dotdigital/dotdigital-php/tests/Resources/DataFieldsTest.php rename vendor/dotdigital/dotdigital-php/tests/{ => V2/Integration}/Resources/AccountInfoTest.php (76%) create mode 100644 vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AddressBooksTest.php rename vendor/dotdigital/dotdigital-php/tests/{ => V2/Integration}/Resources/ContactsTest.php (57%) create mode 100644 vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/DataFieldsTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Integration/.env.example create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactCreateTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportReportTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Integration/TestCase.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Traits/InteractsWithContactTrait.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactImportTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactsTest.php create mode 100644 vendor/dotdigital/dotdigital-php/tests/V3/Unit/TestCase.php delete mode 100644 vendor/guzzlehttp/promises/src/functions.php delete mode 100644 vendor/guzzlehttp/promises/src/functions_include.php create mode 100644 vendor/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json create mode 100644 vendor/guzzlehttp/promises/vendor-bin/phpstan/composer.json create mode 100644 vendor/guzzlehttp/promises/vendor-bin/psalm/composer.json create mode 100644 vendor/php-http/client-common/.php-cs-fixer.dist.php create mode 100644 vendor/php-http/discovery/src/Composer/Plugin.php create mode 100644 vendor/php-http/discovery/src/Psr17Factory.php create mode 100644 vendor/php-http/discovery/src/Psr18Client.php delete mode 100644 vendor/php-http/message-factory/CHANGELOG.md delete mode 100644 vendor/php-http/message-factory/LICENSE delete mode 100644 vendor/php-http/message-factory/README.md delete mode 100644 vendor/php-http/message-factory/composer.json delete mode 100644 vendor/php-http/message-factory/puli.json delete mode 100644 vendor/php-http/message-factory/src/MessageFactory.php delete mode 100644 vendor/php-http/message-factory/src/RequestFactory.php delete mode 100644 vendor/php-http/message-factory/src/ResponseFactory.php delete mode 100644 vendor/php-http/message-factory/src/StreamFactory.php delete mode 100644 vendor/php-http/message-factory/src/UriFactory.php create mode 100644 vendor/php-http/message/.php-cs-fixer.dist.php delete mode 100644 vendor/psr/http-factory/.gitignore delete mode 100644 vendor/psr/http-factory/.pullapprove.yml create mode 100644 vendor/psr/http-message/docs/PSR7-Interfaces.md create mode 100644 vendor/psr/http-message/docs/PSR7-Usage.md diff --git a/DotdigitalConnect.php b/DotdigitalConnect.php index 97e0eb8..974a733 100644 --- a/DotdigitalConnect.php +++ b/DotdigitalConnect.php @@ -2,9 +2,9 @@ require_once __DIR__ . '/vendor/autoload.php'; -use Dotdigital\Client; -use Dotdigital\Models\Contact; -use Dotdigital\Models\ContactList; +use Dotdigital\V2\Client; +use Dotdigital\V2\Models\Contact; +use Dotdigital\V2\Models\ContactList; class DotdigitalConnect { @@ -28,7 +28,7 @@ public function __construct( array $credentials ) { } /** - * @return \Dotdigital\Models\AccountInfo|bool + * @return \Dotdigital\V2\Models\AccountInfo|bool * @throws \Http\Client\Exception */ public function getAccountInfo() { @@ -40,19 +40,21 @@ public function getAccountInfo() { } /** - * @return \Dotdigital\Models\AddressBookList + * @return \Dotdigital\V2\Models\AddressBook[] * @throws \Http\Client\Exception */ public function listAddressBooks() { - return $this->client->addressBooks->show(); + $apiLists = $this->client->addressBooks->show(); + return $apiLists->getList(); } /** - * @return \Dotdigital\Models\DataField[]|\Dotdigital\Models\DataFieldList + * @return \Dotdigital\V2\Models\DataField[] * @throws \Http\Client\Exception */ public function listDataFields() { - return $this->client->dataFields->show(); + $apiDataFields = $this->client->dataFields->show(); + return $apiDataFields->getList(); } /** @@ -65,7 +67,7 @@ public function listDataFields() { */ public function addContactToAddressBook( $email, $addressBookId, $datafields = array() ) { try { - $apiContact = new Dotdigital\Models\Contact( + $apiContact = new Dotdigital\V2\Models\Contact( array( 'id' => -1, 'email' => $email, @@ -101,7 +103,7 @@ public function addContactToAddressBook( $email, $addressBookId, $datafields = a * @throws \Http\Client\Exception */ public function resubscribeContactToAddressBook( $email, $addressBookId, $datafields = array() ) { - $apiContact = new Dotdigital\Models\Contact( + $apiContact = new Dotdigital\V2\Models\Contact( array( 'id' => -1, 'email' => $email, diff --git a/composer.json b/composer.json index 5b52666..38780c7 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ ], "require": { "php": "^7.4 || ^8.0", - "dotdigital/dotdigital-php": "1.0.0", + "dotdigital/dotdigital-php": "2.0.0-RC1", "php-http/guzzle7-adapter": "^1.0", "symfony/deprecation-contracts": "^2.2", "symfony/options-resolver": "~5.0" @@ -21,7 +21,8 @@ }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "php-http/discovery": true } } } diff --git a/composer.lock b/composer.lock index 20c4060..ab05d88 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6c1b96f05ee17f6cfe1e5e4770fac45f", + "content-hash": "310b8a44b671e82e86c37e2bf53f862d", "packages": [ { "name": "clue/stream-filter", @@ -74,16 +74,16 @@ }, { "name": "dotdigital/dotdigital-php", - "version": "v1.0.0", + "version": "v2.0.0-RC1", "source": { "type": "git", "url": "https://github.com/dotmailer/dotdigital-php.git", - "reference": "310753341c24735d3b7f39eca7cebbd7a4985d74" + "reference": "de94511ddf8e0ea20b8dc2796d2fd977f477bd0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dotmailer/dotdigital-php/zipball/310753341c24735d3b7f39eca7cebbd7a4985d74", - "reference": "310753341c24735d3b7f39eca7cebbd7a4985d74", + "url": "https://api.github.com/repos/dotmailer/dotdigital-php/zipball/de94511ddf8e0ea20b8dc2796d2fd977f477bd0b", + "reference": "de94511ddf8e0ea20b8dc2796d2fd977f477bd0b", "shasum": "" }, "require": { @@ -95,17 +95,18 @@ "psr/http-factory": "^1.0" }, "require-dev": { + "fakerphp/faker": "^1.22", "guzzlehttp/guzzle": "^7.4", "php-http/curl-client": "^2.2", "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.1.1", + "symfony/dotenv": "^6.2", "symplify/easy-coding-standard": "^9.4" }, "type": "library", "autoload": { "psr-4": { - "Dotdigital\\": "src/", - "Dotdigital\\Tests\\": "tests/" + "Dotdigital\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -115,28 +116,28 @@ "description": "Dotdigital PHP Library", "support": { "issues": "https://github.com/dotmailer/dotdigital-php/issues", - "source": "https://github.com/dotmailer/dotdigital-php/tree/v1.0.0" + "source": "https://github.com/dotmailer/dotdigital-php/tree/v2.0.0-RC1" }, - "time": "2022-09-05T11:52:01+00:00" + "time": "2023-06-16T14:29:22+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.5.0", + "version": "7.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", + "guzzlehttp/promises": "^1.5.3 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -147,7 +148,8 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, @@ -161,9 +163,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "autoload": { @@ -229,7 +228,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.0" + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" }, "funding": [ { @@ -245,38 +244,37 @@ "type": "tidelift" } ], - "time": "2022-08-28T15:39:27+00:00" + "time": "2023-05-21T14:04:53+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -313,7 +311,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" + "source": "https://github.com/guzzle/promises/tree/2.0.0" }, "funding": [ { @@ -329,26 +327,26 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:55:35+00:00" + "time": "2023-05-21T13:50:22+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.4.1", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" + "reference": "b635f279edd83fc275f822a1188157ffea568ff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", + "reference": "b635f279edd83fc275f822a1188157ffea568ff6", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "ralouphie/getallheaders": "^3.0" }, "provide": { @@ -368,9 +366,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" } }, "autoload": { @@ -432,7 +427,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.1" + "source": "https://github.com/guzzle/psr7/tree/2.5.0" }, "funding": [ { @@ -448,30 +443,29 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:45:39+00:00" + "time": "2023-04-17T16:11:26+00:00" }, { "name": "php-http/client-common", - "version": "2.5.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054" + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054", + "url": "https://api.github.com/repos/php-http/client-common/zipball/880509727a447474d2a71b7d7fa5d268ddd3db4b", + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b", "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", + "psr/http-message": "^1.0 || ^2.0", "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, @@ -481,7 +475,7 @@ "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" + "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" }, "suggest": { "ext-json": "To detect JSON responses with the ContentTypePlugin", @@ -491,11 +485,6 @@ "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\Common\\": "src/" @@ -521,49 +510,59 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.5.0" + "source": "https://github.com/php-http/client-common/tree/2.7.0" }, - "time": "2021-11-26T15:01:24+00:00" + "time": "2023-05-17T06:46:59+00:00" }, { "name": "php-http/discovery", - "version": "1.14.3", + "version": "1.18.1", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735" + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/31d8ee46d0215108df16a8527c7438e96a4d7735", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735", + "url": "https://api.github.com/repos/php-http/discovery/zipball/f258b3a1d16acb7b21f3b42d7a2494a733365237", + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237", "shasum": "" }, "require": { + "composer-plugin-api": "^1.0|^2.0", "php": "^7.1 || ^8.0" }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "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" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -575,7 +574,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -584,13 +583,14 @@ "factory", "http", "message", + "psr17", "psr7" ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.3" + "source": "https://github.com/php-http/discovery/tree/1.18.1" }, - "time": "2022-07-11T14:04:40+00:00" + "time": "2023-05-17T08:53:10+00:00" }, { "name": "php-http/guzzle7-adapter", @@ -656,34 +656,29 @@ }, { "name": "php-http/httplug", - "version": "2.3.0", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "f640739f80dfa1152533976e3c112477f69274eb" + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", - "reference": "f640739f80dfa1152533976e3c112477f69274eb", + "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { "psr-4": { "Http\\Client\\": "src/" @@ -712,29 +707,28 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.3.0" + "source": "https://github.com/php-http/httplug/tree/2.4.0" }, - "time": "2022-02-21T09:52:22+00:00" + "time": "2023-04-14T15:10:03+00:00" }, { "name": "php-http/message", - "version": "1.13.0", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361" + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361", - "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361", + "url": "https://api.github.com/repos/php-http/message/zipball/47a14338bf4ebd67d317bf1144253d7db4ab55fd", + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd", "shasum": "" }, "require": { "clue/stream-filter": "^1.5", - "php": "^7.1 || ^8.0", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" }, "provide": { "php-http/message-factory-implementation": "1.0" @@ -742,8 +736,9 @@ "require-dev": { "ergebnis/composer-normalize": "^2.6", "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0", - "laminas/laminas-diactoros": "^2.0", + "guzzlehttp/psr7": "^1.0 || ^2.0", + "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, @@ -754,11 +749,6 @@ "slim/slim": "Used with Slim Framework PSR-7 implementation" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "files": [ "src/filters.php" @@ -786,63 +776,9 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.13.0" - }, - "time": "2022-02-11T13:41:14+00:00" - }, - { - "name": "php-http/message-factory", - "version": "v1.0.2", - "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" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "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" + "source": "https://github.com/php-http/message/tree/1.16.0" }, - "time": "2015-12-19T14:08:53+00:00" + "time": "2023-05-17T06:43:38+00:00" }, { "name": "php-http/promise", @@ -903,21 +839,21 @@ }, { "name": "psr/http-client", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -937,7 +873,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -949,27 +885,27 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client/tree/1.0.2" }, - "time": "2020-06-29T06:28:15+00:00" + "time": "2023-04-10T20:12:12+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -989,7 +925,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -1004,31 +940,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1043,7 +979,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -1057,9 +993,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "ralouphie/getallheaders", @@ -1174,16 +1110,16 @@ }, { "name": "symfony/options-resolver", - "version": "v5.4.11", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", "shasum": "" }, "require": { @@ -1223,7 +1159,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.11" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -1239,20 +1175,20 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:00:38+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -1261,7 +1197,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1302,7 +1238,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -1318,20 +1254,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -1340,7 +1276,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1385,7 +1321,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -1401,41 +1337,44 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" } ], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1451,7 +1390,7 @@ }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -1475,10 +1414,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1544,16 +1483,16 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", "shasum": "" }, "require": { @@ -1590,26 +1529,27 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2021-02-15T10:24:51+00:00" + "time": "2022-10-25T01:46:02+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -1644,85 +1584,27 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2021-12-30T16:37:40+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "1.8.4", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eed4c9da531f6ebb4787235b6fb486e2c20f34e5", - "reference": "eed4c9da531f6ebb4787235b6fb486e2c20f34e5", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.4" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], - "time": "2022-09-03T13:08:04+00:00" + "time": "2022-10-24T09:00:36+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -1758,14 +1640,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -1821,7 +1704,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "dotdigital/dotdigital-php": 5 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/dm_signup_form.php b/dm_signup_form.php index 8805ae6..8f99f6d 100644 --- a/dm_signup_form.php +++ b/dm_signup_form.php @@ -332,14 +332,14 @@ function dm_API_address_books_input() { if ( isset( $_GET['order'] ) ) { if ( $_GET['order'] == 'asc' ) { - uasort( $dm_account_books, 'dotdigitalItemSortAsc' ); + uasort( $dm_account_books, 'dotdigital_item_sort_asc' ); $neworder = '&order=desc'; } elseif ( $_GET['order'] == 'desc' ) { - uasort( $dm_account_books, 'dotdigitalItemSortDesc' ); + uasort( $dm_account_books, 'dotdigital_item_sort_desc' ); $neworder = '&order=asc'; } } else { - uasort( $dm_account_books, 'dotdigitalItemSortAsc' ); + uasort( $dm_account_books, 'dotdigital_item_sort_asc' ); $neworder = '&order=desc'; } ?> @@ -458,14 +458,14 @@ function dm_API_data_fields_input() { if ( isset( $_GET['order'] ) ) { if ( $_GET['order'] == 'asc' ) { - uasort( $dm_API_data_fields, 'dotdigitalItemSortAsc' ); + uasort( $dm_API_data_fields, 'dotdigital_item_sort_asc' ); $neworder = '&order=desc'; } elseif ( $_GET['order'] == 'desc' ) { - uasort( $dm_API_data_fields, 'dotdigitalItemSortDesc' ); + uasort( $dm_API_data_fields, 'dotdigital_item_sort_desc' ); $neworder = '&order=asc'; } } else { - uasort( $dm_API_data_fields, 'dotdigitalItemSortAsc' ); + uasort( $dm_API_data_fields, 'dotdigital_item_sort_asc' ); $neworder = '&order=desc'; } ?> @@ -558,7 +558,7 @@ function dm_API_data_fields_input() { /> - + $value ) { - writeFormLine( $value['type'], $value['name'], $value['label'], $value['isRequired'] ); + writeFormLine( strtolower($value['type']), $value['name'], $value['label'], $value['isRequired'] ); if ( isset( $formErrors[ $value['name'] ] ) ) { echo "

" . $formErrors[ $value['name'] ] . '

'; } diff --git a/functions.php b/functions.php index 3642093..fedfa0d 100644 --- a/functions.php +++ b/functions.php @@ -25,29 +25,47 @@ function returnRequiredFields( $posts = array() ) { register_shutdown_function( 'shutdown' ); /** - * @param object $a - * @param object $b + * Sort descending. + * + * @param object $a Object A. + * @param object $b Object B. * @return int */ -function dotdigitalItemSortDesc( object $a, object $b ) { - if ( ! method_exists( $a ,'getName' ) || ! method_exists($b, 'getName') ) { - return 0; - } +function dotdigital_item_sort_desc( object $a, object $b ) { + if ( ! method_exists( $a, 'getName' ) || ! method_exists( $b, 'getName' ) ) { + return 0; + } + + $a_name = strtolower( $a->getName() ); + $b_name = strtolower( $b->getName() ); + + if ( $a_name === $b_name ) { + return 0; + } - return strtolower( $a->getName() ) < strtolower($b->getName()); + return $a_name > $b_name ? -1 : 1; } /** - * @param object $a - * @param object $b + * Sort ascending. + * + * @param object $a Object A. + * @param object $b Object B. * @return int */ -function dotdigitalItemSortAsc( object $a, object $b ) { - if ( ! method_exists( $a ,'getName' ) || ! method_exists($b, 'getName') ) { +function dotdigital_item_sort_asc( object $a, object $b ) { + if ( ! method_exists( $a, 'getName' ) || ! method_exists( $b, 'getName' ) ) { + return 0; + } + + $a_name = strtolower( $a->getName() ); + $b_name = strtolower( $b->getName() ); + + if ( $a_name === $b_name ) { return 0; } - return strtolower( $a->getName() ) > strtolower($b->getName()); + return $a_name > $b_name ? 1 : -1; } function clean( $data ) { @@ -66,28 +84,34 @@ function writeFormLine( $fieldType, $fieldName, $fieldWording, $required ) { $asterisk = ''; } - if ( strtolower( $fieldType ) == 'date' ) { - echo ""; - echo ""; - echo ""; - echo ""; - } elseif ( strtolower( $fieldType ) == 'boolean' ) { - $fieldType = 'radio'; - echo ""; - echo "Yes "; - echo "No "; - echo ""; - echo ""; - } elseif ( strtolower( $fieldType ) == 'string' ) { - echo ""; - echo ""; - echo ""; - echo ""; - } else { - echo ""; - echo ""; - echo ""; - echo ""; + switch ( $fieldType ) { + case 'date': + echo ""; + echo ""; + echo ""; + echo ""; + break; + case 'boolean': + echo "$fieldWording$asterisk"; + echo ""; + echo "
"; + echo ""; + echo "
"; + echo ""; + echo ""; + break; + case 'string': + echo ""; + echo ""; + echo ""; + echo ""; + break; + case 'numeric': + echo ""; + echo ""; + echo ""; + echo ""; + break; } } diff --git a/vendor/autoload.php b/vendor/autoload.php index 3497d65..48e0d31 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -3,8 +3,21 @@ // autoload.php @generated by Composer if (PHP_VERSION_ID < 50600) { - echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - exit(1); + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index afef3fa..a72151c 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -42,6 +42,9 @@ */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + /** @var ?string */ private $vendorDir; @@ -106,6 +109,7 @@ class ClassLoader public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** @@ -425,7 +429,8 @@ public function unregister() public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -555,18 +560,26 @@ private function findFileWithExtension($class, $ext) return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 6d1e1c3..58d8d9f 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -11,7 +11,6 @@ '9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', - 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index caa0024..086752e 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -12,7 +12,7 @@ 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'), - 'Http\\Message\\' => array($vendorDir . '/php-http/message/src', $vendorDir . '/php-http/message-factory/src'), + 'Http\\Message\\' => array($vendorDir . '/php-http/message/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'), @@ -20,7 +20,6 @@ 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), - 'Dotdigital\\Tests\\' => array($vendorDir . '/dotdigital/dotdigital-php/tests'), 'Dotdigital\\' => array($vendorDir . '/dotdigital/dotdigital-php/src'), 'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 1cdfd33..d5c3e7c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -33,25 +33,18 @@ public static function getLoader() $loader->register(true); - $includeFiles = \Composer\Autoload\ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414::$files; - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire1bde3b58d5c0542dbfefe0e5ef04b414($fileIdentifier, $file); + $filesToLoad = \Composer\Autoload\ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); } return $loader; } } - -/** - * @param string $fileIdentifier - * @param string $file - * @return void - */ -function composerRequire1bde3b58d5c0542dbfefe0e5ef04b414($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 1b39603..fa5259e 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -12,7 +12,6 @@ class ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414 '9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', - 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', ); @@ -46,7 +45,6 @@ class ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414 ), 'D' => array ( - 'Dotdigital\\Tests\\' => 17, 'Dotdigital\\' => 11, ), 'C' => @@ -84,7 +82,6 @@ class ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414 'Http\\Message\\' => array ( 0 => __DIR__ . '/..' . '/php-http/message/src', - 1 => __DIR__ . '/..' . '/php-http/message-factory/src', ), 'Http\\Discovery\\' => array ( @@ -114,10 +111,6 @@ class ComposerStaticInit1bde3b58d5c0542dbfefe0e5ef04b414 array ( 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', ), - 'Dotdigital\\Tests\\' => - array ( - 0 => __DIR__ . '/..' . '/dotdigital/dotdigital-php/tests', - ), 'Dotdigital\\' => array ( 0 => __DIR__ . '/..' . '/dotdigital/dotdigital-php/src', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d06c49e..f62588f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -71,17 +71,17 @@ }, { "name": "dotdigital/dotdigital-php", - "version": "v1.0.0", - "version_normalized": "1.0.0.0", + "version": "v2.0.0-RC1", + "version_normalized": "2.0.0.0-RC1", "source": { "type": "git", "url": "https://github.com/dotmailer/dotdigital-php.git", - "reference": "310753341c24735d3b7f39eca7cebbd7a4985d74" + "reference": "de94511ddf8e0ea20b8dc2796d2fd977f477bd0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dotmailer/dotdigital-php/zipball/310753341c24735d3b7f39eca7cebbd7a4985d74", - "reference": "310753341c24735d3b7f39eca7cebbd7a4985d74", + "url": "https://api.github.com/repos/dotmailer/dotdigital-php/zipball/de94511ddf8e0ea20b8dc2796d2fd977f477bd0b", + "reference": "de94511ddf8e0ea20b8dc2796d2fd977f477bd0b", "shasum": "" }, "require": { @@ -93,19 +93,20 @@ "psr/http-factory": "^1.0" }, "require-dev": { + "fakerphp/faker": "^1.22", "guzzlehttp/guzzle": "^7.4", "php-http/curl-client": "^2.2", "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.1.1", + "symfony/dotenv": "^6.2", "symplify/easy-coding-standard": "^9.4" }, - "time": "2022-09-05T11:52:01+00:00", + "time": "2023-06-16T14:29:22+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "Dotdigital\\": "src/", - "Dotdigital\\Tests\\": "tests/" + "Dotdigital\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -115,29 +116,29 @@ "description": "Dotdigital PHP Library", "support": { "issues": "https://github.com/dotmailer/dotdigital-php/issues", - "source": "https://github.com/dotmailer/dotdigital-php/tree/v1.0.0" + "source": "https://github.com/dotmailer/dotdigital-php/tree/v2.0.0-RC1" }, "install-path": "../dotdigital/dotdigital-php" }, { "name": "guzzlehttp/guzzle", - "version": "7.5.0", - "version_normalized": "7.5.0.0", + "version": "7.7.0", + "version_normalized": "7.7.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", + "guzzlehttp/promises": "^1.5.3 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -148,7 +149,8 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, @@ -157,15 +159,12 @@ "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", + "time": "2023-05-21T14:04:53+00:00", "type": "library", "extra": { "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "installation-source": "dist", @@ -232,7 +231,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.0" + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" }, "funding": [ { @@ -252,37 +251,36 @@ }, { "name": "guzzlehttp/promises", - "version": "1.5.2", - "version_normalized": "1.5.2.0", + "version": "2.0.0", + "version_normalized": "2.0.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, - "time": "2022-08-28T14:55:35+00:00", + "time": "2023-05-21T13:50:22+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "installation-source": "dist", "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -319,7 +317,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" + "source": "https://github.com/guzzle/promises/tree/2.0.0" }, "funding": [ { @@ -339,23 +337,23 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.1", - "version_normalized": "2.4.1.0", + "version": "2.5.0", + "version_normalized": "2.5.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" + "reference": "b635f279edd83fc275f822a1188157ffea568ff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", - "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", + "reference": "b635f279edd83fc275f822a1188157ffea568ff6", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "ralouphie/getallheaders": "^3.0" }, "provide": { @@ -370,15 +368,12 @@ "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2022-08-28T14:45:39+00:00", + "time": "2023-04-17T16:11:26+00:00", "type": "library", "extra": { "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" } }, "installation-source": "dist", @@ -441,7 +436,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.1" + "source": "https://github.com/guzzle/psr7/tree/2.5.0" }, "funding": [ { @@ -461,27 +456,26 @@ }, { "name": "php-http/client-common", - "version": "2.5.0", - "version_normalized": "2.5.0.0", + "version": "2.7.0", + "version_normalized": "2.7.0.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054" + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054", - "reference": "d135751167d57e27c74de674d6a30cef2dc8e054", + "url": "https://api.github.com/repos/php-http/client-common/zipball/880509727a447474d2a71b7d7fa5d268ddd3db4b", + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b", "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", + "psr/http-message": "^1.0 || ^2.0", "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, @@ -491,7 +485,7 @@ "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" + "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" }, "suggest": { "ext-json": "To detect JSON responses with the ContentTypePlugin", @@ -500,13 +494,8 @@ "php-http/logger-plugin": "PSR-3 Logger plugin", "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" }, - "time": "2021-11-26T15:01:24+00:00", + "time": "2023-05-17T06:46:59+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { @@ -533,52 +522,62 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.5.0" + "source": "https://github.com/php-http/client-common/tree/2.7.0" }, "install-path": "../php-http/client-common" }, { "name": "php-http/discovery", - "version": "1.14.3", - "version_normalized": "1.14.3.0", + "version": "1.18.1", + "version_normalized": "1.18.1.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735" + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/31d8ee46d0215108df16a8527c7438e96a4d7735", - "reference": "31d8ee46d0215108df16a8527c7438e96a4d7735", + "url": "https://api.github.com/repos/php-http/discovery/zipball/f258b3a1d16acb7b21f3b42d7a2494a733365237", + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237", "shasum": "" }, "require": { + "composer-plugin-api": "^1.0|^2.0", "php": "^7.1 || ^8.0" }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "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" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" - }, - "time": "2022-07-11T14:04:40+00:00", - "type": "library", + "time": "2023-05-17T08:53:10+00:00", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "installation-source": "dist", "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -590,7 +589,7 @@ "email": "mark.sagikazar@gmail.com" } ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", "homepage": "http://php-http.org", "keywords": [ "adapter", @@ -599,11 +598,12 @@ "factory", "http", "message", + "psr17", "psr7" ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.3" + "source": "https://github.com/php-http/discovery/tree/1.18.1" }, "install-path": "../php-http/discovery" }, @@ -674,36 +674,31 @@ }, { "name": "php-http/httplug", - "version": "2.3.0", - "version_normalized": "2.3.0.0", + "version": "2.4.0", + "version_normalized": "2.4.0.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "f640739f80dfa1152533976e3c112477f69274eb" + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", - "reference": "f640739f80dfa1152533976e3c112477f69274eb", + "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", + "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, - "time": "2022-02-21T09:52:22+00:00", + "time": "2023-04-14T15:10:03+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { @@ -733,30 +728,29 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.3.0" + "source": "https://github.com/php-http/httplug/tree/2.4.0" }, "install-path": "../php-http/httplug" }, { "name": "php-http/message", - "version": "1.13.0", - "version_normalized": "1.13.0.0", + "version": "1.16.0", + "version_normalized": "1.16.0.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361" + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361", - "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361", + "url": "https://api.github.com/repos/php-http/message/zipball/47a14338bf4ebd67d317bf1144253d7db4ab55fd", + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd", "shasum": "" }, "require": { "clue/stream-filter": "^1.5", - "php": "^7.1 || ^8.0", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" }, "provide": { "php-http/message-factory-implementation": "1.0" @@ -764,8 +758,9 @@ "require-dev": { "ergebnis/composer-normalize": "^2.6", "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0", - "laminas/laminas-diactoros": "^2.0", + "guzzlehttp/psr7": "^1.0 || ^2.0", + "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, @@ -775,13 +770,8 @@ "laminas/laminas-diactoros": "Used with Diactoros Factories", "slim/slim": "Used with Slim Framework PSR-7 implementation" }, - "time": "2022-02-11T13:41:14+00:00", + "time": "2023-05-17T06:43:38+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "installation-source": "dist", "autoload": { "files": [ @@ -810,67 +800,10 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.13.0" + "source": "https://github.com/php-http/message/tree/1.16.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", @@ -933,24 +866,24 @@ }, { "name": "psr/http-client", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "version": "1.0.2", + "version_normalized": "1.0.2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, - "time": "2020-06-29T06:28:15+00:00", + "time": "2023-04-10T20:12:12+00:00", "type": "library", "extra": { "branch-alias": { @@ -970,7 +903,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -982,30 +915,30 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client/tree/1.0.2" }, "install-path": "../psr/http-client" }, { "name": "psr/http-factory", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "version": "1.0.2", + "version_normalized": "1.0.2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, - "time": "2019-04-30T12:38:16+00:00", + "time": "2023-04-10T20:10:41+00:00", "type": "library", "extra": { "branch-alias": { @@ -1025,7 +958,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -1040,33 +973,33 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, "install-path": "../psr/http-factory" }, { "name": "psr/http-message", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "version": "2.0", + "version_normalized": "2.0.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, - "time": "2016-08-06T14:39:51+00:00", + "time": "2023-04-04T09:54:51+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "installation-source": "dist", @@ -1082,7 +1015,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -1096,7 +1029,7 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, "install-path": "../psr/http-message" }, @@ -1219,17 +1152,17 @@ }, { "name": "symfony/options-resolver", - "version": "v5.4.11", - "version_normalized": "5.4.11.0", + "version": "v5.4.21", + "version_normalized": "5.4.21.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", - "reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", "shasum": "" }, "require": { @@ -1238,7 +1171,7 @@ "symfony/polyfill-php73": "~1.0", "symfony/polyfill-php80": "^1.16" }, - "time": "2022-07-20T13:00:38+00:00", + "time": "2023-02-14T08:03:56+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1271,7 +1204,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.11" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -1291,27 +1224,27 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", - "version_normalized": "1.26.0.0", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2022-05-24T11:49:31+00:00", + "time": "2022-11-03T14:55:06+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1353,7 +1286,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -1373,27 +1306,27 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", - "version_normalized": "1.26.0.0", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2022-05-10T07:21:04+00:00", + "time": "2022-11-03T14:55:06+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1439,7 +1372,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 7265148..912e9fc 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'dotdigital/dotdigital-signup-form', - 'pretty_version' => '6.0.0', - 'version' => '6.0.0.0', + 'pretty_version' => '6.0.2', + 'version' => '6.0.2.0', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', @@ -20,17 +20,17 @@ 'dev_requirement' => false, ), 'dotdigital/dotdigital-php' => array( - 'pretty_version' => 'v1.0.0', - 'version' => '1.0.0.0', - 'reference' => '310753341c24735d3b7f39eca7cebbd7a4985d74', + 'pretty_version' => 'v2.0.0-RC1', + 'version' => '2.0.0.0-RC1', + 'reference' => 'de94511ddf8e0ea20b8dc2796d2fd977f477bd0b', 'type' => 'library', 'install_path' => __DIR__ . '/../dotdigital/dotdigital-php', 'aliases' => array(), 'dev_requirement' => false, ), 'dotdigital/dotdigital-signup-form' => array( - 'pretty_version' => '6.0.0', - 'version' => '6.0.0.0', + 'pretty_version' => '6.0.2', + 'version' => '6.0.2.0', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', @@ -38,27 +38,27 @@ 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( - 'pretty_version' => '7.5.0', - 'version' => '7.5.0.0', - 'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba', + 'pretty_version' => '7.7.0', + 'version' => '7.7.0.0', + 'reference' => 'fb7566caccf22d74d1ab270de3551f72a58399f5', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '1.5.2', - 'version' => '1.5.2.0', - 'reference' => 'b94b2807d85443f9719887892882d0329d1e2598', + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'reference' => '3a494dc7dc1d7d12e511890177ae2d0e6c107da6', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.4.1', - 'version' => '2.4.1.0', - 'reference' => '69568e4293f4fa993f3b0e51c9723e1e17c41379', + 'pretty_version' => '2.5.0', + 'version' => '2.5.0.0', + 'reference' => 'b635f279edd83fc275f822a1188157ffea568ff6', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -67,13 +67,14 @@ 'php-http/async-client-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', + 0 => '*', + 1 => '1.0', ), ), 'php-http/client-common' => array( - 'pretty_version' => '2.5.0', - 'version' => '2.5.0.0', - 'reference' => 'd135751167d57e27c74de674d6a30cef2dc8e054', + 'pretty_version' => '2.7.0', + 'version' => '2.7.0.0', + 'reference' => '880509727a447474d2a71b7d7fa5d268ddd3db4b', 'type' => 'library', 'install_path' => __DIR__ . '/../php-http/client-common', 'aliases' => array(), @@ -82,14 +83,15 @@ 'php-http/client-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', + 0 => '*', + 1 => '1.0', ), ), 'php-http/discovery' => array( - 'pretty_version' => '1.14.3', - 'version' => '1.14.3.0', - 'reference' => '31d8ee46d0215108df16a8527c7438e96a4d7735', - 'type' => 'library', + 'pretty_version' => '1.18.1', + 'version' => '1.18.1.0', + 'reference' => 'f258b3a1d16acb7b21f3b42d7a2494a733365237', + 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../php-http/discovery', 'aliases' => array(), 'dev_requirement' => false, @@ -104,32 +106,23 @@ 'dev_requirement' => false, ), 'php-http/httplug' => array( - 'pretty_version' => '2.3.0', - 'version' => '2.3.0.0', - 'reference' => 'f640739f80dfa1152533976e3c112477f69274eb', + 'pretty_version' => '2.4.0', + 'version' => '2.4.0.0', + 'reference' => '625ad742c360c8ac580fcc647a1541d29e257f67', 'type' => 'library', 'install_path' => __DIR__ . '/../php-http/httplug', 'aliases' => array(), 'dev_requirement' => false, ), 'php-http/message' => array( - 'pretty_version' => '1.13.0', - 'version' => '1.13.0.0', - 'reference' => '7886e647a30a966a1a8d1dad1845b71ca8678361', + 'pretty_version' => '1.16.0', + 'version' => '1.16.0.0', + 'reference' => '47a14338bf4ebd67d317bf1144253d7db4ab55fd', 'type' => 'library', 'install_path' => __DIR__ . '/../php-http/message', 'aliases' => array(), 'dev_requirement' => false, ), - 'php-http/message-factory' => array( - 'pretty_version' => 'v1.0.2', - 'version' => '1.0.2.0', - 'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1', - 'type' => 'library', - 'install_path' => __DIR__ . '/../php-http/message-factory', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'php-http/message-factory-implementation' => array( 'dev_requirement' => false, 'provided' => array( @@ -146,9 +139,9 @@ 'dev_requirement' => false, ), 'psr/http-client' => array( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'reference' => '0955afe48220520692d2d09f7ab7e0f93ffd6a31', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-client', 'aliases' => array(), @@ -158,12 +151,13 @@ 'dev_requirement' => false, 'provided' => array( 0 => '1.0', + 1 => '*', ), ), 'psr/http-factory' => array( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'reference' => 'e616d01114759c4c489f93b099585439f795fe35', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-factory', 'aliases' => array(), @@ -173,12 +167,13 @@ 'dev_requirement' => false, 'provided' => array( 0 => '1.0', + 1 => '*', ), ), 'psr/http-message' => array( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', + 'pretty_version' => '2.0', + 'version' => '2.0.0.0', + 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), @@ -188,6 +183,7 @@ 'dev_requirement' => false, 'provided' => array( 0 => '1.0', + 1 => '*', ), ), 'ralouphie/getallheaders' => array( @@ -209,27 +205,27 @@ 'dev_requirement' => false, ), 'symfony/options-resolver' => array( - 'pretty_version' => 'v5.4.11', - 'version' => '5.4.11.0', - 'reference' => '54f14e36aa73cb8f7261d7686691fd4d75ea2690', + 'pretty_version' => 'v5.4.21', + 'version' => '5.4.21.0', + 'reference' => '4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/options-resolver', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php73' => array( - 'pretty_version' => 'v1.26.0', - 'version' => '1.26.0.0', - 'reference' => 'e440d35fa0286f77fb45b79a03fedbeda9307e85', + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php73', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.26.0', - 'version' => '1.26.0.0', - 'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace', + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), diff --git a/vendor/dotdigital/dotdigital-php/.gitignore b/vendor/dotdigital/dotdigital-php/.gitignore index 73c4ddd..944bc48 100644 --- a/vendor/dotdigital/dotdigital-php/.gitignore +++ b/vendor/dotdigital/dotdigital-php/.gitignore @@ -1,5 +1,6 @@ .DS_Store .idea +**/.env .phpunit.result.cache /vendor/ composer.lock diff --git a/vendor/dotdigital/dotdigital-php/README.md b/vendor/dotdigital/dotdigital-php/README.md index 94fbe9d..6a0b055 100644 --- a/vendor/dotdigital/dotdigital-php/README.md +++ b/vendor/dotdigital/dotdigital-php/README.md @@ -31,10 +31,29 @@ composer require php-http/curl-client # app/index.php require_once __DIR__ . '/vendor/autoload.php'; -$dotdigital = new \Dotdigital\Client(); +$dotdigital = new \Dotdigital\V3\Client(); $dotdigital::setApiUser('apiuser-123@apiconnector.com'); $dotdigital::setApiPassword(''); -$dotdigital::setApiEndpoint('https://r1-api.dotmailer.com'); +$dotdigital::setApiEndpoint('https://r1-api.dotdigital.com'); $accountInfo = $dotdigital->accountInfo->show(); ``` + +## API versions + +Dotdigital began releasing endpoints for a new v3 API in May 2023. Initially these endpoints are in public preview, and only available +to merchants with certain Dotdigital account configurations. + +- [View v3 API specs on Swagger Hub](https://app.swaggerhub.com/search?owner=Dotdigital) + +Currently this SDK wraps both the v2 and the v3 APIs, and will be updated to wrap new v3 endpoints as they become available. + +### V2 +``` +$dotdigital = new \Dotdigital\V2\Client(); +``` + +### V3 +``` +$dotdigital = new \Dotdigital\V3\Client(); +``` diff --git a/vendor/dotdigital/dotdigital-php/composer.json b/vendor/dotdigital/dotdigital-php/composer.json index ea44d7c..07522a2 100644 --- a/vendor/dotdigital/dotdigital-php/composer.json +++ b/vendor/dotdigital/dotdigital-php/composer.json @@ -4,7 +4,11 @@ "license": "MIT", "autoload": { "psr-4": { - "Dotdigital\\": "src/", + "Dotdigital\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { "Dotdigital\\Tests\\": "tests/" } }, @@ -20,7 +24,14 @@ "guzzlehttp/guzzle": "^7.4", "symplify/easy-coding-standard": "^9.4", "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.5", - "php-http/curl-client": "^2.2" + "phpunit/phpunit": "^10.1.1", + "php-http/curl-client": "^2.2", + "symfony/dotenv": "^6.2", + "fakerphp/faker": "^1.22" + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/vendor/dotdigital/dotdigital-php/docs/pull_request_template/develop.md b/vendor/dotdigital/dotdigital-php/docs/pull_request_template/develop.md new file mode 100644 index 0000000..8c20806 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/docs/pull_request_template/develop.md @@ -0,0 +1,16 @@ +## What's being changed + +Lorem ipsum... + +## Why it's being changed + +Lorem ipsum... + +## How to review / test this change + +- Lorem +- ipsum + +## Notes + +Optional diff --git a/vendor/dotdigital/dotdigital-php/phpstan.neon b/vendor/dotdigital/dotdigital-php/phpstan.neon new file mode 100644 index 0000000..eeafe7b --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/phpstan.neon @@ -0,0 +1,2 @@ +parameters: + treatPhpDocTypesAsCertain: false diff --git a/vendor/dotdigital/dotdigital-php/phpunit.xml b/vendor/dotdigital/dotdigital-php/phpunit.xml index 66010d9..c1ddfea 100644 --- a/vendor/dotdigital/dotdigital-php/phpunit.xml +++ b/vendor/dotdigital/dotdigital-php/phpunit.xml @@ -1,8 +1,11 @@ - - ./tests/ + + ./tests/V2 + + + ./tests/V3 diff --git a/vendor/dotdigital/dotdigital-php/src/Client.php b/vendor/dotdigital/dotdigital-php/src/AbstractClient.php similarity index 67% rename from vendor/dotdigital/dotdigital-php/src/Client.php rename to vendor/dotdigital/dotdigital-php/src/AbstractClient.php index e66cac3..2bb4d18 100644 --- a/vendor/dotdigital/dotdigital-php/src/Client.php +++ b/vendor/dotdigital/dotdigital-php/src/AbstractClient.php @@ -4,59 +4,45 @@ namespace Dotdigital; +use Dotdigital\Resources\AbstractResource; use Dotdigital\Resources\ResourceFactory; -use Http\Client\Common\HttpMethodsClientInterface; use Http\Client\Common\Plugin\AuthenticationPlugin; use Http\Client\Common\Plugin\BaseUriPlugin; use Http\Client\Common\Plugin\HeaderDefaultsPlugin; use Http\Discovery\Psr17FactoryDiscovery; use Http\Message\Authentication\BasicAuth; -use Http\Message\UriFactory; - -/** - * @property Resources\AccountInfo $accountInfo - * @property Resources\Programs $programs - * @property Resources\Contacts $contact - * @property Resources\AddressBooks $addressBooks - * @property Resources\DataFields $dataFields - */ -class Client -{ - public const API_VERSION = 'v2'; +use Psr\Http\Message\UriFactoryInterface; +abstract class AbstractClient +{ /** * @var ClientBuilder */ - private $clientBuilder; + protected $clientBuilder; /** - * @var UriFactory|\Psr\Http\Message\UriFactoryInterface + * @var UriFactoryInterface */ - private $uriFactory; - - /** - * @var ResourceFactory - */ - private $resourceFactory; + protected $uriFactory; /** * @var string */ - public static $apiEndpoint; + protected static $apiEndpoint; /** * @var string */ - public static $apiUser; + protected static $apiUser; /** * @var string */ - public static $apiPassword; + protected static $apiPassword; public function __construct( ClientBuilder $clientBuilder = null, - UriFactory $uriFactory = null + UriFactoryInterface $uriFactory = null ) { $this->clientBuilder = $clientBuilder ?: new ClientBuilder(); $this->uriFactory = $uriFactory ?: Psr17FactoryDiscovery::findUriFactory(); @@ -103,12 +89,15 @@ public static function setApiEndpoint(string $endpoint) self::$apiEndpoint = $endpoint; } - public function getHttpClient(): HttpMethodsClientInterface + /** + * @return \Http\Client\Common\HttpMethodsClientInterface + */ + public function getHttpClient() { // Set base uri $this->clientBuilder->addPlugin( new BaseUriPlugin($this->uriFactory->createUri( - self::$apiEndpoint . '/' . self::API_VERSION + $this->getApiEndpoint() )) ); @@ -120,17 +109,29 @@ public function getHttpClient(): HttpMethodsClientInterface return $this->clientBuilder->getHttpClient(); } + /** + * @return string + */ + public function getApiEndpoint() + { + return self::$apiEndpoint; + } + + abstract public function mediateResponse($response): string; + /** * @param string $name * - * @return Resources\AbstractResource|null + * @return AbstractResource */ public function __get($name) { - if (null === $this->resourceFactory) { - $this->resourceFactory = new Resources\ResourceFactory($this); - } + $reflectionClass = new \ReflectionClass(get_class($this)); + $nameSpace = $reflectionClass->getNamespaceName(); + + $resource = '\\' . $nameSpace . '\\' . 'Resources' . '\\' . ucfirst($name); + $resourceFactory = new ResourceFactory($this); - return $this->resourceFactory->__get($name); + return $resourceFactory->__get($resource); } } diff --git a/vendor/dotdigital/dotdigital-php/src/Exception/ValidationException.php b/vendor/dotdigital/dotdigital-php/src/Exception/ValidationException.php new file mode 100644 index 0000000..3d0ff9e --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/Exception/ValidationException.php @@ -0,0 +1,7 @@ +getBody()->getContents(); + + if (!json_decode($content)) { + throw new ResponseValidationException('Cannot decode response.'); + } + + $decoded = json_decode($content, true); + + if (isset($decoded['errorCode'])) { + throw new ResponseValidationException($decoded['description']); + } + + return $content; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AbstractModel.php b/vendor/dotdigital/dotdigital-php/src/Models/AbstractModel.php index 7d15826..92e0d2b 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AbstractModel.php +++ b/vendor/dotdigital/dotdigital-php/src/Models/AbstractModel.php @@ -4,8 +4,6 @@ namespace Dotdigital\Models; -use Dotdigital\Exception\ResponseValidationException; - abstract class AbstractModel { /** diff --git a/vendor/dotdigital/dotdigital-php/src/Resources/AbstractResource.php b/vendor/dotdigital/dotdigital-php/src/Resources/AbstractResource.php index dc53319..4c0cc55 100644 --- a/vendor/dotdigital/dotdigital-php/src/Resources/AbstractResource.php +++ b/vendor/dotdigital/dotdigital-php/src/Resources/AbstractResource.php @@ -4,26 +4,26 @@ namespace Dotdigital\Resources; -use Dotdigital\Client; -use Dotdigital\HttpClient\Message\ResponseMediator; +use Dotdigital\AbstractClient; +use Dotdigital\Exception\ResponseValidationException; abstract class AbstractResource { /** * The client instance. * - * @var Client + * @var AbstractClient */ private $client; /** * Create a new API instance. * - * @param Client $client + * @param AbstractClient $client * * @return void */ - public function __construct(Client $client) + public function __construct(AbstractClient $client) { $this->client = $client; } @@ -34,10 +34,10 @@ public function __construct(Client $client) * @return string * @throws \Http\Client\Exception */ - protected function get(string $path) + protected function get($path) { $response = $this->client->getHttpClient()->get($path); - return ResponseMediator::getContent($response); + return $this->client->mediateResponse($response); } /** @@ -46,17 +46,38 @@ protected function get(string $path) * @param array $headers * * @return string - * @throws \Dotdigital\Exception\ResponseValidationException + * @throws ResponseValidationException * @throws \Http\Client\Exception */ - protected function post($path, $body = [], array $headers = []) + protected function post(string $path, array $body = [], array $headers = []) { $response = $this->client->getHttpClient()->post( $path, $headers, json_encode($body) ); - return ResponseMediator::getContent($response); + + return $this->client->mediateResponse($response); + } + + /** + * @param string $path + * @param array $body + * @param array $headers + * + * @return string + * @throws ResponseValidationException + * @throws \Http\Client\Exception + */ + protected function put(string $path, array $body = [], array $headers = []) + { + $response = $this->client->getHttpClient()->put( + $path, + $headers, + json_encode($body) + ); + + return $this->client->mediateResponse($response); } /** diff --git a/vendor/dotdigital/dotdigital-php/src/Resources/ResourceFactory.php b/vendor/dotdigital/dotdigital-php/src/Resources/ResourceFactory.php index 9cd613d..aea1a57 100644 --- a/vendor/dotdigital/dotdigital-php/src/Resources/ResourceFactory.php +++ b/vendor/dotdigital/dotdigital-php/src/Resources/ResourceFactory.php @@ -4,74 +4,40 @@ namespace Dotdigital\Resources; -use Dotdigital\Client; +use Dotdigital\AbstractClient; /** * Factory class for API resources. - * */ class ResourceFactory { /** - * @var Client + * @var AbstractClient */ private $client; - /** - * @var array - */ - private $resources; - - /** - * @var array - */ - private static $classMap = [ - 'accountInfo' => AccountInfo::class, - 'programs' => Programs::class, - 'addressBooks' => AddressBooks::class, - 'dataFields' => DataFields::class, - 'contacts' => Contacts::class, - ]; - /** * ResourceFactory constructor. * - * @param Client $client + * @param AbstractClient $client */ - public function __construct($client) + public function __construct(AbstractClient $client) { $this->client = $client; - $this->resources = []; } /** - * @param string $name - * + * @param string $className * @return null|AbstractResource */ - public function __get($name) + public function __get(string $className) { - $resourceClass = $this->getResourceClass($name); - if (null !== $resourceClass) { - if (!\array_key_exists($name, $this->resources)) { - $this->resources[$name] = new $resourceClass($this->client); - } - - return $this->resources[$name]; + if (class_exists($className)) { + return new $className($this->client); } - \trigger_error('Undefined property: ' . static::class . '::$' . $name); + \trigger_error('Undefined property: ' . static::class . '::$' . $className); return null; } - - /** - * @param string $name - * - * @return string|null - */ - protected function getResourceClass($name) - { - return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; - } } diff --git a/vendor/dotdigital/dotdigital-php/src/V2/Client.php b/vendor/dotdigital/dotdigital-php/src/V2/Client.php new file mode 100644 index 0000000..c384a55 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V2/Client.php @@ -0,0 +1,36 @@ + $listItem + * @param array $listItem * * @return AbstractSingletonModel */ @@ -39,17 +46,26 @@ protected function validate($content) if (is_string($content) && json_decode($content)) { $content = json_decode($content, true); } - foreach ($content as $key => $value) { + foreach ($content ?? [] as $key => $value) { if ($this->ignoreKey($key)) { continue; } - $this->$key = $this->getOne($value); + $this->data[$key] = $this->getOne($value); } } + /** + * @return array + */ + public function getList() + { + return $this->data; + } + /** * Utility to return a list-type object as an array. * + * @deprecated * @return array */ public function toArray() diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AbstractSingletonModel.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AbstractSingletonModel.php similarity index 98% rename from vendor/dotdigital/dotdigital-php/src/Models/AbstractSingletonModel.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AbstractSingletonModel.php index 64591f7..446bda6 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AbstractSingletonModel.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AbstractSingletonModel.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; use Dotdigital\Exception\ResponseValidationException; diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfo.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfo.php similarity index 92% rename from vendor/dotdigital/dotdigital-php/src/Models/AccountInfo.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfo.php index 2bf683c..7870d5f 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfo.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfo.php @@ -2,9 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; - -use Dotdigital\Models\AccountInfoProperty; +namespace Dotdigital\V2\Models; /** * This is an object representing your Dotdigital account info. diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfoProperty.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoProperty.php similarity index 92% rename from vendor/dotdigital/dotdigital-php/src/Models/AccountInfoProperty.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoProperty.php index f980b8e..111fac5 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfoProperty.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoProperty.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; /** * @property string $name diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfoPropertyList.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoPropertyList.php similarity index 83% rename from vendor/dotdigital/dotdigital-php/src/Models/AccountInfoPropertyList.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoPropertyList.php index 8c27dd5..1b0f239 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AccountInfoPropertyList.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AccountInfoPropertyList.php @@ -2,7 +2,9 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; + +use Dotdigital\Models\ListInterface; class AccountInfoPropertyList extends AbstractListModel implements ListInterface { diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AddressBook.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBook.php similarity index 96% rename from vendor/dotdigital/dotdigital-php/src/Models/AddressBook.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBook.php index 0d8f518..92674a9 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AddressBook.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBook.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; /** * @property int $id diff --git a/vendor/dotdigital/dotdigital-php/src/Models/AddressBookList.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBookList.php similarity index 82% rename from vendor/dotdigital/dotdigital-php/src/Models/AddressBookList.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBookList.php index 831a50e..43002b9 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/AddressBookList.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/AddressBookList.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; -use Dotdigital\Models\AddressBook; +use Dotdigital\Models\ListInterface; class AddressBookList extends AbstractListModel implements ListInterface { diff --git a/vendor/dotdigital/dotdigital-php/src/Models/Contact.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/Contact.php similarity index 88% rename from vendor/dotdigital/dotdigital-php/src/Models/Contact.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/Contact.php index 1d65811..bb31e7c 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/Contact.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/Contact.php @@ -1,9 +1,9 @@ name; } + + /** + * @return string + */ + public function getType(): string + { + return $this->type; + } } diff --git a/vendor/dotdigital/dotdigital-php/src/Models/DataFieldList.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/DataFieldList.php similarity index 82% rename from vendor/dotdigital/dotdigital-php/src/Models/DataFieldList.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/DataFieldList.php index 2c29de7..e4e9cd3 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/DataFieldList.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/DataFieldList.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; -use Dotdigital\Models\DataField; +use Dotdigital\Models\ListInterface; class DataFieldList extends AbstractListModel implements ListInterface { diff --git a/vendor/dotdigital/dotdigital-php/src/Models/Enrolment.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/Enrolment.php similarity index 95% rename from vendor/dotdigital/dotdigital-php/src/Models/Enrolment.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/Enrolment.php index a2d8e89..cfb10ae 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/Enrolment.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/Enrolment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; /** * @property string $id diff --git a/vendor/dotdigital/dotdigital-php/src/Models/EnrolmentList.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/EnrolmentList.php similarity index 82% rename from vendor/dotdigital/dotdigital-php/src/Models/EnrolmentList.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/EnrolmentList.php index df397c0..8bbe49a 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/EnrolmentList.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/EnrolmentList.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; -use Dotdigital\Models\Enrolment; +use Dotdigital\Models\ListInterface; class EnrolmentList extends AbstractListModel implements ListInterface { diff --git a/vendor/dotdigital/dotdigital-php/src/Models/Program.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/Program.php similarity index 93% rename from vendor/dotdigital/dotdigital-php/src/Models/Program.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/Program.php index db28b18..a765e0e 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/Program.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/Program.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; /** * @property int $id diff --git a/vendor/dotdigital/dotdigital-php/src/Models/ProgramList.php b/vendor/dotdigital/dotdigital-php/src/V2/Models/ProgramList.php similarity index 81% rename from vendor/dotdigital/dotdigital-php/src/Models/ProgramList.php rename to vendor/dotdigital/dotdigital-php/src/V2/Models/ProgramList.php index f3cd989..7237f20 100644 --- a/vendor/dotdigital/dotdigital-php/src/Models/ProgramList.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Models/ProgramList.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dotdigital\Models; +namespace Dotdigital\V2\Models; -use Dotdigital\Models\Program; +use Dotdigital\Models\ListInterface; class ProgramList extends AbstractListModel implements ListInterface { diff --git a/vendor/dotdigital/dotdigital-php/src/Resources/AccountInfo.php b/vendor/dotdigital/dotdigital-php/src/V2/Resources/AccountInfo.php similarity index 70% rename from vendor/dotdigital/dotdigital-php/src/Resources/AccountInfo.php rename to vendor/dotdigital/dotdigital-php/src/V2/Resources/AccountInfo.php index 3213213..288d5e1 100644 --- a/vendor/dotdigital/dotdigital-php/src/Resources/AccountInfo.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Resources/AccountInfo.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace Dotdigital\Resources; +namespace Dotdigital\V2\Resources; -use Dotdigital\Models\AccountInfo as AccountInfoModel; +use Dotdigital\Resources\AbstractResource; +use Dotdigital\V2\Models\AccountInfo as AccountInfoModel; class AccountInfo extends AbstractResource { diff --git a/vendor/dotdigital/dotdigital-php/src/Resources/AddressBooks.php b/vendor/dotdigital/dotdigital-php/src/V2/Resources/AddressBooks.php similarity index 92% rename from vendor/dotdigital/dotdigital-php/src/Resources/AddressBooks.php rename to vendor/dotdigital/dotdigital-php/src/V2/Resources/AddressBooks.php index c8a9a88..2f9e857 100644 --- a/vendor/dotdigital/dotdigital-php/src/Resources/AddressBooks.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Resources/AddressBooks.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Dotdigital\Resources; +namespace Dotdigital\V2\Resources; -use Dotdigital\Models\AddressBook; -use Dotdigital\Models\AddressBookList; -use Dotdigital\Models\Contact; -use Dotdigital\Models\ContactList; +use Dotdigital\Resources\AbstractResource; +use Dotdigital\V2\Models\AddressBookList; +use Dotdigital\V2\Models\Contact; +use Dotdigital\V2\Models\ContactList; class AddressBooks extends AbstractResource { diff --git a/vendor/dotdigital/dotdigital-php/src/Resources/Contacts.php b/vendor/dotdigital/dotdigital-php/src/V2/Resources/Contacts.php similarity index 90% rename from vendor/dotdigital/dotdigital-php/src/Resources/Contacts.php rename to vendor/dotdigital/dotdigital-php/src/V2/Resources/Contacts.php index 29ee7a4..7fdde12 100644 --- a/vendor/dotdigital/dotdigital-php/src/Resources/Contacts.php +++ b/vendor/dotdigital/dotdigital-php/src/V2/Resources/Contacts.php @@ -1,10 +1,11 @@ $content + * + * @throws \Exception + */ + public function __construct( + $content = [] + ) { + $this->validate($content); + } + + /** + * @param string $property + * @param array $args + * @return mixed|null + */ + public function __call(string $property, array $args) + { + $property = lcfirst(str_replace('get', '', $property)); + return (isset($this->$property)) ? $this->$property : null; + } + + /** + * @return array + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return get_object_vars($this); + } + + /** + * @param string|array $content + * + * @return void + * @throws ValidationException + */ + protected function validate($content) + { + if (is_string($content) && json_decode($content)) { + $content = json_decode($content, true); + } + $properties = $this->getModelProperties(); + foreach ($content as $key => $value) { + if (!empty($properties)) { + if (!in_array($key, array_map(function ($property) { + return $property->name; + }, $properties))) { + throw new ValidationException( + sprintf( + 'Validation error: the key %s is not a property of %s', + $key, + $this->getModelName() + ) + ); + } + } + try { + if (method_exists($this, $method = 'set' . ucfirst($key))) { + $this->$method($value); + } else { + $this->$key = $value; + } + } catch (\TypeError $e) { + throw new ValidationException($e->getMessage()); + } + } + } + + /** + * @return string + */ + private function getModelName() + { + $model = new \ReflectionClass($this); + return $model->getName(); + } + + /** + * @return array + */ + protected function getModelProperties() + { + $model = new \ReflectionClass($this); + return $model->getProperties(); + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Collection.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Collection.php new file mode 100644 index 0000000..b12ceb1 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Collection.php @@ -0,0 +1,195 @@ + + */ + protected $items = []; + + /** + * @param array $items + */ + public function __construct($items = []) + { + foreach ($items as $key => $item) { + $this->set($key, $item); + } + } + + /** + * @param mixed $item + */ + public function add($item): void + { + $this->validateType($item); + + $this->items[] = $item; + } + + /** + * @param string|int $key + * @param object $item + */ + public function set($key, $item): void + { + $this->validateType($item); + + if (is_string($key) || is_int($key)) { + $this->items[$key] = $item; + } else { + throw new \InvalidArgumentException('Keys must be string or integer'); + } + } + + /** + * @return false|string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * @return array|mixed + */ + public function first() + { + return $this->items[0] ?? []; + } + + public function last() + { + $results = array_reverse($this->items); + return $results[0] ?? []; + } + + /** + * @return int + */ + public function count(): int + { + return count($this->items); + } + + /** + * @param \Closure $callback + * + * @return $this + */ + public function each($callback) + { + foreach ($this->items as $key => $value) { + $callback($value, $key); + } + + return $this; + } + + /** + * @param \Closure $callback + * + * @return self + */ + final public function filter($callback = null) + { + if ($callback) { + return new self(array_filter($this->items, $callback)); + } + + return new self(array_filter($this->items)); + } + + /** + * @param \Closure $callback + * + * @return self + */ + final public function map($callback) + { + $keys = array_keys($this->items); + $items = array_map($callback, $this->items, $keys); + + return new self(array_combine($keys, $items)); + } + + /** + * @param \Closure $callback + * @param mixed|null $initial + * + * @return mixed|null + */ + public function reduce($callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * @return false|string + */ + public function toJson() + { + return json_encode($this->items); + } + + /** + * @return ArrayIterator + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->items); + } + + /** + * @return array + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->items; + } + + /** + * @param object $item + */ + protected function validateType($item): void + { + $expectedClass = $this->getExpectedClass(); + if ($expectedClass === null) { + return; + } + + if (!$item instanceof $expectedClass) { + $elementClass = \get_class($item); + + throw new \InvalidArgumentException( + sprintf('Expected collection element of type %s got %s', $expectedClass, $elementClass) + ); + } + } + + /** + * @return string|null + */ + protected function getExpectedClass(): ?string + { + return null; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/ConsentRecordCollection.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/ConsentRecordCollection.php new file mode 100644 index 0000000..57f7418 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/ConsentRecordCollection.php @@ -0,0 +1,14 @@ +|null + */ + protected ?array $lists; + + /** + * @var ConsentRecordCollection|null + */ + protected ?ConsentRecordCollection $consentRecords; + + /** + * @var PreferenceCollection|null + */ + protected ?PreferenceCollection $preferences; + + public function getContactId(): int + { + return $this->contactId; + } + + public function getIdentifiers(): Identifiers + { + return $this->identifiers; + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setIdentifiers($data) + { + $this->identifiers = new Identifiers($data); + } + + /** + * @param $matchIdentifier + * @return void + */ + public function setMatchIdentifier($matchIdentifier): void + { + $this->matchIdentifier = $matchIdentifier; + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setDataFields($data) + { + $dataFieldsCollection = new DataFieldCollection(); + foreach ($data as $key => $value) { + $dataField = new DataField($key, $value); + $dataFieldsCollection->add($dataField); + } + $this->dataFields = $dataFieldsCollection; + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setChannelProperties(array $data) + { + $this->channelProperties = new ChannelProperty($data); + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setLists(array $data) + { + $this->lists = $data; + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setConsentRecords($data) + { + if (!isset($this->consentRecords)) { + $this->consentRecords = new ConsentRecordCollection(); + } + + foreach ($data as $array) { + $consentRecord = new ConsentRecord($array); + $this->consentRecords->add($consentRecord); + } + } + + /** + * @param array $data + * @return void + * @throws \Exception + */ + public function setPreferences($data) + { + $preferenceCollection = new PreferenceCollection(); + foreach ($data as $array) { + $preference = new Preference($array); + $preferenceCollection->add($preference); + } + $this->preferences = $preferenceCollection; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperties/EmailChannelProperty.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperties/EmailChannelProperty.php new file mode 100644 index 0000000..0da7f9c --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ChannelProperties/EmailChannelProperty.php @@ -0,0 +1,23 @@ +email = new EmailChannelProperty($property); + } + + /** + * @param array $property + * + * @return void + * @throws \Exception + */ + public function setSms(array $property) + { + $this->sms = new SmsChannelProperty($property); + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ConsentRecord.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ConsentRecord.php new file mode 100644 index 0000000..c8451cc --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/ConsentRecord.php @@ -0,0 +1,38 @@ +setKey($key); + $this->setValue($value); + } + + public function getKey(): string + { + return $this->key; + } + + public function setKey(string $key): self + { + $this->key = $key; + + return $this; + } + + /** + * @return string|int|float|null + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string|int|float|null $value + */ + public function setValue($value): self + { + $this->value = $value; + + return $this; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifier.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifier.php new file mode 100644 index 0000000..5162fc3 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifier.php @@ -0,0 +1,36 @@ +email = $email; + } + + /** + * @param string $mobileNumber + * @return void + */ + public function setMobileNumber(string $mobileNumber): void + { + $this->mobileNumber = $mobileNumber; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifiers.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifiers.php new file mode 100644 index 0000000..f44040f --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Identifiers.php @@ -0,0 +1,23 @@ +add($contact); + } + return $contacts; + } + + /** + * @param array $failuresData + * @return FailureCollection + * @throws \Exception + */ + private function createFailures(array $failuresData): FailureCollection + { + $failures = new FailureCollection(); + foreach ($failuresData as $failureData) { + $failure = new Failure($failureData); + $failures->add($failure); + } + return $failures; + } + + /** + * @param string $importId + * @return void + */ + public function setImportId(string $importId): void + { + $this->importId = $importId; + } + + /** + * @param string $status + * @return void + */ + public function setStatus(string $status): void + { + $this->status = $status; + } + + /** + * @param array $summary + * @return void + * @throws \Exception + */ + public function setSummary(array $summary): void + { + $this->summary = new Summary($summary); + } + + /** + * @param array $created + * @return void + * @throws \Exception + */ + public function setCreated(array $created): void + { + $this->created = $this->createContactCollection($created); + } + + /** + * @param array $updated + * @return void + * @throws \Exception + */ + public function setUpdated(array $updated): void + { + $this->updated = $this->createContactCollection($updated); + } + + /** + * @param array $failures + * @return void + * @throws \Exception + */ + public function setFailures(array $failures): void + { + $this->failures = $this->createFailures($failures); + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/Failure.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/Failure.php new file mode 100644 index 0000000..3d9a88c --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/Failure.php @@ -0,0 +1,54 @@ +add($failureDetail); + } + return $failureDetails; + } + + /** + * @param array $identifiers + * @return void + * @throws \Exception + */ + public function setIdentifiers(array $identifiers): void + { + $this->identifiers = new Identifier($identifiers); + } + + /** + * @param array $failures + * @return void + * @throws \Exception + */ + public function setFailures(array $failures): void + { + $this->failures = $this->createFailureDetails($failures); + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureCollection.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureCollection.php new file mode 100644 index 0000000..91d703a --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureCollection.php @@ -0,0 +1,16 @@ +failureCode = $failureCode; + } + + /** + * @param string $description + * @return void + */ + public function setDescription(string $description): void + { + $this->description = $description; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureDetailCollection.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureDetailCollection.php new file mode 100644 index 0000000..9e9cf1e --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Import/FailureDetailCollection.php @@ -0,0 +1,16 @@ +newContacts = $newContacts; + } + + /** + * @param int $updatedContacts + * @return void + */ + public function setUpdatedContacts(int $updatedContacts): void + { + $this->updatedContacts = $updatedContacts; + } + + /** + * @param int $globallySuppressed + * @return void + */ + public function setGloballySuppressed(int $globallySuppressed): void + { + $this->globallySuppressed = $globallySuppressed; + } + + /** + * @param int $invalidEntries + * @return void + */ + public function setInvalidEntries(int $invalidEntries): void + { + $this->invalidEntries = $invalidEntries; + } + + /** + * @param int $duplicateIdentifiers + * @return void + */ + public function setDuplicateIdentifiers(int $duplicateIdentifiers): void + { + $this->duplicateIdentifiers = $duplicateIdentifiers; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Preference.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Preference.php new file mode 100644 index 0000000..b0c901a --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/Contact/Preference.php @@ -0,0 +1,28 @@ +items as $item) { + $preparedDataFields[$item->getKey()] = $item->getValue(); + } + return $preparedDataFields; + } +} diff --git a/vendor/dotdigital/dotdigital-php/src/V3/Models/PreferenceCollection.php b/vendor/dotdigital/dotdigital-php/src/V3/Models/PreferenceCollection.php new file mode 100644 index 0000000..e5fe240 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/src/V3/Models/PreferenceCollection.php @@ -0,0 +1,14 @@ +post( + self::RESOURCE_BASE, + json_decode(json_encode($contact), true) + ); + + return new ContactModel($response); + } + + /** + * Retrieves the status of a contacts import request and the results if available. + * + * @param string $importId + * @return \Dotdigital\V3\Models\Contact\Import + * @throws Exception + * @throws \Exception + */ + public function getImportById(string $importId): Import + { + $response = $this->get( + sprintf( + '%s/%s/%s', + self::RESOURCE_BASE, + 'import', + $importId, + ) + ); + return new Import($response); + } + + /** + * Get contact by email. + * + * @param string $value + * @param string $identifier + * @return ContactModel + * @throws Exception + */ + public function getByIdentifier(string $value, string $identifier = 'email') + { + $url = sprintf('%s/%s/%s', self::RESOURCE_BASE, $identifier, $value); + return new ContactModel($this->get($url)); + } + + /** + * @param ContactCollection $contactCollection + * @param string $mergeOption + * @param bool $resubscribeWithNoChallenge + * + * @return string + * @throws Exception + * @throws ResponseValidationException + */ + public function import( + ContactCollection $contactCollection, + string $mergeOption = self::DEFAULT_IMPORT_MERGE_OPTION, + bool $resubscribeWithNoChallenge = self::DEFAULT_RESUBSCRIBE_NO_CHALLENGE + ) { + $data = [ + 'mergeOption' => $mergeOption, + 'resubscribeWithNoChallenge' => $resubscribeWithNoChallenge, + 'contacts' => $contactCollection->all() + ]; + + return $this->put( + sprintf('%s/%s', self::RESOURCE_BASE, 'import'), + $data + ); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/ApiConfigurationTrait.php b/vendor/dotdigital/dotdigital-php/tests/ApiConfigurationTrait.php index a0af011..c29b3f5 100644 --- a/vendor/dotdigital/dotdigital-php/tests/ApiConfigurationTrait.php +++ b/vendor/dotdigital/dotdigital-php/tests/ApiConfigurationTrait.php @@ -2,20 +2,18 @@ namespace Dotdigital\Tests; -use Dotdigital\Client; +use Dotdigital\AbstractClient; use PHPUnit\Framework\Assert; -use PHPUnit\Framework\TestCase; trait ApiConfigurationTrait { /** - * @var Client + * @var AbstractClient */ - protected Client $client; + protected AbstractClient $client; protected function clientInit(): void { - $this->client = new Client(); $this->client::setApiUser('demo@apiconnector.com'); $this->client::setApiPassword('demo'); $this->client::setApiEndpoint('https://r1-api.dotmailer.com'); diff --git a/vendor/dotdigital/dotdigital-php/tests/Resources/AddressBooksTest.php b/vendor/dotdigital/dotdigital-php/tests/Resources/AddressBooksTest.php deleted file mode 100644 index d8cd283..0000000 --- a/vendor/dotdigital/dotdigital-php/tests/Resources/AddressBooksTest.php +++ /dev/null @@ -1,36 +0,0 @@ -clientInit(); - $this->testSuccessResponse(); - } - - public function testAddressBooksContent() - { - $addressBooks = $this->client->addressBooks->show(); - foreach ($addressBooks as $addressBook) { - $this->assertObjectHasAttribute('id', $addressBook); - $this->assertObjectHasAttribute('name', $addressBook); - $this->assertObjectHasAttribute('visibility', $addressBook); - $this->assertObjectHasAttribute('contacts', $addressBook); - } - } - - public function tearDown(): void - { - $this->testFailedResponse(); - } -} diff --git a/vendor/dotdigital/dotdigital-php/tests/Resources/DataFieldsTest.php b/vendor/dotdigital/dotdigital-php/tests/Resources/DataFieldsTest.php deleted file mode 100644 index e578855..0000000 --- a/vendor/dotdigital/dotdigital-php/tests/Resources/DataFieldsTest.php +++ /dev/null @@ -1,36 +0,0 @@ -clientInit(); - } - - public function testDataFieldsContent() - { - $dataFields = $this->client->dataFields->show(); - - foreach ($dataFields as $dataField) { - $this->assertObjectHasAttribute('name', $dataField); - $this->assertObjectHasAttribute('type', $dataField); - $this->assertObjectHasAttribute('visibility', $dataField); - $this->assertObjectHasAttribute('defaultValue', $dataField); - } - } - - public function tearDown(): void - { - $this->testFailedResponse(); - } -} diff --git a/vendor/dotdigital/dotdigital-php/tests/Resources/AccountInfoTest.php b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AccountInfoTest.php similarity index 76% rename from vendor/dotdigital/dotdigital-php/tests/Resources/AccountInfoTest.php rename to vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AccountInfoTest.php index 43ab1b9..6ab10b3 100644 --- a/vendor/dotdigital/dotdigital-php/tests/Resources/AccountInfoTest.php +++ b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AccountInfoTest.php @@ -1,9 +1,11 @@ client = new Client(); $this->clientInit(); - $this->testSuccessResponse(AccountInfo::RESOURCE_BASE); } public function testAccountInfoContent() @@ -29,9 +33,4 @@ public function testAccountInfoContent() $this->assertArrayHasKey('value', $property); } } - - public function tearDown(): void - { - $this->testFailedResponse(); - } } diff --git a/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AddressBooksTest.php b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AddressBooksTest.php new file mode 100644 index 0000000..a197e9d --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/AddressBooksTest.php @@ -0,0 +1,35 @@ +client = new Client(); + $this->clientInit(); + } + + public function testAddressBooksContent() + { + $addressBooks = $this->client->addressBooks->show(); + foreach ($addressBooks->getList() as $addressBook) { + $this->assertTrue(property_exists($addressBook, 'id')); + $this->assertTrue(property_exists($addressBook, 'name')); + $this->assertTrue(property_exists($addressBook, 'visibility')); + $this->assertTrue(property_exists($addressBook, 'contacts')); + } + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/Resources/ContactsTest.php b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/ContactsTest.php similarity index 57% rename from vendor/dotdigital/dotdigital-php/tests/Resources/ContactsTest.php rename to vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/ContactsTest.php index 4e7860f..87d6c54 100644 --- a/vendor/dotdigital/dotdigital-php/tests/Resources/ContactsTest.php +++ b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/ContactsTest.php @@ -1,26 +1,29 @@ client = new Client(); $this->clientInit(); - $this->testSuccessResponse(); } /** @@ -29,7 +32,7 @@ public function setUp(): void public function testPostContactsType() { $contact = $this->client->contacts->postContacts('demo@apiconnector.com'); - $this->assertInstanceOf(\Dotdigital\Models\Contact::class, $contact); + $this->assertInstanceOf(\Dotdigital\V2\Models\Contact::class, $contact); } /** @@ -47,12 +50,12 @@ public function testPostContactsValidation() public function testPostContactsContent() { $contact = $this->client->contacts->postContacts('test@apiconnector.com'); - $this->assertObjectHasAttribute('id',$contact); - $this->assertObjectHasAttribute('email',$contact); - $this->assertObjectHasAttribute('optInType',$contact); - $this->assertObjectHasAttribute('emailType',$contact); - $this->assertObjectHasAttribute('dataFields',$contact); - $this->assertObjectHasAttribute('status',$contact); + $this->assertObjectHasProperty('id',$contact); + $this->assertObjectHasProperty('email',$contact); + $this->assertObjectHasProperty('optInType',$contact); + $this->assertObjectHasProperty('emailType',$contact); + $this->assertObjectHasProperty('dataFields',$contact); + $this->assertObjectHasProperty('status',$contact); } /** @@ -61,9 +64,9 @@ public function testPostContactsContent() public function testResubscribeType() { $contactList = $this->client->contacts->resubscribe('demo@apiconnector.com'); - $this->assertInstanceOf(\Dotdigital\Models\ContactList::class, $contactList); - foreach ($contactList->contact as $contact) { - $this->assertInstanceOf(\Dotdigital\Models\Contact::class, $contact); + $this->assertInstanceOf(\Dotdigital\V2\Models\ContactList::class, $contactList); + foreach ($contactList->getList() as $contact) { + $this->assertInstanceOf(\Dotdigital\V2\Models\Contact::class, $contact); } } @@ -82,16 +85,14 @@ public function testResubscribeValidation() public function testResubscribeContent() { $contactList = $this->client->contacts->resubscribe('demo@apiconnector.com'); - $this->assertObjectHasAttribute('contact',$contactList); - foreach ($contactList->contact as $contact) { - $this->assertObjectHasAttribute('id',$contact); - $this->assertObjectHasAttribute('email',$contact); - $this->assertObjectHasAttribute('optInType',$contact); - $this->assertObjectHasAttribute('emailType',$contact); - $this->assertObjectHasAttribute('dataFields',$contact); - $this->assertObjectHasAttribute('status',$contact); + foreach ($contactList->getList() as $contact) { + $this->assertObjectHasProperty('id',$contact); + $this->assertObjectHasProperty('email',$contact); + $this->assertObjectHasProperty('optInType',$contact); + $this->assertObjectHasProperty('emailType',$contact); + $this->assertObjectHasProperty('dataFields',$contact); + $this->assertObjectHasProperty('status',$contact); } - } /** @@ -100,7 +101,7 @@ public function testResubscribeContent() public function testGetByEmailType() { $contact = $this->client->contacts->getByEmail('demo@apiconnector.com'); - $this->assertInstanceOf(\Dotdigital\Models\Contact::class, $contact); + $this->assertInstanceOf(\Dotdigital\V2\Models\Contact::class, $contact); } @@ -119,17 +120,11 @@ public function testGetByEmailValidation() public function testGetByEmailContent() { $contact = $this->client->contacts->getByEmail('demo@apiconnector.com'); - $this->assertObjectHasAttribute('id',$contact); - $this->assertObjectHasAttribute('email',$contact); - $this->assertObjectHasAttribute('optInType',$contact); - $this->assertObjectHasAttribute('emailType',$contact); - $this->assertObjectHasAttribute('dataFields',$contact); - $this->assertObjectHasAttribute('status',$contact); + $this->assertObjectHasProperty('id',$contact); + $this->assertObjectHasProperty('email',$contact); + $this->assertObjectHasProperty('optInType',$contact); + $this->assertObjectHasProperty('emailType',$contact); + $this->assertObjectHasProperty('dataFields',$contact); + $this->assertObjectHasProperty('status',$contact); } - - public function tearDown(): void - { - $this->testFailedResponse(); - } - } diff --git a/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/DataFieldsTest.php b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/DataFieldsTest.php new file mode 100644 index 0000000..78d6d8a --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V2/Integration/Resources/DataFieldsTest.php @@ -0,0 +1,36 @@ +client = new Client(); + $this->clientInit(); + } + + public function testDataFieldsContent() + { + $dataFields = $this->client->dataFields->show(); + + foreach ($dataFields->getList() as $dataField) { + $this->assertTrue(property_exists($dataField, 'name')); + $this->assertTrue(property_exists($dataField, 'type')); + $this->assertTrue(property_exists($dataField, 'visibility')); + $this->assertTrue(property_exists($dataField, 'defaultValue')); + } + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Integration/.env.example b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/.env.example new file mode 100644 index 0000000..de25276 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/.env.example @@ -0,0 +1,3 @@ +DOTDIGITAL_API_USER= +DOTDIGITAL_API_PASSWORD= +DOTDIGITAL_API_ENDPOINT= diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactCreateTest.php b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactCreateTest.php new file mode 100644 index 0000000..320d12b --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactCreateTest.php @@ -0,0 +1,96 @@ +testSuccessResponse(); + } + + /** + * @return void + */ + public function testSuccessfulContactCreate() + { + $contact = $this->buildContact(); + $contactResponse = $this->client->contacts->create($contact); + + $this->assertObjectHasProperty('contactId', $contactResponse); + $this->assertObjectHasProperty('status', $contactResponse); + $this->assertObjectHasProperty('created', $contactResponse); + $this->assertObjectHasProperty('updated', $contactResponse); + $this->assertObjectHasProperty('identifiers', $contactResponse); + $this->assertObjectHasProperty('channelProperties', $contactResponse); + $this->assertObjectHasProperty('dataFields', $contactResponse); + $this->assertObjectHasProperty('consentRecords', $contactResponse); + } + + public function testCreateInvalidContact() + { + $contact = $this->buildInvalidContact(); + $this->expectException(ResponseValidationException::class); + $this->client->contacts->create($contact); + } + + private function buildInvalidContact() + { + return new Contact( + [ + 'matchIdentifier' => 'email', + 'dataFields' => [ + 'firstName' => 'Chaznay', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ], + 'consentRecords' => [ + [ + "text" => "Yes, I would like to receive a monthly newsletter", + "dateTimeConsented" => "2018-01-26T21:29:00", + "url" => "http://www.example.com/signup", + "ipAddress" => "129.168.0.2", + "userAgent" => "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" + ] + ] + ] + ); + } + + private function buildContact() + { + return new Contact( + [ + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => bin2hex(random_bytes(16)) . '@emailsim.io' + ], + 'dataFields' => [ + 'firstName' => 'Chaznay', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ], + 'consentRecords' => [ + [ + "text" => "Yes, I would like to receive a monthly newsletter", + "dateTimeConsented" => "2018-01-26T21:29:00", + "url" => "http://www.example.com/signup", + "ipAddress" => "129.168.0.2", + "userAgent" => "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" + ] + ] + ] + ); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportReportTest.php b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportReportTest.php new file mode 100644 index 0000000..05fa2cc --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportReportTest.php @@ -0,0 +1,47 @@ +testSuccessResponse(); + } + + public function testSuccessfulImport() + { + $importId = $this->client->contacts->import($this->generateContactCollection(200)); + $this->assertIsString($importId); + return json_decode($importId)->importId; + } + + /** + * @depends testSuccessfulImport + */ + public function testSuccessfulContactImportRetrievalById(string $importId) + { + $importReport = $this->client->contacts->getImportById($importId); + $this->assertIsString($importId); + $this->assertIsString($importReport->getImportId()); + $this->assertIsString($importReport->getStatus()); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportTest.php b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportTest.php new file mode 100644 index 0000000..e078981 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/ContactImportTest.php @@ -0,0 +1,164 @@ +testSuccessResponse(); + } + + public function testSuccessfulContactImport() + { + $contactCollection = $this->buildContactCollection(); + $importId = $this->client->contacts->import($contactCollection); + + $this->assertIsString($importId); + return $importId; + } + + /** + * SNAG: currently omitting matchidentifier does not return an errorCode + * + * @return void + */ + public function testContactImportRequiresMatchIdentifier() + { + $this->markTestSkipped('The endpoint does not treat a contact request as bad if it omits matchIdentifier.'); + $contactCollection = $this->buildContactCollectionWithoutMatchIdentifier(); + + $this->expectException(ResponseValidationException::class); + $this->expectExceptionMessage('The Matchidentifiers field is required.'); + + $this->client->contacts->import($contactCollection); + } + + public function testContactImportRequiresIdentifiers() + { + $contactCollection = $this->buildContactCollectionWithoutIdentifiers(); + + $this->expectException(ResponseValidationException::class); + $this->expectExceptionMessage('Internal server error'); + + $this->client->contacts->import($contactCollection); + } + + private function buildContactCollection() + { + $contact1 = new Contact( + [ + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => 'chaz0959@emailsim.io' + ], + 'dataFields' => [ + 'FIRST_NAME' => 'Chaz', + 'LAST_NAME' => 'Kangaroo', + 'COMPANY' => 'Chaz Inc.' + ], + 'lists' => [174867], + 'consentRecords' => [ + [ + "text" => "Yes, I would like to receive a monthly newsletter", + "dateTimeConsented" => "2018-01-26T21:29:00", + "url" => "http://www.example.com/signup", + "ipAddress" => "129.168.0.2", + "userAgent" => "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" + ] + ] + ] + ); + $contact2 = new Contact( + [ + 'matchIdentifier' => 'mobileNumber', + 'identifiers' => [ + 'email' => 'chaz1702@emailsim.io', + 'mobileNumber' => '44123123123' + ], + 'dataFields' => [ + 'firstName' => 'Chaznay', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ], + 'channelProperties' => [ + 'email' => [ + 'emailType' => 'Html', + 'optInType' => 'Single' + ], + 'sms' => [ + 'optInType' => 'Single' + ] + ], + 'preferences' => [ + [ + 'id' => 334, + 'isOptedIn' => false + ] + ], + ] + ); + $contact3 = new Contact( + [ + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => 'chaz1703@emailsim.io' + ], + 'dataFields' => [ + 'firstName' => 'Chazzandra', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ] + ] + ); + return new ContactCollection([ + $contact1, + $contact2, + $contact3 + ]); + } + + private function buildContactCollectionWithoutMatchIdentifier() + { + $contact1 = new Contact( + [ + 'identifiers' => [ + 'email' => 'chaz1@emailsim.io' + ] + ] + ); + + return new ContactCollection([$contact1]); + } + + private function buildContactCollectionWithoutIdentifiers() + { + $contact1 = new Contact( + [ + 'matchIdentifier' => 'email' + ] + ); + + return new ContactCollection([$contact1]); + } + +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Integration/TestCase.php b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/TestCase.php new file mode 100644 index 0000000..d0f2e0e --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Integration/TestCase.php @@ -0,0 +1,54 @@ +load(__DIR__.'/.env'); + + $this->client = new Client(); + $this->clientInit(); + } + + protected function clientInit(): void + { + $this->client::setApiUser($_ENV['DOTDIGITAL_API_USER']); + $this->client::setApiPassword($_ENV['DOTDIGITAL_API_PASSWORD']); + $this->client::setApiEndpoint($_ENV['DOTDIGITAL_API_ENDPOINT']); + } + + /** @test */ + public function testSuccessResponse() + { + $response = $this->client->getHttpClient()->get($this->resourceBase); + Assert::assertEquals(200, $response->getStatusCode()); + + $contentType = $response->getHeaders()["Content-Type"][0]; + Assert::assertEquals("application/json; charset=utf-8", $contentType); + } + + /** @test */ + public function testFailedResponse() + { + $this->client::setApiUser('invalid_ec_user'); + $this->client::setApiPassword('invalid_ec_password'); + $response = $this->client->getHttpClient()->get($this->resourceBase);; + Assert::assertEquals(401, $response->getStatusCode()); + + $contentType = $response->getHeaders()["Content-Type"][0]; + Assert::assertEquals("application/json; charset=utf-8", $contentType); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Traits/InteractsWithContactTrait.php b/vendor/dotdigital/dotdigital-php/tests/V3/Traits/InteractsWithContactTrait.php new file mode 100644 index 0000000..8e8891a --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Traits/InteractsWithContactTrait.php @@ -0,0 +1,151 @@ + static::MOCK_LISTS] : [], + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => 'chaz0959@emailsim.io' + ], + 'dataFields' => [ + 'FIRST_NAME' => 'Chaz', + 'LAST_NAME' => 'Kangaroo', + 'COMPANY' => 'Chaz Inc.' + ], + 'consentRecords' => [ + [ + "text" => "Yes, I would like to receive a monthly newsletter", + "dateTimeConsented" => "2018-01-26T21:29:00", + "url" => "http://www.example.com/signup", + "ipAddress" => "129.168.0.2", + "userAgent" => "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36" + ] + ] + ] + ); + $contact2 = new Contact( + [ + ...(!empty(static::MOCK_LISTS)) ? ['lists' => static::MOCK_LISTS] : [], + ...(!empty(static::MOCK_PREFERENCES)) ? ['preferences' => static::MOCK_PREFERENCES] : [], + 'matchIdentifier' => 'mobileNumber', + 'identifiers' => [ + 'email' => 'chaz1702@emailsim.io', + 'mobileNumber' => '44123123123' + ], + 'dataFields' => [ + 'firstName' => 'Chaznay', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ], + 'channelProperties' => [ + 'email' => [ + 'emailType' => 'Html', + 'optInType' => 'Single' + ], + 'sms' => [ + 'optInType' => 'Single' + ] + ] + ] + ); + $contact3 = new Contact( + [ + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => 'chaz1703@emailsim.io' + ], + 'dataFields' => [ + 'firstName' => 'Chazzandra', + 'lastName' => 'Kangaroo', + 'gender' => 'female' + ] + ] + ); + return new ContactCollection([ + $contact1, + $contact2, + $contact3 + ]); + } + + protected function buildContactCollectionWithoutMatchIdentifier() + { + $contact1 = new Contact( + [ + 'identifiers' => [ + 'email' => 'chaz1@emailsim.io' + ], + ] + ); + + return new ContactCollection([$contact1]); + } + + protected function buildContactCollectionWithoutIdentifiers() + { + $contact1 = new Contact( + [ + 'matchIdentifier' => 'email', + ] + ); + + return new ContactCollection([$contact1]); + } + + /** + * @param int $count + * @return ContactCollection + * @throws \Exception + */ + public static function generateContactCollection(int $count): ContactCollection + { + $faker = FakerFactory::create(); + $collection = new ContactCollection(); + for ($i = 0; $i < $count; $i++) { + $collection->add( + new Contact([ + "matchIdentifier" => "email", + "identifiers" => [ + "email" => $faker->safeEmail, + ], + "dataFields" => [ + "firstName" => $faker->firstName, + "lastName" => $faker->lastName, + "gender" => $faker->word + ] + ]) + ); + } + + $collection->add( + new Contact([ + "matchIdentifier" => "email", + "identifiers" => [ + "email" => $faker->word, + ], + "dataFields" => [ + "firstName" => $faker->firstName, + "lastName" => $faker->lastName, + "gender" => $faker->word + ] + ]) + ); + + return $collection; + + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactImportTest.php b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactImportTest.php new file mode 100644 index 0000000..219cd04 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactImportTest.php @@ -0,0 +1,191 @@ +setImportId('12345'); + + $this->assertEquals('12345', $import->getImportId()); + } + + /** + * Test case for the getStatus() method. + * + * It verifies that the status returned by getStatus() matches the expected value. + */ + public function testGetStatus() + { + $import = new Import(); + $import->setStatus('completed'); + + $this->assertEquals('completed', $import->getStatus()); + } + + /** + * Test case for the getCreated() method. + * + * It ensures that the ContactCollection returned by getCreated() contains the expected values. + * The test covers the Contact object, its identifiers, and the values of contactId, email, and mobileNumber. + */ + public function testGetSummary() + { + $summary = [ + 'newContacts' => 10, + 'updatedContacts' => 14, + 'globallySuppressed' => 0, + 'invalidEntries' => 2, + 'duplicateIdentifiers' => 2 + ]; + + $import = new Import(); + $import->setSummary($summary); + + $summary = $import->getSummary(); + + $this->assertInstanceOf(Summary::class, $summary); + $this->assertEquals(10, $summary->getNewContacts()); + $this->assertEquals(14, $summary->getUpdatedContacts()); + $this->assertEquals(0, $summary->getGloballySuppressed()); + $this->assertEquals(2, $summary->getInvalidEntries()); + $this->assertEquals(2, $summary->getDuplicateIdentifiers()); + } + + /** + * Test case for the getCreated() method. + * + * It ensures that the ContactCollection returned by getCreated() contains the expected values. + * The test covers the Contact object, its identifiers, and the values of contactId, email, and mobileNumber. + */ + public function testGetCreated() + { + $created = [ + [ + 'contactId' => 35212311, + 'identifiers' => [ + 'email' => 'someone@emailsim.io', + 'mobileNumber' => '447123123123' + ] + ] + ]; + + $import = new Import(); + $import->setCreated($created); + + $created = $import->getCreated(); + + $this->assertInstanceOf(ContactCollection::class, $created); + $this->assertInstanceOf(Contact::class, $created->first()); + $this->assertInstanceOf(Identifiers::class, $created->first()->getIdentifiers()); + $this->assertEquals(35212311, $created->first()->getContactId()); + $this->assertEquals('someone@emailsim.io', $created->first()->getIdentifiers()->getEmail()); + $this->assertEquals('447123123123', $created->first()->getIdentifiers()->getMobileNumber()); + } + + /** + * Test case for the getUpdated() method. + * + * It ensures that the ContactCollection returned by getUpdated() contains the expected values. + * The test covers the Contact object, its identifiers, and the values of contactId, email, and mobileNumber. + */ + public function testGetUpdated() + { + $updated = [ + [ + 'contactId' => 35212311, + 'identifiers' => [ + 'email' => 'someone@emailsim.io', + 'mobileNumber' => '447123123123' + ] + ] + ]; + + $import = new Import(); + $import->setUpdated($updated); + + $updated = $import->getUpdated(); + + + $this->assertCount(1, $updated); + $this->assertInstanceOf(ContactCollection::class, $updated); + $this->assertInstanceOf(Contact::class, $updated->first()); + $this->assertInstanceOf(Identifiers::class, $updated->first()->getIdentifiers()); + $this->assertEquals(35212311, $updated->first()->getContactId()); + $this->assertEquals(35212311, $updated->first()->getContactId()); + $this->assertEquals('someone@emailsim.io', $updated->first()->getIdentifiers()->getEmail()); + $this->assertEquals('447123123123', $updated->first()->getIdentifiers()->getMobileNumber()); + } + + /** + * Test case for the getUpdated() method. + * + * It ensures that the ContactCollection returned by getUpdated() contains the expected values. + * The test covers the Contact object, its identifiers, and the values of contactId, email, and mobileNumber. + */ + public function testGetFailures() + { + + $failure = [ + 'identifiers' => [ + 'email' => 'bob@emailsim@io.com' + ], + 'failures' => [ + [ + 'failureCode' => 'invalidEmail', + 'description' => "Invalid value for 'email'" + ] + ] + ]; + + $import = new Import(); + $import->setFailures([$failure]); + + $failures = $import->getFailures(); + + $this->assertInstanceOf(Failure::class, $failures->first()); + $this->assertInstanceOf(Identifier::class, $failures->first()->getIdentifiers()); + $this->assertInstanceOf(FailureDetailCollection::class, $failures->first()->getFailures()); + $this->assertInstanceOf(FailureDetail::class, $failures->first()->getFailures()->first()); + $this->assertEquals('bob@emailsim@io.com', $failures->first()->getIdentifiers()->getEmail()); + $this->assertEquals('invalidEmail', $failures + ->first() + ->getFailures() + ->first() + ->getFailureCode() + ); + $this->assertEquals("Invalid value for 'email'", $failures + ->first() + ->getFailures() + ->first() + ->getDescription() + ); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactsTest.php b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactsTest.php new file mode 100644 index 0000000..4867907 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/ContactsTest.php @@ -0,0 +1,63 @@ +contactCollectionMock = $this->createMock(ContactCollection::class); + $this->contactsResource = new Contacts($this->clientMock); + } + + public function testContactImport() + { + $contactCollection = $this->buildContactCollection(); + + $this->contactCollectionMock->expects($this->once()) + ->method('all') + ->willReturn($contactCollection->all()); + + $this->clientMock->expects($this->once()) + ->method('mediateResponse') + ->willReturn('a73a2502-e798-4294-904a-153d9f9b80e9'); + + $this->contactsResource->import( + $this->contactCollectionMock + ); + } + + /** + * @return ContactCollection + * @throws \Exception + */ + private function buildContactCollection() + { + $contacts = []; + for ($i = 0; $i < 3; $i++) { + $contacts[] = new Contact([ + 'matchIdentifier' => 'email', + 'identifiers' => [ + 'email' => 'chaz' . $i . '@emailsim.io' + ] + ]); + } + return new ContactCollection($contacts); + } +} diff --git a/vendor/dotdigital/dotdigital-php/tests/V3/Unit/TestCase.php b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/TestCase.php new file mode 100644 index 0000000..5ed31d8 --- /dev/null +++ b/vendor/dotdigital/dotdigital-php/tests/V3/Unit/TestCase.php @@ -0,0 +1,60 @@ +clientMock = $this->createMock(Client::class); + $this->abstractResourceMock = $this->getMockBuilder(AbstractResource::class) + ->onlyMethods(['post', 'put', 'get']) + ->setConstructorArgs([$this->clientMock]) + ->getMock(); + $this->httpMethodsClientMock = $this->createMock(HttpMethodsClientInterface::class); + $this->responseInterfaceMock = $this->createMock(ResponseInterface::class); + + $this->setUpCommonApiMethods(); + } + + protected function setUpCommonApiMethods() + { + $this->clientMock->expects($this->any()) + ->method('getHttpClient') + ->willReturn($this->httpMethodsClientMock); + + $this->httpMethodsClientMock->method('post') + ->willReturn($this->responseInterfaceMock); + + $this->httpMethodsClientMock->method('get') + ->willReturn($this->responseInterfaceMock); + + $this->httpMethodsClientMock->method('put') + ->willReturn($this->responseInterfaceMock); + } +} diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md index 12949ba..1144eb7 100644 --- a/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -2,6 +2,52 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. + +## 7.7.0 - 2023-05-21 + +### Added + +- Support `guzzlehttp/promises` v2 + + +## 7.6.1 - 2023-05-15 + +### Fixed + +- Fix `SetCookie::fromString` MaxAge deprecation warning and skip invalid MaxAge values + + +## 7.6.0 - 2023-05-14 + +### Added + +- Support for setting the minimum TLS version in a unified way +- Apply on request the version set in options parameters + + +## 7.5.2 - 2023-05-14 + +### Fixed + +- Fixed set cookie constructor validation +- Fixed handling of files with `'0'` body + +### Changed + +- Corrected docs and default connect timeout value to 300 seconds + + +## 7.5.1 - 2023-04-17 + +### Fixed + +- Fixed `NO_PROXY` settings so that setting the `proxy` option to `no` overrides the env variable + +### Changed + +- Adjusted `guzzlehttp/psr7` version constraint to `^1.9.1 || ^2.4.5` + + ## 7.5.0 - 2022-08-28 ### Added @@ -9,20 +55,30 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Support PHP 8.2 - Add request to delay closure params + ## 7.4.5 - 2022-06-20 +### Fixed + * Fix change in port should be considered a change in origin * Fix `CURLOPT_HTTPAUTH` option not cleared on change of origin + ## 7.4.4 - 2022-06-09 +### Fixed + * Fix failure to strip Authorization header on HTTP downgrade * Fix failure to strip the Cookie header on change in host or HTTP downgrade + ## 7.4.3 - 2022-05-25 +### Fixed + * Fix cross-domain cookie leakage + ## 7.4.2 - 2022-03-20 ### Fixed @@ -31,6 +87,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Reject non-HTTP schemes in StreamHandler - Set a default ssl.peer_name context in StreamHandler to allow `force_ip_resolve` + ## 7.4.1 - 2021-12-06 ### Changed @@ -42,6 +99,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Only close curl handle if it's done [#2950](https://github.com/guzzle/guzzle/pull/2950) + ## 7.4.0 - 2021-10-18 ### Added @@ -59,6 +117,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Be more strict with types [#2914](https://github.com/guzzle/guzzle/pull/2914), [#2917](https://github.com/guzzle/guzzle/pull/2917), [#2919](https://github.com/guzzle/guzzle/pull/2919), [#2945](https://github.com/guzzle/guzzle/pull/2945) + ## 7.3.0 - 2021-03-23 ### Added @@ -71,6 +130,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Handle exceptions on invalid header consistently between PHP versions and handlers [#2872](https://github.com/guzzle/guzzle/pull/2872) + ## 7.2.0 - 2020-10-10 ### Added @@ -93,6 +153,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - Using environment variable GUZZLE_CURL_SELECT_TIMEOUT [#2786](https://github.com/guzzle/guzzle/pull/2786) + ## 7.1.1 - 2020-09-30 ### Fixed @@ -104,6 +165,7 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - We dont connect curl `sink` on HEAD requests. - Removed some PHP 5 workarounds + ## 7.1.0 - 2020-09-22 ### Added @@ -126,14 +188,17 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version - `Utils::defaultCaBundle()` - `CurlFactory::LOW_CURL_VERSION_NUMBER` + ## 7.0.1 - 2020-06-27 * Fix multiply defined functions fatal error [#2699](https://github.com/guzzle/guzzle/pull/2699) + ## 7.0.0 - 2020-06-27 No changes since 7.0.0-rc1. + ## 7.0.0-rc1 - 2020-06-15 ### Changed @@ -141,6 +206,7 @@ No changes since 7.0.0-rc1. * Use error level for logging errors in Middleware [#2629](https://github.com/guzzle/guzzle/pull/2629) * Disabled IDN support by default and require ext-intl to use it [#2675](https://github.com/guzzle/guzzle/pull/2675) + ## 7.0.0-beta2 - 2020-05-25 ### Added @@ -166,6 +232,7 @@ No changes since 7.0.0-rc1. * Pool option `pool_size` [#2528](https://github.com/guzzle/guzzle/pull/2528) + ## 7.0.0-beta1 - 2019-12-30 The diff might look very big but 95% of Guzzle users will be able to upgrade without modification. @@ -199,15 +266,18 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * `uri_template()` and `UriTemplate` [#2440](https://github.com/guzzle/guzzle/pull/2440) * Request options `save_to` and `exceptions` [#2464](https://github.com/guzzle/guzzle/pull/2464) + ## 6.5.2 - 2019-12-23 * idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489) + ## 6.5.1 - 2019-12-21 * Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454) * IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424) + ## 6.5.0 - 2019-12-07 * Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143) @@ -217,11 +287,13 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348) * Deprecated `ClientInterface::VERSION` + ## 6.4.1 - 2019-10-23 * No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that * Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar` + ## 6.4.0 - 2019-10-23 * Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108) @@ -234,6 +306,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335) * Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362) + ## 6.3.3 - 2018-04-22 * Fix: Default headers when decode_content is specified @@ -275,13 +348,14 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684) * Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827) - + Minor code cleanups, documentation fixes and clarifications. + ## 6.2.3 - 2017-02-28 * Fix deprecations with guzzle/psr7 version 1.4 + ## 6.2.2 - 2016-10-08 * Allow to pass nullable Response to delay callable @@ -289,6 +363,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Fix drain case where content-length is the literal string zero * Obfuscate in-URL credentials in exceptions + ## 6.2.1 - 2016-07-18 * Address HTTP_PROXY security vulnerability, CVE-2016-5385: @@ -299,6 +374,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c a server does not honor `Connection: close`. * Ignore URI fragment when sending requests. + ## 6.2.0 - 2016-03-21 * Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. @@ -318,6 +394,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Bug fix: provide an empty string to `http_build_query` for HHVM workaround. https://github.com/guzzle/guzzle/pull/1367 + ## 6.1.1 - 2015-11-22 * Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler @@ -333,6 +410,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Bug fix: fixed regression where MockHandler was not using `sink`. https://github.com/guzzle/guzzle/pull/1292 + ## 6.1.0 - 2015-09-08 * Feature: Added the `on_stats` request option to provide access to transfer @@ -367,6 +445,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set. https://github.com/guzzle/guzzle/pull/1189 + ## 6.0.2 - 2015-07-04 * Fixed a memory leak in the curl handlers in which references to callbacks @@ -384,6 +463,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Functions are now conditionally required using an additional level of indirection to help with global Composer installations. + ## 6.0.1 - 2015-05-27 * Fixed a bug with serializing the `query` request option where the `&` @@ -392,6 +472,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c use `form_params` or `multipart` instead. * Various doc fixes. + ## 6.0.0 - 2015-05-26 * See the UPGRADING.md document for more information. @@ -416,6 +497,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * `$maxHandles` has been removed from CurlMultiHandler. * `MultipartPostBody` is now part of the `guzzlehttp/psr7` package. + ## 5.3.0 - 2015-05-19 * Mock now supports `save_to` @@ -426,6 +508,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated. * URL scheme is now always lowercased. + ## 6.0.0-beta.1 * Requires PHP >= 5.5 @@ -478,6 +561,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * `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 @@ -488,6 +572,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c 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. @@ -508,6 +593,7 @@ Please see [the upgrade document](UPGRADING.md) that describes all BC breaking c * 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 @@ -522,6 +608,7 @@ 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 @@ -543,6 +630,7 @@ object). 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. @@ -554,6 +642,7 @@ Bugfix release. * 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. @@ -635,6 +724,7 @@ interfaces. 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. diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md index f287fa9..0786462 100644 --- a/vendor/guzzlehttp/guzzle/README.md +++ b/vendor/guzzlehttp/guzzle/README.md @@ -60,13 +60,13 @@ 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 | +| 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 only | `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.3 | [guzzle-3-repo]: https://github.com/guzzle/guzzle3 [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json index f369ce6..3207f8c 100644 --- a/vendor/guzzlehttp/guzzle/composer.json +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -53,8 +53,8 @@ "require": { "php": "^7.2.5 || ^8.0", "ext-json": "*", - "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", + "guzzlehttp/promises": "^1.5.3 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" }, @@ -64,7 +64,8 @@ "require-dev": { "ext-curl": "*", "bamarni/composer-bin-plugin": "^1.8.1", - "php-http/client-integration-tests": "^3.0", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, @@ -84,9 +85,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "autoload": { diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php index 58f1d89..9b0d710 100644 --- a/vendor/guzzlehttp/guzzle/src/Client.php +++ b/vendor/guzzlehttp/guzzle/src/Client.php @@ -120,13 +120,14 @@ public function sendAsync(RequestInterface $request, array $options = []): Promi 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 + * {@inheritDoc} */ public function sendRequest(RequestInterface $request): ResponseInterface { @@ -184,6 +185,7 @@ public function requestAsync(string $method, $uri = '', array $options = []): Pr public function request(string $method, $uri = '', array $options = []): ResponseInterface { $options[RequestOptions::SYNCHRONOUS] = true; + return $this->requestAsync($method, $uri, $options)->wait(); } @@ -228,11 +230,11 @@ private function configureDefaults(array $config): void { $defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, - 'http_errors' => true, - 'decode_content' => true, - 'verify' => true, - 'cookies' => false, - 'idn_conversion' => false, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false, + 'idn_conversion' => false, ]; // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. @@ -354,10 +356,10 @@ private function applyOptions(RequestInterface $request, array &$options): Reque 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.'); + .'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']); @@ -403,7 +405,7 @@ private function applyOptions(RequestInterface $request, array &$options): Reque // 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]"); + .\base64_encode("$value[0]:$value[1]"); break; case 'digest': // @todo: Do not rely on curl @@ -437,13 +439,17 @@ private function applyOptions(RequestInterface $request, array &$options): Reque } } + if (isset($options['version'])) { + $modify['version'] = $options['version']; + } + $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(); + .$request->getBody()->getBoundary(); } // Merge in conditional headers if they are not present. @@ -469,9 +475,9 @@ private function applyOptions(RequestInterface $request, array &$options): Reque 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.'); + .'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/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php index 9985a98..b4ced5a 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -50,10 +50,10 @@ 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 + 'Domain' => $domain, + 'Name' => $name, + 'Value' => $value, + 'Discard' => true, ])); } @@ -97,7 +97,7 @@ public function getCookieByName(string $name): ?SetCookie } /** - * @inheritDoc + * {@inheritDoc} */ public function toArray(): array { @@ -107,12 +107,13 @@ public function toArray(): array } /** - * @inheritDoc + * {@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( @@ -142,7 +143,7 @@ static function (SetCookie $cookie) use ($path, $domain, $name) { } /** - * @inheritDoc + * {@inheritDoc} */ public function clearSessionCookies(): void { @@ -155,7 +156,7 @@ static function (SetCookie $cookie): bool { } /** - * @inheritDoc + * {@inheritDoc} */ public function setCookie(SetCookie $cookie): bool { @@ -170,9 +171,10 @@ public function setCookie(SetCookie $cookie): bool $result = $cookie->validate(); if ($result !== true) { if ($this->strictMode) { - throw new \RuntimeException('Invalid cookie: ' . $result); + throw new \RuntimeException('Invalid cookie: '.$result); } $this->removeCookieIfEmpty($cookie); + return false; } @@ -253,7 +255,7 @@ public function extractCookies(RequestInterface $request, ResponseInterface $res /** * Computes cookie path following RFC 6265 section 5.1.4 * - * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 + * @see https://tools.ietf.org/html/rfc6265#section-5.1.4 */ private function getCookiePathFromRequest(RequestInterface $request): string { @@ -289,8 +291,8 @@ public function withCookieHeader(RequestInterface $request): RequestInterface !$cookie->isExpired() && (!$cookie->getSecure() || $scheme === 'https') ) { - $values[] = $cookie->getName() . '=' - . $cookie->getValue(); + $values[] = $cookie->getName().'=' + .$cookie->getValue(); } } diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php index 7df374b..50bc363 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -13,7 +13,7 @@ * necessary. Subclasses are also responsible for storing and retrieving * cookies from a file, database, etc. * - * @link https://docs.python.org/2/library/cookielib.html Inspiration + * @see https://docs.python.org/2/library/cookielib.html Inspiration * @extends \IteratorAggregate */ interface CookieJarInterface extends \Countable, \IteratorAggregate diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php index 5d51ca9..cb3e67c 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -71,7 +71,7 @@ protected function load(): void $this->setCookie(new SetCookie($cookie)); } } elseif (\strlen($data)) { - throw new \RuntimeException("Invalid cookie 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 index a613c77..d74915b 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -11,15 +11,15 @@ class SetCookie * @var array */ private static $defaults = [ - 'Name' => null, - 'Value' => null, - 'Domain' => null, - 'Path' => '/', - 'Max-Age' => null, - 'Expires' => null, - 'Secure' => false, - 'Discard' => false, - 'HttpOnly' => false + 'Name' => null, + 'Value' => null, + 'Domain' => null, + 'Path' => '/', + 'Max-Age' => null, + 'Expires' => null, + 'Secure' => false, + 'Discard' => false, + 'HttpOnly' => false, ]; /** @@ -58,7 +58,13 @@ public static function fromString(string $cookie): self } else { foreach (\array_keys(self::$defaults) as $search) { if (!\strcasecmp($search, $key)) { - $data[$search] = $value; + if ($search === 'Max-Age') { + if (is_numeric($value)) { + $data[$search] = (int) $value; + } + } else { + $data[$search] = $value; + } continue 2; } } @@ -74,13 +80,49 @@ public static function fromString(string $cookie): self */ 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 = self::$defaults; + + if (isset($data['Name'])) { + $this->setName($data['Name']); + } + + if (isset($data['Value'])) { + $this->setValue($data['Value']); + } + + if (isset($data['Domain'])) { + $this->setDomain($data['Domain']); + } + + if (isset($data['Path'])) { + $this->setPath($data['Path']); + } + + if (isset($data['Max-Age'])) { + $this->setMaxAge($data['Max-Age']); + } + + if (isset($data['Expires'])) { + $this->setExpires($data['Expires']); + } + + if (isset($data['Secure'])) { + $this->setSecure($data['Secure']); + } + + if (isset($data['Discard'])) { + $this->setDiscard($data['Discard']); + } + + if (isset($data['HttpOnly'])) { + $this->setHttpOnly($data['HttpOnly']); + } + + // Set the remaining values that don't have extra validation logic + foreach (array_diff(array_keys($data), array_keys(self::$defaults)) as $key) { + $this->data[$key] = $data[$key]; } - $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 @@ -92,13 +134,13 @@ public function __construct(array $data = []) public function __toString() { - $str = $this->data['Name'] . '=' . ($this->data['Value'] ?? '') . '; '; + $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) . '; '; + $str .= 'Expires='.\gmdate('D, d M Y H:i:s \G\M\T', $v).'; '; } else { - $str .= ($v === true ? $k : "{$k}={$v}") . '; '; + $str .= ($v === true ? $k : "{$k}={$v}").'; '; } } } @@ -394,7 +436,7 @@ public function matchesDomain(string $domain): bool return false; } - return (bool) \preg_match('/\.' . \preg_quote($cookieDomain, '/') . '$/', $domain); + return (bool) \preg_match('/\.'.\preg_quote($cookieDomain, '/').'$/', $domain); } /** @@ -423,8 +465,8 @@ public function validate() $name )) { return 'Cookie name must not contain invalid characters: ASCII ' - . 'Control characters (0-31;127), space, tab and the ' - . 'following characters: ()<>@,;:\"/?={}'; + .'Control characters (0-31;127), space, tab and the ' + .'following characters: ()<>@,;:\"/?={}'; } // Value must not be null. 0 and empty string are valid. Empty strings diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index 0c45089..3a6a8db 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -51,7 +51,7 @@ public function create(RequestInterface $request, array $options): EasyHandle unset($options['curl']['body_as_string']); } - $easy = new EasyHandle; + $easy = new EasyHandle(); $easy->request = $request; $easy->options = $options; $conf = $this->getDefaultConf($easy); @@ -161,11 +161,11 @@ private static function finishError(callable $handler, EasyHandle $easy, CurlFac private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface { static $connectionErrors = [ - \CURLE_OPERATION_TIMEOUTED => true, + \CURLE_OPERATION_TIMEOUTED => true, \CURLE_COULDNT_RESOLVE_HOST => true, - \CURLE_COULDNT_CONNECT => true, - \CURLE_SSL_CONNECT_ERROR => true, - \CURLE_GOT_NOTHING => true, + \CURLE_COULDNT_CONNECT => true, + \CURLE_SSL_CONNECT_ERROR => true, + \CURLE_GOT_NOTHING => true, ]; if ($easy->createResponseException) { @@ -219,12 +219,12 @@ private static function createRejection(EasyHandle $easy, array $ctx): PromiseIn private function getDefaultConf(EasyHandle $easy): array { $conf = [ - '_headers' => $easy->request->getHeaders(), - \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), - \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + '_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, + \CURLOPT_HEADER => false, + \CURLOPT_CONNECTTIMEOUT => 300, ]; if (\defined('CURLOPT_PROTOCOLS')) { @@ -250,6 +250,7 @@ private function applyMethod(EasyHandle $easy, array &$conf): void if ($size === null || $size > 0) { $this->applyBody($easy->request, $easy->options, $conf); + return; } @@ -341,6 +342,7 @@ private function removeHeader(string $name, array &$options): void foreach (\array_keys($options['_headers']) as $key) { if (!\strcasecmp($key, $name)) { unset($options['_headers'][$key]); + return; } } @@ -443,13 +445,41 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf): void $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'])) { + if (isset($options['proxy']['no']) && Utils::isHostInNoProxy($host, $options['proxy']['no'])) { + unset($conf[\CURLOPT_PROXY]); + } else { $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme]; } } } } + if (isset($options['crypto_method'])) { + if (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_0')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.0 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_0; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_1')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.1 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_1; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_2')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2; + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_3')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3; + } else { + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + } + if (isset($options['cert'])) { $cert = $options['cert']; if (\is_array($cert)) { @@ -459,8 +489,8 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf): void 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 + // 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); @@ -523,9 +553,10 @@ private static function retryFailedRewind(callable $handler, EasyHandle $easy, a } } 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; + .'providing an error. The request would have been retried, ' + .'but attempting to rewind the request body failed. ' + .'Exception: '.$e; + return self::createRejection($easy, $ctx); } @@ -534,14 +565,15 @@ private static function retryFailedRewind(callable $handler, EasyHandle $easy, a $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.'; + .'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']++; + ++$easy->options['_curl_retries']; } return $handler($easy->request, $easy->options); @@ -571,6 +603,7 @@ private function createHeaderFn(EasyHandle $easy): callable $easy->createResponse(); } catch (\Exception $e) { $easy->createResponseException = $e; + return -1; } if ($onHeaders !== null) { @@ -580,6 +613,7 @@ private function createHeaderFn(EasyHandle $easy): callable // Associate the exception with the handle and trigger // a curl header write error by returning 0. $easy->onHeadersException = $e; + return -1; } } @@ -589,6 +623,7 @@ private function createHeaderFn(EasyHandle $easy): callable } else { $easy->headers[] = $value; } + return \strlen($h); }; } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index 4356d02..f0acde1 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -164,7 +164,8 @@ public function tick(): void \usleep(250); } - while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM); + while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) { + } $this->processMessages(); } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php index 224344d..1bc39f4 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -106,7 +106,7 @@ public function createResponse(): void */ public function __get($name) { - $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $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 index a098884..5554b8f 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php @@ -14,9 +14,9 @@ final class HeaderProcessor * * @param string[] $headers * - * @throws \RuntimeException - * * @return array{0:string, 1:int, 2:?string, 3:array} + * + * @throws \RuntimeException */ public static function parseHeaders(array $headers): array { diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php index 79664e2..77ffed5 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php @@ -138,6 +138,7 @@ function ($reason) use ($request, $options) { if ($this->onRejected) { ($this->onRejected)($reason); } + return P\Create::rejectionFor($reason); } ); @@ -159,7 +160,7 @@ public function append(...$values): void ) { $this->queue[] = $value; } else { - throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value)); + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found '.Utils::describeType($value)); } } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index 543f825..61632f5 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -67,7 +67,7 @@ public function __invoke(RequestInterface $request, array $options): PromiseInte 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") + || false !== \strpos($message, 'connection attempt failed') ) { $e = new ConnectException($e->getMessage(), $request, $e); } else { @@ -231,9 +231,10 @@ private function createResource(callable $callback) \set_error_handler(static function ($_, $msg, $file, $line) use (&$errors): bool { $errors[] = [ 'message' => $msg, - 'file' => $file, - 'line' => $line + 'file' => $file, + 'line' => $line, ]; + return true; }); @@ -247,7 +248,7 @@ private function createResource(callable $callback) $message = 'Error creating resource: '; foreach ($errors as $err) { foreach ($err as $key => $value) { - $message .= "[$key] $value" . \PHP_EOL; + $message .= "[$key] $value".\PHP_EOL; } } throw new \RuntimeException(\trim($message)); @@ -350,6 +351,7 @@ private function resolveHost(RequestInterface $request, array $options): UriInte 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']) { @@ -357,7 +359,8 @@ private function resolveHost(RequestInterface $request, array $options): UriInte 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->withHost('['.$records[0]['ipv6'].']'); } } @@ -375,11 +378,11 @@ private function getDefaultContext(RequestInterface $request): array $context = [ 'http' => [ - 'method' => $request->getMethod(), - 'header' => $headers, + 'method' => $request->getMethod(), + 'header' => $headers, 'protocol_version' => $request->getProtocolVersion(), - 'ignore_errors' => true, - 'follow_location' => 0, + 'ignore_errors' => true, + 'follow_location' => 0, ], 'ssl' => [ 'peer_name' => $request->getUri()->getHost(), @@ -388,7 +391,7 @@ private function getDefaultContext(RequestInterface $request): array $body = (string) $request->getBody(); - if (!empty($body)) { + if ('' !== $body) { $context['http']['content'] = $body; // Prevent the HTTP handler from adding a Content-Type header. if (!$request->hasHeader('Content-Type')) { @@ -472,6 +475,25 @@ private function add_timeout(RequestInterface $request, array &$options, $value, } } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_crypto_method(RequestInterface $request, array &$options, $value, array &$params): void + { + if ( + $value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT + || $value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT + || $value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT + || (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT) + ) { + $options['http']['crypto_method'] = $value; + + return; + } + + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + /** * @param mixed $value as passed via Request transfer options. */ @@ -542,27 +564,27 @@ private function add_debug(RequestInterface $request, array &$options, $value, a } static $map = [ - \STREAM_NOTIFY_CONNECT => 'CONNECT', + \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', + \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(''); + $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, $args[$i].': "'.$v.'" '); } \fwrite($value, "\n"); } @@ -577,7 +599,7 @@ private static function addNotification(array &$params, callable $notify): void } else { $params['notification'] = self::callArray([ $params['notification'], - $notify + $notify, ]); } } diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php index e0a1d11..1ce9c4b 100644 --- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -86,14 +86,14 @@ public function __toString() $stack = []; if ($this->handler !== null) { - $stack[] = "0) Handler: " . $this->debugCallable($this->handler); + $stack[] = '0) Handler: '.$this->debugCallable($this->handler); } $result = ''; foreach (\array_reverse($this->stack) as $tuple) { - $depth++; + ++$depth; $str = "{$depth}) Name: '{$tuple[1]}', "; - $str .= "Function: " . $this->debugCallable($tuple[0]); + $str .= 'Function: '.$this->debugCallable($tuple[0]); $result = "> {$str}\n{$result}"; $stack[] = $str; } @@ -122,7 +122,7 @@ public function setHandler(callable $handler): void */ public function hasHandler(): bool { - return $this->handler !== null ; + return $this->handler !== null; } /** @@ -266,10 +266,10 @@ private function debugCallable($fn): string if (\is_array($fn)) { return \is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" - : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; + : "callable(['".\get_class($fn[0])."', '{$fn[1]}'])"; } /** @var object $fn */ - return 'callable(' . \spl_object_hash($fn) . ')'; + return 'callable('.\spl_object_hash($fn).')'; } } diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php index da49954..9b77eee 100644 --- a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -40,11 +40,11 @@ class MessageFormatter implements MessageFormatterInterface /** * Apache Common Log Format. * - * @link https://httpd.apache.org/docs/2.4/logs.html#common + * @see https://httpd.apache.org/docs/2.4/logs.html#common * * @var string */ - public const CLF = "{hostname} {req_header_User-Agent} - [{date_common_log}] \"{method} {target} HTTP/{version}\" {code} {res_header_Content-Length}"; + public const CLF = '{hostname} {req_header_User-Agent} - [{date_common_log}] "{method} {target} HTTP/{version}" {code} {res_header_Content-Length}'; public const DEBUG = ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; @@ -90,9 +90,9 @@ function (array $matches) use ($request, $response, $error, &$cache) { break; case 'req_headers': $result = \trim($request->getMethod() - . ' ' . $request->getRequestTarget()) - . ' HTTP/' . $request->getProtocolVersion() . "\r\n" - . $this->headers($request); + .' '.$request->getRequestTarget()) + .' HTTP/'.$request->getProtocolVersion()."\r\n" + .$this->headers($request); break; case 'res_headers': $result = $response ? @@ -101,7 +101,7 @@ function (array $matches) use ($request, $response, $error, &$cache) { $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() - ) . "\r\n" . $this->headers($response) + )."\r\n".$this->headers($response) : 'NULL'; break; case 'req_body': @@ -177,6 +177,7 @@ function (array $matches) use ($request, $response, $error, &$cache) { } $cache[$matches[1]] = $result; + return $result; }, $this->template @@ -190,7 +191,7 @@ private function headers(MessageInterface $message): string { $result = ''; foreach ($message->getHeaders() as $name => $values) { - $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; + $result .= $name.': '.\implode(', ', $values)."\r\n"; } return \trim($result); diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php index 7035c77..7e3eb6b 100644 --- a/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -34,10 +34,12 @@ public static function cookies(): callable } $cookieJar = $options['cookies']; $request = $cookieJar->withCookieHeader($request); + return $handler($request, $options) ->then( static function (ResponseInterface $response) use ($cookieJar, $request): ResponseInterface { $cookieJar->extractCookies($request, $response); + return $response; } ); @@ -60,6 +62,7 @@ public static function httpErrors(BodySummarizerInterface $bodySummarizer = null if (empty($options['http_errors'])) { return $handler($request, $options); } + return $handler($request, $options)->then( static function (ResponseInterface $response) use ($request, $bodySummarizer) { $code = $response->getStatusCode(); @@ -93,20 +96,22 @@ public static function history(&$container): callable return $handler($request, $options)->then( static function ($value) use ($request, &$container, $options) { $container[] = [ - 'request' => $request, + 'request' => $request, 'response' => $value, - 'error' => null, - 'options' => $options + 'error' => null, + 'options' => $options, ]; + return $value; }, static function ($reason) use ($request, &$container, $options) { $container[] = [ - 'request' => $request, + 'request' => $request, 'response' => null, - 'error' => $reason, - 'options' => $options + 'error' => $reason, + 'options' => $options, ]; + return P\Create::rejectionFor($reason); } ); @@ -138,6 +143,7 @@ public static function tap(callable $before = null, callable $after = null): cal if ($after) { $after($request, $options, $response); } + return $response; }; }; @@ -202,12 +208,14 @@ public static function log(LoggerInterface $logger, $formatter, string $logLevel 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); } ); diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php index 7ca6283..0a8de81 100644 --- a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -84,6 +84,7 @@ private function addExpectHeader(RequestInterface $request, array $options, arra // The expect header is unconditionally enabled if ($expect === true) { $modify['set_headers']['Expect'] = '100-Continue'; + return; } diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php index f67d448..f32808a 100644 --- a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -27,10 +27,10 @@ class RedirectMiddleware * @var array */ public static $defaultSettings = [ - 'max' => 5, - 'protocols' => ['http', 'https'], - 'strict' => false, - 'referer' => false, + 'max' => 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, 'track_redirects' => false, ]; diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php index 20b31bc..bf3b02b 100644 --- a/vendor/guzzlehttp/guzzle/src/RequestOptions.php +++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -7,7 +7,7 @@ * * More documentation for each option can be found at http://guzzlephp.org/. * - * @link http://docs.guzzlephp.org/en/v6/request-options.html + * @see http://docs.guzzlephp.org/en/v6/request-options.html */ final class RequestOptions { @@ -70,10 +70,22 @@ final class RequestOptions /** * connect_timeout: (float, default=0) Float describing the number of * seconds to wait while trying to connect to a server. Use 0 to wait - * indefinitely (the default behavior). + * 300 seconds (the default behavior). */ public const CONNECT_TIMEOUT = 'connect_timeout'; + /** + * crypto_method: (int) A value describing the minimum TLS protocol + * version to use. + * + * This setting must be set to one of the + * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. PHP 7.4 or higher is + * required in order to use TLS 1.3, and cURL 7.34.0 or higher is required + * in order to specify a crypto method, with cURL 7.52.0 or higher being + * required to use TLS 1.3. + */ + public const CRYPTO_METHOD = 'crypto_method'; + /** * debug: (bool|resource) Set to true or set to a PHP stream returned by * fopen() enable debug output with the HTTP handler used to send a diff --git a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php index 0236a9d..8f4d93a 100644 --- a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php +++ b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php @@ -44,7 +44,7 @@ public function __construct(callable $decider, callable $nextHandler, callable $ { $this->decider = $decider; $this->nextHandler = $nextHandler; - $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + $this->delay = $delay ?: __CLASS__.'::exponentialDelay'; } /** @@ -54,7 +54,7 @@ public function __construct(callable $decider, callable $nextHandler, callable $ */ public static function exponentialDelay(int $retries): int { - return (int) \pow(2, $retries - 1) * 1000; + return (int) 2 ** ($retries - 1) * 1000; } public function __invoke(RequestInterface $request, array $options): PromiseInterface @@ -64,6 +64,7 @@ public function __invoke(RequestInterface $request, array $options): PromiseInte } $fn = $this->nextHandler; + return $fn($request, $options) ->then( $this->onFulfilled($request, $options), @@ -85,6 +86,7 @@ private function onFulfilled(RequestInterface $request, array $options): callabl )) { return $value; } + return $this->doRetry($request, $options, $value); }; } @@ -103,6 +105,7 @@ private function onRejected(RequestInterface $req, array $options): callable )) { return P\Create::rejectionFor($reason); } + return $this->doRetry($req, $options); }; } diff --git a/vendor/guzzlehttp/guzzle/src/Utils.php b/vendor/guzzlehttp/guzzle/src/Utils.php index e355f32..fcf571d 100644 --- a/vendor/guzzlehttp/guzzle/src/Utils.php +++ b/vendor/guzzlehttp/guzzle/src/Utils.php @@ -23,9 +23,9 @@ public static function describeType($input): string { switch (\gettype($input)) { case 'object': - return 'object(' . \get_class($input) . ')'; + return 'object('.\get_class($input).')'; case 'array': - return 'array(' . \count($input) . ')'; + return 'array('.\count($input).')'; default: \ob_start(); \var_dump($input); @@ -79,9 +79,9 @@ public static function debugResource($value = null) * * The returned handler is not wrapped by any default middlewares. * - * @throws \RuntimeException if no viable Handler is available. - * * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system. + * + * @throws \RuntimeException if no viable Handler is available. */ public static function chooseHandler(): callable { @@ -247,8 +247,8 @@ public static function isHostInNoProxy(string $host, array $noProxyArray): bool } // Special match if the area when prefixed with ".". Remove any // existing leading "." and add a new leading ".". - $area = '.' . \ltrim($area, '.'); - if (\substr($host, -(\strlen($area))) === $area) { + $area = '.'.\ltrim($area, '.'); + if (\substr($host, -\strlen($area)) === $area) { return true; } } @@ -269,13 +269,13 @@ public static function isHostInNoProxy(string $host, array $noProxyArray): bool * * @throws InvalidArgumentException if the JSON cannot be decoded. * - * @link https://www.php.net/manual/en/function.json-decode.php + * @see https://www.php.net/manual/en/function.json-decode.php */ public static function jsonDecode(string $json, bool $assoc = false, int $depth = 512, int $options = 0) { $data = \json_decode($json, $assoc, $depth, $options); if (\JSON_ERROR_NONE !== \json_last_error()) { - throw new InvalidArgumentException('json_decode error: ' . \json_last_error_msg()); + throw new InvalidArgumentException('json_decode error: '.\json_last_error_msg()); } return $data; @@ -290,13 +290,13 @@ public static function jsonDecode(string $json, bool $assoc = false, int $depth * * @throws InvalidArgumentException if the JSON cannot be encoded. * - * @link https://www.php.net/manual/en/function.json-encode.php + * @see https://www.php.net/manual/en/function.json-encode.php */ public static function jsonEncode($value, int $options = 0, int $depth = 512): string { $json = \json_encode($value, $options, $depth); if (\JSON_ERROR_NONE !== \json_last_error()) { - throw new InvalidArgumentException('json_encode error: ' . \json_last_error_msg()); + throw new InvalidArgumentException('json_encode error: '.\json_last_error_msg()); } /** @var string */ @@ -341,7 +341,7 @@ public static function idnUriConvert(UriInterface $uri, int $options = 0): UriIn $errorMessage = 'IDN conversion failed'; if ($errors) { - $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; + $errorMessage .= ' (errors: '.implode(', ', $errors).')'; } throw new InvalidArgumentException($errorMessage); diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php index a70d2cb..5edc66a 100644 --- a/vendor/guzzlehttp/guzzle/src/functions.php +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -50,10 +50,10 @@ function debug_resource($value = null) * * The returned handler is not wrapped by any default middlewares. * - * @throws \RuntimeException if no viable Handler is available. - * * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system. * + * @throws \RuntimeException if no viable Handler is available. + * * @deprecated choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils::chooseHandler instead. */ function choose_handler(): callable @@ -141,7 +141,7 @@ function is_host_in_noproxy(string $host, array $noProxyArray): bool * * @throws Exception\InvalidArgumentException if the JSON cannot be decoded. * - * @link https://www.php.net/manual/en/function.json-decode.php + * @see https://www.php.net/manual/en/function.json-decode.php * @deprecated json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonDecode instead. */ function json_decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0) @@ -158,7 +158,7 @@ function json_decode(string $json, bool $assoc = false, int $depth = 512, int $o * * @throws Exception\InvalidArgumentException if the JSON cannot be encoded. * - * @link https://www.php.net/manual/en/function.json-encode.php + * @see https://www.php.net/manual/en/function.json-encode.php * @deprecated json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonEncode instead. */ function json_encode($value, int $options = 0, int $depth = 512): string diff --git a/vendor/guzzlehttp/guzzle/src/functions_include.php b/vendor/guzzlehttp/guzzle/src/functions_include.php index 6636a42..394f953 100644 --- a/vendor/guzzlehttp/guzzle/src/functions_include.php +++ b/vendor/guzzlehttp/guzzle/src/functions_include.php @@ -2,5 +2,5 @@ // Don't redefine the functions if included multiple times. if (!\function_exists('GuzzleHttp\describe_type')) { - require __DIR__ . '/functions.php'; + require __DIR__.'/functions.php'; } diff --git a/vendor/guzzlehttp/promises/CHANGELOG.md b/vendor/guzzlehttp/promises/CHANGELOG.md index 253282e..ab173ad 100644 --- a/vendor/guzzlehttp/promises/CHANGELOG.md +++ b/vendor/guzzlehttp/promises/CHANGELOG.md @@ -1,11 +1,36 @@ # CHANGELOG + +## 2.0.0 - TBC + +### Added + +- Added PHP 7 type hints + +### Changed + +- All previously non-final non-exception classes have been marked as soft-final + +### Removed + +- Dropped PHP < 7.2 support +- All functions in the `GuzzleHttp\Promise` namespace + + +## 1.5.3 - 2023-05-21 + +### Changed + +- Removed remaining usage of deprecated functions + + ## 1.5.2 - 2022-08-07 ### Changed - Officially support PHP 8.2 + ## 1.5.1 - 2021-10-22 ### Fixed @@ -13,6 +38,7 @@ - Revert "Call handler when waiting on fulfilled/rejected Promise" - Fix pool memory leak when empty array of promises provided + ## 1.5.0 - 2021-10-07 ### Changed @@ -24,12 +50,14 @@ - Fix manually settle promises generated with `Utils::task` + ## 1.4.1 - 2021-02-18 ### Fixed - Fixed `each_limit` skipping promises and failing + ## 1.4.0 - 2020-09-30 ### Added diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md index 1ea667a..4dc7b6a 100644 --- a/vendor/guzzlehttp/promises/README.md +++ b/vendor/guzzlehttp/promises/README.md @@ -29,6 +29,21 @@ for a general introduction to promises. `GuzzleHttp\Promise\Coroutine::of()`. +## Installation + +```shell +composer require guzzlehttp/promises +``` + + +## Version Guidance + +| Version | Status | PHP Version | +|---------|------------------------|--------------| +| 1.x | Bug and security fixes | >=5.5,<8.3 | +| 2.x | Latest | >=7.2.5,<8.3 | + + ## Quick Start A *promise* represents the eventual result of an asynchronous operation. The @@ -430,8 +445,6 @@ $loop = React\EventLoop\Factory::create(); $loop->addPeriodicTimer(0, [$queue, 'run']); ``` -*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? - ## Implementation Notes @@ -501,8 +514,8 @@ $promise->resolve('foo'); 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: +function API was removed in 2.0.0. A migration table has been provided here for +your convenience: | Original Function | Replacement Method | |----------------|----------------| diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json index c959fb3..fc1989e 100644 --- a/vendor/guzzlehttp/promises/composer.json +++ b/vendor/guzzlehttp/promises/composer.json @@ -26,32 +26,32 @@ } ], "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "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" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, "preferred-install": "dist", "sort-packages": true } diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php index d2b5712..40ffdbc 100644 --- a/vendor/guzzlehttp/promises/src/AggregateException.php +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -1,5 +1,7 @@ generator = $generatorFn(); - $this->result = new Promise(function () { + $this->result = new Promise(function (): void { 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); } @@ -78,10 +77,8 @@ public function __construct(callable $generatorFn) /** * Create a new coroutine. - * - * @return self */ - public static function of(callable $generatorFn) + public static function of(callable $generatorFn): self { return new self($generatorFn); } @@ -89,42 +86,42 @@ public static function of(callable $generatorFn) public function then( callable $onFulfilled = null, callable $onRejected = null - ) { + ): PromiseInterface { return $this->result->then($onFulfilled, $onRejected); } - public function otherwise(callable $onRejected) + public function otherwise(callable $onRejected): PromiseInterface { return $this->result->otherwise($onRejected); } - public function wait($unwrap = true) + public function wait(bool $unwrap = true) { return $this->result->wait($unwrap); } - public function getState() + public function getState(): string { return $this->result->getState(); } - public function resolve($value) + public function resolve($value): void { $this->result->resolve($value); } - public function reject($reason) + public function reject($reason): void { $this->result->reject($reason); } - public function cancel() + public function cancel(): void { $this->currentPromise->cancel(); $this->result->cancel(); } - private function nextCoroutine($yielded) + private function nextCoroutine($yielded): void { $this->currentPromise = Create::promiseFor($yielded) ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); @@ -133,7 +130,7 @@ private function nextCoroutine($yielded) /** * @internal */ - public function _handleSuccess($value) + public function _handleSuccess($value): void { unset($this->currentPromise); try { @@ -143,8 +140,6 @@ public function _handleSuccess($value) } else { $this->result->resolve($value); } - } catch (Exception $exception) { - $this->result->reject($exception); } catch (Throwable $throwable) { $this->result->reject($throwable); } @@ -153,15 +148,13 @@ public function _handleSuccess($value) /** * @internal */ - public function _handleFailure($reason) + public function _handleFailure($reason): void { 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 index 8d038e9..9d3fc4a 100644 --- a/vendor/guzzlehttp/promises/src/Create.php +++ b/vendor/guzzlehttp/promises/src/Create.php @@ -1,5 +1,7 @@ then([$promise, 'resolve'], [$promise, 'reject']); + return $promise; } @@ -34,10 +35,8 @@ public static function promiseFor($value) * 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) + public static function rejectionFor($reason): PromiseInterface { if ($reason instanceof PromiseInterface) { return $reason; @@ -50,12 +49,10 @@ public static function rejectionFor($reason) * Create an exception for a rejected promise value. * * @param mixed $reason - * - * @return \Exception|\Throwable */ - public static function exceptionFor($reason) + public static function exceptionFor($reason): \Throwable { - if ($reason instanceof \Exception || $reason instanceof \Throwable) { + if ($reason instanceof \Throwable) { return $reason; } @@ -66,10 +63,8 @@ public static function exceptionFor($reason) * Returns an iterator for the given value. * * @param mixed $value - * - * @return \Iterator */ - public static function iterFor($value) + public static function iterFor($value): \Iterator { if ($value instanceof \Iterator) { return $value; diff --git a/vendor/guzzlehttp/promises/src/Each.php b/vendor/guzzlehttp/promises/src/Each.php index 1dda354..1a7aa0f 100644 --- a/vendor/guzzlehttp/promises/src/Each.php +++ b/vendor/guzzlehttp/promises/src/Each.php @@ -1,5 +1,7 @@ $onFulfilled, - 'rejected' => $onRejected + 'rejected' => $onRejected, ]))->promise(); } @@ -46,19 +46,17 @@ public static function of( * @param int|callable $concurrency * @param callable $onFulfilled * @param callable $onRejected - * - * @return PromiseInterface */ public static function ofLimit( $iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null - ) { + ): PromiseInterface { return (new EachPromise($iterable, [ - 'fulfilled' => $onFulfilled, - 'rejected' => $onRejected, - 'concurrency' => $concurrency + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency, ]))->promise(); } @@ -70,19 +68,17 @@ public static function ofLimit( * @param mixed $iterable * @param int|callable $concurrency * @param callable $onFulfilled - * - * @return PromiseInterface */ public static function ofLimitAll( $iterable, $concurrency, callable $onFulfilled = null - ) { - return each_limit( + ): PromiseInterface { + return self::ofLimit( $iterable, $concurrency, $onFulfilled, - function ($reason, $idx, PromiseInterface $aggregate) { + function ($reason, $idx, PromiseInterface $aggregate): void { $aggregate->reject($reason); } ); diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php index 280d799..28dd979 100644 --- a/vendor/guzzlehttp/promises/src/EachPromise.php +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -1,10 +1,14 @@ aggregate) { return $this->aggregate; @@ -82,21 +86,18 @@ public function promise() $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() + private function createPromise(): void { $this->mutex = false; - $this->aggregate = new Promise(function () { + $this->aggregate = new Promise(function (): void { if ($this->checkIfFinished()) { return; } @@ -113,7 +114,7 @@ private function createPromise() }); // Clear the references when the promise is resolved. - $clearFn = function () { + $clearFn = function (): void { $this->iterable = $this->concurrency = $this->pending = null; $this->onFulfilled = $this->onRejected = null; $this->nextPendingIndex = 0; @@ -122,11 +123,13 @@ private function createPromise() $this->aggregate->then($clearFn, $clearFn); } - private function refillPending() + private function refillPending(): void { if (!$this->concurrency) { // Add all pending promises. - while ($this->addPending() && $this->advanceIterator()); + while ($this->addPending() && $this->advanceIterator()) { + } + return; } @@ -147,10 +150,11 @@ private function refillPending() // next value to yield until promise callbacks are called. while (--$concurrency && $this->advanceIterator() - && $this->addPending()); + && $this->addPending()) { + } } - private function addPending() + private function addPending(): bool { if (!$this->iterable || !$this->iterable->valid()) { return false; @@ -164,7 +168,7 @@ private function addPending() $idx = $this->nextPendingIndex++; $this->pending[$idx] = $promise->then( - function ($value) use ($idx, $key) { + function ($value) use ($idx, $key): void { if ($this->onFulfilled) { call_user_func( $this->onFulfilled, @@ -175,7 +179,7 @@ function ($value) use ($idx, $key) { } $this->step($idx); }, - function ($reason) use ($idx, $key) { + function ($reason) use ($idx, $key): void { if ($this->onRejected) { call_user_func( $this->onRejected, @@ -191,7 +195,7 @@ function ($reason) use ($idx, $key) { return true; } - private function advanceIterator() + private function advanceIterator(): bool { // Place a lock on the iterator so that we ensure to not recurse, // preventing fatal generator errors. @@ -204,19 +208,17 @@ private function advanceIterator() 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) + private function step(int $idx): void { // If the promise was already resolved, then ignore this step. if (Is::settled($this->aggregate)) { @@ -234,11 +236,12 @@ private function step($idx) } } - private function checkIfFinished() + private function checkIfFinished(): bool { if (!$this->pending && !$this->iterable->valid()) { // Resolve the promise if there's nothing left to do. $this->aggregate->resolve(null); + return true; } diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php index 98f72a6..ab71296 100644 --- a/vendor/guzzlehttp/promises/src/FulfilledPromise.php +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -1,5 +1,7 @@ value; - $queue->add(static function () use ($p, $value, $onFulfilled) { + $queue->add(static function () use ($p, $value, $onFulfilled): void { if (Is::pending($p)) { try { $p->resolve($onFulfilled($value)); } catch (\Throwable $e) { $p->reject($e); - } catch (\Exception $e) { - $p->reject($e); } } }); @@ -50,34 +55,34 @@ public function then( return $p; } - public function otherwise(callable $onRejected) + public function otherwise(callable $onRejected): PromiseInterface { return $this->then(null, $onRejected); } - public function wait($unwrap = true, $defaultDelivery = null) + public function wait(bool $unwrap = true) { return $unwrap ? $this->value : null; } - public function getState() + public function getState(): string { return self::FULFILLED; } - public function resolve($value) + public function resolve($value): void { if ($value !== $this->value) { - throw new \LogicException("Cannot resolve a fulfilled promise"); + throw new \LogicException('Cannot resolve a fulfilled promise'); } } - public function reject($reason) + public function reject($reason): void { - throw new \LogicException("Cannot reject a fulfilled promise"); + throw new \LogicException('Cannot reject a fulfilled promise'); } - public function cancel() + public function cancel(): void { // pass } diff --git a/vendor/guzzlehttp/promises/src/Is.php b/vendor/guzzlehttp/promises/src/Is.php index c3ed8d0..f3f0503 100644 --- a/vendor/guzzlehttp/promises/src/Is.php +++ b/vendor/guzzlehttp/promises/src/Is.php @@ -1,45 +1,39 @@ getState() === PromiseInterface::PENDING; } /** * Returns true if a promise is fulfilled or rejected. - * - * @return bool */ - public static function settled(PromiseInterface $promise) + public static function settled(PromiseInterface $promise): bool { return $promise->getState() !== PromiseInterface::PENDING; } /** * Returns true if a promise is fulfilled. - * - * @return bool */ - public static function fulfilled(PromiseInterface $promise) + public static function fulfilled(PromiseInterface $promise): bool { return $promise->getState() === PromiseInterface::FULFILLED; } /** * Returns true if a promise is rejected. - * - * @return bool */ - public static function rejected(PromiseInterface $promise) + public static function rejected(PromiseInterface $promise): bool { return $promise->getState() === PromiseInterface::REJECTED; } diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php index 7593905..1b07bdc 100644 --- a/vendor/guzzlehttp/promises/src/Promise.php +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -1,11 +1,15 @@ 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) + public function otherwise(callable $onRejected): PromiseInterface { return $this->then(null, $onRejected); } - public function wait($unwrap = true) + public function wait(bool $unwrap = true) { $this->waitIfPending(); @@ -73,12 +80,12 @@ public function wait($unwrap = true) } } - public function getState() + public function getState(): string { return $this->state; } - public function cancel() + public function cancel(): void { if ($this->state !== self::PENDING) { return; @@ -93,8 +100,6 @@ public function cancel() $fn(); } catch (\Throwable $e) { $this->reject($e); - } catch (\Exception $e) { - $this->reject($e); } } @@ -105,17 +110,17 @@ public function cancel() } } - public function resolve($value) + public function resolve($value): void { $this->settle(self::FULFILLED, $value); } - public function reject($reason) + public function reject($reason): void { $this->settle(self::REJECTED, $reason); } - private function settle($state, $value) + private function settle(string $state, $value): void { if ($this->state !== self::PENDING) { // Ignore calls with the same resolution. @@ -148,7 +153,7 @@ private function settle($state, $value) 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) { + Utils::queue()->add(static function () use ($id, $value, $handlers): void { foreach ($handlers as $handler) { self::callHandler($id, $value, $handler); } @@ -159,12 +164,12 @@ private function settle($state, $value) } else { // Resolve the handlers when the forwarded promise is resolved. $value->then( - static function ($value) use ($handlers) { + static function ($value) use ($handlers): void { foreach ($handlers as $handler) { self::callHandler(1, $value, $handler); } }, - static function ($reason) use ($handlers) { + static function ($reason) use ($handlers): void { foreach ($handlers as $handler) { self::callHandler(2, $reason, $handler); } @@ -180,7 +185,7 @@ static function ($reason) use ($handlers) { * @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) + private static function callHandler(int $index, $value, array $handler): void { /** @var PromiseInterface $promise */ $promise = $handler[0]; @@ -211,12 +216,10 @@ private static function callHandler($index, $value, array $handler) } } catch (\Throwable $reason) { $promise->reject($reason); - } catch (\Exception $reason) { - $promise->reject($reason); } } - private function waitIfPending() + private function waitIfPending(): void { if ($this->state !== self::PENDING) { return; @@ -227,9 +230,9 @@ private function waitIfPending() } 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.'); + .'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(); @@ -240,13 +243,13 @@ private function waitIfPending() } } - private function invokeWaitFn() + private function invokeWaitFn(): void { try { $wfn = $this->waitFn; $this->waitFn = null; $wfn(true); - } catch (\Exception $reason) { + } catch (\Throwable $reason) { if ($this->state === self::PENDING) { // The promise has not been resolved yet, so reject the promise // with the exception. @@ -259,7 +262,7 @@ private function invokeWaitFn() } } - private function invokeWaitList() + private function invokeWaitList(): void { $waitList = $this->waitList; $this->waitList = null; diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php index e598331..2824802 100644 --- a/vendor/guzzlehttp/promises/src/PromiseInterface.php +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -1,5 +1,7 @@ reason; $p = new Promise([$queue, 'run']); - $queue->add(static function () use ($p, $reason, $onRejected) { + $queue->add(static function () use ($p, $reason, $onRejected): void { if (Is::pending($p)) { try { // Return a resolved promise if onRejected does not throw. @@ -43,9 +50,6 @@ public function then( } 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); } } }); @@ -53,12 +57,12 @@ public function then( return $p; } - public function otherwise(callable $onRejected) + public function otherwise(callable $onRejected): PromiseInterface { return $this->then(null, $onRejected); } - public function wait($unwrap = true, $defaultDelivery = null) + public function wait(bool $unwrap = true) { if ($unwrap) { throw Create::exceptionFor($this->reason); @@ -67,24 +71,24 @@ public function wait($unwrap = true, $defaultDelivery = null) return null; } - public function getState() + public function getState(): string { return self::REJECTED; } - public function resolve($value) + public function resolve($value): void { - throw new \LogicException("Cannot resolve a rejected promise"); + throw new \LogicException('Cannot resolve a rejected promise'); } - public function reject($reason) + public function reject($reason): void { if ($reason !== $this->reason) { - throw new \LogicException("Cannot reject a rejected promise"); + throw new \LogicException('Cannot reject a rejected promise'); } } - public function cancel() + public function cancel(): void { // pass } diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php index e2f1377..0db98ff 100644 --- a/vendor/guzzlehttp/promises/src/RejectionException.php +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -1,5 +1,7 @@ reason; + $message .= ' with reason: '.$this->reason; } elseif ($reason instanceof \JsonSerializable) { - $message .= ' with reason: ' - . json_encode($this->reason, JSON_PRETTY_PRINT); + $message .= ' with reason: '.json_encode($this->reason, JSON_PRETTY_PRINT); } parent::__construct($message); diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php index f0fba2c..503e0b2 100644 --- a/vendor/guzzlehttp/promises/src/TaskQueue.php +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -1,5 +1,7 @@ run(); + * + * @final */ class TaskQueue implements TaskQueueInterface { private $enableShutdown = true; private $queue = []; - public function __construct($withShutdown = true) + public function __construct(bool $withShutdown = true) { if ($withShutdown) { - register_shutdown_function(function () { + register_shutdown_function(function (): void { if ($this->enableShutdown) { // Only run the tasks if an E_ERROR didn't occur. $err = error_get_last(); @@ -31,17 +35,17 @@ public function __construct($withShutdown = true) } } - public function isEmpty() + public function isEmpty(): bool { return !$this->queue; } - public function add(callable $task) + public function add(callable $task): void { $this->queue[] = $task; } - public function run() + public function run(): void { while ($task = array_shift($this->queue)) { /** @var callable $task */ @@ -60,7 +64,7 @@ public function run() * * Note: This shutdown will occur before any destructors are triggered. */ - public function disableShutdown() + public function disableShutdown(): void { $this->enableShutdown = false; } diff --git a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php index 723d4d5..34c561a 100644 --- a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php +++ b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php @@ -1,24 +1,24 @@ * - * @param TaskQueueInterface $assign Optionally specify a new queue instance. - * - * @return TaskQueueInterface + * @param TaskQueueInterface|null $assign Optionally specify a new queue instance. */ - public static function queue(TaskQueueInterface $assign = null) + public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface { static $queue; @@ -39,22 +39,18 @@ public static function queue(TaskQueueInterface $assign = null) * 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) + public static function task(callable $task): PromiseInterface { $queue = self::queue(); $promise = new Promise([$queue, 'run']); - $queue->add(function () use ($task, $promise) { + $queue->add(function () use ($task, $promise): void { try { if (Is::pending($promise)) { $promise->resolve($task()); } } catch (\Throwable $e) { $promise->reject($e); - } catch (\Exception $e) { - $promise->reject($e); } }); @@ -72,22 +68,18 @@ public static function task(callable $task) * key mapping to the rejection reason of the promise. * * @param PromiseInterface $promise Promise or value. - * - * @return array */ - public static function inspect(PromiseInterface $promise) + public static function inspect(PromiseInterface $promise): array { try { return [ 'state' => PromiseInterface::FULFILLED, - 'value' => $promise->wait() + '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]; } } @@ -100,14 +92,12 @@ public static function inspect(PromiseInterface $promise) * @see inspect for the inspection state array format. * * @param PromiseInterface[] $promises Traversable of promises to wait upon. - * - * @return array */ - public static function inspectAll($promises) + public static function inspectAll($promises): array { $results = []; foreach ($promises as $key => $promise) { - $results[$key] = inspect($promise); + $results[$key] = self::inspect($promise); } return $results; @@ -122,12 +112,9 @@ public static function inspectAll($promises) * * @param iterable $promises Iterable of PromiseInterface objects to wait on. * - * @return array - * - * @throws \Exception on error - * @throws \Throwable on error in PHP >=7 + * @throws \Throwable on error */ - public static function unwrap($promises) + public static function unwrap($promises): array { $results = []; foreach ($promises as $key => $promise) { @@ -147,22 +134,21 @@ public static function unwrap($promises) * * @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) + public static function all($promises, bool $recursive = false): PromiseInterface { $results = []; $promise = Each::of( $promises, - function ($value, $idx) use (&$results) { + function ($value, $idx) use (&$results): void { $results[$idx] = $value; }, - function ($reason, $idx, Promise $aggregate) { + function ($reason, $idx, Promise $aggregate): void { $aggregate->reject($reason); } )->then(function () use (&$results) { ksort($results); + return $results; }); @@ -173,6 +159,7 @@ function ($reason, $idx, Promise $aggregate) { return self::all($promises, $recursive); } } + return $results; }); } @@ -193,17 +180,15 @@ function ($reason, $idx, Promise $aggregate) { * * @param int $count Total number of promises. * @param mixed $promises Promises or values. - * - * @return PromiseInterface */ - public static function some($count, $promises) + public static function some(int $count, $promises): PromiseInterface { $results = []; $rejections = []; return Each::of( $promises, - function ($value, $idx, PromiseInterface $p) use (&$results, $count) { + function ($value, $idx, PromiseInterface $p) use (&$results, $count): void { if (Is::settled($p)) { return; } @@ -212,7 +197,7 @@ function ($value, $idx, PromiseInterface $p) use (&$results, $count) { $p->resolve(null); } }, - function ($reason) use (&$rejections) { + function ($reason) use (&$rejections): void { $rejections[] = $reason; } )->then( @@ -224,6 +209,7 @@ function () use (&$results, &$rejections, $count) { ); } ksort($results); + return array_values($results); } ); @@ -234,10 +220,8 @@ function () use (&$results, &$rejections, $count) { * 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) + public static function any($promises): PromiseInterface { return self::some(1, $promises)->then(function ($values) { return $values[0]; @@ -253,23 +237,22 @@ public static function any($promises) * @see inspect for the inspection state array format. * * @param mixed $promises Promises or values. - * - * @return PromiseInterface */ - public static function settle($promises) + public static function settle($promises): PromiseInterface { $results = []; return Each::of( $promises, - function ($value, $idx) use (&$results) { + function ($value, $idx) use (&$results): void { $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; }, - function ($reason, $idx) use (&$results) { + function ($reason, $idx) use (&$results): void { $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 deleted file mode 100644 index c03d39d..0000000 --- a/vendor/guzzlehttp/promises/src/functions.php +++ /dev/null @@ -1,363 +0,0 @@ - - * 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 deleted file mode 100644 index 34cd171..0000000 --- a/vendor/guzzlehttp/promises/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ -stream = $stream; @@ -380,10 +388,28 @@ 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::normalize` +## `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. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json index cd91040..d51dd62 100644 --- a/vendor/guzzlehttp/psr7/composer.json +++ b/vendor/guzzlehttp/psr7/composer.json @@ -52,7 +52,7 @@ "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "ralouphie/getallheaders": "^3.0" }, "provide": { @@ -81,9 +81,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" } }, "config": { diff --git a/vendor/guzzlehttp/psr7/src/Header.php b/vendor/guzzlehttp/psr7/src/Header.php index 10744ed..4d7005b 100644 --- a/vendor/guzzlehttp/psr7/src/Header.php +++ b/vendor/guzzlehttp/psr7/src/Header.php @@ -62,7 +62,7 @@ public static function normalize($header): array } /** - * Splits a HTTP header defined to contain comma-separated list into + * 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'. diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php index 5618331..f6c8490 100644 --- a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -10,7 +10,6 @@ * Lazily reads or writes to a file that is opened only after an IO operation * take place on the stream. */ -#[\AllowDynamicProperties] final class LazyOpenStream implements StreamInterface { use StreamDecoratorTrait; @@ -21,6 +20,11 @@ final class LazyOpenStream implements StreamInterface /** @var string */ private $mode; + /** + * @var StreamInterface + */ + private $stream; + /** * @param string $filename File to lazily open * @param string $mode fopen mode to use when opening the stream @@ -29,6 +33,10 @@ public function __construct(string $filename, string $mode) { $this->filename = $filename; $this->mode = $mode; + + // unsetting the property forces the first access to go through + // __get(). + unset($this->stream); } /** diff --git a/vendor/guzzlehttp/psr7/src/Message.php b/vendor/guzzlehttp/psr7/src/Message.php index 61c1a5d..c1e15f8 100644 --- a/vendor/guzzlehttp/psr7/src/Message.php +++ b/vendor/guzzlehttp/psr7/src/Message.php @@ -77,7 +77,7 @@ public static function bodySummary(MessageInterface $message, int $truncateAt = // 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)) { + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary) !== 0) { return null; } diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php index d2dc28b..464bdfa 100644 --- a/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -224,12 +224,9 @@ private function assertHeader($header): void )); } - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { + if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { throw new \InvalidArgumentException( - sprintf( - '"%s" is not valid header name', - $header - ) + sprintf('"%s" is not valid header name.', $header) ); } } @@ -257,8 +254,10 @@ private function assertValue(string $value): void // 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)); + if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not valid header value.', $value) + ); } } } diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php index 3ae2c84..3e12b74 100644 --- a/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -34,7 +34,7 @@ final class MultipartStream implements StreamInterface */ public function __construct(array $elements = [], string $boundary = null) { - $this->boundary = $boundary ?: sha1(uniqid('', true)); + $this->boundary = $boundary ?: bin2hex(random_bytes(20)); $this->stream = $this->createStream($elements); } diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php index 43cbb50..b2aa382 100644 --- a/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -144,10 +144,10 @@ private static function normalizeNestedFileSpec(array $files = []): array 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], + 'size' => $files['size'][$key] ?? null, + 'error' => $files['error'][$key] ?? null, + 'name' => $files['name'][$key] ?? null, + 'type' => $files['type'][$key] ?? null, ]; $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); } diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php index 5c6416a..09e878d 100644 --- a/vendor/guzzlehttp/psr7/src/Uri.php +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -172,10 +172,14 @@ public static function composeComponents(?string $scheme, ?string $authority, st $uri .= $scheme . ':'; } - if ($authority != ''|| $scheme === 'file') { + if ($authority != '' || $scheme === 'file') { $uri .= '//' . $authority; } + if ($authority != '' && $path != '' && $path[0] != '/') { + $path = '/' . $path; + } + $uri .= $path; if ($query != '') { @@ -731,8 +735,6 @@ private function validateState(): void 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'); } - } elseif (isset($this->path[0]) && $this->path[0] !== '/') { - throw new MalformedUriException('The path of a URI with an authority must start with a slash "/" or be empty'); } } } 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 0000000..92bc748 --- /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/CHANGELOG.md b/vendor/php-http/client-common/CHANGELOG.md index 9b031de..2c933ab 100644 --- a/vendor/php-http/client-common/CHANGELOG.md +++ b/vendor/php-http/client-common/CHANGELOG.md @@ -1,5 +1,28 @@ # Change Log +## 2.7.0 - 2023-05-17 + +- Dropped `php-http/message-factory` from composer requirements as it is abandoned and this package does not actually use it. + +## 2.6.1 - 2023-04-14 + +- Allow installation with http-message (PSR-7) version 2 in addition to version 1. +- Support for PHP 8.2 + +## 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 diff --git a/vendor/php-http/client-common/README.md b/vendor/php-http/client-common/README.md index 7d13658..822d4cf 100644 --- a/vendor/php-http/client-common/README.md +++ b/vendor/php-http/client-common/README.md @@ -2,7 +2,7 @@ [![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) +[![Build Status](https://github.com/php-http/client-common/actions/workflows/tests.yml/badge.svg)](https://github.com/php-http/client-common/actions/workflows/tests.yml) [![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) diff --git a/vendor/php-http/client-common/composer.json b/vendor/php-http/client-common/composer.json index 2ea45aa..cc5cda8 100644 --- a/vendor/php-http/client-common/composer.json +++ b/vendor/php-http/client-common/composer.json @@ -14,10 +14,9 @@ "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", + "psr/http-message": "^1.0 || ^2.0", "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, @@ -27,7 +26,7 @@ "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" + "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" }, "suggest": { "ext-json": "To detect JSON responses with the ContentTypePlugin", @@ -58,10 +57,5 @@ }, "config": { "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } } } diff --git a/vendor/php-http/client-common/src/Deferred.php b/vendor/php-http/client-common/src/Deferred.php index ef2b309..646f375 100644 --- a/vendor/php-http/client-common/src/Deferred.php +++ b/vendor/php-http/client-common/src/Deferred.php @@ -146,7 +146,10 @@ public function wait($unwrap = true) return $this->value; } - /** @var ClientExceptionInterface */ + 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/HttpClientPool/HttpClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php index d6d1777..a30bdb0 100644 --- a/vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php +++ b/vendor/php-http/client-common/src/HttpClientPool/HttpClientPool.php @@ -46,9 +46,9 @@ public function addHttpClient($client): void /** * Return an http client given a specific strategy. * - * @throws HttpClientNotFoundException When no http client has been found into the pool - * * @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; diff --git a/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php b/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php index c7fb05a..2a866ee 100644 --- a/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php +++ b/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php @@ -31,7 +31,7 @@ final class AddHostPlugin implements Plugin * @param array{'replace'?: bool} $config * * Configuration options: - * - replace: True will replace all hosts, false will only add host when none is specified. + * - replace: True will replace all hosts, false will only add host when none is specified */ public function __construct(UriInterface $host, array $config = []) { diff --git a/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php b/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php index 9d43104..87fcdce 100644 --- a/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php +++ b/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php @@ -70,7 +70,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl 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/ContentTypePlugin.php b/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php index 9a87f99..da3758e 100644 --- a/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php +++ b/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php @@ -39,7 +39,7 @@ final class ContentTypePlugin implements Plugin * * 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. + * - size_limit: size stream limit for which the detection as to be skipped */ public function __construct(array $config = []) { diff --git a/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php b/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php index b685967..41c1a58 100644 --- a/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php +++ b/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php @@ -34,7 +34,7 @@ final class DecoderPlugin implements Plugin * @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). + * - 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 = []) { diff --git a/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php b/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php index 06c795f..678977f 100644 --- a/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php +++ b/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php @@ -40,7 +40,7 @@ final class ErrorPlugin implements Plugin * @param array{'only_server_exception'?: bool} $config * * Configuration options: - * - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false). + * - only_server_exception: Whether this plugin should only throw 5XX Exceptions (default to false) */ public function __construct(array $config = []) { @@ -72,10 +72,10 @@ public function handleRequest(RequestInterface $request, callable $next, callabl * @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 - * - * @return ResponseInterface If status code is not in 4xx or 5xx return response */ private function transformResponseToException(RequestInterface $request, ResponseInterface $response): ResponseInterface { diff --git a/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php b/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php index 5b45826..ee5c232 100644 --- a/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php +++ b/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php @@ -4,14 +4,20 @@ namespace Http\Client\Common\Plugin; +use GuzzleHttp\Psr7\Utils; use Http\Client\Common\Exception\CircularRedirectionException; use Http\Client\Common\Exception\MultipleRedirectionException; use Http\Client\Common\Plugin; use Http\Client\Exception\HttpException; +use Http\Discovery\Psr17FactoryDiscovery; use Http\Promise\Promise; +use Nyholm\Psr7\Factory\Psr17Factory; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; +use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -101,13 +107,19 @@ final class RedirectPlugin implements Plugin */ 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. + * - 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 = []) { @@ -116,10 +128,12 @@ public function __construct(array $config = []) '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 []; @@ -127,6 +141,9 @@ public function __construct(array $config = []) return $value; }); + $resolver->setDefault('stream_factory', function (Options $options): ?StreamFactoryInterface { + return $this->guessStreamFactory(); + }); $options = $resolver->resolve($config); $this->preserveHeader = $options['preserve_header']; @@ -137,6 +154,8 @@ public function __construct(array $config = []) $this->redirectCodes[301]['switch'] = false; $this->redirectCodes[302]['switch'] = false; } + + $this->streamFactory = $options['stream_factory']; } /** @@ -170,7 +189,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl $this->circularDetection[$chainIdentifier][] = (string) $request->getUri(); - if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier])) { + if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier], true)) { throw new CircularRedirectionException('Circular redirection detected', $request, $response); } @@ -186,19 +205,62 @@ public function handleRequest(RequestInterface $request, callable $next, callabl }); } + /** + * 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'])) { + 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)) { + if (!in_array($name, $this->preserveHeader, true)) { $originalRequest = $originalRequest->withoutHeader($name); } } @@ -226,12 +288,43 @@ private function createUri(ResponseInterface $redirectResponse, RequestInterface $location = $redirectResponse->getHeaderLine('Location'); $parsedLocation = parse_url($location); - if (false === $parsedLocation) { - throw new HttpException(sprintf('Location %s could not be parsed', $location), $originalRequest, $redirectResponse); + 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']); } @@ -242,22 +335,8 @@ private function createUri(ResponseInterface $redirectResponse, RequestInterface if (array_key_exists('port', $parsedLocation)) { $uri = $uri->withPort($parsedLocation['port']); - } - - if (array_key_exists('path', $parsedLocation)) { - $uri = $uri->withPath($parsedLocation['path']); - } - - if (array_key_exists('query', $parsedLocation)) { - $uri = $uri->withQuery($parsedLocation['query']); - } else { - $uri = $uri->withQuery(''); - } - - if (array_key_exists('fragment', $parsedLocation)) { - $uri = $uri->withFragment($parsedLocation['fragment']); - } else { - $uri = $uri->withFragment(''); + } elseif (array_key_exists('host', $parsedLocation)) { + $uri = $uri->withPort(null); } return $uri; diff --git a/vendor/php-http/client-common/src/PluginChain.php b/vendor/php-http/client-common/src/PluginChain.php index fcb1914..2bfbfbc 100644 --- a/vendor/php-http/client-common/src/PluginChain.php +++ b/vendor/php-http/client-common/src/PluginChain.php @@ -4,7 +4,6 @@ namespace Http\Client\Common; -use function array_reverse; use Http\Client\Common\Exception\LoopException; use Http\Promise\Promise; use Psr\Http\Message\RequestInterface; @@ -38,7 +37,7 @@ public function __construct(array $plugins, callable $clientCallable, array $opt private function createChain(): callable { $lastCallable = $this->clientCallable; - $reversedPlugins = array_reverse($this->plugins); + $reversedPlugins = \array_reverse($this->plugins); foreach ($reversedPlugins as $plugin) { $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable) { diff --git a/vendor/php-http/client-common/src/PluginClient.php b/vendor/php-http/client-common/src/PluginClient.php index d67145d..db81243 100644 --- a/vendor/php-http/client-common/src/PluginClient.php +++ b/vendor/php-http/client-common/src/PluginClient.php @@ -124,7 +124,6 @@ private function configure(array $options = []): array */ private function createPluginChain(array $plugins, callable $clientCallable): callable { - /** @var callable(RequestInterface): Promise */ return new PluginChain($plugins, $clientCallable, $this->options); } } diff --git a/vendor/php-http/client-common/src/PluginClientFactory.php b/vendor/php-http/client-common/src/PluginClientFactory.php index f7e93e3..1d2b2be 100644 --- a/vendor/php-http/client-common/src/PluginClientFactory.php +++ b/vendor/php-http/client-common/src/PluginClientFactory.php @@ -39,11 +39,11 @@ public static function setFactory(callable $factory): void /** * @param ClientInterface|HttpAsyncClient $client * @param Plugin[] $plugins - * @param array{'client_name'?: string} $options + * @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. + * like in the HTTPlugBundle profiler * * @see PluginClient constructor for PluginClient specific $options. */ diff --git a/vendor/php-http/discovery/CHANGELOG.md b/vendor/php-http/discovery/CHANGELOG.md index a4f3840..50ac789 100644 --- a/vendor/php-http/discovery/CHANGELOG.md +++ b/vendor/php-http/discovery/CHANGELOG.md @@ -1,5 +1,47 @@ # Change Log +## 1.18.1 - 2023-05-17 + +- [#242](https://github.com/php-http/discovery/pull/242) - Better exception message when no legacy php-http message factories can be built. Also needs php-http/message-factory package and they are deprecated in favor of PSR-17 anyways. + +## 1.18.0 - 2023-05-03 + +- [#235](https://github.com/php-http/discovery/pull/235) - Deprecate HttpClientDiscovery, use Psr18ClientDiscovery instead +- [#238](https://github.com/php-http/discovery/pull/238) - Skip requiring php-http/message-factory when installing symfony/http-client 6.3+ +- [#239](https://github.com/php-http/discovery/pull/239) - Skip auto-installing when the root package's extra.discovery is enough + +## 1.17.0 - 2023-04-26 + +- [#230](https://github.com/php-http/discovery/pull/230) - Add Psr18Client to make it straightforward to use PSR-18 +- [#232](https://github.com/php-http/discovery/pull/232) - Allow pinning the preferred implementations in composer.json +- [#233](https://github.com/php-http/discovery/pull/233) - Fix Psr17Factory::createServerRequestFromGlobals() when uploaded files have been moved + +## 1.16.0 - 2023-04-26 + +- [#225](https://github.com/php-http/discovery/pull/225) - Remove support for the abandoned Zend Diactoros which has been replaced with Laminas Diactoros; marked the zend library as conflict in composer.json to avoid confusion +- [#227](https://github.com/php-http/discovery/pull/227) - Fix handling requests with nested files + +## 1.15.3 - 2023-03-31 + +- [#224](https://github.com/php-http/discovery/pull/224) - Fix regression with Magento classloader + +## 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 @@ -10,7 +52,7 @@ ## 1.14.1 - 2021-09-18 -- [#199](https://github.com/php-http/discovery/pull/199) - Fixes message factory discovery for `laminas-diactoros ^2.7` +- [#199](https://github.com/php-http/discovery/pull/199) - Fixes message factory discovery for `laminas-diactoros ^2.7` ## 1.14.0 - 2021-06-21 diff --git a/vendor/php-http/discovery/README.md b/vendor/php-http/discovery/README.md index 6a3d18b..1d9fd99 100644 --- a/vendor/php-http/discovery/README.md +++ b/vendor/php-http/discovery/README.md @@ -2,12 +2,12 @@ [![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) +[![Tests](https://github.com/php-http/discovery/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/php-http/discovery/actions/workflows/ci.yml?query=branch%3Amaster) [![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) -**Finds installed HTTPlug implementations and PSR-7 message factories.** +**This library provides auto-discovery and auto-installation of well-known PSR-17, PSR-18 and HTTPlug implementations.** ## Install @@ -15,19 +15,95 @@ Via Composer ``` bash -$ composer require php-http/discovery +composer require php-http/discovery ``` -## Documentation +## Usage as a library author Please see the [official documentation](http://php-http.readthedocs.org/en/latest/discovery.html). +If your library/SDK needs a PSR-18 client, here is a quick example. + +First, you need to install a PSR-18 client and a PSR-17 factory implementations. +This should be done only for dev dependencies as you don't want to force a +specific implementation on your users: + +```bash +composer require --dev symfony/http-client +composer require --dev nyholm/psr7 +``` + +Then, you can disable the Composer plugin embeded in `php-http/discovery` +because you just installed the dev dependencies you need for testing: + +```bash +composer config allow-plugins.php-http/discovery false +``` + +Finally, you need to require `php-http/discovery` and the generic implementations +that your library is going to need: + +```bash +composer require php-http/discovery:^1.17 +composer require psr/http-client-implementation:* +composer require psr/http-factory-implementation:* +``` + +Now, you're ready to make an HTTP request: + +```php +use Http\Discovery\Psr18Client; + +$client = new Psr18Client(); + +$request = $client->createRequest('GET', 'https://example.com'); +$response = $client->sendRequest($request); +``` + +Internally, this code will use whatever PSR-7, PSR-17 and PSR-18 implementations +that your users have installed. + + +## Usage as a library user + +If you use a library/SDK that requires `php-http/discovery`, you can configure +the auto-discovery mechanism to use a specific implementation when many are +available in your project. + +For example, if you have both `nyholm/psr7` and `guzzlehttp/guzzle` in your +project, you can tell `php-http/discovery` to use `guzzlehttp/guzzle` instead of +`nyholm/psr7` by running the following command: + +```bash +composer config extra.discovery.psr/http-factory-implementation GuzzleHttp\\Psr7\\HttpFactory +``` + +This will update your `composer.json` file to add the following configuration: + +```json +{ + "extra": { + "discovery": { + "psr/http-factory-implementation": "GuzzleHttp\\Psr7\\HttpFactory" + } + } +} +``` + +Don't forget to run `composer install` to apply the changes, and ensure that +the composer plugin is enabled: + +```bash +composer config allow-plugins.php-http/discovery true +composer install +``` + ## Testing ``` bash -$ composer test +composer test ``` diff --git a/vendor/php-http/discovery/composer.json b/vendor/php-http/discovery/composer.json index 42d6260..d38ab83 100644 --- a/vendor/php-http/discovery/composer.json +++ b/vendor/php-http/discovery/composer.json @@ -1,8 +1,9 @@ { "name": "php-http/discovery", - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "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"], + "keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7", "psr17"], "homepage": "http://php-http.org", "authors": [ { @@ -10,22 +11,32 @@ "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" + "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" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.2" }, "autoload": { "psr-4": { "Http\\Discovery\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] }, "autoload-dev": { "psr-4": { @@ -33,16 +44,19 @@ } }, "scripts": { - "test": "vendor/bin/phpspec run", + "test": [ + "vendor/bin/phpspec run", + "vendor/bin/simple-phpunit --group NothingInstalled" + ], "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" }, "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true }, "conflict": { - "nyholm/psr7": "<1.0" + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" }, "prefer-stable": true, "minimum-stability": "beta" diff --git a/vendor/php-http/discovery/src/ClassDiscovery.php b/vendor/php-http/discovery/src/ClassDiscovery.php index 4f47f3c..f1e0c82 100644 --- a/vendor/php-http/discovery/src/ClassDiscovery.php +++ b/vendor/php-http/discovery/src/ClassDiscovery.php @@ -6,6 +6,7 @@ use Http\Discovery\Exception\DiscoveryFailedException; use Http\Discovery\Exception\NoCandidateFoundException; use Http\Discovery\Exception\StrategyUnavailableException; +use Http\Discovery\Strategy\DiscoveryStrategy; /** * Registry that based find results on class existence. @@ -19,9 +20,10 @@ abstract class ClassDiscovery /** * A list of strategies to find classes. * - * @var array + * @var DiscoveryStrategy[] */ private static $strategies = [ + Strategy\GeneratedDiscoveryStrategy::class, Strategy\CommonClassesStrategy::class, Strategy\CommonPsr17ClassesStrategy::class, Strategy\PuliBetaStrategy::class, @@ -54,10 +56,17 @@ protected static function findOneByType($type) return $class; } + static $skipStrategy; + $skipStrategy ?? $skipStrategy = self::safeClassExists(Strategy\GeneratedDiscoveryStrategy::class) ? false : Strategy\GeneratedDiscoveryStrategy::class; + $exceptions = []; foreach (self::$strategies as $strategy) { + if ($skipStrategy === $strategy) { + continue; + } + try { - $candidates = call_user_func($strategy.'::getCandidates', $type); + $candidates = $strategy::getCandidates($type); } catch (StrategyUnavailableException $e) { if (!isset(self::$deprecatedStrategies[$strategy])) { $exceptions[] = $e; @@ -122,7 +131,7 @@ private static function storeInCache($type, $class) /** * Set new strategies and clear the cache. * - * @param array $strategies string array of fully qualified class name to a DiscoveryStrategy + * @param string[] $strategies list of fully qualified class names that implement DiscoveryStrategy */ public static function setStrategies(array $strategies) { @@ -143,7 +152,7 @@ public static function getStrategies(): iterable /** * Append a strategy at the end of the strategy queue. * - * @param string $strategy Fully qualified class name to a DiscoveryStrategy + * @param string $strategy Fully qualified class name of a DiscoveryStrategy */ public static function appendStrategy($strategy) { @@ -162,9 +171,6 @@ public static function prependStrategy($strategy) self::clearCache(); } - /** - * Clear the cache. - */ public static function clearCache() { self::$cache = []; @@ -230,14 +236,13 @@ protected static function instantiateClass($class) } /** - * We want to do a "safe" version of PHP's "class_exists" because Magento has a bug + * We need 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. + * This function catches all potential exceptions and makes sure to always return a boolean. * * @param string $class - * @param bool $autoload * * @return bool */ 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 0000000..bba2e2b --- /dev/null +++ b/vendor/php-http/discovery/src/Composer/Plugin.php @@ -0,0 +1,464 @@ + + * + * @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:>=6.3' => ['guzzlehttp/promises', 'psr/http-factory-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:>=6.3' => ['psr/http-factory-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' => [], + '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-slim' => 'slim/slim:^3', + ]; + + private const INTERFACE_MAP = [ + 'php-http/async-client-implementation' => [ + 'Http\Client\HttpAsyncClient', + ], + 'php-http/client-implementation' => [ + 'Http\Client\HttpClient', + ], + 'psr/http-client-implementation' => [ + 'Psr\Http\Client\ClientInterface', + ], + 'psr/http-factory-implementation' => [ + 'Psr\Http\Message\RequestFactoryInterface', + 'Psr\Http\Message\ResponseFactoryInterface', + 'Psr\Http\Message\ServerRequestFactoryInterface', + 'Psr\Http\Message\StreamFactoryInterface', + 'Psr\Http\Message\UploadedFileFactoryInterface', + 'Psr\Http\Message\UriFactoryInterface', + ], + ]; + + public static function getSubscribedEvents(): array + { + return [ + ScriptEvents::PRE_AUTOLOAD_DUMP => 'preAutoloadDump', + 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(), + ]; + $pinnedAbstractions = []; + $pinned = $composer->getPackage()->getExtra()['discovery'] ?? []; + foreach (self::INTERFACE_MAP as $abstraction => $interfaces) { + foreach (isset($pinned[$abstraction]) ? [] : $interfaces as $interface) { + if (!isset($pinned[$interface])) { + continue 2; + } + } + $pinnedAbstractions[$abstraction] = true; + } + + $missingRequires = $this->getMissingRequires($repo, $requires, 'project' === $composer->getPackage()->getType(), $pinnedAbstractions); + $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(ClassDiscovery::safeClassExists(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 $pinnedAbstractions): 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 (ClassDiscovery::safeClassExists(\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) { + $abstraction = key($rules); + + if (isset($pinnedAbstractions[$abstraction])) { + unset($rules[$abstraction]); + continue; + } + + $abstractions[] = $abstraction; + + 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); + [$dep] = explode(':', $dep, 2); + $missingRequires[$dev][$abstraction] = [$dep]; + + if ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[2][$abstraction][] = $dep; + } + } + } + + $missingRequires[1] = array_diff_key($missingRequires[1], $missingRequires[0]); + + return $missingRequires; + } + + public function preAutoloadDump(Event $event) + { + $filesystem = new Filesystem(); + // Double realpath() on purpose, see https://bugs.php.net/72738 + $vendorDir = $filesystem->normalizePath(realpath(realpath($event->getComposer()->getConfig()->get('vendor-dir')))); + $filesystem->ensureDirectoryExists($vendorDir.'/composer'); + $pinned = $event->getComposer()->getPackage()->getExtra()['discovery'] ?? []; + $candidates = []; + + $allInterfaces = array_merge(...array_values(self::INTERFACE_MAP)); + foreach ($pinned as $abstraction => $class) { + if (isset(self::INTERFACE_MAP[$abstraction])) { + $interfaces = self::INTERFACE_MAP[$abstraction]; + } elseif (false !== $k = array_search($abstraction, $allInterfaces, true)) { + $interfaces = [$allInterfaces[$k]]; + } else { + throw new \UnexpectedValueException(sprintf('Invalid "extra.discovery" pinned in composer.json: "%s" is not one of ["%s"].', $abstraction, implode('", "', array_keys(self::INTERFACE_MAP)))); + } + + foreach ($interfaces as $interface) { + $candidates[] = sprintf("case %s: return [['class' => %s]];\n", var_export($interface, true), var_export($class, true)); + } + } + + $file = $vendorDir.'/composer/GeneratedDiscoveryStrategy.php'; + + if (!$candidates) { + if (file_exists($file)) { + unlink($file); + } + + return; + } + + $candidates = implode(' ', $candidates); + $code = <<getComposer()->getPackage(); + $autoload = $rootPackage->getAutoload(); + $autoload['classmap'][] = $vendorDir.'/composer/GeneratedDiscoveryStrategy.php'; + $rootPackage->setAutoload($autoload); + } + + 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 = ClassDiscovery::safeClassExists(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 index 58b0523..0fa8c76 100644 --- a/vendor/php-http/discovery/src/Exception.php +++ b/vendor/php-http/discovery/src/Exception.php @@ -2,13 +2,11 @@ namespace Http\Discovery; -use Throwable; - /** * An interface implemented by all discovery related exceptions. * * @author Tobias Nyholm */ -interface Exception extends Throwable +interface Exception extends \Throwable { } diff --git a/vendor/php-http/discovery/src/HttpClientDiscovery.php b/vendor/php-http/discovery/src/HttpClientDiscovery.php index 2072b94..bd3da03 100644 --- a/vendor/php-http/discovery/src/HttpClientDiscovery.php +++ b/vendor/php-http/discovery/src/HttpClientDiscovery.php @@ -9,6 +9,8 @@ * Finds an HTTP Client. * * @author Márk Sági-Kazár + * + * @deprecated This will be removed in 2.0. Consider using Psr18FactoryDiscovery. */ final class HttpClientDiscovery extends ClassDiscovery { diff --git a/vendor/php-http/discovery/src/MessageFactoryDiscovery.php b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php index 659916d..4ae104a 100644 --- a/vendor/php-http/discovery/src/MessageFactoryDiscovery.php +++ b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php @@ -26,7 +26,7 @@ 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); + throw new NotFoundException('No php-http message factories found. Note that the php-http message factories are deprecated in favor of the PSR-17 message factories. To use the legacy Guzzle, Diactoros or Slim Framework factories of php-http, install php-http/message and php-http/message-factory and the chosen message implementation.', 0, $e); } return static::instantiateClass($messageFactory); diff --git a/vendor/php-http/discovery/src/Psr17Factory.php b/vendor/php-http/discovery/src/Psr17Factory.php new file mode 100644 index 0000000..5d3ab92 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr17Factory.php @@ -0,0 +1,303 @@ + + * 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 $k => $v) { + if (0 === strpos($k, 'HTTP_')) { + $k = substr($k, 5); + } elseif (!\in_array($k, ['CONTENT_TYPE', 'CONTENT_LENGTH', 'CONTENT_MD5'], true)) { + continue; + } + $k = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $k)))); + + $headers[$k] = $v; + } + + 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 $k => $v) { + try { + $request = $request->withHeader($k, $v); + } 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 + { + foreach ($files as $k => $v) { + if ($v instanceof UploadedFileInterface) { + continue; + } + if (!\is_array($v)) { + unset($files[$k]); + } elseif (!isset($v['tmp_name'])) { + $files[$k] = $this->normalizeFiles($v); + } else { + $files[$k] = $this->createUploadedFileFromSpec($v); + } + } + + return $files; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * @param array $value $_FILES struct + * + * @return UploadedFileInterface|UploadedFileInterface[] + */ + private function createUploadedFileFromSpec(array $value) + { + if (!is_array($tmpName = $value['tmp_name'])) { + $file = is_file($tmpName) ? $this->createStreamFromFile($tmpName, 'r') : $this->createStream(); + + return $this->createUploadedFile($file, $value['size'], $value['error'], $value['name'], $value['type']); + } + + foreach ($tmpName as $k => $v) { + $tmpName[$k] = $this->createUploadedFileFromSpec([ + 'tmp_name' => $v, + 'size' => $value['size'][$k] ?? null, + 'error' => $value['error'][$k] ?? null, + 'name' => $value['name'][$k] ?? null, + 'type' => $value['type'][$k] ?? null, + ]); + } + + return $tmpName; + } +} diff --git a/vendor/php-http/discovery/src/Psr18Client.php b/vendor/php-http/discovery/src/Psr18Client.php new file mode 100644 index 0000000..c47780e --- /dev/null +++ b/vendor/php-http/discovery/src/Psr18Client.php @@ -0,0 +1,45 @@ + + */ +class Psr18Client extends Psr17Factory implements ClientInterface +{ + private $client; + + public function __construct( + ClientInterface $client = null, + RequestFactoryInterface $requestFactory = null, + ResponseFactoryInterface $responseFactory = null, + ServerRequestFactoryInterface $serverRequestFactory = null, + StreamFactoryInterface $streamFactory = null, + UploadedFileFactoryInterface $uploadedFileFactory = null, + UriFactoryInterface $uriFactory = null + ) { + parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory); + + $this->client = $client ?? Psr18ClientDiscovery::find(); + } + + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->client->sendRequest($request); + } +} diff --git a/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php index 8bddbe8..af63f88 100644 --- a/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php +++ b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php @@ -12,7 +12,6 @@ use Http\Adapter\Guzzle6\Client as Guzzle6; use Http\Adapter\Guzzle7\Client as Guzzle7; use Http\Adapter\React\Client as React; -use Http\Adapter\Zend\Client as Zend; use Http\Client\Curl\Client as Curl; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; @@ -25,7 +24,6 @@ use Http\Message\MessageFactory\DiactorosMessageFactory; use Http\Message\MessageFactory\GuzzleMessageFactory; use Http\Message\MessageFactory\SlimMessageFactory; -use Http\Message\RequestFactory; use Http\Message\StreamFactory; use Http\Message\StreamFactory\DiactorosStreamFactory; use Http\Message\StreamFactory\GuzzleStreamFactory; @@ -41,12 +39,13 @@ use Slim\Http\Request as SlimRequest; use Symfony\Component\HttpClient\HttplugClient as SymfonyHttplug; use Symfony\Component\HttpClient\Psr18Client as SymfonyPsr18; -use Zend\Diactoros\Request as ZendDiactorosRequest; /** * @internal * * @author Tobias Nyholm + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. */ final class CommonClassesStrategy implements DiscoveryStrategy { @@ -57,33 +56,30 @@ final class CommonClassesStrategy implements DiscoveryStrategy 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' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, Promise::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' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, [self::class, 'isPsr17FactoryInstalled']]], ['class' => Guzzle7::class, 'condition' => Guzzle7::class], ['class' => Guzzle6::class, 'condition' => Guzzle6::class], ['class' => Guzzle5::class, 'condition' => Guzzle5::class], @@ -92,7 +88,6 @@ final class CommonClassesStrategy implements DiscoveryStrategy ['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'], diff --git a/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php index fc26778..3e1c29b 100644 --- a/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php +++ b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php @@ -13,6 +13,8 @@ * @internal * * @author Tobias Nyholm + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. */ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy { @@ -23,7 +25,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy RequestFactoryInterface::class => [ 'Phalcon\Http\Message\RequestFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\RequestFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\RequestFactory', 'Http\Factory\Guzzle\RequestFactory', @@ -34,7 +35,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy ResponseFactoryInterface::class => [ 'Phalcon\Http\Message\ResponseFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\ResponseFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\ResponseFactory', 'Http\Factory\Guzzle\ResponseFactory', @@ -45,7 +45,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy ServerRequestFactoryInterface::class => [ 'Phalcon\Http\Message\ServerRequestFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\ServerRequestFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\ServerRequestFactory', 'Http\Factory\Guzzle\ServerRequestFactory', @@ -56,7 +55,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy StreamFactoryInterface::class => [ 'Phalcon\Http\Message\StreamFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\StreamFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\StreamFactory', 'Http\Factory\Guzzle\StreamFactory', @@ -67,7 +65,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy UploadedFileFactoryInterface::class => [ 'Phalcon\Http\Message\UploadedFileFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\UploadedFileFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\UploadedFileFactory', 'Http\Factory\Guzzle\UploadedFileFactory', @@ -78,7 +75,6 @@ final class CommonPsr17ClassesStrategy implements DiscoveryStrategy UriFactoryInterface::class => [ 'Phalcon\Http\Message\UriFactory', 'Nyholm\Psr7\Factory\Psr17Factory', - 'Zend\Diactoros\UriFactory', 'GuzzleHttp\Psr7\HttpFactory', 'Http\Factory\Diactoros\UriFactory', 'Http\Factory\Guzzle\UriFactory', diff --git a/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php index c1e1fb7..6b3a862 100644 --- a/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php +++ b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php @@ -11,6 +11,7 @@ * Find candidates using Puli. * * @internal + * * @final * * @author David de Boer diff --git a/vendor/php-http/httplug/CHANGELOG.md b/vendor/php-http/httplug/CHANGELOG.md index 26483c2..efccd55 100644 --- a/vendor/php-http/httplug/CHANGELOG.md +++ b/vendor/php-http/httplug/CHANGELOG.md @@ -7,7 +7,12 @@ 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.4.0] - 2023-04-14 + +### Changed + +- Allow `psr/http-message` v2 in addition to v1 +- Deprecate `Http\Client\HttpClient`, use [PSR-18](https://www.php-fig.org/psr/psr-18/) instead ## [2.3.0] - 2022-02-21 diff --git a/vendor/php-http/httplug/README.md b/vendor/php-http/httplug/README.md index ce60cfa..a9b476a 100644 --- a/vendor/php-http/httplug/README.md +++ b/vendor/php-http/httplug/README.md @@ -15,19 +15,11 @@ ## 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. +messages. The HttpAsyncClient defines an asynchronous HTTP client for PHP. + +This package also provides a synchronous HttpClient interface with the same +method signature as the [PSR-18](http://www.php-fig.org/psr/psr-18/) client. +For synchronous requests, we recommend using PSR-18 directly. ## History diff --git a/vendor/php-http/httplug/composer.json b/vendor/php-http/httplug/composer.json index 268b27e..7391770 100644 --- a/vendor/php-http/httplug/composer.json +++ b/vendor/php-http/httplug/composer.json @@ -22,16 +22,11 @@ "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.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" - } + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "autoload": { "psr-4": { diff --git a/vendor/php-http/httplug/src/HttpClient.php b/vendor/php-http/httplug/src/HttpClient.php index 4442bd0..22b94aa 100644 --- a/vendor/php-http/httplug/src/HttpClient.php +++ b/vendor/php-http/httplug/src/HttpClient.php @@ -9,6 +9,8 @@ * * Provide the Httplug HttpClient interface for BC. * You should typehint Psr\Http\Client\ClientInterface in new code + * + * @deprecated since version 2.4, use Psr\Http\Client\ClientInterface instead; see https://www.php-fig.org/psr/psr-18/ */ interface HttpClient extends ClientInterface { diff --git a/vendor/php-http/message-factory/CHANGELOG.md b/vendor/php-http/message-factory/CHANGELOG.md deleted file mode 100644 index 4711924..0000000 --- a/vendor/php-http/message-factory/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# 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 deleted file mode 100644 index 8e2c4a0..0000000 --- a/vendor/php-http/message-factory/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 4654495..0000000 --- a/vendor/php-http/message-factory/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# 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 deleted file mode 100644 index 7c72feb..0000000 --- a/vendor/php-http/message-factory/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "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 deleted file mode 100644 index 08d3762..0000000 --- a/vendor/php-http/message-factory/puli.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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 deleted file mode 100644 index 965aaa8..0000000 --- a/vendor/php-http/message-factory/src/MessageFactory.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -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 deleted file mode 100644 index 624e82f..0000000 --- a/vendor/php-http/message-factory/src/RequestFactory.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -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 deleted file mode 100644 index 2411ed3..0000000 --- a/vendor/php-http/message-factory/src/ResponseFactory.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ -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 deleted file mode 100644 index 327a902..0000000 --- a/vendor/php-http/message-factory/src/StreamFactory.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ -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 deleted file mode 100644 index f05e625..0000000 --- a/vendor/php-http/message-factory/src/UriFactory.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ -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/.php-cs-fixer.dist.php b/vendor/php-http/message/.php-cs-fixer.dist.php new file mode 100644 index 0000000..472cc1e --- /dev/null +++ b/vendor/php-http/message/.php-cs-fixer.dist.php @@ -0,0 +1,18 @@ +in(__DIR__.'/src') + ->in(__DIR__.'/spec') + ->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/message/CHANGELOG.md b/vendor/php-http/message/CHANGELOG.md index a185f46..096ee0c 100644 --- a/vendor/php-http/message/CHANGELOG.md +++ b/vendor/php-http/message/CHANGELOG.md @@ -1,4 +1,4 @@ -# Change Log +# Changelog All notable changes to this project will be documented in this file. @@ -6,6 +6,26 @@ 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.16.0] - 2023-05-17 + +- Remove direct dependency on `php-http/message-factory` as it is only needed for the deprecated Httplug factories. + Upgrade to PSR-17 message factories provided by your HTTP client implementation. + If you need the Httplug factories for the time being, you can `composer require php-http/message-factory` in your application. + +## [1.15.0] - 2023-05-10 + +**If you use the decorator classes, you might need to adjust your code to the parameter and return type declarations added in PSR-7** + +- Actually make compatible with PSR-7 1.1 and 2.0 +- Drop support for PHP 7.1 + +## [1.14.0] - 2023-04-14 (broken) + +**This release is not actually compatible with PSR-7 1.1 or 2.0** + +- Allow installation with http-message (PSR-7) version 2 in addition to version 1. +- Support for PHP 8.2 + ## [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. diff --git a/vendor/php-http/message/README.md b/vendor/php-http/message/README.md index df1a7d5..7699b91 100644 --- a/vendor/php-http/message/README.md +++ b/vendor/php-http/message/README.md @@ -2,7 +2,7 @@ [![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) +[![tests](https://github.com/php-http/message/actions/workflows/ci.yml/badge.svg)](https://github.com/php-http/message/actions/workflows/ci.yml) [![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.** diff --git a/vendor/php-http/message/composer.json b/vendor/php-http/message/composer.json index 1a614df..37a86a7 100644 --- a/vendor/php-http/message/composer.json +++ b/vendor/php-http/message/composer.json @@ -15,10 +15,9 @@ } ], "require": { - "php": "^7.1 || ^8.0", + "php": "^7.2 || ^8.0", "clue/stream-filter": "^1.5", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1 || ^2.0" }, "provide": { "php-http/message-factory-implementation": "1.0" @@ -26,10 +25,11 @@ "require-dev": { "ext-zlib": "*", "ergebnis/composer-normalize": "^2.6", - "guzzlehttp/psr7": "^1.0", + "guzzlehttp/psr7": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0.2", "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0", - "laminas/laminas-diactoros": "^2.0" + "laminas/laminas-diactoros": "^2.0 || ^3.0" }, "suggest": { "ext-zlib": "Used with compressor/decompressor streams", @@ -43,11 +43,6 @@ "ergebnis/composer-normalize": true } }, - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Http\\Message\\": "src/" diff --git a/vendor/php-http/message/src/Authentication/Wsse.php b/vendor/php-http/message/src/Authentication/Wsse.php index f343633..88c266b 100644 --- a/vendor/php-http/message/src/Authentication/Wsse.php +++ b/vendor/php-http/message/src/Authentication/Wsse.php @@ -3,7 +3,6 @@ namespace Http\Message\Authentication; use Http\Message\Authentication; -use InvalidArgumentException; use Psr\Http\Message\RequestInterface; /** @@ -38,7 +37,7 @@ 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)); + throw new \InvalidArgumentException(sprintf('Unaccepted hashing algorithm: %s', $hashAlgorithm)); } $this->hashAlgorithm = $hashAlgorithm; } diff --git a/vendor/php-http/message/src/Cookie.php b/vendor/php-http/message/src/Cookie.php index 0cc2d43..c6eaf51 100644 --- a/vendor/php-http/message/src/Cookie.php +++ b/vendor/php-http/message/src/Cookie.php @@ -399,8 +399,6 @@ public function withHttpOnly($httpOnly) * * This does not compare the values, only name, domain and path. * - * @param Cookie $cookie - * * @return bool */ public function match(self $cookie) diff --git a/vendor/php-http/message/src/CookieJar.php b/vendor/php-http/message/src/CookieJar.php index 914ad97..165084d 100644 --- a/vendor/php-http/message/src/CookieJar.php +++ b/vendor/php-http/message/src/CookieJar.php @@ -10,7 +10,7 @@ final class CookieJar implements \Countable, \IteratorAggregate { /** - * @var \SplObjectStorage + * @var \SplObjectStorage */ private $cookies; diff --git a/vendor/php-http/message/src/Decorator/MessageDecorator.php b/vendor/php-http/message/src/Decorator/MessageDecorator.php index 0ffc7ca..4ec4690 100644 --- a/vendor/php-http/message/src/Decorator/MessageDecorator.php +++ b/vendor/php-http/message/src/Decorator/MessageDecorator.php @@ -20,26 +20,18 @@ trait MessageDecorator * * 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() + public function getMessage(): MessageInterface { return $this->message; } - /** - * {@inheritdoc} - */ - public function getProtocolVersion() + public function getProtocolVersion(): string { return $this->message->getProtocolVersion(); } - /** - * {@inheritdoc} - */ - public function withProtocolVersion($version) + public function withProtocolVersion(string $version): MessageInterface { $new = clone $this; $new->message = $this->message->withProtocolVersion($version); @@ -47,42 +39,27 @@ public function withProtocolVersion($version) return $new; } - /** - * {@inheritdoc} - */ - public function getHeaders() + public function getHeaders(): array { return $this->message->getHeaders(); } - /** - * {@inheritdoc} - */ - public function hasHeader($header) + public function hasHeader(string $header): bool { return $this->message->hasHeader($header); } - /** - * {@inheritdoc} - */ - public function getHeader($header) + public function getHeader(string $header): array { return $this->message->getHeader($header); } - /** - * {@inheritdoc} - */ - public function getHeaderLine($header) + public function getHeaderLine(string $header): string { return $this->message->getHeaderLine($header); } - /** - * {@inheritdoc} - */ - public function withHeader($header, $value) + public function withHeader(string $header, $value): MessageInterface { $new = clone $this; $new->message = $this->message->withHeader($header, $value); @@ -90,10 +67,7 @@ public function withHeader($header, $value) return $new; } - /** - * {@inheritdoc} - */ - public function withAddedHeader($header, $value) + public function withAddedHeader(string $header, $value): MessageInterface { $new = clone $this; $new->message = $this->message->withAddedHeader($header, $value); @@ -101,10 +75,7 @@ public function withAddedHeader($header, $value) return $new; } - /** - * {@inheritdoc} - */ - public function withoutHeader($header) + public function withoutHeader(string $header): MessageInterface { $new = clone $this; $new->message = $this->message->withoutHeader($header); @@ -112,18 +83,12 @@ public function withoutHeader($header) return $new; } - /** - * {@inheritdoc} - */ - public function getBody() + public function getBody(): StreamInterface { return $this->message->getBody(); } - /** - * {@inheritdoc} - */ - public function withBody(StreamInterface $body) + public function withBody(StreamInterface $body): MessageInterface { $new = clone $this; $new->message = $this->message->withBody($body); diff --git a/vendor/php-http/message/src/Decorator/RequestDecorator.php b/vendor/php-http/message/src/Decorator/RequestDecorator.php index bd254a8..1392a76 100644 --- a/vendor/php-http/message/src/Decorator/RequestDecorator.php +++ b/vendor/php-http/message/src/Decorator/RequestDecorator.php @@ -16,10 +16,8 @@ trait RequestDecorator /** * Exchanges the underlying request with another. - * - * @return self */ - public function withRequest(RequestInterface $request) + public function withRequest(RequestInterface $request): RequestInterface { $new = clone $this; $new->message = $request; @@ -27,18 +25,12 @@ public function withRequest(RequestInterface $request) return $new; } - /** - * {@inheritdoc} - */ - public function getRequestTarget() + public function getRequestTarget(): string { return $this->message->getRequestTarget(); } - /** - * {@inheritdoc} - */ - public function withRequestTarget($requestTarget) + public function withRequestTarget(string $requestTarget): RequestInterface { $new = clone $this; $new->message = $this->message->withRequestTarget($requestTarget); @@ -46,18 +38,12 @@ public function withRequestTarget($requestTarget) return $new; } - /** - * {@inheritdoc} - */ - public function getMethod() + public function getMethod(): string { return $this->message->getMethod(); } - /** - * {@inheritdoc} - */ - public function withMethod($method) + public function withMethod(string $method): RequestInterface { $new = clone $this; $new->message = $this->message->withMethod($method); @@ -65,18 +51,12 @@ public function withMethod($method) return $new; } - /** - * {@inheritdoc} - */ - public function getUri() + public function getUri(): UriInterface { return $this->message->getUri(); } - /** - * {@inheritdoc} - */ - public function withUri(UriInterface $uri, $preserveHost = false) + public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface { $new = clone $this; $new->message = $this->message->withUri($uri, $preserveHost); diff --git a/vendor/php-http/message/src/Decorator/ResponseDecorator.php b/vendor/php-http/message/src/Decorator/ResponseDecorator.php index 20319ed..0b75438 100644 --- a/vendor/php-http/message/src/Decorator/ResponseDecorator.php +++ b/vendor/php-http/message/src/Decorator/ResponseDecorator.php @@ -15,10 +15,8 @@ trait ResponseDecorator /** * Exchanges the underlying response with another. - * - * @return self */ - public function withResponse(ResponseInterface $response) + public function withResponse(ResponseInterface $response): ResponseInterface { $new = clone $this; $new->message = $response; @@ -26,18 +24,12 @@ public function withResponse(ResponseInterface $response) return $new; } - /** - * {@inheritdoc} - */ - public function getStatusCode() + public function getStatusCode(): int { return $this->message->getStatusCode(); } - /** - * {@inheritdoc} - */ - public function withStatus($code, $reasonPhrase = '') + public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface { $new = clone $this; $new->message = $this->message->withStatus($code, $reasonPhrase); @@ -45,10 +37,7 @@ public function withStatus($code, $reasonPhrase = '') return $new; } - /** - * {@inheritdoc} - */ - public function getReasonPhrase() + public function getReasonPhrase(): string { return $this->message->getReasonPhrase(); } diff --git a/vendor/php-http/message/src/Decorator/StreamDecorator.php b/vendor/php-http/message/src/Decorator/StreamDecorator.php index f405c7a..b1f306d 100644 --- a/vendor/php-http/message/src/Decorator/StreamDecorator.php +++ b/vendor/php-http/message/src/Decorator/StreamDecorator.php @@ -16,122 +16,77 @@ trait StreamDecorator */ protected $stream; - /** - * {@inheritdoc} - */ - public function __toString() + public function __toString(): string { return $this->stream->__toString(); } - /** - * {@inheritdoc} - */ - public function close() + public function close(): void { $this->stream->close(); } - /** - * {@inheritdoc} - */ public function detach() { return $this->stream->detach(); } - /** - * {@inheritdoc} - */ - public function getSize() + public function getSize(): ?int { return $this->stream->getSize(); } - /** - * {@inheritdoc} - */ - public function tell() + public function tell(): int { return $this->stream->tell(); } - /** - * {@inheritdoc} - */ - public function eof() + public function eof(): bool { return $this->stream->eof(); } - /** - * {@inheritdoc} - */ - public function isSeekable() + public function isSeekable(): bool { return $this->stream->isSeekable(); } - /** - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) + public function seek(int $offset, int $whence = SEEK_SET): void { $this->stream->seek($offset, $whence); } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { $this->stream->rewind(); } - /** - * {@inheritdoc} - */ - public function isWritable() + public function isWritable(): bool { return $this->stream->isWritable(); } - /** - * {@inheritdoc} - */ - public function write($string) + public function write(string $string): int { return $this->stream->write($string); } - /** - * {@inheritdoc} - */ - public function isReadable() + public function isReadable(): bool { return $this->stream->isReadable(); } - /** - * {@inheritdoc} - */ - public function read($length) + public function read(int $length): string { return $this->stream->read($length); } - /** - * {@inheritdoc} - */ - public function getContents() + public function getContents(): string { return $this->stream->getContents(); } - /** - * {@inheritdoc} - */ - public function getMetadata($key = null) + public function getMetadata(string $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 index 74c2fbd..362ed78 100644 --- a/vendor/php-http/message/src/Encoding/ChunkStream.php +++ b/vendor/php-http/message/src/Encoding/ChunkStream.php @@ -9,26 +9,17 @@ */ class ChunkStream extends FilteredStream { - /** - * {@inheritdoc} - */ - protected function readFilter() + protected function readFilter(): string { return 'chunk'; } - /** - * {@inheritdoc} - */ - protected function writeFilter() + protected function writeFilter(): string { return 'dechunk'; } - /** - * {@inheritdoc} - */ - protected function fill() + protected function fill(): void { parent::fill(); diff --git a/vendor/php-http/message/src/Encoding/CompressStream.php b/vendor/php-http/message/src/Encoding/CompressStream.php index bdb740a..7e89388 100644 --- a/vendor/php-http/message/src/Encoding/CompressStream.php +++ b/vendor/php-http/message/src/Encoding/CompressStream.php @@ -27,18 +27,12 @@ public function __construct(StreamInterface $stream, $level = -1) $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15]); } - /** - * {@inheritdoc} - */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.deflate'; } - /** - * {@inheritdoc} - */ - protected function writeFilter() + protected function writeFilter(): string { return 'zlib.inflate'; } diff --git a/vendor/php-http/message/src/Encoding/DechunkStream.php b/vendor/php-http/message/src/Encoding/DechunkStream.php index 4cade83..c1fe3a6 100644 --- a/vendor/php-http/message/src/Encoding/DechunkStream.php +++ b/vendor/php-http/message/src/Encoding/DechunkStream.php @@ -11,18 +11,12 @@ */ class DechunkStream extends FilteredStream { - /** - * {@inheritdoc} - */ - protected function readFilter() + protected function readFilter(): string { return 'dechunk'; } - /** - * {@inheritdoc} - */ - protected function writeFilter() + protected function writeFilter(): string { return 'chunk'; } diff --git a/vendor/php-http/message/src/Encoding/DecompressStream.php b/vendor/php-http/message/src/Encoding/DecompressStream.php index ab3a345..aa3fdf0 100644 --- a/vendor/php-http/message/src/Encoding/DecompressStream.php +++ b/vendor/php-http/message/src/Encoding/DecompressStream.php @@ -27,18 +27,12 @@ public function __construct(StreamInterface $stream, $level = -1) $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15, 'level' => $level]); } - /** - * {@inheritdoc} - */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.inflate'; } - /** - * {@inheritdoc} - */ - protected function writeFilter() + protected function writeFilter(): string { return 'zlib.deflate'; } diff --git a/vendor/php-http/message/src/Encoding/DeflateStream.php b/vendor/php-http/message/src/Encoding/DeflateStream.php index 2ab3e00..d18dd0a 100644 --- a/vendor/php-http/message/src/Encoding/DeflateStream.php +++ b/vendor/php-http/message/src/Encoding/DeflateStream.php @@ -26,7 +26,7 @@ public function __construct(StreamInterface $stream, $level = -1) /** * {@inheritdoc} */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.deflate'; } @@ -34,7 +34,7 @@ protected function readFilter() /** * {@inheritdoc} */ - protected function writeFilter() + protected function writeFilter(): string { 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 index 538e270..7a9e18f 100644 --- a/vendor/php-http/message/src/Encoding/Filter/Chunk.php +++ b/vendor/php-http/message/src/Encoding/Filter/Chunk.php @@ -9,11 +9,7 @@ */ class Chunk extends \php_user_filter { - /** - * {@inheritdoc} - */ - #[\ReturnTypeWillChange] - public function filter($in, $out, &$consumed, $closing) + public function filter($in, $out, &$consumed, $closing): int { while ($bucket = stream_bucket_make_writeable($in)) { $lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n"); diff --git a/vendor/php-http/message/src/Encoding/FilteredStream.php b/vendor/php-http/message/src/Encoding/FilteredStream.php index a937c82..d2e0e45 100644 --- a/vendor/php-http/message/src/Encoding/FilteredStream.php +++ b/vendor/php-http/message/src/Encoding/FilteredStream.php @@ -17,7 +17,7 @@ abstract class FilteredStream implements StreamInterface rewind as private doRewind; seek as private doSeek; } - const BUFFER_SIZE = 8192; + public const BUFFER_SIZE = 8192; /** * @var callable @@ -75,10 +75,7 @@ public function __construct(StreamInterface $stream, $readFilterOptions = null, $this->stream = $stream; } - /** - * {@inheritdoc} - */ - public function read($length) + public function read(int $length): string { if (strlen($this->buffer) >= $length) { $read = substr($this->buffer, 0, $length); @@ -101,10 +98,7 @@ public function read($length) return $read.$this->read($length - strlen($read)); } - /** - * {@inheritdoc} - */ - public function eof() + public function eof(): bool { return $this->stream->eof() && '' === $this->buffer; } @@ -116,7 +110,7 @@ public function eof() * 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() + protected function fill(): void { $readFilterCallback = $this->readFilterCallback; $this->buffer .= $readFilterCallback($this->stream->read(self::BUFFER_SIZE)); @@ -129,7 +123,7 @@ protected function fill() /** * {@inheritdoc} */ - public function getContents() + public function getContents(): string { $buffer = ''; @@ -149,15 +143,12 @@ public function getContents() /** * Always returns null because we can't tell the size of a stream when we filter. */ - public function getSize() + public function getSize(): ?int { return null; } - /** - * {@inheritdoc} - */ - public function __toString() + public function __toString(): string { return $this->getContents(); } @@ -167,24 +158,24 @@ public function __toString() * * We would need to buffer and process everything to allow seeking. */ - public function isSeekable() + public function isSeekable(): bool { return false; } /** - * {@inheritdoc} + * Filtered streams are not seekable and can thus not be rewound. */ - public function rewind() + public function rewind(): void { @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} + * Filtered streams are not seekable. */ - public function seek($offset, $whence = SEEK_SET) + public function seek(int $offset, int $whence = SEEK_SET): void { @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); @@ -193,11 +184,9 @@ public function seek($offset, $whence = SEEK_SET) /** * Returns the read filter name. * - * @return string - * * @deprecated since version 1.5, will be removed in 2.0 */ - public function getReadFilter() + public function getReadFilter(): string { @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); @@ -206,19 +195,15 @@ public function getReadFilter() /** * Returns the write filter name. - * - * @return string */ - abstract protected function readFilter(); + abstract protected function readFilter(): string; /** * Returns the write filter name. * - * @return string - * * @deprecated since version 1.5, will be removed in 2.0 */ - public function getWriteFilter() + public function getWriteFilter(): string { @trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); @@ -227,8 +212,6 @@ public function getWriteFilter() /** * Returns the write filter name. - * - * @return string */ - abstract protected function writeFilter(); + abstract protected function writeFilter(): string; } diff --git a/vendor/php-http/message/src/Encoding/GzipDecodeStream.php b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php index 92b5dad..9872499 100644 --- a/vendor/php-http/message/src/Encoding/GzipDecodeStream.php +++ b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php @@ -30,7 +30,7 @@ public function __construct(StreamInterface $stream, $level = -1) /** * {@inheritdoc} */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.inflate'; } @@ -38,7 +38,7 @@ protected function readFilter() /** * {@inheritdoc} */ - protected function writeFilter() + protected function writeFilter(): string { return 'zlib.deflate'; } diff --git a/vendor/php-http/message/src/Encoding/GzipEncodeStream.php b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php index 13f097a..36018c2 100644 --- a/vendor/php-http/message/src/Encoding/GzipEncodeStream.php +++ b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php @@ -30,7 +30,7 @@ public function __construct(StreamInterface $stream, $level = -1) /** * {@inheritdoc} */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.deflate'; } @@ -38,7 +38,7 @@ protected function readFilter() /** * {@inheritdoc} */ - protected function writeFilter() + protected function writeFilter(): string { return 'zlib.inflate'; } diff --git a/vendor/php-http/message/src/Encoding/InflateStream.php b/vendor/php-http/message/src/Encoding/InflateStream.php index 06c5187..1abe88e 100644 --- a/vendor/php-http/message/src/Encoding/InflateStream.php +++ b/vendor/php-http/message/src/Encoding/InflateStream.php @@ -27,18 +27,12 @@ public function __construct(StreamInterface $stream, $level = -1) $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15, 'level' => $level]); } - /** - * {@inheritdoc} - */ - protected function readFilter() + protected function readFilter(): string { return 'zlib.inflate'; } - /** - * {@inheritdoc} - */ - protected function writeFilter() + protected function writeFilter(): string { return 'zlib.deflate'; } diff --git a/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php b/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php index 6d54d35..51d15a2 100644 --- a/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php +++ b/vendor/php-http/message/src/MessageFactory/DiactorosMessageFactory.php @@ -9,6 +9,10 @@ use Zend\Diactoros\Request as ZendRequest; use Zend\Diactoros\Response as ZendResponse; +if (!interface_exists(MessageFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Diactoros messages. * diff --git a/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php b/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php index 02989d9..65353ff 100644 --- a/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php +++ b/vendor/php-http/message/src/MessageFactory/GuzzleMessageFactory.php @@ -6,6 +6,10 @@ use GuzzleHttp\Psr7\Response; use Http\Message\MessageFactory; +if (!interface_exists(MessageFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Guzzle messages. * diff --git a/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php b/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php index bee9322..bc59ef5 100644 --- a/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php +++ b/vendor/php-http/message/src/MessageFactory/SlimMessageFactory.php @@ -9,6 +9,10 @@ use Slim\Http\Request; use Slim\Http\Response; +if (!interface_exists(MessageFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Slim 3 messages. * diff --git a/vendor/php-http/message/src/Stream/BufferedStream.php b/vendor/php-http/message/src/Stream/BufferedStream.php index 3d38731..cf23fc7 100644 --- a/vendor/php-http/message/src/Stream/BufferedStream.php +++ b/vendor/php-http/message/src/Stream/BufferedStream.php @@ -17,7 +17,7 @@ class BufferedStream implements StreamInterface /** @var resource The buffered resource used to seek previous data */ private $resource; - /** @var int size of the stream if available */ + /** @var int|null size of the stream if available */ private $size; /** @var StreamInterface The underlying stream decorated by this class */ @@ -49,10 +49,7 @@ public function __construct(StreamInterface $stream, $useFileBuffer = true, $mem } } - /** - * {@inheritdoc} - */ - public function __toString() + public function __toString(): string { try { $this->rewind(); @@ -60,15 +57,10 @@ public function __toString() 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() + public function close(): void { if (null === $this->resource) { throw new \RuntimeException('Cannot close on a detached stream'); @@ -78,13 +70,10 @@ public function close() fclose($this->resource); } - /** - * {@inheritdoc} - */ public function detach() { if (null === $this->resource) { - return; + return null; } // Force reading the remaining data of the stream @@ -98,13 +87,10 @@ public function detach() return $resource; } - /** - * {@inheritdoc} - */ - public function getSize() + public function getSize(): ?int { if (null === $this->resource) { - return; + return null; } if (null === $this->size && $this->stream->eof()) { @@ -114,22 +100,21 @@ public function getSize() return $this->size; } - /** - * {@inheritdoc} - */ - public function tell() + public function tell(): int { if (null === $this->resource) { throw new \RuntimeException('Cannot tell on a detached stream'); } - return ftell($this->resource); + $tell = ftell($this->resource); + if (false === $tell) { + throw new \RuntimeException('ftell failed'); + } + + return $tell; } - /** - * {@inheritdoc} - */ - public function eof() + public function eof(): bool { if (null === $this->resource) { throw new \RuntimeException('Cannot call eof on a detached stream'); @@ -139,18 +124,12 @@ public function eof() return $this->stream->eof() && (ftell($this->resource) === $this->written); } - /** - * {@inheritdoc} - */ - public function isSeekable() + public function isSeekable(): bool { return null !== $this->resource; } - /** - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) + public function seek(int $offset, int $whence = SEEK_SET): void { if (null === $this->resource) { throw new \RuntimeException('Cannot seek on a detached stream'); @@ -159,10 +138,7 @@ public function seek($offset, $whence = SEEK_SET) fseek($this->resource, $offset, $whence); } - /** - * {@inheritdoc} - */ - public function rewind() + public function rewind(): void { if (null === $this->resource) { throw new \RuntimeException('Cannot rewind on a detached stream'); @@ -171,34 +147,22 @@ public function rewind() rewind($this->resource); } - /** - * {@inheritdoc} - */ - public function isWritable() + public function isWritable(): bool { return false; } - /** - * {@inheritdoc} - */ - public function write($string) + public function write(string $string): int { throw new \RuntimeException('Cannot write on this stream'); } - /** - * {@inheritdoc} - */ - public function isReadable() + public function isReadable(): bool { return null !== $this->resource; } - /** - * {@inheritdoc} - */ - public function read($length) + public function read(int $length): string { if (null === $this->resource) { throw new \RuntimeException('Cannot read on a detached stream'); @@ -213,6 +177,9 @@ public function read($length) if (ftell($this->resource) !== $this->written) { $read = fread($this->resource, $length); } + if (false === $read) { + throw new \RuntimeException('Failed to read from resource'); + } $bytesRead = strlen($read); @@ -227,10 +194,7 @@ public function read($length) return $read; } - /** - * {@inheritdoc} - */ - public function getContents() + public function getContents(): string { if (null === $this->resource) { throw new \RuntimeException('Cannot read on a detached stream'); @@ -245,17 +209,14 @@ public function getContents() return $read; } - /** - * {@inheritdoc} - */ - public function getMetadata($key = null) + public function getMetadata(?string $key = null) { if (null === $this->resource) { if (null === $key) { return []; } - return; + return null; } $metadata = stream_get_meta_data($this->resource); @@ -265,7 +226,7 @@ public function getMetadata($key = null) } if (!array_key_exists($key, $metadata)) { - return; + return null; } return $metadata[$key]; diff --git a/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php b/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php index 8ae2b28..59255d4 100644 --- a/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php +++ b/vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php @@ -7,6 +7,10 @@ use Psr\Http\Message\StreamInterface; use Zend\Diactoros\Stream as ZendStream; +if (!interface_exists(StreamFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Diactoros streams. * diff --git a/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php b/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php index 14d83e9..fb23ddf 100644 --- a/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php +++ b/vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php @@ -5,6 +5,10 @@ use GuzzleHttp\Psr7\Utils; use Http\Message\StreamFactory; +if (!interface_exists(StreamFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Guzzle streams. * @@ -23,6 +27,7 @@ public function createStream($body = null) return Utils::streamFor($body); } + // legacy support for guzzle/psr7 1.* 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 index 9274aae..aee112e 100644 --- a/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php +++ b/vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php @@ -6,6 +6,10 @@ use Psr\Http\Message\StreamInterface; use Slim\Http\Stream; +if (!interface_exists(StreamFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Slim 3 streams. * diff --git a/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php b/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php index be883de..f67c7b3 100644 --- a/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php +++ b/vendor/php-http/message/src/UriFactory/DiactorosUriFactory.php @@ -7,6 +7,10 @@ use Psr\Http\Message\UriInterface; use Zend\Diactoros\Uri as ZendUri; +if (!interface_exists(UriFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Diactoros URI. * diff --git a/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php b/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php index e09ac61..7256740 100644 --- a/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php +++ b/vendor/php-http/message/src/UriFactory/GuzzleUriFactory.php @@ -2,10 +2,15 @@ namespace Http\Message\UriFactory; -use function GuzzleHttp\Psr7\uri_for; use GuzzleHttp\Psr7\Utils; use Http\Message\UriFactory; +use function GuzzleHttp\Psr7\uri_for; + +if (!interface_exists(UriFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Guzzle URI. * diff --git a/vendor/php-http/message/src/UriFactory/SlimUriFactory.php b/vendor/php-http/message/src/UriFactory/SlimUriFactory.php index e5bef03..f39d0f6 100644 --- a/vendor/php-http/message/src/UriFactory/SlimUriFactory.php +++ b/vendor/php-http/message/src/UriFactory/SlimUriFactory.php @@ -6,6 +6,10 @@ use Psr\Http\Message\UriInterface; use Slim\Http\Uri; +if (!interface_exists(UriFactory::class)) { + throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); +} + /** * Creates Slim 3 URI. * diff --git a/vendor/psr/http-client/README.md b/vendor/psr/http-client/README.md index 6876b84..84af5c5 100644 --- a/vendor/psr/http-client/README.md +++ b/vendor/psr/http-client/README.md @@ -7,6 +7,6 @@ Note that this is not a HTTP Client implementation of its own. It is merely abst The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. -[psr-url]: http://www.php-fig.org/psr/psr-18 +[psr-url]: https://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 index c195f8f..e4cab2f 100644 --- a/vendor/psr/http-client/composer.json +++ b/vendor/psr/http-client/composer.json @@ -7,12 +7,12 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "autoload": { "psr-4": { diff --git a/vendor/psr/http-factory/.gitignore b/vendor/psr/http-factory/.gitignore deleted file mode 100644 index d8a7996..0000000 --- a/vendor/psr/http-factory/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -composer.lock -vendor/ diff --git a/vendor/psr/http-factory/.pullapprove.yml b/vendor/psr/http-factory/.pullapprove.yml deleted file mode 100644 index 8cf0819..0000000 --- a/vendor/psr/http-factory/.pullapprove.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: default -reviewers: - - - name: contributors - required: 1 - teams: - - http-factory-contributors diff --git a/vendor/psr/http-factory/README.md b/vendor/psr/http-factory/README.md index 41d362a..bf8913b 100644 --- a/vendor/psr/http-factory/README.md +++ b/vendor/psr/http-factory/README.md @@ -1,10 +1,12 @@ HTTP Factories ============== -This repository holds all interfaces related to [PSR-17 (HTTP Message Factories)][psr-17]. -Please refer to the specification for a description. +This repository holds all interfaces related to [PSR-17 (HTTP Factories)][psr-url]. -You can find implementations of the specification by looking for packages providing the -[psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation) virtual package. +Note that this is not a HTTP Factory implementation of its own. It is merely interfaces that describe the components of a HTTP Factory. -[psr-17]: https://www.php-fig.org/psr/psr-17/ +The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. + +[psr-url]: https://www.php-fig.org/psr/psr-17/ +[package-url]: https://packagist.org/packages/psr/http-factory +[implementation-url]: https://packagist.org/providers/psr/http-factory-implementation diff --git a/vendor/psr/http-factory/composer.json b/vendor/psr/http-factory/composer.json index af62b29..d1bbdde 100644 --- a/vendor/psr/http-factory/composer.json +++ b/vendor/psr/http-factory/composer.json @@ -15,12 +15,12 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "autoload": { "psr-4": { diff --git a/vendor/psr/http-message/README.md b/vendor/psr/http-message/README.md index 2818533..2668be6 100644 --- a/vendor/psr/http-message/README.md +++ b/vendor/psr/http-message/README.md @@ -10,4 +10,7 @@ interface that describes a HTTP message. See the specification for more details. Usage ----- -We'll certainly need some stuff in here. \ No newline at end of file +Before reading the usage guide we recommend reading the PSR-7 interfaces method list: + +* [`PSR-7 Interfaces Method List`](docs/PSR7-Interfaces.md) +* [`PSR-7 Usage Guide`](docs/PSR7-Usage.md) \ No newline at end of file diff --git a/vendor/psr/http-message/composer.json b/vendor/psr/http-message/composer.json index b0d2937..c66e5ab 100644 --- a/vendor/psr/http-message/composer.json +++ b/vendor/psr/http-message/composer.json @@ -7,11 +7,11 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "autoload": { "psr-4": { @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } } } diff --git a/vendor/psr/http-message/docs/PSR7-Interfaces.md b/vendor/psr/http-message/docs/PSR7-Interfaces.md new file mode 100644 index 0000000..3a7e7dd --- /dev/null +++ b/vendor/psr/http-message/docs/PSR7-Interfaces.md @@ -0,0 +1,130 @@ +# Interfaces + +The purpose of this list is to help in finding the methods when working with PSR-7. This can be considered as a cheatsheet for PSR-7 interfaces. + +The interfaces defined in PSR-7 are the following: + +| Class Name | Description | +|---|---| +| [Psr\Http\Message\MessageInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagemessageinterface) | Representation of a HTTP message | +| [Psr\Http\Message\RequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagerequestinterface) | Representation of an outgoing, client-side request. | +| [Psr\Http\Message\ServerRequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageserverrequestinterface) | Representation of an incoming, server-side HTTP request. | +| [Psr\Http\Message\ResponseInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageresponseinterface) | Representation of an outgoing, server-side response. | +| [Psr\Http\Message\StreamInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagestreaminterface) | Describes a data stream | +| [Psr\Http\Message\UriInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuriinterface) | Value object representing a URI. | +| [Psr\Http\Message\UploadedFileInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuploadedfileinterface) | Value object representing a file uploaded through an HTTP request. | + +## `Psr\Http\Message\MessageInterface` Methods + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getProtocolVersion()` | Retrieve HTTP protocol version | 1.0 or 1.1 | +| `withProtocolVersion($version)` | Returns new message instance with given HTTP protocol version | | +| `getHeaders()` | Retrieve all HTTP Headers | [Request Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields), [Response Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields) | +| `hasHeader($name)` | Checks if HTTP Header with given name exists | | +| `getHeader($name)` | Retrieves a array with the values for a single header | | +| `getHeaderLine($name)` | Retrieves a comma-separated string of the values for a single header | | +| `withHeader($name, $value)` | Returns new message instance with given HTTP Header | if the header existed in the original instance, replaces the header value from the original message with the value provided when creating the new instance. | +| `withAddedHeader($name, $value)` | Returns new message instance with appended value to given header | If header already exists value will be appended, if not a new header will be created | +| `withoutHeader($name)` | Removes HTTP Header with given name| | +| `getBody()` | Retrieves the HTTP Message Body | Returns object implementing `StreamInterface`| +| `withBody(StreamInterface $body)` | Returns new message instance with given HTTP Message Body | | + + +## `Psr\Http\Message\RequestInterface` Methods + +Same methods as `Psr\Http\Message\MessageInterface` + the following methods: + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getRequestTarget()` | Retrieves the message's request target | origin-form, absolute-form, authority-form, asterisk-form ([RFC7230](https://www.rfc-editor.org/rfc/rfc7230.txt)) | +| `withRequestTarget($requestTarget)` | Return a new message instance with the specific request-target | | +| `getMethod()` | Retrieves the HTTP method of the request. | GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE (defined in [RFC7231](https://tools.ietf.org/html/rfc7231)), PATCH (defined in [RFC5789](https://tools.ietf.org/html/rfc5789)) | +| `withMethod($method)` | Returns a new message instance with the provided HTTP method | | +| `getUri()` | Retrieves the URI instance | | +| `withUri(UriInterface $uri, $preserveHost = false)` | Returns a new message instance with the provided URI | | + + +## `Psr\Http\Message\ServerRequestInterface` Methods + +Same methods as `Psr\Http\Message\RequestInterface` + the following methods: + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getServerParams() ` | Retrieve server parameters | Typically derived from `$_SERVER` | +| `getCookieParams()` | Retrieves cookies sent by the client to the server. | Typically derived from `$_COOKIES` | +| `withCookieParams(array $cookies)` | Returns a new request instance with the specified cookies | | +| `withQueryParams(array $query)` | Returns a new request instance with the specified query string arguments | | +| `getUploadedFiles()` | Retrieve normalized file upload data | | +| `withUploadedFiles(array $uploadedFiles)` | Returns a new request instance with the specified uploaded files | | +| `getParsedBody()` | Retrieve any parameters provided in the request body | | +| `withParsedBody($data)` | Returns a new request instance with the specified body parameters | | +| `getAttributes()` | Retrieve attributes derived from the request | | +| `getAttribute($name, $default = null)` | Retrieve a single derived request attribute | | +| `withAttribute($name, $value)` | Returns a new request instance with the specified derived request attribute | | +| `withoutAttribute($name)` | Returns a new request instance that without the specified derived request attribute | | + +## `Psr\Http\Message\ResponseInterface` Methods: + +Same methods as `Psr\Http\Message\MessageInterface` + the following methods: + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getStatusCode()` | Gets the response status code. | | +| `withStatus($code, $reasonPhrase = '')` | Returns a new response instance with the specified status code and, optionally, reason phrase. | | +| `getReasonPhrase()` | Gets the response reason phrase associated with the status code. | | + +## `Psr\Http\Message\StreamInterface` Methods + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `__toString()` | Reads all data from the stream into a string, from the beginning to end. | | +| `close()` | Closes the stream and any underlying resources. | | +| `detach()` | Separates any underlying resources from the stream. | | +| `getSize()` | Get the size of the stream if known. | | +| `eof()` | Returns true if the stream is at the end of the stream.| | +| `isSeekable()` | Returns whether or not the stream is seekable. | | +| `seek($offset, $whence = SEEK_SET)` | Seek to a position in the stream. | | +| `rewind()` | Seek to the beginning of the stream. | | +| `isWritable()` | Returns whether or not the stream is writable. | | +| `write($string)` | Write data to the stream. | | +| `isReadable()` | Returns whether or not the stream is readable. | | +| `read($length)` | Read data from the stream. | | +| `getContents()` | Returns the remaining contents in a string | | +| `getMetadata($key = null)()` | Get stream metadata as an associative array or retrieve a specific key. | | + +## `Psr\Http\Message\UriInterface` Methods + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getScheme()` | Retrieve the scheme component of the URI. | | +| `getAuthority()` | Retrieve the authority component of the URI. | | +| `getUserInfo()` | Retrieve the user information component of the URI. | | +| `getHost()` | Retrieve the host component of the URI. | | +| `getPort()` | Retrieve the port component of the URI. | | +| `getPath()` | Retrieve the path component of the URI. | | +| `getQuery()` | Retrieve the query string of the URI. | | +| `getFragment()` | Retrieve the fragment component of the URI. | | +| `withScheme($scheme)` | Return an instance with the specified scheme. | | +| `withUserInfo($user, $password = null)` | Return an instance with the specified user information. | | +| `withHost($host)` | Return an instance with the specified host. | | +| `withPort($port)` | Return an instance with the specified port. | | +| `withPath($path)` | Return an instance with the specified path. | | +| `withQuery($query)` | Return an instance with the specified query string. | | +| `withFragment($fragment)` | Return an instance with the specified URI fragment. | | +| `__toString()` | Return the string representation as a URI reference. | | + +## `Psr\Http\Message\UploadedFileInterface` Methods + +| Method Name | Description | Notes | +|------------------------------------| ----------- | ----- | +| `getStream()` | Retrieve a stream representing the uploaded file. | | +| `moveTo($targetPath)` | Move the uploaded file to a new location. | | +| `getSize()` | Retrieve the file size. | | +| `getError()` | Retrieve the error associated with the uploaded file. | | +| `getClientFilename()` | Retrieve the filename sent by the client. | | +| `getClientMediaType()` | Retrieve the media type sent by the client. | | + +> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + diff --git a/vendor/psr/http-message/docs/PSR7-Usage.md b/vendor/psr/http-message/docs/PSR7-Usage.md new file mode 100644 index 0000000..b6d048a --- /dev/null +++ b/vendor/psr/http-message/docs/PSR7-Usage.md @@ -0,0 +1,159 @@ +### PSR-7 Usage + +All PSR-7 applications comply with these interfaces +They were created to establish a standard between middleware implementations. + +> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + + +The following examples will illustrate how basic operations are done in PSR-7. + +##### Examples + + +For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc) +All PSR-7 implementations should have the same behaviour. + +The following will be assumed: +`$request` is an object of `Psr\Http\Message\RequestInterface` and + +`$response` is an object implementing `Psr\Http\Message\RequestInterface` + + +### Working with HTTP Headers + +#### Adding headers to response: + +```php +$response->withHeader('My-Custom-Header', 'My Custom Message'); +``` + +#### Appending values to headers + +```php +$response->withAddedHeader('My-Custom-Header', 'The second message'); +``` + +#### Checking if header exists: + +```php +$request->hasHeader('My-Custom-Header'); // will return false +$response->hasHeader('My-Custom-Header'); // will return true +``` + +> Note: My-Custom-Header was only added in the Response + +#### Getting comma-separated values from a header (also applies to request) + +```php +// getting value from request headers +$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8" +// getting value from response headers +$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message" +``` + +#### Getting array of value from a header (also applies to request) +```php +// getting value from request headers +$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"] +// getting value from response headers +$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"] +``` + +#### Removing headers from HTTP Messages +```php +// removing a header from Request, removing deprecated "Content-MD5" header +$request->withoutHeader('Content-MD5'); + +// removing a header from Response +// effect: the browser won't know the size of the stream +// the browser will download the stream till it ends +$response->withoutHeader('Content-Length'); +``` + +### Working with HTTP Message Body + +When working with the PSR-7 there are two methods of implementation: +#### 1. Getting the body separately + +> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented. + +```php +$body = $response->getBody(); +// operations on body, eg. read, write, seek +// ... +// replacing the old body +$response->withBody($body); +// this last statement is optional as we working with objects +// in this case the "new" body is same with the "old" one +// the $body variable has the same value as the one in $request, only the reference is passed +``` + +#### 2. Working directly on response + +> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required + +```php +$response->getBody()->write('hello'); +``` + +### Getting the body contents + +The following snippet gets the contents of a stream contents. +> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream. +```php +$body = $response->getBody(); +$body->rewind(); // or $body->seek(0); +$bodyText = $body->getContents(); +``` +> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended. + +### Append to body + +```php +$response->getBody()->write('Hello'); // writing directly +$body = $request->getBody(); // which is a `StreamInterface` +$body->write('xxxxx'); +``` + +### Prepend to body +Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended. +The following example will explain the behaviour of streams. + +```php +// assuming our response is initially empty +$body = $repsonse->getBody(); +// writing the string "abcd" +$body->write('abcd'); + +// seeking to start of stream +$body->seek(0); +// writing 'ef' +$body->write('ef'); // at this point the stream contains "efcd" +``` + +#### Prepending by rewriting separately + +```php +// assuming our response body stream only contains: "abcd" +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // abcd +// seeking the stream to beginning +$body->rewind(); +$body->write('ef'); // stream contains "efcd" +$body->write($contents); // stream contains "efabcd" +``` + +> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`. + +#### Prepending by using contents as a string +```php +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // efabcd +$contents = 'ef'.$contents; +$body->rewind(); +$body->write($contents); +``` diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php index dd46e5e..a83c985 100644 --- a/vendor/psr/http-message/src/MessageInterface.php +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -23,7 +23,7 @@ interface MessageInterface * * @return string HTTP protocol version. */ - public function getProtocolVersion(); + public function getProtocolVersion(): string; /** * Return an instance with the specified HTTP protocol version. @@ -38,7 +38,7 @@ public function getProtocolVersion(); * @param string $version HTTP protocol version * @return static */ - public function withProtocolVersion($version); + public function withProtocolVersion(string $version): MessageInterface; /** * Retrieves all message header values. @@ -65,7 +65,7 @@ public function withProtocolVersion($version); * key MUST be a header name, and each value MUST be an array of strings * for that header. */ - public function getHeaders(); + public function getHeaders(): array; /** * Checks if a header exists by the given case-insensitive name. @@ -75,7 +75,7 @@ public function getHeaders(); * name using a case-insensitive string comparison. Returns false if * no matching header name is found in the message. */ - public function hasHeader($name); + public function hasHeader(string $name): bool; /** * Retrieves a message header value by the given case-insensitive name. @@ -91,7 +91,7 @@ public function hasHeader($name); * header. If the header does not appear in the message, this method MUST * return an empty array. */ - public function getHeader($name); + public function getHeader(string $name): array; /** * Retrieves a comma-separated string of the values for a single header. @@ -112,7 +112,7 @@ public function getHeader($name); * 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); + public function getHeaderLine(string $name): string; /** * Return an instance with the provided value replacing the specified header. @@ -129,7 +129,7 @@ public function getHeaderLine($name); * @return static * @throws \InvalidArgumentException for invalid header names or values. */ - public function withHeader($name, $value); + public function withHeader(string $name, $value): MessageInterface; /** * Return an instance with the specified header appended with the given value. @@ -147,7 +147,7 @@ public function withHeader($name, $value); * @return static * @throws \InvalidArgumentException for invalid header names or values. */ - public function withAddedHeader($name, $value); + public function withAddedHeader(string $name, $value): MessageInterface; /** * Return an instance without the specified header. @@ -161,14 +161,14 @@ public function withAddedHeader($name, $value); * @param string $name Case-insensitive header field name to remove. * @return static */ - public function withoutHeader($name); + public function withoutHeader(string $name): MessageInterface; /** * Gets the body of the message. * * @return StreamInterface Returns the body as a stream. */ - public function getBody(); + public function getBody(): StreamInterface; /** * Return an instance with the specified message body. @@ -183,5 +183,5 @@ public function getBody(); * @return static * @throws \InvalidArgumentException When the body is not valid. */ - public function withBody(StreamInterface $body); + public function withBody(StreamInterface $body): MessageInterface; } diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php index a96d4fd..33f85e5 100644 --- a/vendor/psr/http-message/src/RequestInterface.php +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -39,7 +39,7 @@ interface RequestInterface extends MessageInterface * * @return string */ - public function getRequestTarget(); + public function getRequestTarget(): string; /** * Return an instance with the specific request-target. @@ -55,17 +55,18 @@ public function getRequestTarget(); * * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various * request-target forms allowed in request messages) - * @param mixed $requestTarget + * @param string $requestTarget * @return static */ - public function withRequestTarget($requestTarget); + public function withRequestTarget(string $requestTarget): RequestInterface; + /** * Retrieves the HTTP method of the request. * * @return string Returns the request method. */ - public function getMethod(); + public function getMethod(): string; /** * Return an instance with the provided HTTP method. @@ -82,7 +83,7 @@ public function getMethod(); * @return static * @throws \InvalidArgumentException for invalid HTTP methods. */ - public function withMethod($method); + public function withMethod(string $method): RequestInterface; /** * Retrieves the URI instance. @@ -93,7 +94,7 @@ public function withMethod($method); * @return UriInterface Returns a UriInterface instance * representing the URI of the request. */ - public function getUri(); + public function getUri(): UriInterface; /** * Returns an instance with the provided URI. @@ -125,5 +126,5 @@ public function getUri(); * @param bool $preserveHost Preserve the original state of the Host header. * @return static */ - public function withUri(UriInterface $uri, $preserveHost = false); + public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface; } diff --git a/vendor/psr/http-message/src/ResponseInterface.php b/vendor/psr/http-message/src/ResponseInterface.php index c306514..e9299a9 100644 --- a/vendor/psr/http-message/src/ResponseInterface.php +++ b/vendor/psr/http-message/src/ResponseInterface.php @@ -27,7 +27,7 @@ interface ResponseInterface extends MessageInterface * * @return int Status code. */ - public function getStatusCode(); + public function getStatusCode(): int; /** * Return an instance with the specified status code and, optionally, reason phrase. @@ -49,7 +49,7 @@ public function getStatusCode(); * @return static * @throws \InvalidArgumentException For invalid status code arguments. */ - public function withStatus($code, $reasonPhrase = ''); + public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface; /** * Gets the response reason phrase associated with the status code. @@ -64,5 +64,5 @@ public function withStatus($code, $reasonPhrase = ''); * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml * @return string Reason phrase; must return an empty string if none present. */ - public function getReasonPhrase(); + public function getReasonPhrase(): string; } diff --git a/vendor/psr/http-message/src/ServerRequestInterface.php b/vendor/psr/http-message/src/ServerRequestInterface.php index 0251234..8625d0e 100644 --- a/vendor/psr/http-message/src/ServerRequestInterface.php +++ b/vendor/psr/http-message/src/ServerRequestInterface.php @@ -51,7 +51,7 @@ interface ServerRequestInterface extends RequestInterface * * @return array */ - public function getServerParams(); + public function getServerParams(): array; /** * Retrieve cookies. @@ -63,7 +63,7 @@ public function getServerParams(); * * @return array */ - public function getCookieParams(); + public function getCookieParams(): array; /** * Return an instance with the specified cookies. @@ -82,7 +82,7 @@ public function getCookieParams(); * @param array $cookies Array of key/value pairs representing cookies. * @return static */ - public function withCookieParams(array $cookies); + public function withCookieParams(array $cookies): ServerRequestInterface; /** * Retrieve query string arguments. @@ -96,7 +96,7 @@ public function withCookieParams(array $cookies); * * @return array */ - public function getQueryParams(); + public function getQueryParams(): array; /** * Return an instance with the specified query string arguments. @@ -120,7 +120,7 @@ public function getQueryParams(); * $_GET. * @return static */ - public function withQueryParams(array $query); + public function withQueryParams(array $query): ServerRequestInterface; /** * Retrieve normalized file upload data. @@ -134,7 +134,7 @@ public function withQueryParams(array $query); * @return array An array tree of UploadedFileInterface instances; an empty * array MUST be returned if no data is present. */ - public function getUploadedFiles(); + public function getUploadedFiles(): array; /** * Create a new instance with the specified uploaded files. @@ -147,7 +147,7 @@ public function getUploadedFiles(); * @return static * @throws \InvalidArgumentException if an invalid structure is provided. */ - public function withUploadedFiles(array $uploadedFiles); + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface; /** * Retrieve any parameters provided in the request body. @@ -194,7 +194,7 @@ public function getParsedBody(); * @throws \InvalidArgumentException if an unsupported argument type is * provided. */ - public function withParsedBody($data); + public function withParsedBody($data): ServerRequestInterface; /** * Retrieve attributes derived from the request. @@ -207,7 +207,7 @@ public function withParsedBody($data); * * @return array Attributes derived from the request. */ - public function getAttributes(); + public function getAttributes(): array; /** * Retrieve a single derived request attribute. @@ -224,7 +224,7 @@ public function getAttributes(); * @param mixed $default Default value to return if the attribute does not exist. * @return mixed */ - public function getAttribute($name, $default = null); + public function getAttribute(string $name, $default = null); /** * Return an instance with the specified derived request attribute. @@ -241,7 +241,7 @@ public function getAttribute($name, $default = null); * @param mixed $value The value of the attribute. * @return static */ - public function withAttribute($name, $value); + public function withAttribute(string $name, $value): ServerRequestInterface; /** * Return an instance that removes the specified derived request attribute. @@ -257,5 +257,5 @@ public function withAttribute($name, $value); * @param string $name The attribute name. * @return static */ - public function withoutAttribute($name); + public function withoutAttribute(string $name): ServerRequestInterface; } diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php index f68f391..a62aabb 100644 --- a/vendor/psr/http-message/src/StreamInterface.php +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -25,14 +25,14 @@ interface StreamInterface * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring * @return string */ - public function __toString(); + public function __toString(): string; /** * Closes the stream and any underlying resources. * * @return void */ - public function close(); + public function close(): void; /** * Separates any underlying resources from the stream. @@ -48,7 +48,7 @@ public function detach(); * * @return int|null Returns the size in bytes if known, or null if unknown. */ - public function getSize(); + public function getSize(): ?int; /** * Returns the current position of the file read/write pointer @@ -56,21 +56,21 @@ public function getSize(); * @return int Position of the file pointer * @throws \RuntimeException on error. */ - public function tell(); + public function tell(): int; /** * Returns true if the stream is at the end of the stream. * * @return bool */ - public function eof(); + public function eof(): bool; /** * Returns whether or not the stream is seekable. * * @return bool */ - public function isSeekable(); + public function isSeekable(): bool; /** * Seek to a position in the stream. @@ -84,7 +84,7 @@ public function isSeekable(); * SEEK_END: Set position to end-of-stream plus offset. * @throws \RuntimeException on failure. */ - public function seek($offset, $whence = SEEK_SET); + public function seek(int $offset, int $whence = SEEK_SET): void; /** * Seek to the beginning of the stream. @@ -96,14 +96,14 @@ public function seek($offset, $whence = SEEK_SET); * @link http://www.php.net/manual/en/function.fseek.php * @throws \RuntimeException on failure. */ - public function rewind(); + public function rewind(): void; /** * Returns whether or not the stream is writable. * * @return bool */ - public function isWritable(); + public function isWritable(): bool; /** * Write data to the stream. @@ -112,14 +112,14 @@ public function isWritable(); * @return int Returns the number of bytes written to the stream. * @throws \RuntimeException on failure. */ - public function write($string); + public function write(string $string): int; /** * Returns whether or not the stream is readable. * * @return bool */ - public function isReadable(); + public function isReadable(): bool; /** * Read data from the stream. @@ -131,7 +131,7 @@ public function isReadable(); * if no bytes are available. * @throws \RuntimeException if an error occurs. */ - public function read($length); + public function read(int $length): string; /** * Returns the remaining contents in a string @@ -140,7 +140,7 @@ public function read($length); * @throws \RuntimeException if unable to read or an error occurs while * reading. */ - public function getContents(); + public function getContents(): string; /** * Get stream metadata as an associative array or retrieve a specific key. @@ -149,10 +149,10 @@ public function getContents(); * stream_get_meta_data() function. * * @link http://php.net/manual/en/function.stream-get-meta-data.php - * @param string $key Specific metadata to retrieve. + * @param string|null $key Specific metadata to retrieve. * @return array|mixed|null Returns an associative array if no key is * provided. Returns a specific key value if a key is provided and the * value is found, or null if the key is not found. */ - public function getMetadata($key = null); + public function getMetadata(?string $key = null); } diff --git a/vendor/psr/http-message/src/UploadedFileInterface.php b/vendor/psr/http-message/src/UploadedFileInterface.php index f8a6901..dd19d65 100644 --- a/vendor/psr/http-message/src/UploadedFileInterface.php +++ b/vendor/psr/http-message/src/UploadedFileInterface.php @@ -28,7 +28,7 @@ interface UploadedFileInterface * @throws \RuntimeException in cases when no stream is available or can be * created. */ - public function getStream(); + public function getStream(): StreamInterface; /** * Move the uploaded file to a new location. @@ -62,7 +62,7 @@ public function getStream(); * @throws \RuntimeException on any error during the move operation, or on * the second or subsequent call to the method. */ - public function moveTo($targetPath); + public function moveTo(string $targetPath): void; /** * Retrieve the file size. @@ -73,7 +73,7 @@ public function moveTo($targetPath); * * @return int|null The file size in bytes or null if unknown. */ - public function getSize(); + public function getSize(): ?int; /** * Retrieve the error associated with the uploaded file. @@ -89,7 +89,7 @@ public function getSize(); * @see http://php.net/manual/en/features.file-upload.errors.php * @return int One of PHP's UPLOAD_ERR_XXX constants. */ - public function getError(); + public function getError(): int; /** * Retrieve the filename sent by the client. @@ -104,7 +104,7 @@ public function getError(); * @return string|null The filename sent by the client or null if none * was provided. */ - public function getClientFilename(); + public function getClientFilename(): ?string; /** * Retrieve the media type sent by the client. @@ -119,5 +119,5 @@ public function getClientFilename(); * @return string|null The media type sent by the client or null if none * was provided. */ - public function getClientMediaType(); + public function getClientMediaType(): ?string; } diff --git a/vendor/psr/http-message/src/UriInterface.php b/vendor/psr/http-message/src/UriInterface.php index 9d7ab9e..15e2cf2 100644 --- a/vendor/psr/http-message/src/UriInterface.php +++ b/vendor/psr/http-message/src/UriInterface.php @@ -1,4 +1,5 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + #[Attribute(Attribute::TARGET_CLASS)] final class Attribute { diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php b/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php index 72f1081..bd1212f 100644 --- a/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +++ b/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php @@ -1,6 +1,15 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) { class PhpToken extends Symfony\Polyfill\Php80\PhpToken { } diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php b/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php index 77e037c..7c62d75 100644 --- a/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +++ b/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { interface Stringable { diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php b/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php index 37937cb..01c6c6c 100644 --- a/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +++ b/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class UnhandledMatchError extends Error { diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php b/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php index a3a9b88..783dbc2 100644 --- a/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +++ b/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class ValueError extends Error { diff --git a/vendor/symfony/polyfill-php80/composer.json b/vendor/symfony/polyfill-php80/composer.json index cd3e9b6..bd9a326 100644 --- a/vendor/symfony/polyfill-php80/composer.json +++ b/vendor/symfony/polyfill-php80/composer.json @@ -30,7 +30,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", From a973bcfedf76bb396516fa4d33958fae7ba89afd Mon Sep 17 00:00:00 2001 From: Alastair Mucklow Date: Tue, 20 Jun 2023 11:16:50 +0000 Subject: [PATCH 2/2] Merged PR 45869: 6.0.3 pre-release Update versions Related work items: #215166 --- composer.json | 2 +- dm_signup_form.php | 2 +- readme.txt | 9 +++++++-- vendor/composer/installed.php | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 38780c7..a679d82 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "dotdigital/dotdigital-signup-form", - "version": "6.0.2", + "version": "6.0.3", "authors": [ { "name": "dotdigital" diff --git a/dm_signup_form.php b/dm_signup_form.php index 8f99f6d..ad98f51 100644 --- a/dm_signup_form.php +++ b/dm_signup_form.php @@ -3,7 +3,7 @@ Plugin Name: Dotdigital Signup Form Plugin URI: https://integrations.dotdigital.com/technology-partners/wordpress Description: Add a "Subscribe to Newsletter" widget to your WordPress powered website that will insert your contact in one of your Dotdigital address books. - Version: 6.0.2 + Version: 6.0.3 Author: dotdigital Author URI: https://www.dotdigital.com/ */ diff --git a/readme.txt b/readme.txt index a3e67dd..d8ed8b9 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: dotMailer, bsstaveley, amucklow, fstrezos Tags: email marketing, newsletter signup Requires at least: 5.3 -Tested up to: 6.1.1 +Tested up to: 6.2.2 Requires PHP: 7.4 -Stable tag: 6.0.2 +Stable tag: 6.0.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -92,6 +92,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA == Changelog == += 6.0.3 = + +**Bug fixes** +- We repaired HTML input types for data fields displayed in the signup widget. + = 6.0.2 = **Bug fixes** diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 912e9fc..61c1dcc 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'dotdigital/dotdigital-signup-form', - 'pretty_version' => '6.0.2', - 'version' => '6.0.2.0', + 'pretty_version' => '6.0.3', + 'version' => '6.0.3.0', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../',