コード例 #1
0
 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;
 }
コード例 #2
0
 /**
  * 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;
 }