ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
HasMaxLength.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Refinery\String;
22 
23 use ILIAS\Data;
25 use ilLanguage;
26 
27 class HasMaxLength extends Constraint
28 {
29  public function __construct(int $max_length, Data\Factory $data_factory, ilLanguage $lng)
30  {
32  static function ($value) use ($max_length): bool {
33  return strlen($value) <= $max_length;
34  },
35  static function ($txt, $value) use ($max_length): string {
36  return $txt("not_max_length", $max_length);
37  },
38  $data_factory,
39  $lng
40  );
41  }
42 }
$lng
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
__construct(int $max_length, Data\Factory $data_factory, ilLanguage $lng)
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: CaseOfLabel.php:21