protected function registerSessionBinder()
    {
        list($app, $me) = array($this->app, $this);

        $app->booted(function() use ($app, $me)
        {
            // If the current session has an "errors" variable bound to it, we will share
            // its value with all view instances so the views can easily access errors
            // without having to bind. An empty bag is set when there aren't errors.
            if ($me->sessionHasErrors($app))
            {
                $errors = $app['session.store']->get('errors');

                $app['view']->share('errors', $errors);
            }

            // Putting the errors in the view for every view allows the developer to just
            // assume that some errors are always available, which is convenient since
            // they don't have to continually run checks for the presence of errors.
            else
            {
                $app['view']->share('errors', new ViewErrorBag);
            }
        });
    }