1 | <?php |
||
25 | class GitHubDocsImport extends Command |
||
26 | { |
||
27 | /** |
||
28 | * The name and signature of the console command. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $signature = 'docs:import {?--force}'; |
||
33 | |||
34 | /** |
||
35 | * The console command description. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $description = 'Import documentation from GitHub.'; |
||
40 | |||
41 | /** |
||
42 | * Execute the console command. |
||
43 | * |
||
44 | * @param GitHubDocsManager $manager |
||
45 | * @param GitHubConfigRepository $config |
||
46 | * @return void |
||
47 | * @throws \Github\Exception\ErrorException |
||
48 | * @throws \Github\Exception\InvalidArgumentException |
||
49 | * @throws \RuntimeException |
||
50 | */ |
||
51 | public function handle(GitHubDocsManager $manager, GitHubConfigRepository $config): void |
||
73 | |||
74 | /** |
||
75 | * @param string $org |
||
76 | * @param string $repo |
||
77 | * @param string $branch |
||
78 | * @return Collection |
||
79 | */ |
||
80 | private function getDocsCurrentState(string $org, string $repo, string $branch) |
||
88 | |||
89 | /** |
||
90 | * @param GitHubDocsManager $manager |
||
91 | * @param GitHubConfigRepository $config |
||
92 | * @param Collection $exists |
||
93 | * @return Collection|DocsCollection |
||
94 | * @throws \Github\Exception\ErrorException |
||
95 | * @throws \Github\Exception\InvalidArgumentException |
||
96 | * @throws \RuntimeException |
||
97 | */ |
||
98 | private function getFilesForSync(GitHubDocsManager $manager, GitHubConfigRepository $config, Collection $exists) |
||
112 | |||
113 | /** |
||
114 | * @param DocsCollection $files |
||
115 | * @param GitHubDocsManager $manager |
||
116 | * @param GitHubConfigRepository $config |
||
117 | * @throws \Github\Exception\ErrorException |
||
118 | * @throws \Github\Exception\InvalidArgumentException |
||
119 | */ |
||
120 | private function sync(DocsCollection $files, GitHubDocsManager $manager, GitHubConfigRepository $config): void |
||
154 | |||
155 | /** |
||
156 | * @param string $org |
||
157 | * @param string $repo |
||
158 | * @param string $branch |
||
159 | * @param string $file |
||
160 | * @return \Illuminate\Database\Eloquent\Model|Docs |
||
161 | */ |
||
162 | private function getDocsModel(string $org, string $repo, string $branch, string $file) |
||
172 | } |
||
173 |