/**
  * startMiddlewarePlugin method
  *
  * @param Application $app
  */
 protected function startProvideCodexPluginServicePlugin($app)
 {
     $this->onRegister('codex', function ($app) {
         $this->projectConfig($this->project);
         $this->documentAttributes($this->document);
         foreach ($this->views as $k => $v) {
             $this->view($k, $v);
         }
         // todo ex tend
         foreach ($this->routeExclusions as $exclusion) {
             $this->excludeRoute($exclusion);
         }
         foreach ($this->extend as $target => $extensions) {
             foreach ($extensions as $name => $extension) {
                 Codex::registerExtension($target, $name, $extension);
             }
         }
     });
 }
 protected function registerCodex()
 {
     Codex::registerExtension('codex', 'menus', 'codex.menus');
     Codex::registerExtension('codex', 'theme', 'codex.helpers.theme');
     Codex::registerExtension('codex', 'cache', 'codex.helpers.cache');
     Codex::registerExtension('codex', 'projects', 'codex.projects');
     Codex::registerExtension('codex.project', 'refs', 'codex.refs');
     Codex::registerExtension('codex.ref', 'documents', 'codex.documents');
 }