protected function registerViewEvent(string $view)
    {
        if ($this->has($view)) {
            $class = $this->get($view);

            if (is_callable($class)) {
                return $class($this);
            }

            $this->viewShared = $this->container()->make($class);

            if (!method_exists($this->viewShared, 'creating')) {
                throw new ViewEventNotFoundException("Event not resgistered for the view $view.");
            }
            $this->viewShared->creating($this);
        }
    }