1 | <?php |
||
8 | class ShitarabaDriver extends AbstractDriver |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $baseUrl = 'https://jbbs.shitaraba.net'; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $encoding = 'EUC-JP'; |
||
19 | |||
20 | /** |
||
21 | * get threads. |
||
22 | * |
||
23 | * @return \Illuminate\Support\Collection |
||
24 | * @throws MonarException |
||
25 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
26 | */ |
||
27 | public function threads(): Collection |
||
33 | |||
34 | /** |
||
35 | * get messages. |
||
36 | * |
||
37 | * @param int|null $start |
||
38 | * @param int|null $end |
||
39 | * |
||
40 | * @return \Illuminate\Support\Collection |
||
41 | * @throws MonarException |
||
42 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
43 | */ |
||
44 | public function messages(?int $start = null, ?int $end = null): Collection |
||
50 | |||
51 | /** |
||
52 | * post message. |
||
53 | * |
||
54 | * @param string $name |
||
55 | * @param string $email |
||
56 | * @param string|null $text |
||
57 | * |
||
58 | * @return string |
||
59 | * @throws MonarException |
||
60 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
61 | */ |
||
62 | public function post(?string $name = '', ?string $email = '', ?string $text = null): string |
||
97 | |||
98 | /** |
||
99 | * parse url. |
||
100 | * |
||
101 | * @return void |
||
102 | */ |
||
103 | protected function parse(): void |
||
115 | |||
116 | /** |
||
117 | * parse dat collection. |
||
118 | * |
||
119 | * @param string $body |
||
120 | * @param int|null $start |
||
121 | * @param int|null $end |
||
122 | * |
||
123 | * @return \Illuminate\Support\Collection |
||
124 | */ |
||
125 | protected function parseDatCollection(string $body, ?int $start = null, ?int $end = null): Collection |
||
137 | |||
138 | /** |
||
139 | * parse threads collection. |
||
140 | * |
||
141 | * @param string $body |
||
142 | * |
||
143 | * @return \Illuminate\Support\Collection |
||
144 | */ |
||
145 | protected function parseThreadsCollection(string $body): Collection |
||
166 | |||
167 | /** |
||
168 | * build message url. |
||
169 | * |
||
170 | * @param int $start |
||
171 | * @param int|null $end |
||
172 | * |
||
173 | * @return string |
||
174 | */ |
||
175 | protected function messagesUrl(?int $start = null, ?int $end = null): string |
||
190 | |||
191 | /** |
||
192 | * build thread url. |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | protected function threadsUrl(): string |
||
200 | |||
201 | /** |
||
202 | * build post url. |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | protected function postUrl(): string |
||
210 | |||
211 | /** |
||
212 | * 書き込み確認かどうか. |
||
213 | * |
||
214 | * @param string $html |
||
215 | * |
||
216 | * @return bool |
||
217 | */ |
||
218 | private function confirm(string $html): bool |
||
222 | |||
223 | /** |
||
224 | * @param string $html |
||
225 | * |
||
226 | * @return bool |
||
227 | */ |
||
228 | private function isError(string $html): bool |
||
232 | } |
||
233 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.