Detector of label/description uniqueness constraint violations.
More...
Detector of label/description uniqueness constraint violations.
Builds on top of LabelConflictFinder adding handling of self-conflicts and localization.
- See also
- LabelConflictFinder
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Repo\LabelDescriptionDuplicateDetector::__construct |
( |
LabelConflictFinder |
$conflictFinder | ) |
|
◆ detectLabelConflicts()
Wikibase\Repo\LabelDescriptionDuplicateDetector::detectLabelConflicts |
( |
|
$entityType, |
|
|
array |
$labels, |
|
|
array |
$aliases = null , |
|
|
EntityId |
$ignoreEntityId = null |
|
) |
| |
Detects conflicting labels and aliases.
A conflict arises when another entity has the same label or alias for a given language as is present in $label or $aliases. If $aliases is null, only conflicts between labels are considered. If $aliases is not null (but possibly empty), conflicts are also detected between labels and aliases, in any combination.
- Parameters
-
string | $entityType | The type of entity to search for conflicts. |
string[] | $labels | An associative array of labels, with language codes as the keys. |
array[] | null | $aliases | Aliases to be considered to be conflicting with labels. Ignored if descriptions are given. |
EntityId | null | $ignoreEntityId | Conflicts with this entity will be considered self-conflicts and ignored. |
- Exceptions
-
- Returns
- Result
◆ detectLabelDescriptionConflicts()
Wikibase\Repo\LabelDescriptionDuplicateDetector::detectLabelDescriptionConflicts |
( |
|
$entityType, |
|
|
array |
$labels, |
|
|
array |
$descriptions, |
|
|
EntityId |
$ignoreEntityId = null |
|
) |
| |
Detects conflicting combinations of labels and descriptions.
A conflict arises when an entity (other than the one given by $ignoreEntityId, if any) has the same combination of label and non-empty description for a given language as is present tin the $label and $description parameters.
- Parameters
-
string | $entityType | The type of entity to search for conflicts. |
string[] | $labels | An associative array of labels, with language codes as the keys. |
string[] | $descriptions | An associative array of descriptions, with language codes as the keys. |
EntityId | null | $ignoreEntityId | Conflicts with this entity will be considered self-conflicts and ignored. |
- Exceptions
-
- Returns
- Result
◆ filterSelfConflicts()
Wikibase\Repo\LabelDescriptionDuplicateDetector::filterSelfConflicts |
( |
array |
$terms, |
|
|
EntityId |
$entityId |
|
) |
| |
|
private |
- Parameters
-
TermIndexEntry[] | $terms | |
EntityId | $entityId | |
- Returns
- TermIndexEntry[]
◆ termsToErrors()
Wikibase\Repo\LabelDescriptionDuplicateDetector::termsToErrors |
( |
|
$message, |
|
|
|
$errorCode, |
|
|
array |
$terms |
|
) |
| |
|
private |
- Parameters
-
string | $message | Plain text message (English) |
string | $errorCode | Error code (for later localization) |
TermIndexEntry[] | $terms | The conflicting terms. |
- Returns
- UniquenessViolation[]
◆ $conflictFinder
Wikibase\Repo\LabelDescriptionDuplicateDetector::$conflictFinder |
|
private |
The documentation for this class was generated from the following file: