Teren-app/app/Reports/ReportRegistry.php
Simon Pocrnjič 63e0958b66 Dev branch
2025-11-02 12:31:01 +01:00

30 lines
522 B
PHP

<?php
namespace App\Reports;
use App\Reports\Contracts\Report;
class ReportRegistry
{
/** @var array<string, Report> */
protected array $reports = [];
public function register(Report $report): void
{
$this->reports[$report->slug()] = $report;
}
/**
* @return array<string, Report>
*/
public function all(): array
{
return $this->reports;
}
public function findBySlug(string $slug): ?Report
{
return $this->reports[$slug] ?? null;
}
}