/** * @param FormatterInterface $formatter * * @return DataExtension */ public function registerFormatter(FormatterInterface $formatter) { $this->formatters[$formatter->getName()] = $formatter; return $this; }
/** * {@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))); }
/** * 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)); }