/** * Register the helper for view template engine. * * @param mixed $name * @param Closure $callback * @return Closure */ public function register($name, \Closure $callback) { if (array_key_exists($name, $this->helpers) || method_exists($this, $name)) { throw new \InvalidArgumentException('Helper name already registered!'); } if (!$this->app->isValidMethodName($name)) { throw new \InvalidArgumentException('Invalid helper function name!'); } $this->helpers[$name] = $callback; }