MediaWiki master
MediaWiki\EditPage\EditPageStatus Class Reference

Status returned by edit constraints and other page editing checks. More...

Inherits StatusValue, and StatusValue.

Collaboration diagram for MediaWiki\EditPage\EditPageStatus:

Public Member Functions

 getFailedConstraint ()
 
 setErrorFunction (?Closure $errorFunction)
 
 setFailedConstraint (?EditConstraint $failedConstraint)
 
 setValue (int $value)
 Sets the value of the status.
 
 throwError ()
 
- Public Member Functions inherited from StatusValue
 __construct ()
 
 __toString ()
 Returns a string representation of the status for debugging.
 
 error ( $message,... $parameters)
 Add an error, do not set fatal flag This can be used for non-fatal errors.
 
 fatal ( $message,... $parameters)
 Add an error and set OK to false, indicating that the operation as a whole was fatal.
 
 getErrors ()
 Get the list of errors.
 
 getErrorsByType ( $type)
 Returns a list of status messages of the given type.
 
 getMessages (?string $type=null)
 Returns a list of error messages, optionally only those of the given type.
 
 getValue ()
 
 hasMessage (string $message)
 Returns true if the specified message is present as a warning or error.
 
 hasMessagesExcept (string ... $messages)
 Returns true if any other message than the specified ones is present as a warning or error.
 
 isGood ()
 Returns whether the operation completed and didn't have any error or warnings.
 
 isOK ()
 Returns whether the operation completed.
 
 merge ( $other, $overwriteValue=false)
 Merge another status object into this one.
 
 replaceMessage (string $source, $dest)
 If the specified source message exists, replace it with the specified destination message, but keep the same parameters as in the original error.
 
 setOK ( $ok)
 Change operation status.
 
 setResult ( $ok, $value=null)
 Change operation result.
 
 splitByErrorType ()
 Splits this StatusValue object into two new StatusValue objects, one which contains only the error messages, and one that contains the warnings, only.
 
 warning ( $message,... $parameters)
 Add a new warning.
 

Additional Inherited Members

- Static Public Member Functions inherited from StatusValue
static cast (StatusValue $sv)
 Succinct helper method to wrap a StatusValue in some other specific subclass.
 
static newFatal ( $message,... $parameters)
 Factory function for fatal errors.
 
static newGood ( $value=null)
 Factory function for good results.
 
- Public Attributes inherited from StatusValue
int $failCount = 0
 Counter for batch operations.
 
mixed $statusData
 arbitrary extra data about the operation
 
bool[] $success = []
 Map of (key => bool) to indicate success of each part of batch operations.
 
int $successCount = 0
 Counter for batch operations.
 
$value
 
- Protected Member Functions inherited from StatusValue
 getStatusArray ( $type=false)
 Returns a list of status messages of the given type (or all if false)
 
- Protected Attributes inherited from StatusValue
array[] $errors = []
 
bool $ok = true
 

Detailed Description

Status returned by edit constraints and other page editing checks.

Since
1.46
Access: internal

<int>

Definition at line 19 of file EditPageStatus.php.

Member Function Documentation

◆ getFailedConstraint()

MediaWiki\EditPage\EditPageStatus::getFailedConstraint ( )
Returns
?EditConstraint The constraint that failed, or null if no constraint failed.

Definition at line 35 of file EditPageStatus.php.

◆ setErrorFunction()

MediaWiki\EditPage\EditPageStatus::setErrorFunction ( ?Closure $errorFunction)
Parameters
Closure | null$errorFunctionA function that can be called to produce an error.

Definition at line 27 of file EditPageStatus.php.

◆ setFailedConstraint()

MediaWiki\EditPage\EditPageStatus::setFailedConstraint ( ?EditConstraint $failedConstraint)
Parameters
?EditConstraint$failedConstraintThe constraint that failed and produced this status, or null if no constraint failed.

Definition at line 43 of file EditPageStatus.php.

◆ setValue()

◆ throwError()

MediaWiki\EditPage\EditPageStatus::throwError ( )
Exceptions
ThrowableIf an error function is set.
LogicExceptionIf no error function is set or the error function did not throw an error.

Definition at line 61 of file EditPageStatus.php.


The documentation for this class was generated from the following file: