game/_incl_data/class/Model/Constant/Stat.php

37 lines
782 B
PHP

<?php
namespace Model\Constant;
use Enum\StatFilterCellName;
class Stat extends Constant
{
public function __construct()
{
self::$tableName = 'const_stats';
parent::__construct();
}
public function getBonusNames(): array
{
return $this->filterByCell(StatFilterCellName::Bonus);
}
private function filterByCell(StatFilterCellName $cellName): array
{
$result = [];
foreach ($this->rows as $row) {
if (!$row[$cellName->value]) {
continue;
}
$result[$row['sys_name']] = $row['name'];
}
return $result;
}
public function getRequirementNames(): array
{
return $this->filterByCell(StatFilterCellName::Requirement);
}
}