@@ 889-897 (lines=9) @@ | ||
886 | } |
|
887 | } |
|
888 | ||
889 | public static function keyExists($array, $key, $message = '') |
|
890 | { |
|
891 | if (!array_key_exists($key, $array)) { |
|
892 | static::reportInvalidArgument(sprintf( |
|
893 | $message ?: 'Expected the key %s to exist.', |
|
894 | static::valueToString($key) |
|
895 | )); |
|
896 | } |
|
897 | } |
|
898 | ||
899 | public static function keyNotExists($array, $key, $message = '') |
|
900 | { |
|
@@ 899-907 (lines=9) @@ | ||
896 | } |
|
897 | } |
|
898 | ||
899 | public static function keyNotExists($array, $key, $message = '') |
|
900 | { |
|
901 | if (array_key_exists($key, $array)) { |
|
902 | static::reportInvalidArgument(sprintf( |
|
903 | $message ?: 'Expected the key %s to not exist.', |
|
904 | static::valueToString($key) |
|
905 | )); |
|
906 | } |
|
907 | } |
|
908 | ||
909 | public static function count($array, $number, $message = '') |
|
910 | { |
|
@@ 918-927 (lines=10) @@ | ||
915 | ); |
|
916 | } |
|
917 | ||
918 | public static function minCount($array, $min, $message = '') |
|
919 | { |
|
920 | if (count($array) < $min) { |
|
921 | static::reportInvalidArgument(sprintf( |
|
922 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
923 | count($array), |
|
924 | $min |
|
925 | )); |
|
926 | } |
|
927 | } |
|
928 | ||
929 | public static function maxCount($array, $max, $message = '') |
|
930 | { |
|
@@ 929-938 (lines=10) @@ | ||
926 | } |
|
927 | } |
|
928 | ||
929 | public static function maxCount($array, $max, $message = '') |
|
930 | { |
|
931 | if (count($array) > $max) { |
|
932 | static::reportInvalidArgument(sprintf( |
|
933 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
934 | count($array), |
|
935 | $max |
|
936 | )); |
|
937 | } |
|
938 | } |
|
939 | ||
940 | public static function countBetween($array, $min, $max, $message = '') |
|
941 | { |