Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit c357ce5

Browse files
authored
Render only PHP programming language (#200)
1 parent 21af794 commit c357ce5

File tree

4 files changed

+24
-110
lines changed

4 files changed

+24
-110
lines changed

src/Generator.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ public function run(): void
2626
mkdir($this->root_path . '/lang');
2727
}
2828

29+
// todo
30+
$language = ProgrammingLanguage::PHP;
2931
// Generate HTML-page with issues for each proramming language
30-
foreach (ProgrammingLanguage::cases() as $language) {
31-
$issues = $this->github_api_client->searchIssuesWithGoodFirtsIssueTag($language->value);
32-
print_r(PHP_EOL);
33-
print_r($language->name . ' issues count: ' . count($issues) . PHP_EOL);
32+
// foreach (ProgrammingLanguage::cases() as $language) {
33+
$issues = $this->github_api_client->searchIssuesWithGoodFirtsIssueTag($language->value);
34+
print_r(PHP_EOL);
35+
print_r($language->name . ' issues count: ' . count($issues) . PHP_EOL);
3436

35-
$renderer = new Renderer($this->root_path);
36-
$renderer->renderPage($issues, $language);
37+
$renderer = new Renderer($this->root_path);
38+
$renderer->renderPage($issues, $language);
3739

38-
sleep(2);
39-
}
40+
sleep(2);
41+
// }
4042
}
4143
}

src/References/ProgrammingLanguage.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ enum ProgrammingLanguage: string
99
case PHP = 'PHP';
1010
case Python = 'Python';
1111
case JavaScript = 'JavaScript';
12-
// case Java = 'Java';
13-
// case HTML = 'HTML';
14-
// case JupyterNotebook = 'Jupyter Notebook';
15-
// case TypeScript = 'TypeScript';
16-
// case CSharp = 'C#';
17-
// case CPlusPlus = 'C++';
18-
// case CSS = 'CSS';
12+
case Java = 'Java';
13+
case HTML = 'HTML';
14+
case JupyterNotebook = 'Jupyter Notebook';
15+
case TypeScript = 'TypeScript';
16+
case CSharp = 'C#';
17+
case CPlusPlus = 'C++';
18+
case CSS = 'CSS';
1919
case Go = 'Go';
20-
// case Ruby = 'Ruby';
20+
case Ruby = 'Ruby';
2121
}

src/Renderer.php

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Templates/main.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ <h1 class="h5 text-uppercase fw-bold mt-2">Good First Issue</h1>
6060
<a href="./index.html" class="btn btn-sm btn-outline-secondary me-2" type="button">
6161
PHP
6262
</a>
63-
<a href="./lang/Python.html" class="btn btn-sm btn-outline-secondary me-2" type="button">
64-
Python
65-
</a>
66-
<a href="./lang/JavaScript.html" class="btn btn-sm btn-outline-secondary me-2" type="button">
67-
JavaScript
68-
</a>
63+
<!-- <a href="./lang/Python.html" class="btn btn-sm btn-outline-secondary me-2" type="button">-->
64+
<!-- Python-->
65+
<!-- </a>-->
66+
<!-- <a href="./lang/JavaScript.html" class="btn btn-sm btn-outline-secondary me-2" type="button">-->
67+
<!-- JavaScript-->
68+
<!-- </a>-->
6969
<!-- <a href="./lang/Java.html" class="btn btn-sm btn-outline-secondary me-2" type="button">-->
7070
<!-- Java-->
7171
<!-- </a>-->

0 commit comments

Comments
 (0)