public function testGetByOffsets()
 {
     $expectedOffsetCoords = ['H9', 'J9', 'I10', 'I8', 'H10', 'H8', 'J10', 'J8'];
     $expectedResult = array_combine($this->offsets, $expectedOffsetCoords);
     $coords = 'I9';
     $this->assertEquals($expectedResult, $this->coordsManager->getByOffsets($coords, $this->offsets));
 }
 /**
  * Checks if the shot sinks the ship (if all other masts have been hit)
  *
  * @param string $mast
  * @param CoordsCollection $allShips
  * @param CoordsCollection $allShots
  * @return bool
  */
 public function isSunk($mast, CoordsCollection $allShips, CoordsCollection $allShots)
 {
     $sidePositions = $this->coordsManager->getByOffsets($mast, [CoordsManager::OFFSET_TOP, CoordsManager::OFFSET_BOTTOM, CoordsManager::OFFSET_RIGHT, CoordsManager::OFFSET_LEFT]);
     // try to find a mast which hasn't been hit
     foreach ($sidePositions as $offset => $sidePosition) {
         if ($sidePosition && $this->remainingMastInDirectionExists($sidePosition, $allShips, $allShots, $offset)) {
             return false;
         }
     }
     return true;
 }