private static function getWord(Arrow $arrow, GridFile $gridFile, $xStart, $yStart) { $word = ""; $cell = $arrow->firstCell($xStart, $yStart); list($x, $y) = $cell; $value = $gridFile->getCell($x, $y); while ($x < $gridFile->getWidth() && $y < $gridFile->getHeight() && $value != strtolower($value)) { $word .= $value; $cell = $arrow->nextCell($x, $y); list($x, $y) = $cell; $value = $gridFile->getCell($x, $y); } return $word; }