Tale\Jade\Renderer::getAdapter PHP 메소드

getAdapter() 공개 메소드

This is lazy, meaning that the adapter gets created and stored as soon as the method is called the first time. After that all calls will return the same adapter instance
public getAdapter ( ) : AdapterBase
리턴 Tale\Jade\Renderer\AdapterBase
    public function getAdapter()
    {
        if (!isset($this->adapter)) {
            $adapter = $this->options['adapter'];
            $className = strpos($adapter, '\\') === false ? __NAMESPACE__ . '\\Renderer\\Adapter\\' . ucfirst($this->options['adapter']) : $adapter;
            if (!class_exists($className)) {
                throw new \RuntimeException("The passed adapter {$className} doesn't exist");
            }
            if (!is_subclass_of($className, __NAMESPACE__ . '\\Renderer\\AdapterBase')) {
                throw new \RuntimeException("The passed adapter {$className} doesn't extend Tale\\Jade\\Renderer\\AdapterBase");
            }
            $this->adapter = new $className($this, $this->options['adapter_options']);
        }
        return $this->adapter;
    }