public function processEntry($key, $value, GridFile $file) { foreach (str_split(preg_replace("/\n/", "", $value)) as $index => $char) { if ($char === "1") { $file->addPicture($index % $file->getWidth(), floor($index / $file->getWidth())); } } }
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; }