player = $thePlayer; $this->lines = $theLines; } /** * @return Player */ public function getPlayer(){ return $this->player; } /** * @return string[] */ public function getLines(){ return $this->lines; } /** * @param int $index 0-3 * * @return string */ public function getLine($index){ if($index < 0 or $index > 3){ throw new \InvalidArgumentException("Index must be in the range 0-3!"); } return $this->lines[$index]; } /** * @param string[] $lines */ public function setLines(array $lines){ if(count($lines) !== 4){ throw new \InvalidArgumentException("Array size must be 4!"); } $this->lines = $lines; } /** * @param int $index 0-3 * @param string $line */ public function setLine($index, $line){ if($index < 0 or $index > 3){ throw new \InvalidArgumentException("Index must be in the range 0-3!"); } $this->lines[$index] = $line; } }