From b84c10b9fc52f66e3a45911ad525ecb9e93991e6 Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Mon, 13 Sep 2021 10:20:41 +0300 Subject: [PATCH 1/8] Implement API endpoint to fetch account statistics related to charges --- .../Profile/ProfileStatisticsController.php | 63 +++++++++++++++ app/src/Repository/ChargeRepository.php | 20 +++++ app/src/Repository/WalletRepository.php | 17 ++++ .../Service/Statistics/ProfileStatistics.php | 79 +++++++++++++++++++ composer.json | 14 ++++ 5 files changed, 193 insertions(+) create mode 100644 app/src/Controller/Profile/ProfileStatisticsController.php create mode 100644 app/src/Service/Statistics/ProfileStatistics.php diff --git a/app/src/Controller/Profile/ProfileStatisticsController.php b/app/src/Controller/Profile/ProfileStatisticsController.php new file mode 100644 index 0000000..0c350f1 --- /dev/null +++ b/app/src/Controller/Profile/ProfileStatisticsController.php @@ -0,0 +1,63 @@ +getActor(); + + if (! $user instanceof User) { + throw new \RuntimeException('Unable to get authenticated user'); + } + + $this->user = $user; + } + + /** + * @Route(route="/profile/statistics/charges-flow", name="profile.statistics.charges-flow", methods="GET", group="auth") + * + * @param \App\Service\Statistics\ProfileStatistics $statistics + * @return \Psr\Http\Message\ResponseInterface + */ + public function chargesFlow(ProfileStatistics $statistics): ResponseInterface + { + $currency = $this->currencies->findByPK($this->user->defaultCurrencyCode ?? Currency::DEFAULT_CURRENCY_CODE); + + if (! $currency instanceof Currency) { + return $this->response->json([ + 'message' => 'Unable to find currency.', + ], 400); + } + + $data = $statistics->getChargeFlow($this->user, $currency); + $data['currency'] = $this->currencyView->map($currency); + + return $this->response->json([ + 'data' => $data, + ]); + } +} diff --git a/app/src/Repository/ChargeRepository.php b/app/src/Repository/ChargeRepository.php index e674ca8..c9d09a8 100644 --- a/app/src/Repository/ChargeRepository.php +++ b/app/src/Repository/ChargeRepository.php @@ -5,6 +5,7 @@ namespace App\Repository; use Cycle\ORM\Select\Repository; +use Spiral\Database\Injection\Parameter; class ChargeRepository extends Repository { @@ -51,4 +52,23 @@ public function totalByWalletPK(int $walletId, string $type = null): float return (float) $query->sum('amount'); } + + /** + * @param string $type + * @param array $walletIDs + * @param \DateTimeImmutable|null $dateFrom + * @return float + */ + public function sumTotalByTypeByCurrencyFromDate(string $type, array $walletIDs, \DateTimeImmutable $dateFrom = null): float + { + $query = $this->select() + ->where('type', $type) + ->where('wallet_id', 'in', new Parameter($walletIDs)); + + if ($dateFrom !== null) { + $query = $query->where('created_at', '>=', $dateFrom); + } + + return (float) $query->sum('amount'); + } } diff --git a/app/src/Repository/WalletRepository.php b/app/src/Repository/WalletRepository.php index 16bcb5b..b7fdc7c 100644 --- a/app/src/Repository/WalletRepository.php +++ b/app/src/Repository/WalletRepository.php @@ -4,6 +4,7 @@ namespace App\Repository; +use App\Database\Currency; use Cycle\ORM\Select; use Cycle\ORM\Select\Repository; @@ -34,6 +35,22 @@ public function findAllByUserPKByArchived(int $userID, bool $isArchived = false) return $wallets; } + /** + * @param int $userID + * @param string $currencyCode + * @return \App\Database\Wallet[] + */ + public function findAllByUserPKByCurrencyCode(int $userID, string $currencyCode = Currency::DEFAULT_CURRENCY_CODE): array + { + /** @var \App\Database\Wallet[] $wallets */ + $wallets = $this->select() + ->where('users.id', $userID) + ->where('default_currency_code', $currencyCode) + ->fetchAll(); + + return $wallets; + } + /** * @param int $userID * @return \Cycle\ORM\Select diff --git a/app/src/Service/Statistics/ProfileStatistics.php b/app/src/Service/Statistics/ProfileStatistics.php new file mode 100644 index 0000000..c253c1c --- /dev/null +++ b/app/src/Service/Statistics/ProfileStatistics.php @@ -0,0 +1,79 @@ +walletRepository = $walletRepository; + $this->chargeRepository = $chargeRepository; + } + + /** + * @param \App\Database\User $user + * @param \App\Database\Currency $currency + * @return array + */ + public function getChargeFlow(User $user, Currency $currency): array + { + $walletIDs = array_map(function (Wallet $wallet) { + return $wallet->id; + }, $this->walletRepository->findAllByUserPKByCurrencyCode($user->id, $currency->code)); + + $data = [ + Charge::TYPE_INCOME => [ + 'type' => Charge::TYPE_INCOME, + ], + Charge::TYPE_EXPENSE => [ + 'type' => Charge::TYPE_EXPENSE, + ], + ]; + + $metrics = [ + 'total' => null, + 'lastYear' => (new \DateTimeImmutable())->sub(new \DateInterval('P1Y')), + 'lastQuarter' => (new \DateTimeImmutable())->sub(new \DateInterval('P3M')), + 'lastMonth' => (new \DateTimeImmutable())->sub(new \DateInterval('P1M')), + ]; + + foreach ($metrics as $metricName => $dateFrom) { + foreach ($data as $type => &$value) { + $value[$metricName] = $this->chargeRepository->sumTotalByTypeByCurrencyFromDate($type, $walletIDs, $dateFrom); + } + } + + return $data; + } +} diff --git a/composer.json b/composer.json index e57d5e4..b151219 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,20 @@ "php app.php encrypt:key -m .env", "php app.php configure -vv", "spiral get-binary" + ], + "checks": [ + "./vendor/bin/phpunit", + "./vendor/bin/phpcs -p -n --standard=PSR12 --colors --report=code ./app/src", + "./vendor/bin/psalm --php-version=8.0 --show-info=true" + ], + "phpunit": [ + "./vendor/bin/phpunit" + ], + "phpcs": [ + "./vendor/bin/phpcs -p -n --standard=PSR12 --colors --report=code ./app/src" + ], + "psalm": [ + "./vendor/bin/psalm --php-version=8.0 --show-info=true" ] }, "autoload": { From 5d1da849add115faa007aba604a4df7900af2e97 Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Tue, 14 Sep 2021 16:39:34 +0300 Subject: [PATCH 2/8] Add security checks for composer packages --- .github/workflows/pull.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index e37d878..9922207 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -39,7 +39,7 @@ jobs: id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies + - name: Prepare cache for composer uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} @@ -48,6 +48,16 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- + - name: Prepare cache for vulnerability database + uses: actions/cache@v2 + id: vulnerability-db-cache + with: + path: ~/.vulnerability-db/cache + key: vulnerability-db + + - name: Scan packages for vulnerability + uses: symfonycorp/security-checker-action@v2 + - name: Setup application run: | cp .env.actions .env From 45caf96bb6d6e04001ea9d03dfeb9848f08cd871 Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Wed, 15 Sep 2021 00:16:38 +0300 Subject: [PATCH 3/8] Implement API endpoint to fetch profile counters --- .../Profile/ProfileStatisticsController.php | 13 +++++++++++++ app/src/Repository/ChargeRepository.php | 16 ++++++++++++++++ app/src/Repository/WalletRepository.php | 18 ++++++++++++++++++ .../Service/Statistics/ProfileStatistics.php | 14 ++++++++++++++ 4 files changed, 61 insertions(+) diff --git a/app/src/Controller/Profile/ProfileStatisticsController.php b/app/src/Controller/Profile/ProfileStatisticsController.php index 0c350f1..5f9c089 100644 --- a/app/src/Controller/Profile/ProfileStatisticsController.php +++ b/app/src/Controller/Profile/ProfileStatisticsController.php @@ -60,4 +60,17 @@ public function chargesFlow(ProfileStatistics $statistics): ResponseInterface 'data' => $data, ]); } + + /** + * @Route(route="/profile/statistics/counters", name="profile.statistics.counters", methods="GET", group="auth") + * + * @param \App\Service\Statistics\ProfileStatistics $statistics + * @return \Psr\Http\Message\ResponseInterface + */ + public function counters(ProfileStatistics $statistics): ResponseInterface + { + return $this->response->json([ + 'data' => $statistics->getCounters($this->user), + ]); + } } diff --git a/app/src/Repository/ChargeRepository.php b/app/src/Repository/ChargeRepository.php index c9d09a8..0b085c4 100644 --- a/app/src/Repository/ChargeRepository.php +++ b/app/src/Repository/ChargeRepository.php @@ -71,4 +71,20 @@ public function sumTotalByTypeByCurrencyFromDate(string $type, array $walletIDs, return (float) $query->sum('amount'); } + + /** + * @param int $userID + * @param string|null $type + * @return int + */ + public function countAllByUserPKByType(int $userID, string $type = null): int + { + $query = $this->select()->where('user_id', $userID); + + if ($type !== null) { + $query = $query->where('type', $type); + } + + return $query->count(); + } } diff --git a/app/src/Repository/WalletRepository.php b/app/src/Repository/WalletRepository.php index b7fdc7c..c1d8019 100644 --- a/app/src/Repository/WalletRepository.php +++ b/app/src/Repository/WalletRepository.php @@ -51,6 +51,24 @@ public function findAllByUserPKByCurrencyCode(int $userID, string $currencyCode return $wallets; } + /** + * @param int $userID + * @return int + */ + public function countAllByUserPK(int $userID): int + { + return $this->allByUserPK($userID)->count(); + } + + /** + * @param int $userID + * @return int + */ + public function countArchivedByUserPK(int $userID): int + { + return $this->allByUserPK($userID)->where('is_archived', true)->count(); + } + /** * @param int $userID * @return \Cycle\ORM\Select diff --git a/app/src/Service/Statistics/ProfileStatistics.php b/app/src/Service/Statistics/ProfileStatistics.php index c253c1c..e1c496b 100644 --- a/app/src/Service/Statistics/ProfileStatistics.php +++ b/app/src/Service/Statistics/ProfileStatistics.php @@ -76,4 +76,18 @@ public function getChargeFlow(User $user, Currency $currency): array return $data; } + + /** + * @param \App\Database\User $user + * @return array + */ + public function getCounters(User $user): array + { + return [ + 'wallets' => $this->walletRepository->countAllByUserPK($user->id), + 'walletsArchived' => $this->walletRepository->countArchivedByUserPK($user->id), + 'charges' => $this->chargeRepository->countAllByUserPKByType($user->id), + 'chargesIncome' => $this->chargeRepository->countAllByUserPKByType($user->id, Charge::TYPE_INCOME), + ]; + } } From 9050c0bb9fabac06905528128134b877b8fe94c5 Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Sat, 2 Oct 2021 14:44:20 +0300 Subject: [PATCH 4/8] Upgrade PHP version to elimitante MySQLND bug --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 346c75d..7fbd567 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.0.9-cli +FROM php:8.0.11-cli RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ From 1e55c9a8cc54075722c3faf6cd94753f89cb2554 Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Sun, 3 Oct 2021 19:58:56 +0300 Subject: [PATCH 5/8] Update packages. Fix empty ID for new charges --- app/src/Database/Charge.php | 4 +- composer.lock | 511 ++++++++++++++++-------------------- 2 files changed, 230 insertions(+), 285 deletions(-) diff --git a/app/src/Database/Charge.php b/app/src/Database/Charge.php index 601149a..135597a 100644 --- a/app/src/Database/Charge.php +++ b/app/src/Database/Charge.php @@ -16,9 +16,9 @@ class Charge /** * @Cycle\Column(type = "string(36)", primary = true) - * @var string + * @var string|null */ - public $id = ''; + public $id; /** * @Cycle\Column(type = "int", name = "wallet_id") diff --git a/composer.lock b/composer.lock index c429877..db3259f 100644 --- a/composer.lock +++ b/composer.lock @@ -58,20 +58,20 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.192.0", + "version": "3.196.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "3f3026ecd3ef534701499ce98c8e3393604fca8b" + "reference": "2845899d05c66a00d88eabbf7cf5d3dbae2da58a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3f3026ecd3ef534701499ce98c8e3393604fca8b", - "reference": "3f3026ecd3ef534701499ce98c8e3393604fca8b", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2845899d05c66a00d88eabbf7cf5d3dbae2da58a", + "reference": "2845899d05c66a00d88eabbf7cf5d3dbae2da58a", "shasum": "" }, "require": { - "aws/aws-crt-php": "^1.0.1", + "aws/aws-crt-php": "^1.0.2", "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.192.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.196.1" }, - "time": "2021-09-03T18:13:44+00:00" + "time": "2021-10-01T18:23:06+00:00" }, { "name": "brick/math", @@ -326,16 +326,16 @@ }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.3", + "version": "1.11.99.4", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "fff576ac850c045158a250e7e27666e146e78d18" + "reference": "b174585d1fe49ceed21928a945138948cb394600" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/fff576ac850c045158a250e7e27666e146e78d18", - "reference": "fff576ac850c045158a250e7e27666e146e78d18", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", + "reference": "b174585d1fe49ceed21928a945138948cb394600", "shasum": "" }, "require": { @@ -379,7 +379,7 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.3" + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" }, "funding": [ { @@ -395,20 +395,20 @@ "type": "tidelift" } ], - "time": "2021-08-17T13:49:14+00:00" + "time": "2021-09-13T08:41:34+00:00" }, { "name": "cycle/annotated", - "version": "v2.3.1", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/cycle/annotated.git", - "reference": "6fa9f1dc86433ac0bcbbde939812e12b0e92b51d" + "reference": "fc7e5e18ad7c36ee7790e90f3a03005e85386f25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/annotated/zipball/6fa9f1dc86433ac0bcbbde939812e12b0e92b51d", - "reference": "6fa9f1dc86433ac0bcbbde939812e12b0e92b51d", + "url": "https://api.github.com/repos/cycle/annotated/zipball/fc7e5e18ad7c36ee7790e90f3a03005e85386f25", + "reference": "fc7e5e18ad7c36ee7790e90f3a03005e85386f25", "shasum": "" }, "require": { @@ -437,9 +437,9 @@ "description": "Cycle ORM Annotated Entities generator", "support": { "issues": "https://github.com/cycle/annotated/issues", - "source": "https://github.com/cycle/annotated/tree/v2.3.1" + "source": "https://github.com/cycle/annotated/tree/v2.4.0" }, - "time": "2021-04-08T18:08:49+00:00" + "time": "2021-09-17T15:15:02+00:00" }, { "name": "cycle/migrations", @@ -486,16 +486,16 @@ }, { "name": "cycle/orm", - "version": "v1.5.1", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/cycle/orm.git", - "reference": "abba32e347fdbc32478d150f51920247d5b42352" + "reference": "c90fcf341391403fcd51bde9fc5e165c257ac385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/orm/zipball/abba32e347fdbc32478d150f51920247d5b42352", - "reference": "abba32e347fdbc32478d150f51920247d5b42352", + "url": "https://api.github.com/repos/cycle/orm/zipball/c90fcf341391403fcd51bde9fc5e165c257ac385", + "reference": "c90fcf341391403fcd51bde9fc5e165c257ac385", "shasum": "" }, "require": { @@ -511,7 +511,7 @@ "mockery/mockery": "^1.1", "phpunit/phpunit": "~8.0", "ramsey/uuid": "^3.8", - "spiral/code-style": "^1.0", + "spiral/code-style": "^1.0.6", "spiral/dumper": "^2.7", "spiral/tokenizer": "^2.7" }, @@ -528,9 +528,9 @@ "description": "PHP DataMapper ORM and Data Modelling Engine", "support": { "issues": "https://github.com/cycle/orm/issues", - "source": "https://github.com/cycle/orm/tree/v1.5.1" + "source": "https://github.com/cycle/orm/tree/v1.6.0" }, - "time": "2021-08-06T11:13:06+00:00" + "time": "2021-09-03T17:55:23+00:00" }, { "name": "cycle/proxy-factory", @@ -1317,23 +1317,23 @@ }, { "name": "google/cloud-core", - "version": "v1.42.2", + "version": "v1.43.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "f3fff3ca4af92c87eb824e5c98aaf003523204a2" + "reference": "2cbd6d2d975611cd420df428344049fe3a20dbde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/f3fff3ca4af92c87eb824e5c98aaf003523204a2", - "reference": "f3fff3ca4af92c87eb824e5c98aaf003523204a2", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/2cbd6d2d975611cd420df428344049fe3a20dbde", + "reference": "2cbd6d2d975611cd420df428344049fe3a20dbde", "shasum": "" }, "require": { - "google/auth": "^1.12", + "google/auth": "^1.18", "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", "guzzlehttp/promises": "^1.3", - "guzzlehttp/psr7": "^1.2", + "guzzlehttp/psr7": "^1.7|^2.0", "monolog/monolog": "^1.1|^2.0", "php": ">=5.5", "psr/http-message": "1.0.*", @@ -1342,7 +1342,7 @@ "require-dev": { "erusev/parsedown": "^1.6", "google/common-protos": "^1.0", - "google/gax": "^1.1", + "google/gax": "^1.9", "opis/closure": "^3", "phpdocumentor/reflection": "^3.0", "phpunit/phpunit": "^4.8|^5.0", @@ -1375,26 +1375,26 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.42.2" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.43.0" }, - "time": "2021-06-30T16:21:40+00:00" + "time": "2021-09-15T00:52:58+00:00" }, { "name": "google/cloud-storage", - "version": "v1.24.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "440e195a11dbb9a6a98818dc78ba09857fbf7ebd" + "reference": "22dd587e5136248e31c8ce047c331acbe74ffbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/440e195a11dbb9a6a98818dc78ba09857fbf7ebd", - "reference": "440e195a11dbb9a6a98818dc78ba09857fbf7ebd", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/22dd587e5136248e31c8ce047c331acbe74ffbb7", + "reference": "22dd587e5136248e31c8ce047c331acbe74ffbb7", "shasum": "" }, "require": { - "google/cloud-core": "^1.39", + "google/cloud-core": "^1.43", "google/crc32": "^0.1.0" }, "require-dev": { @@ -1429,9 +1429,9 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.24.1" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.25.0" }, - "time": "2021-07-05T20:37:04+00:00" + "time": "2021-09-15T00:52:58+00:00" }, { "name": "google/crc32", @@ -1854,16 +1854,16 @@ }, { "name": "kreait/firebase-tokens", - "version": "1.16.0", + "version": "1.16.1", "source": { "type": "git", "url": "https://github.com/kreait/firebase-tokens-php.git", - "reference": "563394ba948aee2e0c387a381f88c4aaeaa52138" + "reference": "595ad06cb5f75c188d8fbfdefc9078c3ec8aa5e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kreait/firebase-tokens-php/zipball/563394ba948aee2e0c387a381f88c4aaeaa52138", - "reference": "563394ba948aee2e0c387a381f88c4aaeaa52138", + "url": "https://api.github.com/repos/kreait/firebase-tokens-php/zipball/595ad06cb5f75c188d8fbfdefc9078c3ec8aa5e8", + "reference": "595ad06cb5f75c188d8fbfdefc9078c3ec8aa5e8", "shasum": "" }, "require": { @@ -1872,7 +1872,7 @@ "fig/http-message-util": "^1.1.5", "guzzlehttp/guzzle": "^6.3.1|^7.0", "kreait/clock": "^1.1.0", - "lcobucci/jwt": "^3.4.1|^4.0", + "lcobucci/jwt": "^3.4.6|^4.0.4|^4.1.5", "php": "^7.4|^8.0", "psr/cache": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0.1" @@ -1923,7 +1923,7 @@ ], "support": { "issues": "https://github.com/kreait/firebase-tokens-php/issues", - "source": "https://github.com/kreait/firebase-tokens-php/tree/1.16.0" + "source": "https://github.com/kreait/firebase-tokens-php/tree/1.16.1" }, "funding": [ { @@ -1931,38 +1931,35 @@ "type": "github" } ], - "time": "2021-07-15T21:59:51+00:00" + "time": "2021-10-03T00:41:06+00:00" }, { "name": "laminas/laminas-diactoros", - "version": "2.6.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "7d2034110ae18afe05050b796a3ee4b3fe177876" + "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/7d2034110ae18afe05050b796a3ee4b3fe177876", - "reference": "7d2034110ae18afe05050b796a3ee4b3fe177876", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/0c26ef1d95b6d7e6e3943a243ba3dc0797227199", + "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0", + "php": "^7.3 || ~8.0.0 || ~8.1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0" }, "conflict": { - "phpspec/prophecy": "<1.9.0" + "phpspec/prophecy": "<1.9.0", + "zendframework/zend-diactoros": "*" }, "provide": { "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, - "replace": { - "zendframework/zend-diactoros": "^2.2.1" - }, "require-dev": { "ext-curl": "*", "ext-dom": "*", @@ -2033,30 +2030,29 @@ "type": "community_bridge" } ], - "time": "2021-05-18T14:41:54+00:00" + "time": "2021-09-22T03:54:36+00:00" }, { "name": "laminas/laminas-hydrator", - "version": "4.2.2", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-hydrator.git", - "reference": "ed5d9cacc551a37b552cb44e1bbf315512612248" + "reference": "cc5ea6b42d318dbac872d94e8dca2d3013a37ab5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-hydrator/zipball/ed5d9cacc551a37b552cb44e1bbf315512612248", - "reference": "ed5d9cacc551a37b552cb44e1bbf315512612248", + "url": "https://api.github.com/repos/laminas/laminas-hydrator/zipball/cc5ea6b42d318dbac872d94e8dca2d3013a37ab5", + "reference": "cc5ea6b42d318dbac872d94e8dca2d3013a37ab5", "shasum": "" }, "require": { "laminas/laminas-stdlib": "^3.3", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0", + "php": "^7.3 || ~8.0.0 || ~8.1.0", "webmozart/assert": "^1.10" }, - "replace": { - "zendframework/zend-hydrator": "^3.0.2" + "conflict": { + "zendframework/zend-hydrator": "*" }, "require-dev": { "laminas/laminas-coding-standard": "~2.3.0", @@ -2064,8 +2060,10 @@ "laminas/laminas-modulemanager": "^2.8", "laminas/laminas-serializer": "^2.9", "laminas/laminas-servicemanager": "^3.3.2", - "phpunit/phpunit": "~9.3.0", + "phpbench/phpbench": "^1.0", + "phpunit/phpunit": "~9.5.5", "psalm/plugin-phpunit": "^0.16.1", + "psr/cache": "1.0.1", "vimeo/psalm": "^4.8.1" }, "suggest": { @@ -2109,7 +2107,7 @@ "type": "community_bridge" } ], - "time": "2021-08-02T15:28:57+00:00" + "time": "2021-09-09T09:55:00+00:00" }, { "name": "laminas/laminas-stdlib", @@ -2170,68 +2168,6 @@ ], "time": "2021-09-02T16:11:32+00:00" }, - { - "name": "laminas/laminas-zendframework-bridge", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "shasum": "" - }, - "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.6" - }, - "type": "library", - "extra": { - "laminas": { - "module": "Laminas\\ZendFrameworkBridge" - } - }, - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Laminas\\ZendFrameworkBridge\\": "src//" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Alias legacy ZF class names to Laminas Project equivalents.", - "keywords": [ - "ZendFramework", - "autoloading", - "laminas", - "zf" - ], - "support": { - "forum": "https://discourse.laminas.dev/", - "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", - "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", - "source": "https://github.com/laminas/laminas-zendframework-bridge" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2021-09-03T17:53:30+00:00" - }, { "name": "lcobucci/clock", "version": "2.0.0", @@ -2295,16 +2231,16 @@ }, { "name": "lcobucci/jwt", - "version": "4.1.4", + "version": "4.1.5", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "71cf170102c8371ccd933fa4df6252086d144de6" + "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/71cf170102c8371ccd933fa4df6252086d144de6", - "reference": "71cf170102c8371ccd933fa4df6252086d144de6", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/fe2d89f2eaa7087af4aa166c6f480ef04e000582", + "reference": "fe2d89f2eaa7087af4aa166c6f480ef04e000582", "shasum": "" }, "require": { @@ -2320,7 +2256,7 @@ "infection/infection": "^0.21", "lcobucci/coding-standard": "^6.0", "mikey179/vfsstream": "^1.6.7", - "phpbench/phpbench": "^1.0@alpha", + "phpbench/phpbench": "^1.0", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-deprecation-rules": "^0.12", @@ -2353,7 +2289,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/4.1.4" + "source": "https://github.com/lcobucci/jwt/tree/4.1.5" }, "funding": [ { @@ -2365,20 +2301,20 @@ "type": "patreon" } ], - "time": "2021-03-23T23:53:08+00:00" + "time": "2021-09-28T19:34:56+00:00" }, { "name": "league/flysystem", - "version": "2.2.3", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "811bdc2d52a07eafbb6cb68a7b368b0668b362c8" + "reference": "499313f8b65f9a4dae1c779cd974d59a6fcf0f15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/811bdc2d52a07eafbb6cb68a7b368b0668b362c8", - "reference": "811bdc2d52a07eafbb6cb68a7b368b0668b362c8", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/499313f8b65f9a4dae1c779cd974d59a6fcf0f15", + "reference": "499313f8b65f9a4dae1c779cd974d59a6fcf0f15", "shasum": "" }, "require": { @@ -2434,7 +2370,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/2.2.3" + "source": "https://github.com/thephpleague/flysystem/tree/2.3.0" }, "funding": [ { @@ -2450,20 +2386,20 @@ "type": "tidelift" } ], - "time": "2021-08-18T19:59:31+00:00" + "time": "2021-09-22T06:09:19+00:00" }, { "name": "league/mime-type-detection", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" + "reference": "b38b25d7b372e9fddb00335400467b223349fd7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b38b25d7b372e9fddb00335400467b223349fd7e", + "reference": "b38b25d7b372e9fddb00335400467b223349fd7e", "shasum": "" }, "require": { @@ -2494,7 +2430,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.8.0" }, "funding": [ { @@ -2506,28 +2442,28 @@ "type": "tidelift" } ], - "time": "2021-01-18T20:58:21+00:00" + "time": "2021-09-25T08:23:19+00:00" }, { "name": "monolog/monolog", - "version": "2.3.2", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "71312564759a7db5b789296369c1a264efc43aad" + "reference": "fd4380d6fc37626e2f799f29d91195040137eba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad", - "reference": "71312564759a7db5b789296369c1a264efc43aad", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9", + "reference": "fd4380d6fc37626e2f799f29d91195040137eba9", "shasum": "" }, "require": { "php": ">=7.2", - "psr/log": "^1.0.1" + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", @@ -2535,14 +2471,14 @@ "elasticsearch/elasticsearch": "^7", "graylog2/gelf-php": "^1.4.2", "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4", + "php-amqplib/php-amqplib": "~2.4 || ^3", "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.6.1", "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", - "ruflin/elastica": ">=0.90 <7.0.1", + "ruflin/elastica": ">=0.90@dev", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { @@ -2550,8 +2486,11 @@ "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", "ext-mbstring": "Allow to work properly with unicode symbols", "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", @@ -2590,7 +2529,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.2" + "source": "https://github.com/Seldaek/monolog/tree/2.3.5" }, "funding": [ { @@ -2602,7 +2541,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T07:42:52+00:00" + "time": "2021-10-01T21:08:31+00:00" }, { "name": "mtdowling/jmespath.php", @@ -2725,16 +2664,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.12.0", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + "reference": "50953a2691a922aa1769461637869a0a2faa3f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", + "reference": "50953a2691a922aa1769461637869a0a2faa3f53", "shasum": "" }, "require": { @@ -2775,9 +2714,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" }, - "time": "2021-07-21T10:44:31+00:00" + "time": "2021-09-20T12:20:58+00:00" }, { "name": "nyholm/psr7", @@ -3031,20 +2970,20 @@ }, { "name": "psr/cache", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -3064,7 +3003,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -3074,9 +3013,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:23:37+00:00" }, { "name": "psr/container", @@ -3676,24 +3615,25 @@ }, { "name": "ramsey/uuid", - "version": "4.2.1", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae" + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fe665a03df4f056aa65af552a96e1976df8c8dae", - "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", "shasum": "" }, "require": { "brick/math": "^0.8 || ^0.9", "ext-json": "*", - "php": "^7.2 || ^8", + "php": "^7.2 || ^8.0", "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8" + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php80": "^1.14" }, "replace": { "rhumsaa/uuid": "self.version" @@ -3757,7 +3697,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.2.1" + "source": "https://github.com/ramsey/uuid/tree/4.2.3" }, "funding": [ { @@ -3769,7 +3709,7 @@ "type": "tidelift" } ], - "time": "2021-08-11T01:06:55+00:00" + "time": "2021-09-25T23:10:38+00:00" }, { "name": "riverline/multipart-parser", @@ -3925,16 +3865,16 @@ }, { "name": "spiral/database", - "version": "v2.8.4", + "version": "v2.9.1", "source": { "type": "git", "url": "https://github.com/spiral/database.git", - "reference": "3a881628a241f250cc7cea7801926b89ee6e43d4" + "reference": "497c892b02e5f19d8036b3d34550f825448a8bba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spiral/database/zipball/3a881628a241f250cc7cea7801926b89ee6e43d4", - "reference": "3a881628a241f250cc7cea7801926b89ee6e43d4", + "url": "https://api.github.com/repos/spiral/database/zipball/497c892b02e5f19d8036b3d34550f825448a8bba", + "reference": "497c892b02e5f19d8036b3d34550f825448a8bba", "shasum": "" }, "require": { @@ -3970,22 +3910,22 @@ "description": "DBAL, schema introspection, migration and pagination", "support": { "issues": "https://github.com/spiral/database/issues", - "source": "https://github.com/spiral/database/tree/v2.8.4" + "source": "https://github.com/spiral/database/tree/v2.9.1" }, - "time": "2021-04-02T10:07:04+00:00" + "time": "2021-09-15T18:29:49+00:00" }, { "name": "spiral/framework", - "version": "v2.8.11", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/spiral/framework.git", - "reference": "04b59e422d9cb7c59b15e6e42ae69a2900a07146" + "reference": "f66f812ac7f9da78a5458c8c294f0f77d405addc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spiral/framework/zipball/04b59e422d9cb7c59b15e6e42ae69a2900a07146", - "reference": "04b59e422d9cb7c59b15e6e42ae69a2900a07146", + "url": "https://api.github.com/repos/spiral/framework/zipball/f66f812ac7f9da78a5458c8c294f0f77d405addc", + "reference": "f66f812ac7f9da78a5458c8c294f0f77d405addc", "shasum": "" }, "require": { @@ -4085,7 +4025,7 @@ "spiral/code-style": "^1.0", "spiral/database": "^2.7.3", "spiral/jobs": "^2.2", - "spiral/migrations": "^2.1", + "spiral/migrations": "^2.3", "spiral/php-grpc": "^1.4", "spiral/roadrunner": "^1.9.2", "symfony/var-dumper": "^5.2", @@ -4188,7 +4128,7 @@ "issues": "https://github.com/spiral/framework/issues", "source": "https://github.com/spiral/framework" }, - "time": "2021-08-24T15:40:32+00:00" + "time": "2021-09-27T15:34:02+00:00" }, { "name": "spiral/goridge", @@ -4241,16 +4181,16 @@ }, { "name": "spiral/jobs", - "version": "v2.2.1", + "version": "v2.2.2", "source": { "type": "git", "url": "https://github.com/spiral/jobs.git", - "reference": "db1a2edb82ed919686717fc0b9cf30495ecf79a7" + "reference": "f2d237f454e936aa9efe010b54e305f1c0a75033" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spiral/jobs/zipball/db1a2edb82ed919686717fc0b9cf30495ecf79a7", - "reference": "db1a2edb82ed919686717fc0b9cf30495ecf79a7", + "url": "https://api.github.com/repos/spiral/jobs/zipball/f2d237f454e936aa9efe010b54e305f1c0a75033", + "reference": "f2d237f454e936aa9efe010b54e305f1c0a75033", "shasum": "" }, "require": { @@ -4283,41 +4223,47 @@ "description": "Spiral: Jobs Jobs and Queue", "support": { "issues": "https://github.com/spiral/jobs/issues", - "source": "https://github.com/spiral/jobs/tree/v2.2.1" + "source": "https://github.com/spiral/jobs/tree/v2.2.2" }, - "time": "2020-12-21T10:56:43+00:00" + "time": "2021-09-15T18:09:24+00:00" }, { "name": "spiral/migrations", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/spiral/migrations.git", - "reference": "10a192cdfffccaee6ed6064dcd5ca9d2283bb874" + "reference": "4d8355afd250caa794a6cb7da667637d0578b3ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spiral/migrations/zipball/10a192cdfffccaee6ed6064dcd5ca9d2283bb874", - "reference": "10a192cdfffccaee6ed6064dcd5ca9d2283bb874", + "url": "https://api.github.com/repos/spiral/migrations/zipball/4d8355afd250caa794a6cb7da667637d0578b3ec", + "reference": "4d8355afd250caa794a6cb7da667637d0578b3ec", "shasum": "" }, "require": { "php": ">=7.2", - "spiral/core": "^2.7", - "spiral/database": "^2.7", - "spiral/files": "^2.7", - "spiral/reactor": "^2.7", - "spiral/tokenizer": "^2.7" + "spiral/core": "^2.8", + "spiral/database": "^2.9", + "spiral/files": "^2.8", + "spiral/reactor": "^2.8", + "spiral/tokenizer": "^2.8" }, "require-dev": { - "mockery/mockery": "^1.1", - "phpunit/phpunit": "~8.0", - "spiral/code-style": "^1.0" + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^8.5|^9.0", + "spiral/code-style": "^1.0", + "vimeo/psalm": "^4.9" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, "autoload": { "psr-4": { - "Spiral\\Migrations\\": "src/" + "Spiral\\Migrations\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -4333,9 +4279,9 @@ "description": "Database migrations, migration scaffolding", "support": { "issues": "https://github.com/spiral/migrations/issues", - "source": "https://github.com/spiral/migrations/tree/v2.2.0" + "source": "https://github.com/spiral/migrations/tree/v2.3.0" }, - "time": "2020-12-23T19:15:52+00:00" + "time": "2021-09-20T16:07:08+00:00" }, { "name": "spiral/nyholm-bridge", @@ -4912,7 +4858,7 @@ }, { "name": "symfony/mailer", - "version": "v5.3.4", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", @@ -4967,7 +4913,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v5.3.4" + "source": "https://github.com/symfony/mailer/tree/v5.3.9" }, "funding": [ { @@ -4987,16 +4933,16 @@ }, { "name": "symfony/mime", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8" + "reference": "a756033d0a7e53db389618653ae991eba5a19a11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/ae887cb3b044658676129f5e97aeb7e9eb69c2d8", - "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8", + "url": "https://api.github.com/repos/symfony/mime/zipball/a756033d0a7e53db389618653ae991eba5a19a11", + "reference": "a756033d0a7e53db389618653ae991eba5a19a11", "shasum": "" }, "require": { @@ -5050,7 +4996,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.3.7" + "source": "https://github.com/symfony/mime/tree/v5.3.8" }, "funding": [ { @@ -5066,7 +5012,7 @@ "type": "tidelift" } ], - "time": "2021-08-20T11:40:01+00:00" + "time": "2021-09-10T12:30:38+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5639,16 +5585,16 @@ }, { "name": "symfony/translation", - "version": "v5.3.7", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6" + "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", - "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", + "url": "https://api.github.com/repos/symfony/translation/zipball/6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", + "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", "shasum": "" }, "require": { @@ -5714,7 +5660,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.3.7" + "source": "https://github.com/symfony/translation/tree/v5.3.9" }, "funding": [ { @@ -5812,16 +5758,16 @@ }, { "name": "vlucas/phpdotenv", - "version": "v3.6.8", + "version": "v3.6.9", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "5e679f7616db829358341e2d5cccbd18773bdab8" + "reference": "a1bf4c9853d90ade427b4efe35355fc41b3d6988" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5e679f7616db829358341e2d5cccbd18773bdab8", - "reference": "5e679f7616db829358341e2d5cccbd18773bdab8", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a1bf4c9853d90ade427b4efe35355fc41b3d6988", + "reference": "a1bf4c9853d90ade427b4efe35355fc41b3d6988", "shasum": "" }, "require": { @@ -5832,7 +5778,7 @@ "require-dev": { "ext-filter": "*", "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" }, "suggest": { "ext-filter": "Required to use the boolean validator.", @@ -5856,13 +5802,11 @@ "authors": [ { "name": "Graham Campbell", - "email": "graham@alt-three.com", - "homepage": "https://gjcampbell.co.uk/" + "email": "hello@gjcampbell.co.uk" }, { "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://vancelucas.com/" + "email": "vance@vancelucas.com" } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", @@ -5873,7 +5817,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.8" + "source": "https://github.com/vlucas/phpdotenv/tree/v3.6.9" }, "funding": [ { @@ -5885,7 +5829,7 @@ "type": "tidelift" } ], - "time": "2021-01-20T14:39:46+00:00" + "time": "2021-10-02T19:07:56+00:00" }, { "name": "voku/portable-ascii", @@ -6176,16 +6120,16 @@ "packages-dev": [ { "name": "amphp/amp", - "version": "v2.6.0", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc" + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/caa95edeb1ca1bf7532e9118ede4a3c3126408cc", - "reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc", + "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", "shasum": "" }, "require": { @@ -6253,7 +6197,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.0" + "source": "https://github.com/amphp/amp/tree/v2.6.1" }, "funding": [ { @@ -6261,7 +6205,7 @@ "type": "github" } ], - "time": "2021-07-16T20:06:06+00:00" + "time": "2021-09-23T18:43:08+00:00" }, { "name": "amphp/byte-stream", @@ -6949,16 +6893,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -6966,7 +6910,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -6992,39 +6937,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -7059,29 +7004,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.12.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -7130,7 +7075,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" }, "funding": [ { @@ -7138,7 +7083,7 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2021-09-17T05:39:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -7383,16 +7328,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.9", + "version": "9.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", "shasum": "" }, "require": { @@ -7408,7 +7353,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.7", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -7470,7 +7415,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" }, "funding": [ { @@ -7482,7 +7427,7 @@ "type": "github" } ], - "time": "2021-08-31T06:47:40+00:00" + "time": "2021-09-25T07:38:51+00:00" }, { "name": "sebastian/cli-parser", @@ -8337,7 +8282,6 @@ "type": "github" } ], - "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -8557,16 +8501,16 @@ }, { "name": "vimeo/psalm", - "version": "4.9.3", + "version": "4.10.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "4c262932602b9bbab5020863d1eb22d49de0dbf4" + "reference": "916b098b008f6de4543892b1e0651c1c3b92cbfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/4c262932602b9bbab5020863d1eb22d49de0dbf4", - "reference": "4c262932602b9bbab5020863d1eb22d49de0dbf4", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/916b098b008f6de4543892b1e0651c1c3b92cbfa", + "reference": "916b098b008f6de4543892b1e0651c1c3b92cbfa", "shasum": "" }, "require": { @@ -8576,6 +8520,7 @@ "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^1.1 || ^2.0", "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -8655,9 +8600,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.9.3" + "source": "https://github.com/vimeo/psalm/tree/4.10.0" }, - "time": "2021-08-14T16:19:38+00:00" + "time": "2021-09-04T21:00:09+00:00" }, { "name": "webmozart/path-util", From ef26fdbc581d4cad380b5bbb2b108c2883d31f2f Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Sun, 3 Oct 2021 21:21:52 +0300 Subject: [PATCH 6/8] Implement API method to fetch latest wallets with latest charges --- app/src/Controller/AuthAwareController.php | 30 +++++++ .../Profile/ProfileStatisticsController.php | 82 +++++++++++-------- app/src/Database/Wallet.php | 6 ++ app/src/Repository/ChargeRepository.php | 18 ++++ app/src/Repository/WalletRepository.php | 13 +++ app/src/View/WalletView.php | 46 ++++++++++- composer.json | 2 +- composer.lock | 4 +- tests/Traits/InteractsWithHttp.php | 2 +- 9 files changed, 160 insertions(+), 43 deletions(-) create mode 100644 app/src/Controller/AuthAwareController.php diff --git a/app/src/Controller/AuthAwareController.php b/app/src/Controller/AuthAwareController.php new file mode 100644 index 0000000..9278c2f --- /dev/null +++ b/app/src/Controller/AuthAwareController.php @@ -0,0 +1,30 @@ +getActor(); + + if (! $user instanceof User) { + throw new \RuntimeException('Unable to get authenticated user'); + } + + $this->user = $user; + } +} diff --git a/app/src/Controller/Profile/ProfileStatisticsController.php b/app/src/Controller/Profile/ProfileStatisticsController.php index 5f9c089..dd4ddeb 100644 --- a/app/src/Controller/Profile/ProfileStatisticsController.php +++ b/app/src/Controller/Profile/ProfileStatisticsController.php @@ -4,59 +4,48 @@ namespace App\Controller\Profile; +use App\Controller\AuthAwareController; use App\Database\Currency; -use App\Database\User; +use App\Repository\ChargeRepository; +use App\Repository\CurrencyRepository; +use App\Repository\WalletRepository; use App\Service\Statistics\ProfileStatistics; +use App\View\CurrencyView; +use App\View\WalletsView; +use Doctrine\Common\Collections\ArrayCollection; use Psr\Http\Message\ResponseInterface; -use Spiral\Auth\AuthScope; -use Spiral\Prototype\Traits\PrototypeTrait; +use Spiral\Http\ResponseWrapper; use Spiral\Router\Annotation\Route; -class ProfileStatisticsController +class ProfileStatisticsController extends AuthAwareController { - use PrototypeTrait; - - /** - * @var \App\Database\User - */ - protected $user; - - /** - * ProfileStatisticsController constructor. - * - * @param \Spiral\Auth\AuthScope $auth - */ - public function __construct(AuthScope $auth) - { - $user = $auth->getActor(); - - if (! $user instanceof User) { - throw new \RuntimeException('Unable to get authenticated user'); - } - - $this->user = $user; - } - /** * @Route(route="/profile/statistics/charges-flow", name="profile.statistics.charges-flow", methods="GET", group="auth") * + * @param \Spiral\Http\ResponseWrapper $response + * @param \App\Repository\CurrencyRepository $currencyRepository + * @param \App\View\CurrencyView $currencyView * @param \App\Service\Statistics\ProfileStatistics $statistics * @return \Psr\Http\Message\ResponseInterface */ - public function chargesFlow(ProfileStatistics $statistics): ResponseInterface - { - $currency = $this->currencies->findByPK($this->user->defaultCurrencyCode ?? Currency::DEFAULT_CURRENCY_CODE); + public function chargesFlow( + ResponseWrapper $response, + CurrencyRepository $currencyRepository, + CurrencyView $currencyView, + ProfileStatistics $statistics, + ): ResponseInterface { + $currency = $currencyRepository->findByPK($this->user->defaultCurrencyCode ?? Currency::DEFAULT_CURRENCY_CODE); if (! $currency instanceof Currency) { - return $this->response->json([ + return $response->json([ 'message' => 'Unable to find currency.', ], 400); } $data = $statistics->getChargeFlow($this->user, $currency); - $data['currency'] = $this->currencyView->map($currency); + $data['currency'] = $currencyView->map($currency); - return $this->response->json([ + return $response->json([ 'data' => $data, ]); } @@ -64,13 +53,36 @@ public function chargesFlow(ProfileStatistics $statistics): ResponseInterface /** * @Route(route="/profile/statistics/counters", name="profile.statistics.counters", methods="GET", group="auth") * + * @param \Spiral\Http\ResponseWrapper $response * @param \App\Service\Statistics\ProfileStatistics $statistics * @return \Psr\Http\Message\ResponseInterface */ - public function counters(ProfileStatistics $statistics): ResponseInterface + public function counters(ResponseWrapper $response, ProfileStatistics $statistics): ResponseInterface { - return $this->response->json([ + return $response->json([ 'data' => $statistics->getCounters($this->user), ]); } + + /** + * @Route(route="/profile/wallets/latest", name="profile.wallets.latest", methods="GET", group="auth") + * + * @param \App\Repository\WalletRepository $walletRepository + * @param \App\Repository\ChargeRepository $chargeRepository + * @param \App\View\WalletsView $view + * @return \Psr\Http\Message\ResponseInterface + */ + public function walletsLatest( + WalletRepository $walletRepository, + ChargeRepository $chargeRepository, + WalletsView $view + ): ResponseInterface { + $wallets = $walletRepository->findAllUnArchivedByUserPKWithLimit($this->user->id); + + foreach ($wallets as $wallet) { + $wallet->latestCharges = new ArrayCollection($chargeRepository->findByWalletIDLatest($wallet->id)); + } + + return $view->json($wallets); + } } diff --git a/app/src/Database/Wallet.php b/app/src/Database/Wallet.php index b6a04ef..74831fb 100644 --- a/app/src/Database/Wallet.php +++ b/app/src/Database/Wallet.php @@ -91,6 +91,11 @@ class Wallet */ public $users; + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + public ArrayCollection $latestCharges; + /** * Wallet constructor. */ @@ -101,5 +106,6 @@ public function __construct() $this->users = new PivotedCollection(); $this->createdAt = new \DateTimeImmutable(); $this->updatedAt = new \DateTimeImmutable(); + $this->latestCharges = new ArrayCollection(); } } diff --git a/app/src/Repository/ChargeRepository.php b/app/src/Repository/ChargeRepository.php index 0b085c4..5b7aadc 100644 --- a/app/src/Repository/ChargeRepository.php +++ b/app/src/Repository/ChargeRepository.php @@ -27,6 +27,24 @@ public function findByWalletId(int $walletId) return $query->fetchAll(); } + /** + * @param int $walletId + * @param int $limit + * @return \App\Database\Charge[] + */ + public function findByWalletIDLatest(int $walletId, int $limit = 4): array + { + /** @var \App\Database\Charge[] $charges */ + $charges = $this->select() + ->load('user') + ->where('wallet_id', $walletId) + ->orderBy('created_at', 'DESC') + ->limit($limit) + ->fetchAll(); + + return $charges; + } + /** * @param string $chargeId * @param int $walletId diff --git a/app/src/Repository/WalletRepository.php b/app/src/Repository/WalletRepository.php index c1d8019..ec6077f 100644 --- a/app/src/Repository/WalletRepository.php +++ b/app/src/Repository/WalletRepository.php @@ -35,6 +35,19 @@ public function findAllByUserPKByArchived(int $userID, bool $isArchived = false) return $wallets; } + /** + * @param int $userID + * @param int $limit + * @return \App\Database\Wallet[] + */ + public function findAllUnArchivedByUserPKWithLimit(int $userID, int $limit = 4): array + { + /** @var \App\Database\Wallet[] $wallets */ + $wallets = $this->allByUserPK($userID)->where('is_archived', false)->limit($limit)->fetchAll(); + + return $wallets; + } + /** * @param int $userID * @param string $currencyCode diff --git a/app/src/View/WalletView.php b/app/src/View/WalletView.php index de9997a..2aef840 100644 --- a/app/src/View/WalletView.php +++ b/app/src/View/WalletView.php @@ -7,15 +7,51 @@ use App\Database\Wallet; use Psr\Http\Message\ResponseInterface; use Spiral\Core\Container\SingletonInterface; +use Spiral\Http\ResponseWrapper; use Spiral\Prototype\Annotation\Prototyped; -use Spiral\Prototype\Traits\PrototypeTrait; /** * @Prototyped(property="walletView") */ class WalletView implements SingletonInterface { - use PrototypeTrait; + /** + * @var \Spiral\Http\ResponseWrapper + */ + protected ResponseWrapper $response; + + /** + * @var \App\View\CurrencyView + */ + protected CurrencyView $currency; + + /** + * @var \App\View\UsersView + */ + protected UsersView $users; + + /** + * @var \App\View\ChargesView + */ + protected ChargesView $charges; + + /** + * @param \Spiral\Http\ResponseWrapper $response + * @param \App\View\CurrencyView $currencyView + * @param \App\View\UsersView $usersView + * @param \App\View\ChargesView $chargesView + */ + public function __construct( + ResponseWrapper $response, + CurrencyView $currencyView, + UsersView $usersView, + ChargesView $chargesView + ) { + $this->response = $response; + $this->currency = $currencyView; + $this->users = $usersView; + $this->charges = $chargesView; + } /** * @param \App\Database\Wallet $wallet @@ -47,9 +83,11 @@ public function map(Wallet $wallet): array 'updatedAt' => $wallet->updatedAt->format(DATE_W3C), 'defaultCurrencyCode' => $wallet->defaultCurrencyCode, - 'defaultCurrency' => $this->currencyView->map($wallet->defaultCurrency), + 'defaultCurrency' => $this->currency->map($wallet->defaultCurrency), + + 'users' => $wallet->users->count() ? $this->users->map($wallet->users->getValues()) : [], - 'users' => $wallet->users->count() ? $this->usersView->map($wallet->users->getValues()) : [], + 'latestCharges' => $wallet->latestCharges->count() ? $this->charges->map($wallet->latestCharges->getValues()) : [], ]; } } diff --git a/composer.json b/composer.json index b151219..7476bb7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": ">=7.3", + "php": ">=8.0", "ext-mbstring": "*", "ext-openssl": "*", "ext-pdo": "*", diff --git a/composer.lock b/composer.lock index db3259f..b2a24bd 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": "e2cd3c740ae82b46b500a5359993b3d9", + "content-hash": "f8133fff795f39f7b592ed87f25f6037", "packages": [ { "name": "aws/aws-crt-php", @@ -8661,7 +8661,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.3", + "php": ">=8.0", "ext-mbstring": "*", "ext-openssl": "*", "ext-pdo": "*" diff --git a/tests/Traits/InteractsWithHttp.php b/tests/Traits/InteractsWithHttp.php index 7422d38..e9a1850 100644 --- a/tests/Traits/InteractsWithHttp.php +++ b/tests/Traits/InteractsWithHttp.php @@ -5,7 +5,7 @@ namespace Tests\Traits; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; +use Laminas\Diactoros\ServerRequest; trait InteractsWithHttp { From ee5dc1aa1fe11a2aebe2b0a22df6bfedd453143e Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Mon, 4 Oct 2021 00:07:33 +0300 Subject: [PATCH 7/8] Fix typed property init state before access --- app/src/Database/Wallet.php | 4 ++-- app/src/View/WalletView.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/Database/Wallet.php b/app/src/Database/Wallet.php index 74831fb..59ec7e2 100644 --- a/app/src/Database/Wallet.php +++ b/app/src/Database/Wallet.php @@ -92,9 +92,9 @@ class Wallet public $users; /** - * @var \Doctrine\Common\Collections\ArrayCollection + * @var \Doctrine\Common\Collections\ArrayCollection|null */ - public ArrayCollection $latestCharges; + public ArrayCollection|null $latestCharges = null; /** * Wallet constructor. diff --git a/app/src/View/WalletView.php b/app/src/View/WalletView.php index 2aef840..8815c09 100644 --- a/app/src/View/WalletView.php +++ b/app/src/View/WalletView.php @@ -87,7 +87,7 @@ public function map(Wallet $wallet): array 'users' => $wallet->users->count() ? $this->users->map($wallet->users->getValues()) : [], - 'latestCharges' => $wallet->latestCharges->count() ? $this->charges->map($wallet->latestCharges->getValues()) : [], + 'latestCharges' => $wallet->latestCharges !== null ? $this->charges->map($wallet->latestCharges->getValues()) : [], ]; } } From 83f76e98564cf79932c946eb5e4b880b3bd76c6b Mon Sep 17 00:00:00 2001 From: Volodymyr Komarov Date: Sat, 16 Oct 2021 14:33:12 +0300 Subject: [PATCH 8/8] Update packages. Fix JWT package vulnerability --- composer.json | 1 + composer.lock | 211 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 144 insertions(+), 68 deletions(-) diff --git a/composer.json b/composer.json index 7476bb7..e0659d2 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "voku/portable-utf8": "^5.4", "firebase/php-jwt": "^5.2", "kreait/firebase-php": "^5.0", + "lcobucci/jwt": "4.1.5", "aws/aws-sdk-php": "^3.190", "swiftmailer/swiftmailer": "^6.2", "laminas/laminas-diactoros": "^2.6" diff --git a/composer.lock b/composer.lock index b2a24bd..7d0b789 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": "f8133fff795f39f7b592ed87f25f6037", + "content-hash": "d8a4a33b9b29805f02ff38fb82c4e0ed", "packages": [ { "name": "aws/aws-crt-php", @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.196.1", + "version": "3.198.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "2845899d05c66a00d88eabbf7cf5d3dbae2da58a" + "reference": "821b8db50dd39be8ec94f286050a500b5f8a0142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2845899d05c66a00d88eabbf7cf5d3dbae2da58a", - "reference": "2845899d05c66a00d88eabbf7cf5d3dbae2da58a", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/821b8db50dd39be8ec94f286050a500b5f8a0142", + "reference": "821b8db50dd39be8ec94f286050a500b5f8a0142", "shasum": "" }, "require": { @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.196.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.198.6" }, - "time": "2021-10-01T18:23:06+00:00" + "time": "2021-10-15T18:38:53+00:00" }, { "name": "brick/math", @@ -486,16 +486,16 @@ }, { "name": "cycle/orm", - "version": "v1.6.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/cycle/orm.git", - "reference": "c90fcf341391403fcd51bde9fc5e165c257ac385" + "reference": "d7878094ddb22add06ed3439d4a0174a5d967e09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/orm/zipball/c90fcf341391403fcd51bde9fc5e165c257ac385", - "reference": "c90fcf341391403fcd51bde9fc5e165c257ac385", + "url": "https://api.github.com/repos/cycle/orm/zipball/d7878094ddb22add06ed3439d4a0174a5d967e09", + "reference": "d7878094ddb22add06ed3439d4a0174a5d967e09", "shasum": "" }, "require": { @@ -528,9 +528,9 @@ "description": "PHP DataMapper ORM and Data Modelling Engine", "support": { "issues": "https://github.com/cycle/orm/issues", - "source": "https://github.com/cycle/orm/tree/v1.6.0" + "source": "https://github.com/cycle/orm/tree/v1.6.1" }, - "time": "2021-09-03T17:55:23+00:00" + "time": "2021-10-12T16:37:28+00:00" }, { "name": "cycle/proxy-factory", @@ -1080,16 +1080,16 @@ }, { "name": "egulias/email-validator", - "version": "3.1.1", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307" + "reference": "ee0db30118f661fb166bcffbf5d82032df484697" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c81f18a3efb941d8c4d2e025f6183b5c6d697307", - "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ee0db30118f661fb166bcffbf5d82032df484697", + "reference": "ee0db30118f661fb166bcffbf5d82032df484697", "shasum": "" }, "require": { @@ -1136,7 +1136,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/3.1.1" + "source": "https://github.com/egulias/EmailValidator/tree/3.1.2" }, "funding": [ { @@ -1144,7 +1144,7 @@ "type": "github" } ], - "time": "2021-04-01T18:37:14+00:00" + "time": "2021-10-11T09:18:27+00:00" }, { "name": "fig/http-message-util", @@ -1381,16 +1381,16 @@ }, { "name": "google/cloud-storage", - "version": "v1.25.0", + "version": "v1.25.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "22dd587e5136248e31c8ce047c331acbe74ffbb7" + "reference": "8367aaaa6c541fcc95ff349e8f14d9ce9f631c16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/22dd587e5136248e31c8ce047c331acbe74ffbb7", - "reference": "22dd587e5136248e31c8ce047c331acbe74ffbb7", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/8367aaaa6c541fcc95ff349e8f14d9ce9f631c16", + "reference": "8367aaaa6c541fcc95ff349e8f14d9ce9f631c16", "shasum": "" }, "require": { @@ -1429,9 +1429,9 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.25.0" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.25.1" }, - "time": "2021-09-15T00:52:58+00:00" + "time": "2021-10-04T22:16:26+00:00" }, { "name": "google/crc32", @@ -1584,16 +1584,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" + "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", + "url": "https://api.github.com/repos/guzzle/promises/zipball/136a635e2b4a49b9d79e9c8fee267ffb257fdba0", + "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0", "shasum": "" }, "require": { @@ -1605,7 +1605,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -1621,10 +1621,25 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", @@ -1633,22 +1648,36 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.4.1" + "source": "https://github.com/guzzle/promises/tree/1.5.0" }, - "time": "2021-03-07T09:25:29+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-07T13:05:22+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91" + "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", + "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "shasum": "" }, "require": { @@ -1685,13 +1714,34 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], @@ -1708,9 +1758,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.2" + "source": "https://github.com/guzzle/psr7/tree/1.8.3" }, - "time": "2021-04-26T09:17:50+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2021-10-05T13:56:00+00:00" }, { "name": "kreait/clock", @@ -1760,16 +1824,16 @@ }, { "name": "kreait/firebase-php", - "version": "5.23.0", + "version": "5.24.0", "source": { "type": "git", "url": "https://github.com/kreait/firebase-php.git", - "reference": "0b3ba9f97adb439501ca99381be9ea7b0d4347e1" + "reference": "668d45026a65e607bcc679bf0f534850ada9d60d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kreait/firebase-php/zipball/0b3ba9f97adb439501ca99381be9ea7b0d4347e1", - "reference": "0b3ba9f97adb439501ca99381be9ea7b0d4347e1", + "url": "https://api.github.com/repos/kreait/firebase-php/zipball/668d45026a65e607bcc679bf0f534850ada9d60d", + "reference": "668d45026a65e607bcc679bf0f534850ada9d60d", "shasum": "" }, "require": { @@ -1784,7 +1848,7 @@ "guzzlehttp/promises": "^1.4", "guzzlehttp/psr7": "^1.7|^2.0", "kreait/clock": "^1.1", - "kreait/firebase-tokens": "^1.16", + "kreait/firebase-tokens": "^1.16.1", "mtdowling/jmespath.php": "^2.6.1", "php": "^7.4|^8.0", "psr/cache": "^1.0.1|^2.0|^3.0", @@ -1800,7 +1864,7 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^0.12.92", "phpstan/phpstan-phpunit": "^0.12.21", - "phpunit/phpunit": "^9.5.6", + "phpunit/phpunit": "^9.5.10", "symfony/var-dumper": "^5.3.3" }, "suggest": { @@ -1850,7 +1914,7 @@ "type": "github" } ], - "time": "2021-08-26T11:58:39+00:00" + "time": "2021-10-05T16:12:48+00:00" }, { "name": "kreait/firebase-tokens", @@ -3536,16 +3600,16 @@ }, { "name": "ramsey/collection", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa" + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/eaca1dc1054ddd10cbd83c1461907bee6fb528fa", - "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa", + "url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a", + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a", "shasum": "" }, "require": { @@ -3599,7 +3663,7 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.2.1" + "source": "https://github.com/ramsey/collection/tree/1.2.2" }, "funding": [ { @@ -3611,7 +3675,7 @@ "type": "tidelift" } ], - "time": "2021-08-06T03:41:06+00:00" + "time": "2021-10-10T03:01:02+00:00" }, { "name": "ramsey/uuid", @@ -3769,16 +3833,16 @@ }, { "name": "rize/uri-template", - "version": "0.3.3", + "version": "0.3.4", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "6e0b97e00e0f36c652dd3c37b194ef07de669b82" + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/6e0b97e00e0f36c652dd3c37b194ef07de669b82", - "reference": "6e0b97e00e0f36c652dd3c37b194ef07de669b82", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2a874863c48d643b9e2e254ab288ec203060a0b8", + "reference": "2a874863c48d643b9e2e254ab288ec203060a0b8", "shasum": "" }, "require": { @@ -3811,9 +3875,19 @@ ], "support": { "issues": "https://github.com/rize/UriTemplate/issues", - "source": "https://github.com/rize/UriTemplate/tree/0.3.3" + "source": "https://github.com/rize/UriTemplate/tree/0.3.4" }, - "time": "2021-02-22T15:03:38+00:00" + "funding": [ + { + "url": "https://www.paypal.me/rezigned", + "type": "custom" + }, + { + "url": "https://opencollective.com/rize-uri-template", + "type": "open_collective" + } + ], + "time": "2021-10-09T06:30:16+00:00" }, { "name": "spiral/composer-publish-plugin", @@ -3865,16 +3939,16 @@ }, { "name": "spiral/database", - "version": "v2.9.1", + "version": "v2.9.2", "source": { "type": "git", "url": "https://github.com/spiral/database.git", - "reference": "497c892b02e5f19d8036b3d34550f825448a8bba" + "reference": "b5eb6752aaff96bf870109b8a261df96ecd3c748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spiral/database/zipball/497c892b02e5f19d8036b3d34550f825448a8bba", - "reference": "497c892b02e5f19d8036b3d34550f825448a8bba", + "url": "https://api.github.com/repos/spiral/database/zipball/b5eb6752aaff96bf870109b8a261df96ecd3c748", + "reference": "b5eb6752aaff96bf870109b8a261df96ecd3c748", "shasum": "" }, "require": { @@ -3910,9 +3984,9 @@ "description": "DBAL, schema introspection, migration and pagination", "support": { "issues": "https://github.com/spiral/database/issues", - "source": "https://github.com/spiral/database/tree/v2.9.1" + "source": "https://github.com/spiral/database/tree/v2.9.2" }, - "time": "2021-09-15T18:29:49+00:00" + "time": "2021-10-06T13:58:26+00:00" }, { "name": "spiral/framework", @@ -8282,6 +8356,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -8395,16 +8470,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", "shasum": "" }, "require": { @@ -8447,7 +8522,7 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-04-09T00:54:41+00:00" + "time": "2021-10-11T04:00:11+00:00" }, { "name": "theseer/tokenizer",