Prepare for block level program handling
This commit is contained in:
@@ -13,9 +13,7 @@ class ProgramMemory
|
||||
|
||||
public function save(Program $program): void
|
||||
{
|
||||
if ($program->N > 9998 || $program->N < 9001) {
|
||||
throw new InvalidArgumentException('Program number must be in range 9001 - 9998');
|
||||
}
|
||||
$this->guardInvalidProgramNumber($program->N);
|
||||
$this->memory[$program->N] = $program;
|
||||
}
|
||||
|
||||
@@ -24,4 +22,13 @@ class ProgramMemory
|
||||
{
|
||||
return @$this->memory[$N];
|
||||
}
|
||||
|
||||
|
||||
private function guardInvalidProgramNumber(int $N): void
|
||||
{
|
||||
if ($N > 9998 || $N < 9001) {
|
||||
throw new InvalidArgumentException('Program number must be in range 9001 - 9998');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user