Example #1
0
 /**
  * Add mapper source type.
  *
  * @param SourceTypeInterface $type
  * @param string $alias
  *
  * @throws SourceTypeException
  */
 public function add(SourceTypeInterface $type, $alias)
 {
     if ($alias !== $type->getName()) {
         throw new SourceTypeException(sprintf('Mapper source type %s alias is not valid!', $alias));
     }
     $this->types[$alias] = $type;
 }
Example #2
0
 /**
  * Check if mapper type support data.
  *
  * @return bool
  */
 private function supportData()
 {
     $dataClass = $this->type->getDataClass();
     return $this->data instanceof $dataClass || $dataClass === get_class($this->data);
 }