registers = new Registers(); $this->traverseMode = new TraverseMode(0); $this->planeSelection = new PlaneSelection(17); $this->radiusCompensation = new RadiusCompensation(40); $this->dimensionMode = new DimensionMode(90); $this->workCycleSelection = new WorkCycle(0); $this->coolantMode = new CoolantMode(9); $this->spindleMode = new SpindleMode(5); $this->tableClamping = new TableClampingMode(10); } public function apply(Word $word): void { if ($word->register === 'G') { $this->traverseMode->apply($word->value); $this->planeSelection->apply($word->value); $this->radiusCompensation->apply($word->value); $this->dimensionMode->apply($word->value); $this->workCycleSelection->apply($word->value); // TODO Handle other G commands return; } if ($word->register === 'M') { $this->coolantMode->apply($word->value); $this->spindleMode->apply($word->value); $this->tableClamping->apply($word->value); // TODO Handle other M commands return; } if (property_exists($this->registers, $word->register)) { $this->registers->{$word->register} = $word->value; } } }