ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
HasMaxLength.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Refinery\String;
22 
23 use ILIAS\Data;
25 
26 class HasMaxLength extends Constraint
27 {
28  public function __construct(int $max_length, Data\Factory $data_factory, \ILIAS\Language\Language $lng)
29  {
31  static function ($value) use ($max_length): bool {
32  return strlen($value) <= $max_length;
33  },
34  static function ($txt, $value) use ($max_length): string {
35  return $txt("not_max_length", $max_length);
36  },
37  $data_factory,
38  $lng
39  );
40  }
41 }
Interface Observer Contains several chained tasks and infos about them.
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
Builds data types.
Definition: Factory.php:35
$txt
Definition: error.php:31
__construct(Container $dic, ilPlugin $plugin)
global $lng
Definition: privfeed.php:31
__construct(int $max_length, Data\Factory $data_factory, \ILIAS\Language\Language $lng)