示例#1
0
 public function __construct(string $viewPath = null, $loader = null)
 {
     $this->viewPath = rtrim($viewPath, '/ ') . '/';
     if (!is_null($loader)) {
         $this->loader = $loader;
     } else {
         $this->loader = Services::loader(true);
     }
 }
 /**
  * Loads a helper file into memory. Supports namespaced helpers,
  * both in and out of the 'helpers' directory of a namespaced directory.
  *
  * @param string $filename
  *
  * @return string
  */
 function load_helper(string $filename) : string
 {
     $loader = \App\Config\Services::loader(true);
     $path = $loader->locateFile($filename, 'helpers');
     if (!empty($path)) {
         include $path;
     }
 }