2023-04-18 09:21:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DTO;
|
|
|
|
|
2023-08-14 15:15:05 +00:00
|
|
|
use Helper\Conversion;
|
2023-04-18 09:21:54 +00:00
|
|
|
use ItemModel;
|
|
|
|
|
|
|
|
class KnowledgeTempleItem
|
|
|
|
{
|
|
|
|
public int $id;
|
|
|
|
public int $type;
|
|
|
|
public string $name;
|
|
|
|
public int $level;
|
|
|
|
|
|
|
|
private int $rowId;
|
2023-07-31 12:21:05 +00:00
|
|
|
|
2023-04-18 09:21:54 +00:00
|
|
|
/**
|
|
|
|
* @param array $item
|
|
|
|
*/
|
|
|
|
public function __construct(array $item)
|
|
|
|
{
|
|
|
|
$this->rowId = $item['id'];
|
|
|
|
$this->id = intval($item['item_id']);
|
|
|
|
$this->type = intval($item['type']);
|
|
|
|
$this->name = $item['name'];
|
|
|
|
|
2023-07-31 12:21:05 +00:00
|
|
|
// Общий + конкретный.
|
2023-04-18 09:21:54 +00:00
|
|
|
$itemData = array_merge(
|
2023-08-14 15:15:05 +00:00
|
|
|
Conversion::dataStringToArray(ItemModel::getItemData($this->id)),
|
|
|
|
Conversion::dataStringToArray($item['data']),
|
2023-04-18 09:21:54 +00:00
|
|
|
);
|
|
|
|
$this->level = intval($itemData['tr_lvl']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function exists(): bool
|
|
|
|
{
|
|
|
|
return !empty($this->rowId);
|
|
|
|
}
|
2023-07-31 12:21:05 +00:00
|
|
|
}
|
|
|
|
|