X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStatus.php;h=a6348b7165ec0d465246a39beccb29d1d9fe7853;hb=3706dcb;hp=e5788733cf95939d22c1ba9c2016dac834aefced;hpb=39bdb0cb4905eaebd24ebb0ed22728fa4b94e0ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Status.php b/includes/Status.php index e5788733cf..a6348b7165 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -105,6 +105,26 @@ class Status { return new self( $sv ); } + /** + * Splits this Status object into two new Status objects, one which contains only + * the error messages, and one that contains the warnings, only. The returned array is + * defined as: + * array( + * 0 => object(Status) # the Status with error messages, only + * 1 => object(Status) # The Status with warning messages, only + * ) + * + * @return array + */ + public function splitByErrorType() { + list( $errorsOnlyStatusValue, $warningsOnlyStatusValue ) = $this->sv->splitByErrorType(); + $errorsOnlyStatus = new Status( $errorsOnlyStatusValue ); + $warningsOnlyStatus = new Status( $warningsOnlyStatusValue ); + $errorsOnlyStatus->cleanCallback = $warningsOnlyStatus->cleanCallback = $this->cleanCallback; + + return [ $errorsOnlyStatus, $warningsOnlyStatus ]; + } + /** * Change operation result * @@ -314,6 +334,7 @@ class Status { /** * Return the message for a single error. + * * @param mixed $error With an array & two values keyed by * 'message' and 'params', use those keys-value pairs. * Otherwise, if its an array, just use the first value as the