@@ -106,92 +106,4 @@ private function extractRepositoryFullname(string $issue_html_url): string
106106
107107 return $ repository_fullname ;
108108 }
109-
110- // TODO
111- // public function buildLangs(array $repositories): void
112- // {
113- //
114- // $repositoriesByLanguage = [];
115- //
116- // // Проходимся по всем репозиториям
117- // foreach ($json_data as $line) {
118- // echo 'Line : https://api.github.com/repos/' . $line . "\n";
119- // // Записываем информацию о репозитории в файл data/repositories.json
120- // // Это необходимо для главной страницы
121- //
122- // $opts = [
123- // 'http' => [
124- // 'method' => 'GET',
125- // 'header' => [
126- // 'User-Agent: PHP',
127- // ],
128- // ],
129- // ];
130- //
131- // $context = stream_context_create($opts);
132- // $repositoryJson = file_get_contents('https://api.github.com/repos/' . $line, false, $context);
133- // $repository = json_decode($repositoryJson, true);
134- //
135- // $repositoryData = [
136- // 'html_url' => $repository['html_url'], // Ex: "https://github.com/octocat/Hello-World"
137- // 'full_name' => $repository['full_name'], // Ex: "octocat/Hello-World"
138- // 'description' => $repository['description'], // Ex: "This your first repo!"
139- // 'language' => $repository['language'], // Ex: null,
140- // 'stargazers_count' => $repository['stargazers_count'], // Ex: 80,
141- // 'open_issues_count' => $repository['open_issues_count'], // Ex: 0,
142- // 'open_issues' => $repository['open_issues'], // Ex: 0,
143- // 'updated_at' => $repository['updated_at'], // Ex: "2011-01-26T19:14:43Z",
144- // ];
145- //
146- // print_r($repositoryData);
147- //
148- // // Конетент для главной страницы
149- // $indexContent .= '<h2>' . $repositoryData['full_name'] . '</h2>';
150- // $indexContent .= '<p>' . $repositoryData['description'] . '</p>';
151- //
152- // $repositoriesByLanguage[$repositoryData['language']][] = $repositoryData['full_name'];
153- //
154- // // Записываем ищуйки в общий файл
155- // }
156- //
157- //
158- // file_put_contents($langFile, $str, FILE_APPEND);
159- //
160- // file_put_contents('index.html', $indexContent);
161- //
162- //
163- // foreach ($repositoriesByLanguage as $lang => $repositories) {
164- // if (strlen($lang) < 1) {
165- // $lang = 'other';
166- // }
167- //
168- // print_r('Language: ' . $lang);
169- //
170- // $langFile = 'lang/' . $lang . '.html';
171- // if (file_exists($langFile)) {
172- // $status = unlink($langFile) ? 'The file ' . $langFile . ' has been deleted' . "\n" : 'Error deleting ' . $langFile . "\n";
173- // echo $status;
174- // }
175- //
176- //
177- // // TODO Пишем шапку файла
178- // file_put_contents($langFile, '<h1>Lang: ' . $lang . '</h1>' . "\n");
179- //
180- // foreach ($repositories as $repository) {
181- // print_r('Repository: ' . $repository . "\n");
182- //
183- // $issuesJson = file_get_contents('https://api.github.com/repos/' . $repository . '/issues?state=open&sort=updated&labels=good%20first%20issue', false, $context);
184- // $issues = json_decode($issuesJson, true);
185- //
186- // foreach ($issues as $issue) {
187- // print_r('Issue #' . $issue['number'] . ' ' . $issue['title'] . "\n");
188- //
189- // $str = '<p>' . $issue['title'] . '</p>';
190- // $str .= '<p>' . $issue['html_url'] . '</p>';
191- //
192- // file_put_contents($langFile, $str, FILE_APPEND);
193- // }
194- // }
195- // }
196- // }
197109}
0 commit comments