コード例 #1
0
ファイル: BladeInstance.php プロジェクト: ngangchill/blade-1
 /**
  * Get the laravel view factory.
  *
  * @return Factory
  */
 protected function getViewFactory()
 {
     if ($this->factory) {
         return $this->factory;
     }
     $resolver = new EngineResolver();
     $resolver->register("blade", function () {
         if (!is_dir($this->cache)) {
             mkdir($this->cache, 0777, true);
         }
         $blade = new BladeCompiler(new Filesystem(), $this->cache);
         Blade::registerDirectives($blade);
         return new CompilerEngine($blade);
     });
     $this->factory = new Factory($resolver, $this->getViewFinder(), new Dispatcher());
     return $this->factory;
 }
コード例 #2
0
ファイル: BladeTest.php プロジェクト: jawngee/Stem
 public function testCustomCompiler()
 {
     Blade::extend(function ($value) {
         return str_replace("Original", "New", $value);
     });
     $result = Blade::render("view12");
     $this->assertSame(file_get_contents(__DIR__ . "/views/view12.html"), $result);
 }
コード例 #3
0
ファイル: Email.php プロジェクト: duncan3dc/swiftmailer
 /**
  * Add content to the body of the message.
  *
  * @param string $view The name of the view to use
  * @param array $params Parameters to pass to the view
  *
  * @return static
  */
 public function addView($view, array $params = null)
 {
     if (!is_array($params)) {
         $params = [];
     }
     $content = Blade::make($view, $params);
     return $this->addContent($content);
 }
コード例 #4
0
ファイル: AbstractTest.php プロジェクト: jawngee/Stem
 public function setUp()
 {
     $this->blade = new BladeCompiler(new Filesystem(), "/tmp/phpunit/cache/views");
     Blade::registerDirectives($this->blade);
 }