ILIAS  release_7 Revision v7.30-3-g800a261c036
HasSpecialChars.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 HasSpecialChars extends CustomConstraint implements Constraint
11{
12 protected static $ALLOWED_CHARS = '/[,_.\-#\+\*?!%ยง\‍(\‍)\$]/';
13
15 {
17 function (Data\Password $value) {
18 return (bool) preg_match(static::$ALLOWED_CHARS, $value->toString());
19 },
20 function ($value) {
21 return "Password must contain special chars.";
22 },
24 $lng
25 );
26 }
27}
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(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