| Conditions | 7 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Bardex\Elastic; |
||
| 25 | protected function extractDocuments(array $response) |
||
| 26 | { |
||
| 27 | $results = []; |
||
| 28 | if (isset($response['hits']['hits'])) { |
||
| 29 | foreach ($response['hits']['hits'] as $hit) { |
||
| 30 | $row = $hit['_source']; |
||
| 31 | if (isset($hit['fields'])) { // script fields |
||
| 32 | foreach ($hit['fields'] as $field => $data) { |
||
| 33 | if (count($data) == 1) { |
||
| 34 | $row[$field] = array_shift($data); |
||
| 35 | } else { |
||
| 36 | $row[$field] = $data; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 | if ($this->filter($row)) { |
||
| 41 | $results[] = $row; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 | return $results; |
||
| 46 | } |
||
| 47 | |||
| 67 | } |