src/Identifier/Resolver/ResolverAwareTrait.php
protected function buildResolver($config)
    {
        if (is_string($config)) {
            $config = [
                'className' => $config
            ];
        }

        if (!isset($config['className'])) {
            $message = 'Option `className` is not present.';
            throw new InvalidArgumentException($message);
        }

        $class = App::className($config['className'], 'Identifier/Resolver', 'Resolver');
        if ($class === false) {
            $message = sprintf('Resolver class `%s` does not exist.', $config['className']);
            throw new InvalidArgumentException($message);
        }
        $instance = new $class($config);

        if (!($instance instanceof ResolverInterface)) {
            $message = sprintf('Resolver must implement `%s`.', ResolverInterface::class);
            throw new RuntimeException($message);
        }

        return $instance;
    }
protected function buildResolver($config)
    {
        if (is_string($config)) {
            $config = [
                'className' => $config
            ];
        }

        if (!isset($config['className'])) {
            $message = 'Option `className` is not present.';
            throw new InvalidArgumentException($message);
        }

        $class = App::className($config['className'], 'Identifier/Resolver', 'Resolver');
        if ($class === false) {
            $message = sprintf('Resolver class `%s` does not exist.', $config['className']);
            throw new InvalidArgumentException($message);
        }
        $instance = new $class($config);

        if (!($instance instanceof ResolverInterface)) {
            $message = sprintf('Resolver must implement `%s`.', ResolverInterface::class);
            throw new RuntimeException($message);
        }

        return $instance;
    }
protected function buildResolver ( $ config ) { if ( is_string ( $ config ) ) { $ config = [ 'className' => $ config ] ; } if ( ! isset ( $ config [ 'className' ] ) ) { $ message = 'Option `className` is not present.' ; throw new InvalidArgumentException ( $ message ) ; } $ class = App :: className ( $ config [ 'className' ] , 'Identifier/Resolver' , 'Resolver' ) ; if ( $ class === false ) { $ message = sprintf ( 'Resolver class `%s` does not exist.' , $ config [ 'className' ] ) ; throw new InvalidArgumentException ( $ message ) ; } $ instance = new $ class ( $ config ) ; if ( ! ( $ instance instanceof ResolverInterface ) ) { $ message = sprintf ( 'Resolver must implement `%s`.' , ResolverInterface :: class ) ; throw new RuntimeException ( $ message ) ; } return $ instance ; }
Builds a ResolverInterface instance.

@param string|array $config Resolver class name or config.
@return \Authentication\Identifier\Resolver\ResolverInterface
@throws \InvalidArgumentException When className option is missing or class name does not exist.
@throws \RuntimeException When resolver does not implement ResolverInterface.
Builds a ResolverInterface instance .