ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Refinery\String\HasMaxLength Class Reference
+ Inheritance diagram for ILIAS\Refinery\String\HasMaxLength:
+ Collaboration diagram for ILIAS\Refinery\String\HasMaxLength:

Public Member Functions

 __construct (int $max_length, Data\Factory $data_factory, \ilLanguage $lng)
 
- Public Member Functions inherited from ILIAS\Refinery\Custom\Constraint
 __construct (callable $is_ok, $error, Data\Factory $data_factory, \ilLanguage $lng)
 If $error is a callable it needs to take two parameters: More...
 
 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...
 
 applyTo (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$result
Returns
Result
More...
 
- Public Member Functions inherited from ILIAS\Refinery\Constraint
 withProblemBuilder (callable $builder)
 Get a constraint like this one with a builder for a custom error message. More...
 
- Public Member Functions inherited from ILIAS\Refinery\Transformation
 transform ($from)
 Perform the transformation. More...
 
 __invoke ($from)
 Transformations should be callable. More...
 

Protected Attributes

 $max_length
 
- Protected Attributes inherited from ILIAS\Refinery\Custom\Constraint
 $data_factory
 
 $lng
 
 $is_ok
 
 $error
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\Refinery\Custom\Constraint
 getError ()
 

Detailed Description

Definition at line 10 of file HasMaxLength.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Refinery\String\HasMaxLength::__construct ( int  $max_length,
Data\Factory  $data_factory,
\ilLanguage  $lng 
)

Definition at line 17 of file HasMaxLength.php.

References ILIAS\Refinery\Custom\Constraint\$data_factory, ILIAS\Refinery\Custom\Constraint\$lng, ILIAS\Refinery\String\HasMaxLength\$max_length, $txt, and ILIAS\GlobalScreen\Provider\__construct().

18  {
19  $this->max_length = $max_length;
21  function ($value) {
22  return strlen($value) <= $this->max_length;
23  },
24  function ($txt, $value) {
25  return $txt("not_max_length", $this->max_length);
26  },
28  $lng
29  );
30  }
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Field Documentation

◆ $max_length

ILIAS\Refinery\String\HasMaxLength::$max_length
protected

Definition at line 15 of file HasMaxLength.php.

Referenced by ILIAS\Refinery\String\HasMaxLength\__construct().


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