Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class PhpRenderer implements Renderer, TreeRendererInterface
*/
private $__varsCache = array();

/**
* @var array Cache for the plugin call
*/
private $__pluginCache = array();

/**
* Constructor.
*
Expand Down Expand Up @@ -350,11 +355,13 @@ public function plugin($name, array $options = null)
*/
public function __call($method, $argv)
{
$helper = $this->plugin($method);
if (is_callable($helper)) {
return call_user_func_array($helper, $argv);
if (!isset($this->__pluginCache[$method])) {
$this->__pluginCache[$method] = $this->plugin($method);
}
if (is_callable($this->__pluginCache[$method])) {
return call_user_func_array($this->__pluginCache[$method], $argv);
}
return $helper;
return $this->__pluginCache[$method];
}

/**
Expand Down

0 comments on commit 42477b6

Please sign in to comment.