/**
  * handle
  *
  * @param \Docit\Core\Project $project
  */
 public function handle(Project $project, Menu $menu)
 {
     if (!$project->config('enable_phpdoc_hook', false)) {
         return;
     }
     $node = $menu->add('phpdoc', $project->config('phpdoc_hook_settings.menu_name'));
     $node->setMeta('icon', $project->config('phpdoc_hook_settings.menu_icon'));
     $node->setAttribute('href', route('docit.phpdoc', ['projectName' => $project->getName(), 'ref' => $project->getRef()]));
 }
Example #2
0
 /**
  * Handle the hook.
  *
  * @param  \Docit\Core\Project $project
  * @return void
  */
 public function handle(Project $project)
 {
     if (!$project->config('enable_filesystem_hook')) {
         $project->setFiles(new LocalFilesystem());
     }
     $disk = $project->config('default_filesystem_disk');
     $settings = $project->config('filesystem_hook_settings');
     if (!isset($settings[$disk])) {
         return;
     }
     $files = $this->fsm->disk($disk);
     if (isset($files)) {
         $project->setFiles($files);
         $project->setPath($project->getName());
     }
 }
Example #3
0
 /**
  * @param \Docit\Core\Project                   $project
  * @param \Github\Client                         $github
  * @param \Illuminate\Contracts\Filesystem\Filesystem      $files
  * @param \Illuminate\Contracts\Cache\Repository $cache
  */
 public function __construct(Project $project, Client $github, Filesystem $files, Cache $cache)
 {
     $this->project = $project;
     $this->github = $github;
     $this->files = $files;
     $this->cache = $cache;
     $this->projectConfig = $project->config();
 }
Example #4
0
 public function __construct(Factory $docit, Filesystem $files, Project $project, Container $container)
 {
     ini_set('memory_limit', '2G');
     $path = $project->path($project->config('phpdoc_hook_settings.path'));
     $pathName = 'phpdoc';
     parent::__construct($docit, $files, $project, $container, $path, $pathName);
     $this->parser = new PhpdocParser();
     $this->mergeAttributes($project->config('phpdoc_hook_settings'));
     $this->setPath($path);
 }
Example #5
0
 /**
  * Render the document.
  *
  * This will run all document:render hooks and then return the
  * output. Should be called within a view.
  *
  * @return string
  */
 public function render()
 {
     $this->runHook('document:render', [$this]);
     $fsettings = $this->project->config('filters_settings');
     $filters = Extensions::getFilters($this->getProject()->config('filters'));
     if (count($filters) > 0) {
         foreach ($filters as $name => $filter) {
             if ($filter instanceof \Closure) {
                 call_user_func_array($filter, [$this, isset($fsettings[$name]) ? $fsettings[$name] : []]);
             } else {
                 $instance = app()->make($filter);
                 call_user_func_array([$instance, 'handle'], [$this, isset($fsettings[$name]) ? $fsettings[$name] : []]);
             }
         }
     }
     return $this->content;
 }
Example #6
0
 public function setting($key, $default = null)
 {
     return array_get($this->project->config('github_hook_settings'), $key, $default);
 }