ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
HasMinLength.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
4 namespace ILIAS\Refinery\String;
5 
7 use ILIAS\Data;
9 
10 class HasMinLength extends CustomConstraint implements Constraint
11 {
15  protected $min_length;
16 
18  {
19  $this->min_length = $min_length;
21  function ($value) {
22  return strlen($value) >= $this->min_length;
23  },
24  function ($txt, $value) {
25  $len = strlen($value);
26  return $txt("not_min_length", $len, $this->min_length);
27  },
29  $lng
30  );
31  }
32 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
__construct(int $min_length, Data\Factory $data_factory, \ilLanguage $lng)
Builds data types.
Definition: Factory.php:19
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)