ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HasNumbers.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 
8 use ILIAS\Data;
9 
10 class HasNumbers extends Constraints\Custom implements Constraint
11 {
13  {
14  parent::__construct(
15  function (Data\Password $value) {
16  return (bool) preg_match('/[0-9]/', $value->toString());
17  },
18  function ($value) {
19  return "Password must contain numbers.";
20  },
22  $lng
23  );
24  }
25 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:14
A password is used as part of credentials for authentication.
Definition: Password.php:13
__construct(Data\Factory $data_factory, \ilLanguage $lng)
Definition: HasNumbers.php:12
Builds data types.
Definition: Factory.php:14
language handling