protected function getRefList(Project $project) { $list = []; foreach ($project->getSortedRefs() as $ref) { $list[$ref] = $project->url(null, $ref); } return $list; }
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); }
/** * handle * * @param \Docit\Core\Project $project */ public function handle(Project $project) { $that = $this; Project::macro('getPhpdocDocument', function () use($that) { /** @var Project $this */ return $that->container->make(PhpdocDocument::class, ['project' => $this, 'factory' => $this->getFactory()]); }); }
/** * handle * * @param \Docit\Core\Project $project */ public function handle(Project $project) { $that = $this; // Add a method on the project class that creates a new GitSync for that specific project Project::macro('githubSync', function () { /** @var Project $this */ return app('docit.hooks.github.factory')->githubSync($this); }); // Add a method on the project class that creates a new GitSync for that specific project Project::macro('githubShow', function () use($that) { /** @var Project $this */ return app('docit.hooks.github.factory')->githubShow($this); }); }
/** * 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()); } }
/** * 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()])); }
public function getVersionsToSync() { $versionsToSync = []; $currentVersions = $this->project->getRefs(); $allowedVersionRange = new expression($this->setting('sync.sync.versions')); $tags = $this->github->repositories()->tags($this->setting('owner'), $this->setting('repository')); foreach ($tags as $tag) { try { $version = new version($tag['name']); } catch (SemVerException $e) { continue; } if ($version->satisfies($allowedVersionRange) === false or in_array($version->getVersion(), $currentVersions, true)) { continue; } $versionsToSync[] = $version; } return $versionsToSync; }
public function githubShow(Project $project) { return new GitShow($this, $project, $this->githubClient(), $project->getFiles(), $this->cache); }
/** * Returns an array of parent menu items * * @return array */ public function getBreadcrumb() { return $this->project->getDocumentsMenu()->getBreadcrumbToHref($this->url()); }
public function setting($key, $default = null) { return array_get($this->project->config('github_hook_settings'), $key, $default); }