/** * Transforms a normalized format into a localized money string. * * @param number $value Normalized number * @return string Localized money string. */ public function transform($value) { if (!is_numeric($value)) { throw new \InvalidArgumentException(sprintf('Numeric argument expected, %s given', gettype($value))); } return parent::transform($value / $this->getOption('divisor')); }
/** * Transforms a normalized format into a localized money string. * * @param number $value Normalized number * @return string Localized money string. */ public function transform($value) { if (null !== $value) { if (!is_numeric($value)) { throw new UnexpectedTypeException($value, 'numeric'); } $value /= $this->getOption('divisor'); } return parent::transform($value); }
public function testTransformExpectsNumeric() { $transformer = new NumberToLocalizedStringTransformer(); $this->setExpectedException('Symfony\\Component\\Form\\Exception\\UnexpectedTypeException'); $transformer->transform('foo'); }
public function testTransformExpectsNumeric() { $transformer = new NumberToLocalizedStringTransformer(); $this->setExpectedException('\\InvalidArgumentException'); $transformer->transform('foo'); }