36 lines
811 B
PHP
36 lines
811 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\BusProNet\Model;
|
|
|
|
/**
|
|
* The GUTSCHEINVORLAGEN response: the designs on sale plus BusPro's amount bounds.
|
|
*
|
|
* The bounds (gutscheinminbetrag/gutscheinmaxbetrag) are not in the vendor documentation,
|
|
* they were measured on the test system (10 and 5,000 €, both inclusive).
|
|
*/
|
|
final readonly class VoucherTemplates
|
|
{
|
|
/**
|
|
* @param list<VoucherTemplate> $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;
|
|
}
|
|
}
|