[李景山php]每天laravel-20161106|EngineResolver.php

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[李景山php]每天laravel-20161106|EngineResolver.php相关的知识,希望对你有一定的参考价值。

<?php

namespace Illuminate\View\Engines;

use Closure;
use InvalidArgumentException;

class EngineResolver
{// engineResolver
    /**
     * The array of engine resolvers.
     *
     * @var array
     */
    protected $resolvers = [];// The array of engine resolvers.

    /**
     * The resolved engine instances.
     *
     * @var array
     */
    protected $resolved = [];// The resolved engine instances.

    /**
     * Register a new engine resolver.
     *
     * The engine string typically corresponds to a file extension.
     *
     * @param  string   $engine
     * @param  \Closure  $resolver
     * @return void
     */
    public function register($engine, Closure $resolver)
    {
        unset($this->resolved[$engine]);// first to unset it

        $this->resolvers[$engine] = $resolver;// set it
    }// Register a new engine resolver.
   // change the new register

    /**
     * Resolver an engine instance by name.
     *
     * @param  string  $engine
     * @return \Illuminate\View\Engines\EngineInterface
     * @throws \InvalidArgumentException
     */
    public function resolve($engine)
    {// resolver an engine instance by name.
        if (isset($this->resolved[$engine])) {
            return $this->resolved[$engine];
        }// isset resolved

        if (isset($this->resolvers[$engine])) {
            return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]);
        }// isset resolvers
       // call_user_func has been used

        throw new InvalidArgumentException("Engine $engine not found.");
    }// throw new exception
}


本文出自 “专注php 群号:414194301” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1846650

以上是关于[李景山php]每天laravel-20161106|EngineResolver.php的主要内容,如果未能解决你的问题,请参考以下文章

[李景山php]每天laravel-20161028|Translator.php

[李景山php]每天laravel-20161107|PhpEngine.php

[李景山php]每天laravel-20161106|EngineResolver.php

[李景山php]每天laravel-20161108|ShareErrorsFromSession.php

[李景山php]每天laravel-20160825|Encrypter

[李景山php]每天laravel-20161113|FileViewFinder-1.php