@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | foreach ( $objects as $object ) { |
| 39 | 39 | $this->addResult([ "title" => $object ]); |
| 40 | 40 | } |
| 41 | - } else |
|
| 42 | - $this->elements=\array_merge($this->elements, $objects); |
|
| 41 | + } else { |
|
| 42 | + $this->elements=\array_merge($this->elements, $objects); |
|
| 43 | + } |
|
| 43 | 44 | return $this; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | $result=array (); |
| 48 | 49 | foreach ( $this->elements as $element ) { |
| 49 | 50 | if ($element instanceof SearchResult) { |
| 50 | - if ($element->search($query, $field) !== false) |
|
| 51 | - $result[]=$element->asArray(); |
|
| 51 | + if ($element->search($query, $field) !== false) { |
|
| 52 | + $result[]=$element->asArray(); |
|
| 53 | + } |
|
| 52 | 54 | } else { |
| 53 | 55 | if (\array_key_exists($field, $element)) { |
| 54 | 56 | $value=$element[$field]; |
@@ -66,8 +68,9 @@ discard block |
||
| 66 | 68 | |
| 67 | 69 | public function search($query, $field="title") { |
| 68 | 70 | $result=$this->_search($query, $field); |
| 69 | - if ($result === false) |
|
| 70 | - $result=NULL; |
|
| 71 | + if ($result === false) { |
|
| 72 | + $result=NULL; |
|
| 73 | + } |
|
| 71 | 74 | return new SearchResults($result); |
| 72 | 75 | } |
| 73 | 76 | |