Esempio n. 1
0
 public function testGetString()
 {
     $this->assertEquals('The value has to be of the type %s, but currently is of the type %s instead.', Strings::getString('message_incompatible_types'));
     $this->assertEquals('The value has to be of the type goodType, but currently is of the type badType instead.', Strings::getFormattedString('message_incompatible_types', null, 'goodType', 'badType'));
 }
Esempio n. 2
0
 /**
  * @return string [Message as a string]
  */
 public static function getPropresultarrayNotSuppliedMessage()
 {
     return Strings::getString('message_propresultarray_not_supplied');
 }
Esempio n. 3
0
 /**
  * @param string $identifier
  * @param string|null $locale
  * @return string
  */
 public static function getFormattedString($identifier, $locale)
 {
     $formatArgs = array_slice(func_get_args(), 2);
     $unformattedString = Strings::getString($identifier, $locale);
     return is_null($unformattedString) ? null : vsprintf($unformattedString, $formatArgs);
 }
 /**
  * @return string
  * @throws Exception
  */
 public function getStockPresentValue()
 {
     switch ($this->dividendDiscountModelType->getValue()) {
         case StockDDMTypes::ZERO_GROWTH:
             // PV = D/i
             return MathFuncs::div($this->stockAnnualDividendsValue, $this->stockVIR);
         case StockDDMTypes::MULTIPLE_GROWTH:
             if ($this->stockAnnualDividendsGrowth === null) {
                 throw new Exception(Strings::getString('message_must_set_growth_value'));
             }
             // PV = (D*(1+g))/(i-g)
             return MathFuncs::mul($this->stockAnnualDividendsValue, MathFuncs::div(MathFuncs::add(1, $this->stockAnnualDividendsGrowth), MathFuncs::sub($this->stockVIR, $this->stockAnnualDividendsGrowth)));
     }
 }