public function add(TypeConverterInterface $converter) { if ($this->has($converter->getTypeNamespace(), $converter->getTypeName())) { throw new \InvalidArgumentException(sprintf('The converter "%s %s" already exists', $converter->getTypeNamespace(), $converter->getTypeName())); } $this->converters[$converter->getTypeNamespace() . ':' . $converter->getTypeName()] = $converter; }
/** * Set (overwrite) a type converter in the collection * * @param TypeConverterInterface $converter Type converter * * @return TypeConverterCollection */ public function set(TypeConverterInterface $converter) { $this->converters[$converter->getTypeNamespace() . ':' . $converter->getTypeName()] = $converter; return $this; }