/** * @param $i * @param $type */ protected function determineCell($i, $type) { if (!array_key_exists($i, $this->row)) { throw new \OutOfBoundsException(sprintf('invalid cell identifier %d', $i)); } if ($this->row[$i]->getType() !== $type && $type !== AnyCell::TYPE_UNKNOWN) { if ($this->row[$i]->getType() !== AnyCell::TYPE_UNKNOWN) { throw new \RuntimeException('puzzle has no solution'); } $this->row[$i] = $this->cellFactory->getByType($type); $this->updateCounter++; } }