protected function callFunction($function, array $params = [])
    {
        if (is_string($function)) {
            $function = trim($function);
            if (strpos($function, '.') !== false) {
                $function = explode('.', $function);
            } else {
                return $this->template->getSnippet($function, $params);
            }
        }
        if (is_array($function)) {
            if ($function[0] === 'context') {
                $function[0] = $this->template->getContext();
                return call_user_func_array($function, $params);
            } elseif (is_string($function[0])) {
                if (class_exists('\rock\di\Container') && Container::exists($function[0])) {
                    $function[0] = Container::load($function[0]);
                }
                return call_user_func_array($function, $params);
            }
        }
        return call_user_func_array($function, $params);
    }