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

Public Member Functions

 __construct ($max, 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...
 

Protected Attributes

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

Detailed Description

Definition at line 10 of file LessThan.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Validation\Constraints\LessThan::__construct (   $max,
Data\Factory  $data_factory 
)

Definition at line 17 of file LessThan.php.

References ILIAS\Validation\Constraints\Custom\$data_factory, and ILIAS\Validation\Constraints\LessThan\$max.

18  {
19  assert('is_int($max)');
20  $this->max = $max;
21  parent::__construct(
22  function ($value) {
23  return $value < $this->max;
24  },
25  function ($value) {
26  return "'$value' is greater than '{$this->max}'.";
27  },
29  );
30  }

Field Documentation

◆ $max

ILIAS\Validation\Constraints\LessThan::$max
protected

Definition at line 15 of file LessThan.php.

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


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