Flow\Template::helper PHP Method

helper() public method

public helper ( $name, $args = [] )
    public function helper($name, $args = array())
    {
        $args = func_get_args();
        $name = array_shift($args);
        try {
            $helper = array('Help', $name);
            if (isset($this->helpers[$name]) && is_callable($this->helpers[$name])) {
                return call_user_func_array($this->helpers[$name], $args);
            } elseif (is_callable($helper)) {
                return call_user_func_array($helper, $args);
            }
        } catch (\Exception $e) {
            throw new \RuntimeException(sprintf('%s in %s line %d', $e->getMessage(), static::NAME, $this->getLineTrace($e)));
        }
        throw new \RuntimeException(sprintf('undefined helper "%s" in %s line %d', $name, static::NAME, $this->getLineTrace()));
    }