$lexer->setEnvironment($this);
}
- public function tokenize($source, $name)
+ public function tokenize($source, $name = null)
{
return $this->getLexer()->tokenize($source, $name);
}
return $this->getCompiler()->compile($node)->getSource();
}
- public function compileSource($source, $name)
+ public function compileSource($source, $name = null)
{
return $this->compile($this->parse($this->tokenize($source, $name)));
}
*
* @return Twig_TokenStream A token stream instance
*/
- public function tokenize($code, $filename = 'n/a')
+ public function tokenize($code, $filename = null)
{
if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
$mbEncoding = mb_internal_encoding();
return $tokens;
}
// empty array, call again
- else if (empty($tokens)) {
+ elseif (empty($tokens)) {
return $this->nextToken();
}
// if we have multiple items we push them to the buffer
- else if (count($tokens) > 1) {
+ elseif (count($tokens) > 1) {
$first = array_shift($tokens);
$this->pushedBack = $tokens;