Source of file NetefxValidatorRuleREGEXP.php
Size: 0,920 Bytes - Last Modified: 2021-12-23T10:02:33+00:00
/var/www/docs.ssmods.com/process/src/code/rules/NetefxValidatorRuleREGEXP.php
1234567891011121314151617181920212223242526272829 | <?php /** * @package NetefxValidator * @author lx-berlin * @author zauberfisch */ class NetefxValidatorRuleREGEXP extends NetefxValidatorRule { /** * Check if the given expression matches * @example $rule = new NetefxValidatorRuleREGEXP('Name', 'This field is required', null, '/^.{2,}$/'); * @uses preg_match() * @param string $field name of the field * @param string $errorMsg the message to be displayed * @param string $errorMsgType the css class added to the field on validation error * @param string $expression */ public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $expression = null) { parent::__construct($field, $errorMsg, $errorMsgType, $expression); } /** * @param array $data * @return boolean */ public function validate($data) { return preg_match($this->args[0], $data[$this->field]) > 0; } } |