| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Keywords extends Provider |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Get recommendations for query word. |
||
| 12 | * |
||
| 13 | * @param string $query |
||
| 14 | * @return array|bool |
||
| 15 | */ |
||
| 16 | public function recommendedFor($query) |
||
| 17 | { |
||
| 18 | $requestOptions = [ |
||
| 19 | 'scope' => 'pins', |
||
| 20 | 'query' => $query, |
||
| 21 | ]; |
||
| 22 | |||
| 23 | $result = $this->get(UrlBuilder::RESOURCE_SEARCH, $requestOptions); |
||
| 24 | |||
| 25 | return empty($result) ? [] : $this->getKeywordsFromRequest($result); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param bool|array $response |
||
| 30 | * @return bool|array |
||
| 31 | */ |
||
| 32 | protected function getKeywordsFromRequest($response) |
||
| 47 | } |
||
| 48 | } |
||
| 49 |