lib/Loader.php
function load($name): string {
    if (!isset($this->views[$name])) {
      $cacheKey = [__CLASS__, $name];
      $viewRenderer = $this->viewRenderer;

      /** @var \yii\caching\Cache $cache */
      $cache = $viewRenderer->cache;
      if ($viewRenderer->enableCaching && $cache->exists($cacheKey))
        $output = $cache->get($cacheKey);
      else {
        $path = FileHelper::localize($this->findViewFile($name));
        if (!is_file($path)) throw new InvalidCallException("The view file '$path' does not exist.");

        $output = @file_get_contents($path);
        if ($viewRenderer->enableCaching) $cache->set($cacheKey, $output, $viewRenderer->cachingDuration);
      }

      $this->views[$name] = $output;
    }

    return $this->views[$name];
  }
function load($name): string {
    if (!isset($this->views[$name])) {
      $cacheKey = [__CLASS__, $name];
      $viewRenderer = $this->viewRenderer;

      /** @var \yii\caching\Cache $cache */
      $cache = $viewRenderer->cache;
      if ($viewRenderer->enableCaching && $cache->exists($cacheKey))
        $output = $cache->get($cacheKey);
      else {
        $path = FileHelper::localize($this->findViewFile($name));
        if (!is_file($path)) throw new InvalidCallException("The view file '$path' does not exist.");

        $output = @file_get_contents($path);
        if ($viewRenderer->enableCaching) $cache->set($cacheKey, $output, $viewRenderer->cachingDuration);
      }

      $this->views[$name] = $output;
    }

    return $this->views[$name];
  }
function load ( $ name ) : string { if ( ! isset ( $ this -> views [ $ name ] ) ) { $ cacheKey = [ __CLASS__ , $ name ] ; $ viewRenderer = $ this -> viewRenderer ; /** @var \yii\caching\Cache $cache */ $ cache = $ viewRenderer -> cache ; if ( $ viewRenderer -> enableCaching && $ cache -> exists ( $ cacheKey ) ) $ output = $ cache -> get ( $ cacheKey ) ; else { $ path = FileHelper :: localize ( $ this -> findViewFile ( $ name ) ) ; if ( ! is_file ( $ path ) ) throw new InvalidCallException ( "The view file '$path' does not exist." ) ; $ output = @ file_get_contents ( $ path ) ; if ( $ viewRenderer -> enableCaching ) $ cache -> set ( $ cacheKey , $ output , $ viewRenderer -> cachingDuration ) ; } $ this -> views [ $ name ] = $ output ; } return $ this -> views [ $ name ] ; }
Loads the view with the specified name.
@param string $name The view name.
@return string The view contents.
@throws InvalidCallException Unable to locate the view file.
Loads the view with the specified name .