@@ -29,60 +29,60 @@ |
||
| 29 | 29 | |
| 30 | 30 | class SearchResult implements ISearchResult { |
| 31 | 31 | |
| 32 | - protected $result = [ |
|
| 33 | - 'exact' => [], |
|
| 34 | - ]; |
|
| 32 | + protected $result = [ |
|
| 33 | + 'exact' => [], |
|
| 34 | + ]; |
|
| 35 | 35 | |
| 36 | - protected $exactIdMatches = []; |
|
| 36 | + protected $exactIdMatches = []; |
|
| 37 | 37 | |
| 38 | - public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) { |
|
| 39 | - $type = $type->getLabel(); |
|
| 40 | - if(!isset($this->result[$type])) { |
|
| 41 | - $this->result[$type] = []; |
|
| 42 | - $this->result['exact'][$type] = []; |
|
| 43 | - } |
|
| 38 | + public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) { |
|
| 39 | + $type = $type->getLabel(); |
|
| 40 | + if(!isset($this->result[$type])) { |
|
| 41 | + $this->result[$type] = []; |
|
| 42 | + $this->result['exact'][$type] = []; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $this->result[$type] = array_merge($this->result[$type], $matches); |
|
| 46 | - if(is_array($exactMatches)) { |
|
| 47 | - $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
|
| 48 | - } |
|
| 49 | - } |
|
| 45 | + $this->result[$type] = array_merge($this->result[$type], $matches); |
|
| 46 | + if(is_array($exactMatches)) { |
|
| 47 | + $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function markExactIdMatch(SearchResultType $type) { |
|
| 52 | - $this->exactIdMatches[$type->getLabel()] = 1; |
|
| 53 | - } |
|
| 51 | + public function markExactIdMatch(SearchResultType $type) { |
|
| 52 | + $this->exactIdMatches[$type->getLabel()] = 1; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function hasExactIdMatch(SearchResultType $type) { |
|
| 56 | - return isset($this->exactIdMatches[$type->getLabel()]); |
|
| 57 | - } |
|
| 55 | + public function hasExactIdMatch(SearchResultType $type) { |
|
| 56 | + return isset($this->exactIdMatches[$type->getLabel()]); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function hasResult(SearchResultType $type, $collaboratorId) { |
|
| 60 | - $type = $type->getLabel(); |
|
| 61 | - if(!isset($this->result[$type])) { |
|
| 62 | - return false; |
|
| 63 | - } |
|
| 59 | + public function hasResult(SearchResultType $type, $collaboratorId) { |
|
| 60 | + $type = $type->getLabel(); |
|
| 61 | + if(!isset($this->result[$type])) { |
|
| 62 | + return false; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
|
| 66 | - foreach($resultArrays as $resultArray) { |
|
| 67 | - foreach ($resultArray as $result) { |
|
| 68 | - if ($result['value']['shareWith'] === $collaboratorId) { |
|
| 69 | - return true; |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - } |
|
| 65 | + $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
|
| 66 | + foreach($resultArrays as $resultArray) { |
|
| 67 | + foreach ($resultArray as $result) { |
|
| 68 | + if ($result['value']['shareWith'] === $collaboratorId) { |
|
| 69 | + return true; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return false; |
|
| 75 | - } |
|
| 74 | + return false; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public function asArray() { |
|
| 78 | - return $this->result; |
|
| 79 | - } |
|
| 77 | + public function asArray() { |
|
| 78 | + return $this->result; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - public function unsetResult(SearchResultType $type) { |
|
| 82 | - $type = $type->getLabel(); |
|
| 83 | - $this->result[$type] = []; |
|
| 84 | - if(isset($this->result['exact'][$type])) { |
|
| 85 | - $this->result['exact'][$type] = []; |
|
| 86 | - } |
|
| 87 | - } |
|
| 81 | + public function unsetResult(SearchResultType $type) { |
|
| 82 | + $type = $type->getLabel(); |
|
| 83 | + $this->result[$type] = []; |
|
| 84 | + if(isset($this->result['exact'][$type])) { |
|
| 85 | + $this->result['exact'][$type] = []; |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | 88 | } |