Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function search(string $url): array |
||
29 | { |
||
30 | $json = file_get_contents($url); |
||
31 | |||
32 | $myArray = json_decode($json, true); |
||
33 | $result = $myArray['query']['search']; |
||
34 | if (empty($result)) { |
||
35 | return []; |
||
36 | } |
||
37 | |||
38 | foreach ($result as $res) { |
||
39 | $titles[] = trim($res['title']); |
||
40 | } |
||
41 | |||
42 | return $titles; |
||
|
|||
43 | } |
||
45 |