From 11e7dea2674cf440d9b1e63cc7e11eae15c785be Mon Sep 17 00:00:00 2001 From: Jonathan Vuillemin Date: Sun, 10 May 2020 08:56:18 +0200 Subject: [PATCH] Added findAll() method to the RegistrationRepositoryInterface --- CHANGELOG.md | 5 +++++ doc/quickstart/interfaces.md | 5 +++++ src/Registration/RegistrationRepositoryInterface.php | 3 +++ tests/Traits/DomainTestingTrait.php | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1399abd8..3464254a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +1.1.0 +----- + +* Added `findAll()` method to `RegistrationRepositoryInterface` + 1.0.0 ----- diff --git a/doc/quickstart/interfaces.md b/doc/quickstart/interfaces.md index c24c521b..2ebb636b 100644 --- a/doc/quickstart/interfaces.md +++ b/doc/quickstart/interfaces.md @@ -33,6 +33,11 @@ $registrationRepository = new class implements RegistrationRepositoryInterface // TODO: Implement find() method to find a registration by identifier, or null if not found. } + public function findAll(): array + { + // TODO: Implement findAll() method to find all available registrations. + } + public function findByClientId(string $clientId) : ?RegistrationInterface { // TODO: Implement findByClientId() method to find a registration by client id, or null if not found. diff --git a/src/Registration/RegistrationRepositoryInterface.php b/src/Registration/RegistrationRepositoryInterface.php index b2c392cc..7a8eefea 100644 --- a/src/Registration/RegistrationRepositoryInterface.php +++ b/src/Registration/RegistrationRepositoryInterface.php @@ -26,6 +26,9 @@ interface RegistrationRepositoryInterface { public function find(string $identifier): ?RegistrationInterface; + /** @return RegistrationInterface[] */ + public function findAll(): array; + public function findByClientId(string $clientId): ?RegistrationInterface; public function findByPlatformIssuer(string $issuer, string $clientId = null): ?RegistrationInterface; diff --git a/tests/Traits/DomainTestingTrait.php b/tests/Traits/DomainTestingTrait.php index 4bcba0dd..0292ea44 100644 --- a/tests/Traits/DomainTestingTrait.php +++ b/tests/Traits/DomainTestingTrait.php @@ -179,6 +179,11 @@ public function find(string $identifier): ?RegistrationInterface return $this->registrations[$identifier] ?? null; } + public function findAll(): array + { + return $this->registrations; + } + public function findByClientId(string $clientId): ?RegistrationInterface { foreach ($this->registrations as $registration) {