MediaWiki  master
MediaWiki\EditPage\Constraint\EditConstraintRunner Class Reference

Back end to process the edit constraints. More...

Collaboration diagram for MediaWiki\EditPage\Constraint\EditConstraintRunner:

Public Member Functions

 __construct ()
 Create a new runner. More...
 
 addConstraint (IEditConstraint $constraint)
 Add a constraint to check. More...
 
 checkConstraints ()
 Run constraint checks. More...
 
 getFailedConstraint ()
 Get the constraint that failed. More...
 

Private Member Functions

 getConstraintName (IEditConstraint $constraint)
 

Private Attributes

IEditConstraint[] $constraints = []
 Constraints to check. More...
 
IEditConstraint bool $failedConstraint = false
 The constraint that failed, so that its status can be fetched, or false if none failed. More...
 
LoggerInterface $logger
 

Detailed Description

Back end to process the edit constraints.

Constraints reflect possible errors that need to be checked

Since
1.36
Access: internal
Author
DannyS712

Definition at line 36 of file EditConstraintRunner.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\EditPage\Constraint\EditConstraintRunner::__construct ( )

Create a new runner.

Definition at line 58 of file EditConstraintRunner.php.

References MediaWiki\Logger\LoggerFactory\getInstance().

Member Function Documentation

◆ addConstraint()

MediaWiki\EditPage\Constraint\EditConstraintRunner::addConstraint ( IEditConstraint  $constraint)

Add a constraint to check.

Not all constraints are applicable to the action api or other methods of submitting an edit

For constraints that have dependencies, use the EditConstraintFactory.

Parameters
IEditConstraint$constraint

Definition at line 74 of file EditConstraintRunner.php.

◆ checkConstraints()

MediaWiki\EditPage\Constraint\EditConstraintRunner::checkConstraints ( )

Run constraint checks.

Returns true if all constraints pass, false otherwise. Check getLegacyStatus for the reason

Returns
bool

Definition at line 86 of file EditConstraintRunner.php.

References MediaWiki\EditPage\Constraint\EditConstraintRunner\getConstraintName().

◆ getConstraintName()

MediaWiki\EditPage\Constraint\EditConstraintRunner::getConstraintName ( IEditConstraint  $constraint)
private
Parameters
IEditConstraint$constraint
Returns
string

Definition at line 119 of file EditConstraintRunner.php.

Referenced by MediaWiki\EditPage\Constraint\EditConstraintRunner\checkConstraints().

◆ getFailedConstraint()

MediaWiki\EditPage\Constraint\EditConstraintRunner::getFailedConstraint ( )

Get the constraint that failed.

Returns
IEditConstraint

Definition at line 138 of file EditConstraintRunner.php.

Member Data Documentation

◆ $constraints

IEditConstraint [] MediaWiki\EditPage\Constraint\EditConstraintRunner::$constraints = []
private

Constraints to check.

Definition at line 46 of file EditConstraintRunner.php.

◆ $failedConstraint

IEditConstraint bool MediaWiki\EditPage\Constraint\EditConstraintRunner::$failedConstraint = false
private

The constraint that failed, so that its status can be fetched, or false if none failed.

Definition at line 53 of file EditConstraintRunner.php.

◆ $logger

LoggerInterface MediaWiki\EditPage\Constraint\EditConstraintRunner::$logger
private

Definition at line 39 of file EditConstraintRunner.php.


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