ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ILIAS\Validation\Constraints\Not Class Reference
+ Inheritance diagram for ILIAS\Validation\Constraints\Not:
+ Collaboration diagram for ILIAS\Validation\Constraints\Not:

Public Member Functions

 __construct (Constraint $constraint, Data\Factory $data_factory)
 
- Public Member Functions inherited from ILIAS\Validation\Constraints\Custom
 __construct (callable $is_ok, $error, Data\Factory $data_factory)
 
 check ($value)
 Checks the provided value.Should not throw if accepts($value).
Exceptions
More...
 
 accepts ($value)
 Tells if the provided value complies.
Parameters
mixed$value
Returns
bool
More...
 
 problemWith ($value)
 Tells what the problem with the provided value is.Should return null if accepts($value).
Parameters
mixed$value
Returns
string|null
More...
 
 restrict (Result $result)
 Restricts a Result.Must do nothing with the result if $result->isError(). Must replace the result with an error according to problemWith() if !accepts($result->value()).
Parameters
Result$value
Returns
Result
More...
 
 withProblemBuilder (callable $builder)
 Get a constraint like this one with a builder for a custom error message.problemWith() must return an error message according to the new builder for the new constraint.
Parameters
callable$buildermixed -> string
Returns
Constraint
More...
 
 getErrorMessage ($value)
 Get the problem message. More...
 

Data Fields

const ERROR_MESSAGE_PREFIX = "It is not the case that:"
 

Protected Attributes

 $constraint
 
- Protected Attributes inherited from ILIAS\Validation\Constraints\Custom
 $data_factory
 
 $is_ok
 
 $error
 

Detailed Description

Definition at line 10 of file Not.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Validation\Constraints\Not::__construct ( Constraint  $constraint,
Data\Factory  $data_factory 
)

Definition at line 19 of file Not.php.

References ILIAS\Validation\Constraints\Not\$constraint, and ILIAS\Validation\Constraints\Custom\$data_factory.

20  {
21  $this->constraint = $constraint;
22  parent::__construct(
23  function ($value) {
24  return !$this->constraint->accepts($value);
25  },
26  function ($value) {
27  return self::ERROR_MESSAGE_PREFIX . ": " . $this->constraint->getErrorMessage($value);
28  },
30  );
31  }

Field Documentation

◆ $constraint

ILIAS\Validation\Constraints\Not::$constraint
protected

Definition at line 17 of file Not.php.

Referenced by ILIAS\Validation\Constraints\Not\__construct().

◆ ERROR_MESSAGE_PREFIX

const ILIAS\Validation\Constraints\Not::ERROR_MESSAGE_PREFIX = "It is not the case that:"

Definition at line 12 of file Not.php.


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