/**
  * @test
  * @expectedException \OutOfRangeException
  */
 public function I_can_not_convert_too_high_value_to_bonus()
 {
     $weightTable = new WeightTable();
     $weightTable->toBonus(new Weight(9001, Weight::KG, $weightTable))->getValue();
 }
Exemplo n.º 2
0
 /**
  * @return AbstractBonus
  */
 public function getBonus()
 {
     return $this->weightTable->toBonus($this);
 }
Exemplo n.º 3
0
 /**
  * @param RaceCode $raceCode
  * @param SubraceCode $subraceCode
  * @param FemaleModifiersTable $femaleModifiersTable
  * @param WeightTable $weightTable
  * @return float
  */
 public function getFemaleWeightInKg($raceCode, $subraceCode, FemaleModifiersTable $femaleModifiersTable, WeightTable $weightTable)
 {
     $maleWeightValue = $this->getMaleWeightInKg($raceCode, $subraceCode);
     $maleWeightBonus = $weightTable->toBonus(new Weight($maleWeightValue, Weight::KG, $weightTable));
     $femaleWeightBonusModifier = $femaleModifiersTable->getWeightBonus($raceCode);
     $femaleWeightBonusValue = $maleWeightBonus->getValue() + $femaleWeightBonusModifier;
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     $femaleWeightBonus = new WeightBonus($femaleWeightBonusValue, $weightTable);
     return $femaleWeightBonus->getWeight()->getValue();
 }