1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace Wei\Validator;
10:
11: 12: 13: 14: 15:
16: class Uppercase extends BaseValidator
17: {
18: protected $invalidMessage = '%name% must be uppercase';
19:
20: protected $negativeMessage = '%name% must not be uppercase';
21:
22: 23: 24:
25: protected function doValidate($input)
26: {
27: if (!$this->isString($input)) {
28: $this->addError('notString');
29: return false;
30: }
31:
32: if (mb_strtoupper($input, mb_detect_encoding($input)) != $input) {
33: $this->addError('invalid');
34: return false;
35: }
36: return true;
37: }
38: }
39: