Esempio n. 1
0
 public function __construct($token, $compiler)
 {
     $this->_token = $token;
     $this->_compiler = $compiler;
     $this->_id = ++self::$_idCounter;
     $this->_params = $this->_compiler->parseSpacedArguments($token);
     if (strpos($this->_token, '|') !== false) {
         $modifiers = array();
         preg_match_all('#(\\|[\\w]+)+$#is', $token, $modifiers);
         if (!empty($modifiers[0])) {
             $this->_modifiers = explode('|', substr($modifiers[0][0], 1));
             array_pop($this->_params);
         }
     }
 }
Esempio n. 2
0
 protected function _testFileExpressions($path)
 {
     $files = GLOB($path);
     if (empty($files)) {
         $this->fail('files not found in ' . $path);
     }
     foreach ($files as $file) {
         $source = file($file);
         $expectation = file('expectations/' . substr($file, 10));
         foreach ($source as $index => $expression) {
             $expected = trim($expectation[$index]);
             $compiled = $this->_compiler->compileExpression($expression);
             $this->assertEquals($expected, $compiled, 'working with: ' . $expression);
         }
     }
 }
Esempio n. 3
0
File: Slot.php Progetto: solve/slot
 public function processTemplate($templatePath)
 {
     $source = file_get_contents($templatePath);
     return $this->_compiler->compileSource($source);
 }