| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | public function getPageTitles(): array |
||
| 50 | { |
||
| 51 | if (!$this->url) { |
||
| 52 | throw new ConfigException('CirrusSearch null URL'); |
||
| 53 | } |
||
| 54 | |||
| 55 | $json = file_get_contents($this->url); |
||
| 56 | if (false === $json) { |
||
| 57 | return []; |
||
| 58 | } |
||
| 59 | |||
| 60 | $myArray = json_decode($json, true); |
||
| 61 | $result = $myArray['query']['search']; |
||
| 62 | if (empty($result)) { |
||
| 63 | return []; |
||
| 64 | } |
||
| 65 | |||
| 66 | foreach ($result as $res) { |
||
| 67 | $titles[] = trim($res['title']); |
||
| 68 | } |
||
| 69 | |||
| 70 | return $titles; |
||
|
|
|||
| 71 | } |
||
| 73 |