LightnCandy option: FLAG_METHOD

Support object instance attribute access; you must apply this if your data contains object.

This flag cause bad rendering performance, do not enable it unless you need this feature anyway.

Sample Codes

The default behavior: only do associative array lookup

Data:
array(
  "foo" => array(
    "key" => "OK"
  ),
  "date" => new DateTime()
)
Template:
{{foo.key}}, {{date.getTimestamp}}
Result:
OK, 
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo.key}}, {{date.getTimestamp}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => array(
    "key" => "OK"
  ),
  "date" => new DateTime()
);
echo $render($data);

executes method of an instance

Used option: FLAG_METHOD

Data:
array(
  "foo" => array(
    "key" => "OK"
  ),
  "date" => new DateTime()
)
Template:
{{foo.key}}, {{date.getTimestamp}}
Result:
OK, 1647868442
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo.key}}, {{date.getTimestamp}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_METHOD
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => array(
    "key" => "OK"
  ),
  "date" => new DateTime()
);
echo $render($data);