add getAll method to carrier repo

This commit is contained in:
Yisroel Baum 2025-11-08 21:24:42 +02:00
parent 95feab744e
commit 059c111059
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 15 additions and 0 deletions

View file

@ -6,4 +6,9 @@ interface CarrierRepository
{ {
public function find(int $id): ?Carrier; public function find(int $id): ?Carrier;
public function save(Carrier $carrier): Carrier; public function save(Carrier $carrier): Carrier;
/**
* @return Carrier[]
*/
public function getAll(): array;
} }

View file

@ -36,4 +36,14 @@ class FakeCarrierRepository implements CarrierRepository
{ {
return count($this->existingCarriers); return count($this->existingCarriers);
} }
public function getAll(): array
{
return array_map(function (Carrier $carrier) {
return new Carrier(
$carrier->getId(),
$carrier->getEmail()
);
}, $this->existingCarriers);
}
} }