public function getTransformer(string $target_class)
    {
        if (isset($this->transformers[$target_class]))
            return $this->transformers[$target_class];

        foreach ($this->transformers as $class => $transformer)
        {
            $inherit_mode = $transformer->getInheritMode();
            if (
                ($inherit_mode === Transformer::INHERIT_UP && is_a($class, $target_class, true))
                || ($inherit_mode === Transformer::INHERIT_DOWN && is_a($target_class, $class, true))
            )
            {
                return $transformer;
            }
        }

        throw new TransformException("No transform to class $target_class");
    }
public function getTransformer(string $target_class)
    {
        if (isset($this->transformers[$target_class]))
            return $this->transformers[$target_class];

        foreach ($this->transformers as $class => $transformer)
        {
            $inherit_mode = $transformer->getInheritMode();
            if (
                ($inherit_mode === Transformer::INHERIT_UP && is_a($class, $target_class, true))
                || ($inherit_mode === Transformer::INHERIT_DOWN && is_a($target_class, $class, true))
            )
            {
                return $transformer;
            }
        }

        throw new TransformException("No transform to class $target_class");
    }
public function getTransformer ( string $ target_class ) { if ( isset ( $ this -> transformers [ $ target_class ] ) ) return $ this -> transformers [ $ target_class ] ; foreach ( $ this -> transformers as $ class => $ transformer ) { $ inherit_mode = $ transformer -> getInheritMode ( ) ; if ( ( $ inherit_mode === Transformer :: INHERIT_UP && is_a ( $ class , $ target_class , true ) ) || ( $ inherit_mode === Transformer :: INHERIT_DOWN && is_a ( $ target_class , $ class , true ) ) ) { return $ transformer ; } } throw new TransformException ( "No transform to class $target_class" ) ; }
Get a transformer that converts to the target class. If a direct version
is available, that is returned. Otherwise, a transformer registered to
transform to a superclass of the target may be returned instead.

@param string $target_class The class to transform to
@return Transformer A suitable transformer
@throws TransformException When no transform is available
Get a transformer that converts to the target class . If a direct version is available that is returned . Otherwise a transformer registered to transform to a superclass of the target may be returned instead .