public function create(string $type): RenderableElementInterface
    {
        $type = (string) $type;
        $search = strtolower($type);

        if (isset($this->typeToView[$search])) {
            $class = $this->typeToView[$search];

            return new $class();
        } elseif (class_exists($type)) {
            $class = new $type();
            if ($class instanceof RenderableElementInterface) {
                return $class;
            }
        }

        throw new Exception\UnknownTypeException(
            sprintf(
                'The given type "%s" is not an instance of "%s".',
                $type,
                RenderableElementInterface::class
            )
        );
    }
public function create(string $type): RenderableElementInterface
    {
        $type = (string) $type;
        $search = strtolower($type);

        if (isset($this->typeToView[$search])) {
            $class = $this->typeToView[$search];

            return new $class();
        } elseif (class_exists($type)) {
            $class = new $type();
            if ($class instanceof RenderableElementInterface) {
                return $class;
            }
        }

        throw new Exception\UnknownTypeException(
            sprintf(
                'The given type "%s" is not an instance of "%s".',
                $type,
                RenderableElementInterface::class
            )
        );
    }
public function create ( string $ type ) : RenderableElementInterface { $ type = ( string ) $ type ; $ search = strtolower ( $ type ) ; if ( isset ( $ this -> typeToView [ $ search ] ) ) { $ class = $ this -> typeToView [ $ search ] ; return new $ class ( ) ; } elseif ( class_exists ( $ type ) ) { $ class = new $ type ( ) ; if ( $ class instanceof RenderableElementInterface ) { return $ class ; } } throw new Exception \ UnknownTypeException ( sprintf ( 'The given type "%s" is not an instance of "%s".' , $ type , RenderableElementInterface :: class ) ) ; }
Find the correct Field-Class by type.

@param mixed $type

@throws Exception\UnknownTypeException

@return RenderableElementInterface $class
Find the correct Field - Class by type .