| Conditions | 3 |
| Paths | 2 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 22 | 4 | protected function createResult(array $data): RelatedResult |
|
| 23 | { |
||
| 24 | 4 | if (!isset($data['query'], $data['value'], $data['link'])) { |
|
| 25 | 1 | throw new GoogleTrendsException( |
|
| 26 | 1 | sprintf( |
|
| 27 | 1 | 'Google ranked list does not contain all keys. Only has: %s', |
|
| 28 | 1 | implode(', ', array_keys($data)) |
|
| 29 | ) |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | 3 | return new RelatedResult( |
|
| 34 | 3 | (string)$data['query'], |
|
| 35 | 3 | (bool)($data['hasData'] ?? false), |
|
| 36 | 3 | (int)$data['value'], |
|
| 37 | 3 | self::TRENDS_URL . (string)$data['link'], |
|
| 38 | 3 | $this->isRisingMetric($data) ? 'RISING' : 'TOP' |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 50 |