/** * @param Arrow $arrow * * @return Arrow */ public function setArrow(Arrow $arrow) { switch ($arrow->getNumber()) { case 1: $this->arrow1multiplier = $arrow->getMultiplier(); $this->arrow1score = $arrow->getScore(); $this->arrow1total = $arrow->getTotal(); break; case 2: $this->arrow2multiplier = $arrow->getMultiplier(); $this->arrow2score = $arrow->getScore(); $this->arrow2total = $arrow->getTotal(); break; case 3: $this->arrow3multiplier = $arrow->getMultiplier(); $this->arrow3score = $arrow->getScore(); $this->arrow3total = $arrow->getTotal(); break; } if ($this->isVoid()) { $this->totalScore = 0; } else { $this->totalScore = ($this->arrow1total > 0 ? $this->arrow1total : 0) + ($this->arrow2total > 0 ? $this->arrow2total : 0) + ($this->arrow3total > 0 ? $this->arrow3total : 0); } return $arrow; }