public static function flagWaterAroundShip(Cell $cell) { $processor = new PathProcessor($cell->getCoordinate()); $battlefield = $cell->getBattlefield(); $cells = $processor->getAdjacentCells($cell->getBattlefield(), 4, CellModel::FLAG_SHIP); $cells[$cell->getCoordinate()] = $cell; foreach ($cells as $cell) { foreach ($processor->reset($cell->getCoordinate())->getAdjacentCells($battlefield, 1, 0, CellModel::FLAG_SHIP) as $waterCell) { CellModel::switchPhase($waterCell, CellModel::FLAG_SKIP); } } }