Source of file NetefxValidatorRuleINARRAY.php
Size: 1,021 Bytes - Last Modified: 2021-12-23T10:02:33+00:00
/var/www/docs.ssmods.com/process/src/code/rules/NetefxValidatorRuleINARRAY.php
12345678910111213141516171819202122232425262728293031 | <?php /** * @package NetefxValidator * @author lx-berlin * @author zauberfisch */ class NetefxValidatorRuleINARRAY extends NetefxValidatorRule { /** * Check if the field is equal to one of the given strings * @example $rule = new NetefxValidatorRuleINARRAY('Flat', 'Only Paris and Berlin are available at the moment.', null, array('Paris', 'Berlin')); * @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 array $args array of strings|ints to be checked */ public function __construct($field, $errorMsg = null, $errorMsgType = 'error', $args = null) { parent::__construct($field, $errorMsg, $errorMsgType, $args); } /** * @param array $data * @return boolean */ public function validate($data) { foreach ($this->args as $text) if (strcmp($data[$this->field],$text)==0) return true; return false; } } |