@@ 652-665 (lines=14) @@ | ||
649 | } |
|
650 | } |
|
651 | ||
652 | public static function alpha($value, $message = '') |
|
653 | { |
|
654 | $locale = setlocale(LC_CTYPE, 0); |
|
655 | setlocale(LC_CTYPE, 'C'); |
|
656 | $valid = !ctype_alpha($value); |
|
657 | setlocale(LC_CTYPE, $locale); |
|
658 | ||
659 | if ($valid) { |
|
660 | static::reportInvalidArgument(sprintf( |
|
661 | $message ?: 'Expected a value to contain only letters. Got: %s', |
|
662 | static::valueToString($value) |
|
663 | )); |
|
664 | } |
|
665 | } |
|
666 | ||
667 | public static function digits($value, $message = '') |
|
668 | { |
|
@@ 667-680 (lines=14) @@ | ||
664 | } |
|
665 | } |
|
666 | ||
667 | public static function digits($value, $message = '') |
|
668 | { |
|
669 | $locale = setlocale(LC_CTYPE, 0); |
|
670 | setlocale(LC_CTYPE, 'C'); |
|
671 | $valid = !ctype_digit($value); |
|
672 | setlocale(LC_CTYPE, $locale); |
|
673 | ||
674 | if ($valid) { |
|
675 | static::reportInvalidArgument(sprintf( |
|
676 | $message ?: 'Expected a value to contain digits only. Got: %s', |
|
677 | static::valueToString($value) |
|
678 | )); |
|
679 | } |
|
680 | } |
|
681 | ||
682 | public static function alnum($value, $message = '') |
|
683 | { |
|
@@ 682-695 (lines=14) @@ | ||
679 | } |
|
680 | } |
|
681 | ||
682 | public static function alnum($value, $message = '') |
|
683 | { |
|
684 | $locale = setlocale(LC_CTYPE, 0); |
|
685 | setlocale(LC_CTYPE, 'C'); |
|
686 | $valid = !ctype_alnum($value); |
|
687 | setlocale(LC_CTYPE, $locale); |
|
688 | ||
689 | if ($valid) { |
|
690 | static::reportInvalidArgument(sprintf( |
|
691 | $message ?: 'Expected a value to contain letters and digits only. Got: %s', |
|
692 | static::valueToString($value) |
|
693 | )); |
|
694 | } |
|
695 | } |
|
696 | ||
697 | public static function lower($value, $message = '') |
|
698 | { |
|
@@ 697-710 (lines=14) @@ | ||
694 | } |
|
695 | } |
|
696 | ||
697 | public static function lower($value, $message = '') |
|
698 | { |
|
699 | $locale = setlocale(LC_CTYPE, 0); |
|
700 | setlocale(LC_CTYPE, 'C'); |
|
701 | $valid = !ctype_lower($value); |
|
702 | setlocale(LC_CTYPE, $locale); |
|
703 | ||
704 | if ($valid) { |
|
705 | static::reportInvalidArgument(sprintf( |
|
706 | $message ?: 'Expected a value to contain lowercase characters only. Got: %s', |
|
707 | static::valueToString($value) |
|
708 | )); |
|
709 | } |
|
710 | } |
|
711 | ||
712 | public static function upper($value, $message = '') |
|
713 | { |
|
@@ 712-725 (lines=14) @@ | ||
709 | } |
|
710 | } |
|
711 | ||
712 | public static function upper($value, $message = '') |
|
713 | { |
|
714 | $locale = setlocale(LC_CTYPE, 0); |
|
715 | setlocale(LC_CTYPE, 'C'); |
|
716 | $valid = !ctype_upper($value); |
|
717 | setlocale(LC_CTYPE, $locale); |
|
718 | ||
719 | if ($valid) { |
|
720 | static::reportInvalidArgument(sprintf( |
|
721 | $message ?: 'Expected a value to contain uppercase characters only. Got: %s', |
|
722 | static::valueToString($value) |
|
723 | )); |
|
724 | } |
|
725 | } |
|
726 | ||
727 | public static function length($value, $length, $message = '') |
|
728 | { |