mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
1.4.8
This commit is contained in:
parent
0b192c8399
commit
1ce0315282
@ -1,6 +1,11 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
### 1.4.8 (2013-12-01)
|
||||||
|
|
||||||
|
- Fix #52
|
||||||
|
- Tests++
|
||||||
|
|
||||||
### 1.4.7 (2013-09-19)
|
### 1.4.7 (2013-09-19)
|
||||||
|
|
||||||
- Bug fixes
|
- Bug fixes
|
||||||
|
@ -725,7 +725,14 @@ class Template extends Render
|
|||||||
if ($this->_options & Fenom::DENY_METHODS) {
|
if ($this->_options & Fenom::DENY_METHODS) {
|
||||||
throw new \LogicException("Forbidden to call methods");
|
throw new \LogicException("Forbidden to call methods");
|
||||||
}
|
}
|
||||||
|
do { // parse call-chunks: $var->func()->func()->prop->func()->...
|
||||||
|
if($tokens->is('(')) {
|
||||||
$code .= $this->parseArgs($tokens);
|
$code .= $this->parseArgs($tokens);
|
||||||
|
}
|
||||||
|
if($tokens->is(T_OBJECT_OPERATOR) && $tokens->isNext(T_STRING)) {
|
||||||
|
$code .= '->'.$tokens->next()->getAndNext();
|
||||||
|
}
|
||||||
|
} while($tokens->is('(', T_OBJECT_OPERATOR));
|
||||||
} elseif ($tokens->is(Tokenizer::MACRO_INCDEC)) {
|
} elseif ($tokens->is(Tokenizer::MACRO_INCDEC)) {
|
||||||
$code .= $tokens->getAndNext();
|
$code .= $tokens->getAndNext();
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,3 +274,21 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Helper {
|
||||||
|
|
||||||
|
public $word = 'helper';
|
||||||
|
|
||||||
|
public function __construct($word) {
|
||||||
|
$this->word = $word;
|
||||||
|
$this->self = $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function chunk() {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString() {
|
||||||
|
return $this->word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -34,7 +34,18 @@ class TemplateTest extends TestCase
|
|||||||
$obj->name = "Object";
|
$obj->name = "Object";
|
||||||
$obj->list = $a;
|
$obj->list = $a;
|
||||||
$obj->c = "c";
|
$obj->c = "c";
|
||||||
$b = array("b" => array("c" => "Username", "c_char" => "c", "mcp" => "Master", 'm{$c}p' => "Unknown", 'obj' => $obj), "c" => "c");
|
// $world = new
|
||||||
|
$b = array(
|
||||||
|
"b" => array(
|
||||||
|
"c" => "Username",
|
||||||
|
"c_char" => "c",
|
||||||
|
"mcp" => "Master",
|
||||||
|
'm{$c}p' => "Unknown",
|
||||||
|
'obj' => $obj
|
||||||
|
),
|
||||||
|
"c" => "c",
|
||||||
|
"world" => new Helper('world')
|
||||||
|
);
|
||||||
$c = array_replace_recursive($b, array("b" => array(3 => $b["b"], 4 => "Mister")));
|
$c = array_replace_recursive($b, array("b" => array(3 => $b["b"], 4 => "Mister")));
|
||||||
return array(
|
return array(
|
||||||
array('hello, {$a}!', $a, 'hello, World!'),
|
array('hello, {$a}!', $a, 'hello, World!'),
|
||||||
@ -83,6 +94,7 @@ class TemplateTest extends TestCase
|
|||||||
$b, 'hello, Username!'),
|
$b, 'hello, Username!'),
|
||||||
array('hello, {"World"}!', $a, 'hello, World!'),
|
array('hello, {"World"}!', $a, 'hello, World!'),
|
||||||
array('hello, {"W{$a}d"}!', $a, 'hello, WWorldd!'),
|
array('hello, {"W{$a}d"}!', $a, 'hello, WWorldd!'),
|
||||||
|
array('hello, {$world->chunk(1)->self->chunk("new")}!', $b, 'hello, world!'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user