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')); }
/** * @param string $methodName [Name of the method] * @param string $className [Name of the class] * @return string [Concatenated message as a string] */ public static function getMethodDoesNotExistMessage($methodName, $className) { return Strings::getFormattedString('message_method_does_not_exist', null, $methodName, $className); }
/** * @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))); } }