24 lines
283 B
PHP
24 lines
283 B
PHP
|
<?php
|
||
|
|
||
|
namespace Automata\Storage;
|
||
|
|
||
|
use Automata\Tool;
|
||
|
|
||
|
class ToolMemory
|
||
|
{
|
||
|
/** @var Tool[] */
|
||
|
private array $memory = [];
|
||
|
|
||
|
|
||
|
public function save(Tool $tool): void
|
||
|
{
|
||
|
$this->memory[$tool->T] = $tool;
|
||
|
}
|
||
|
|
||
|
|
||
|
public function read(int $T): ?Tool
|
||
|
{
|
||
|
return @$this->memory[$T];
|
||
|
}
|
||
|
}
|