WIP: removing User::class public array $items for Stat()::class.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace User;
|
||||
|
||||
class WearedItem
|
||||
{
|
||||
private array $slot = [];
|
||||
|
||||
|
||||
public function add(Item $item): void
|
||||
{
|
||||
$this->slot[$item->inslot] = $item;
|
||||
}
|
||||
|
||||
public function exist(int $slot): bool
|
||||
{
|
||||
return array_key_exists($slot, $this->slot);
|
||||
}
|
||||
|
||||
public function get(int $slot): Item
|
||||
{
|
||||
return $this->slot[$slot];
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->slot);
|
||||
}
|
||||
|
||||
public function remove(int $slot): void
|
||||
{
|
||||
array_splice($this->slot, $slot, 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user