19 lines
491 B
PHP
19 lines
491 B
PHP
<?php
|
|
namespace Game\Database;
|
|
|
|
class AbilityRepository implements RepositoryInterface {
|
|
private array $data;
|
|
|
|
public function __construct(JsonFileLoader $loader) {
|
|
$this->data = $loader->load('abilities.json');
|
|
$this->data = array_combine(array_column($this->data, 'id'), $this->data);
|
|
}
|
|
|
|
public function find(int|string $id): ?array {
|
|
return $this->data[$id] ?? null;
|
|
}
|
|
|
|
public function findAll(): array {
|
|
return $this->data;
|
|
}
|
|
} |