Dominic.sauer has uploaded a new change for review.
https://gerrit.wikimedia.org/r/221104
Change subject: T99358 guard setting the result to a list of constant strings
in ReferenceResult similar to the ComparisonResult
......................................................................
T99358 guard setting the result to a list of constant strings in
ReferenceResult similar to the ComparisonResult
Change-Id: I9b50efee769630547a499cc021584e9cdd24550f
---
M includes/CrossCheck/Result/ComparisonResult.php
M includes/CrossCheck/Result/ReferenceResult.php
2 files changed, 24 insertions(+), 8 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation
refs/changes/04/221104/1
diff --git a/includes/CrossCheck/Result/ComparisonResult.php
b/includes/CrossCheck/Result/ComparisonResult.php
index 35bc087..e59b249 100755
--- a/includes/CrossCheck/Result/ComparisonResult.php
+++ b/includes/CrossCheck/Result/ComparisonResult.php
@@ -79,6 +79,8 @@
/**
* @param string $status
+ *
+ * @throws InvalidArgumentException
*/
private function setStatus( $status ) {
Assert::parameterType( 'string', $status, '$status' );
diff --git a/includes/CrossCheck/Result/ReferenceResult.php
b/includes/CrossCheck/Result/ReferenceResult.php
index 56f5fda..ff86760 100755
--- a/includes/CrossCheck/Result/ReferenceResult.php
+++ b/includes/CrossCheck/Result/ReferenceResult.php
@@ -40,13 +40,16 @@
* @throws InvalidArgumentException
*/
public function __construct( $status, Reference $reference ) {
- Assert::parameterType( 'string', $status, '$status' );
- if ( !in_array( $status, array(
self::STATUS_REFERENCES_MISSING, self::STATUS_REFERENCES_STATED ) ) ) {
- throw new InvalidArgumentException( '$status must be
one of the status constants' );
- }
- $this->status = $status;
$this->reference = $reference;
+ $this->setStatus( $status );
+ }
+
+ /**
+ * @return Reference
+ */
+ public function getReference() {
+ return $this->reference;
}
/**
@@ -57,9 +60,20 @@
}
/**
- * @return Reference
+ * @param string $status
+ *
+ * @throws InvalidArgumentException
*/
- public function getReference() {
- return $this->reference;
+ private function setStatus( $status ) {
+ Assert::parameterType( 'string', $status, '$status' );
+ if ( !in_array(
+ $status,
+ array( self::STATUS_REFERENCES_MISSING,
self::STATUS_REFERENCES_STATED )
+ )
+ ) {
+ throw new InvalidArgumentException( '$status must be
one of the status constants.' );
+ }
+
+ $this->status = $status;
}
}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/221104
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b50efee769630547a499cc021584e9cdd24550f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: v1
Gerrit-Owner: Dominic.sauer <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits