src/TransformerRegistry.php
/**
     * @param CanTransform $transformer
     * @param bool $override
     * @return $this
     * @throws DuplicateResourceTransformerException
     */
@param CanTransform $transformer
@param bool $override
@return $this
@throws DuplicateResourceTransformerException
@param CanTransform $transformer @param bool $override @return $this @throws DuplicateResourceTransformerException
public function addTransformer(CanTransform $transformer, bool $override = false)
    {
        $resourceClass = $transformer->getResourceClass();
        if ($override === false && array_key_exists($resourceClass, $this->transformerByResourceClass)) {
            throw new DuplicateResourceTransformerException(sprintf(
                'Transformer for resource "%s" already registered in "%s"',
                $resourceClass,
                get_class($this->transformerByResourceClass[$resourceClass])
            ));
        }
        $this->transformerByResourceClass[$resourceClass] = $transformer;
        return $this;
    }
public function addTransformer ( CanTransform $ transformer , bool $ override = false ) { $ resourceClass = $ transformer -> getResourceClass ( ) ; if ( $ override === false && array_key_exists ( $ resourceClass , $ this -> transformerByResourceClass ) ) { throw new DuplicateResourceTransformerException ( sprintf ( 'Transformer for resource "%s" already registered in "%s"' , $ resourceClass , get_class ( $ this -> transformerByResourceClass [ $ resourceClass ] ) ) ) ; } $ this -> transformerByResourceClass [ $ resourceClass ] = $ transformer ; return $ this ; }
@param CanTransform $transformer
 @param bool $override
 @return $this
 @throws DuplicateResourceTransformerException
@param CanTransform $transformer @param bool $override @return $this @throws DuplicateResourceTransformerException