diff --git a/composer.json b/composer.json index 9ec0dbe..b050eec 100644 --- a/composer.json +++ b/composer.json @@ -13,13 +13,13 @@ "email": "thanh1101dev@gmail.com" } ], - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true, "require": { "php-http/httplug": "^2.4", "php-http/client-common": "^2.7", "nette/utils": "^4.0", - "league/object-mapper": "dev-main" + "eventsauce/object-hydrator": "^1.4" }, "require-dev": { "php-http/curl-client": "^2.3", diff --git a/composer.lock b/composer.lock index 5849e26..93e7c7a 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": "aea4d0667f4344934e73e1531cdcdf2e", + "content-hash": "2b789cc2795ed92a0bf7fdf763add988", "packages": [ { "name": "clue/stream-filter", @@ -73,39 +73,38 @@ "time": "2023-12-20T15:40:13+00:00" }, { - "name": "league/object-mapper", - "version": "dev-main", + "name": "eventsauce/object-hydrator", + "version": "1.4.0", "source": { "type": "git", - "url": "https://github.com/thephpleague/object-mapper.git", - "reference": "9cbcd21f3ce81aa2d614f65347f6abc901941ea7" + "url": "https://github.com/EventSaucePHP/ObjectHydrator.git", + "reference": "743ee4524d1a3d7b381ef9f61afcb18e0cc81cb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/object-mapper/zipball/9cbcd21f3ce81aa2d614f65347f6abc901941ea7", - "reference": "9cbcd21f3ce81aa2d614f65347f6abc901941ea7", + "url": "https://api.github.com/repos/EventSaucePHP/ObjectHydrator/zipball/743ee4524d1a3d7b381ef9f61afcb18e0cc81cb0", + "reference": "743ee4524d1a3d7b381ef9f61afcb18e0cc81cb0", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^8.1" + "php": "^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.4", "league/construct-finder": "^1.1", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.7", - "phpunit/phpunit": "^10.0.0", + "phpunit/phpunit": "^9.5.11", "ramsey/uuid": "^4.2" }, "suggest": { "league/construct-finder": "Find all classes in a directory for the best dumped hydrators." }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { - "League\\ObjectMapper\\": "src/" + "EventSauce\\ObjectHydrator\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -126,8 +125,8 @@ "mapper" ], "support": { - "issues": "https://github.com/thephpleague/object-mapper/issues", - "source": "https://github.com/thephpleague/object-mapper/tree/main" + "issues": "https://github.com/EventSaucePHP/ObjectHydrator/issues", + "source": "https://github.com/EventSaucePHP/ObjectHydrator/tree/1.4.0" }, "funding": [ { @@ -135,7 +134,7 @@ "type": "github" } ], - "time": "2023-12-16T09:26:10+00:00" + "time": "2023-08-03T07:27:58+00:00" }, { "name": "nette/utils", @@ -1128,10 +1127,8 @@ } ], "aliases": [], - "minimum-stability": "dev", - "stability-flags": { - "league/object-mapper": 20 - }, + "minimum-stability": "stable", + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": [], diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 58880a3..bfc9b8c 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -2,11 +2,11 @@ namespace IPay\Api; +use EventSauce\ObjectHydrator\DefinitionProvider; +use EventSauce\ObjectHydrator\KeyFormatterWithoutConversion; +use EventSauce\ObjectHydrator\ObjectMapper; +use EventSauce\ObjectHydrator\ObjectMapperUsingReflection; use IPay\IPayClient; -use League\ObjectMapper\KeyFormatterWithoutConversion; -use League\ObjectMapper\ObjectMapper; -use League\ObjectMapper\ObjectMapperUsingReflection; -use League\ObjectMapper\ReflectionDefinitionProvider; use Nette\Utils\Json; /** @@ -24,7 +24,7 @@ public function __construct( private SessionInterface $session, ) { $this->objectMapper = new ObjectMapperUsingReflection( - new ReflectionDefinitionProvider( + new DefinitionProvider( keyFormatter: new KeyFormatterWithoutConversion(), ), ); diff --git a/src/Api/AuthenticatedApi.php b/src/Api/AuthenticatedApi.php index be40589..675b872 100644 --- a/src/Api/AuthenticatedApi.php +++ b/src/Api/AuthenticatedApi.php @@ -32,6 +32,7 @@ public function accounts(): array /** * @param 'Credit'|'Debit'|'' $tranType + * * @return \Traversable */ public function historyTransactions( @@ -42,9 +43,7 @@ public function historyTransactions( int $pageNumber = 0, int $maxResult = 999999999, ): \Traversable { - $parameters = get_defined_vars(); - - foreach ($parameters as &$value) { + foreach ($parameters = get_defined_vars() as &$value) { if ($value instanceof \DateTimeInterface) { $value = $value->format('Y-m-d'); } diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index 124f688..0ce9c53 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -2,7 +2,7 @@ namespace IPay\Entity; -use League\ObjectMapper\MapFrom; +use EventSauce\ObjectHydrator\MapFrom; #[MapFrom([ 'fullname' => 'name', diff --git a/src/Entity/Transaction.php b/src/Entity/Transaction.php index f078d09..abe97cc 100644 --- a/src/Entity/Transaction.php +++ b/src/Entity/Transaction.php @@ -2,7 +2,7 @@ namespace IPay\Entity; -use League\ObjectMapper\PropertyCasters\CastToType; +use EventSauce\ObjectHydrator\PropertyCasters\CastToType; readonly class Transaction {