| Conditions | 5 |
| Paths | 6 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 3 | public function matchResultsToLanguage( SearchResultSet $matches, $languageCode ) { |
|
| 41 | |||
| 42 | 3 | $mappedMatches = []; |
|
| 43 | |||
| 44 | 3 | while ( $searchresult = $matches->next() ) { |
|
| 45 | |||
| 46 | 2 | $title = $searchresult->getTitle(); |
|
| 47 | |||
| 48 | 2 | $pageLanguage = $this->interlanguageLinksLookup->findPageLanguageForTarget( $title ); |
|
| 49 | |||
| 50 | 2 | if ( $pageLanguage === $languageCode && $this->interlanguageLinksLookup->hasSilAnnotationFor( $title ) ) { |
|
| 51 | 1 | $mappedMatches[] = $searchresult; |
|
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | 3 | if ( $mappedMatches === [] ) { |
|
| 56 | 2 | return null; |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | return new MappedSearchResultSet( $mappedMatches, $matches->termMatches() ); |
|
| 60 | } |
||
| 61 | |||
| 63 |