Max Word Count Validator


_max = $max;
$this->_messageTemplates = array(
self::INVALID => "$subject has more than $max words."
);
}

public function isValid($value)
{
if(count(explode(' ', preg_replace('/s+/', ' ',$value))) > $this->_max){
$this->_error(self::INVALID);
return false;
}
return true;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *