/** * Reads a specific array data to fill the key class properties. * * @param array $data * @return bool */ public function load(array $data) { if (isset($data['isSunk'], $data['sunkShips'], $data['grid'], $data['shipsGrid'])) { $this->isSunk = $data['isSunk']; $this->sunkShips = $data['sunkShips']; $this->grid = $data['grid']; $this->shipsGrid = new Ships(); $this->shipsGrid->load($data['shipsGrid']); return true; } return false; }