ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
HasMinLength.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2018 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
5
6use ILIAS\Refinery\Custom\Constraint as CustomConstraint;
8use ILIAS\Data;
9
10class HasMinLength extends CustomConstraint implements Constraint
11{
15 protected $min_length;
16
18 {
19 $this->min_length = $min_length;
21 function (Data\Password $value) {
22 return strlen($value->toString()) >= $this->min_length;
23 },
24 function ($value) {
25 return "Password has a length less than '{$this->min_length}'.";
26 },
28 $lng
29 );
30 }
31}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
A password is used as part of credentials for authentication.
Definition: Password.php:14
__construct(int $min_length, Data\Factory $data_factory, \ilLanguage $lng)
language handling
A constraint encodes some resrtictions on values.
Definition: Constraint.php:15
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc