/**
  * @param $stockAnnualDividendsGrowth
  */
 public function setStockAnnualDividendsGrowth($stockAnnualDividendsGrowth)
 {
     $dividendDiscountModelType = $this->dividendDiscountModelType->getValue();
     if ($dividendDiscountModelType == StockDDMTypes::ZERO_GROWTH && $stockAnnualDividendsGrowth !== null) {
         throw new InvalidArgumentException(Strings::getString('message_cannot_set_growth_value_on_zero_growth_type'));
     }
     if ($dividendDiscountModelType == StockDDMTypes::MULTIPLE_GROWTH) {
         if (Helpers::checkIfPositiveNumberOrThrowAnException($stockAnnualDividendsGrowth)) {
             Helpers::checkIfLeftOperandGreaterOrThrowAnException($this->stockVIR, $stockAnnualDividendsGrowth, Strings::getString('message_vir_must_be_higher_than_growth_value'));
         }
     }
     $this->setProperty("stockAnnualDividendsGrowth", $stockAnnualDividendsGrowth);
 }
Пример #2
0
 public function testCheckIfPositiveNumberException()
 {
     $this->setExpectedException('InvalidArgumentException', ErrorMessages::getMustBePositiveNumberMessage("0"));
     Helpers::checkIfPositiveNumberOrThrowAnException(0);
 }
Пример #3
0
 /**
  * @param $bondPaymentFrequency
  */
 public function setBondPaymentFrequency($bondPaymentFrequency)
 {
     if (Helpers::checkIfPositiveNumberOrThrowAnException($bondPaymentFrequency)) {
         $this->setProperty("bondPaymentFrequency", $bondPaymentFrequency);
     }
 }