1 | <?php |
||
10 | class TwoChanDriver extends AbstractDriver |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $encoding = 'Shift_JIS'; |
||
16 | |||
17 | /** |
||
18 | * get threads. |
||
19 | * |
||
20 | * @return \Illuminate\Support\Collection |
||
21 | * @throws MonarException |
||
22 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
23 | */ |
||
24 | public function threads(): Collection |
||
30 | |||
31 | /** |
||
32 | * get messages. |
||
33 | * |
||
34 | * @param int|null $start |
||
35 | * @param int|null $end |
||
36 | * |
||
37 | * @return \Illuminate\Support\Collection |
||
38 | * @throws MonarException |
||
39 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
40 | */ |
||
41 | public function messages(?int $start = null, ?int $end = null): Collection |
||
47 | |||
48 | /** |
||
49 | * post message. |
||
50 | * |
||
51 | * @param string $name |
||
52 | * @param string $email |
||
53 | * @param string|null $text |
||
54 | * |
||
55 | * @return mixed|string |
||
56 | * @throws MonarException |
||
57 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
58 | */ |
||
59 | public function post(string $name = '', string $email = 'sage', ?string $text = null) |
||
94 | |||
95 | /** |
||
96 | * parse url. |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | protected function parse(): void |
||
116 | |||
117 | /** |
||
118 | * parse dat collection. |
||
119 | * |
||
120 | * @param string $body |
||
121 | * |
||
122 | * @return \Illuminate\Support\Collection |
||
123 | */ |
||
124 | protected function parseDatCollection(string $body, ?int $end = null): Collection |
||
151 | |||
152 | /** |
||
153 | * parse threads collection. |
||
154 | * |
||
155 | * @param string $body |
||
156 | * |
||
157 | * @return \Illuminate\Support\Collection |
||
158 | */ |
||
159 | protected function parseThreadsCollection(string $body): Collection |
||
179 | |||
180 | /** |
||
181 | * build message url. |
||
182 | * |
||
183 | * @param int $start |
||
184 | * @param int|null $end |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | protected function messagesUrl(int $start = 1, ?int $end = null): string |
||
192 | |||
193 | /** |
||
194 | * build thread url. |
||
195 | * |
||
196 | * @return string |
||
197 | */ |
||
198 | protected function threadsUrl(): string |
||
202 | |||
203 | /** |
||
204 | * build post url. |
||
205 | * |
||
206 | * @return string |
||
207 | */ |
||
208 | protected function postUrl(): string |
||
212 | |||
213 | /** |
||
214 | * 書き込み確認かどうか. |
||
215 | * |
||
216 | * @param string $html |
||
217 | * |
||
218 | * @return bool |
||
219 | */ |
||
220 | private function confirm(string $html): bool |
||
224 | } |
||
225 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.