Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
NoConflictingTermListValues | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
validate | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 |
1 | <?php |
2 | |
3 | namespace Wikibase\Lexeme\Domain\Merge\Validator; |
4 | |
5 | use Wikibase\DataModel\Term\Term; |
6 | use Wikibase\DataModel\Term\TermList; |
7 | |
8 | /** |
9 | * @license GPL-2.0-or-later |
10 | */ |
11 | class NoConflictingTermListValues { |
12 | |
13 | /** |
14 | * @param TermList $source |
15 | * @param TermList $target |
16 | * @return bool |
17 | */ |
18 | public function validate( TermList $source, TermList $target ) { |
19 | foreach ( $source as $term ) { |
20 | /** @var $term Term */ |
21 | if ( |
22 | $target->hasTermForLanguage( $term->getLanguageCode() ) |
23 | && |
24 | !$target->hasTerm( $term ) |
25 | ) { |
26 | return false; |
27 | } |
28 | } |
29 | |
30 | return true; |
31 | } |
32 | |
33 | } |