Example #1
0
 /**
  * @param FormatterInterface $formatter
  *
  * @return DataExtension
  */
 public function registerFormatter(FormatterInterface $formatter)
 {
     $this->formatters[$formatter->getName()] = $formatter;
     return $this;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function handle(Column $column, Entity $entity = null, array $options = array())
 {
     $value = $entity->get($column->getName(), $options['path']);
     return new Cell(new Data($this->formatter->format($value, $options)));
 }
Example #3
0
 /**
  * Invalid data type.
  *
  * @param FormatterInterface $formatter
  * @param mixed              $value
  * @param string             $expectedType
  *
  * @return FormatterException
  */
 public static function invalidType(FormatterInterface $formatter, $value, $expectedType)
 {
     return new self(sprintf('Invalid data type for "%s" formatter: "%s" given, but %s expected.', $formatter->getName(), self::getType($value), $expectedType));
 }