transfers = $transfers; } public function getTypes(): array { return array_keys($this->getTransfers()); } /** * @return TransferInterface[] */ public function getTransfers(): array { $result = []; foreach ($this->transfers as $transfer) { $result[$transfer::getType()] = $transfer; } return $result; } public function getTransfer(string $type): TransferInterface { if ($transfer = $this->getTransfers()[$type] ?? null) { return $transfer; } throw new TransferNotFoundException($type); } }