$templates */ public function __construct( public int $minAmount, public int $maxAmount, public array $templates, ) { } public function find(int $id): ?VoucherTemplate { foreach ($this->templates as $template) { if ($id === $template->id) { return $template; } } return null; } }