Skip to content
This repository was archived by the owner on May 5, 2019. It is now read-only.

Commit c35a428

Browse files
committed
Use pure native compiler object
1 parent 753f32c commit c35a428

File tree

3 files changed

+4
-138
lines changed

3 files changed

+4
-138
lines changed

Diff for: src/Compiler/Compiler.php

-83
This file was deleted.

Diff for: src/Handlebars.php

+4-11
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ public function __construct($options = array())
6464
{
6565
$this->setOptions($options);
6666

67-
$this->compiler = new Compiler\Compiler();
68-
$this->phpCompiler = new Compiler\PhpCompiler();
67+
if( extension_loaded('handlebars') ) {
68+
$this->compiler = new Compiler();
69+
$this->phpCompiler = new Compiler\PhpCompiler();
70+
}
6971

7072
$this->setupBuiltins();
7173
}
@@ -166,15 +168,6 @@ public function getPartials()
166168
*/
167169
public function precompile($tmpl, array $compileOptions = array())
168170
{
169-
// Add current helpers as known helpers
170-
if( !isset($compileOptions['knownHelpers']) ) {
171-
$compileOptions['knownHelpers'] = array();
172-
}
173-
foreach( $this->helpers as $name => $helper ) {
174-
$compileOptions['knownHelpers'][] = $name;
175-
}
176-
177-
// Compile
178171
$opcodes = $this->compiler->compile($tmpl, $compileOptions);
179172
return $this->phpCompiler->compile($opcodes, $compileOptions);
180173
}

Diff for: tests/Compiler/CompilerTest.php

-44
This file was deleted.

0 commit comments

Comments
 (0)