@@ 903-911 (lines=9) @@ | ||
900 | } |
|
901 | } |
|
902 | ||
903 | public static function keyExists($array, $key, $message = '') |
|
904 | { |
|
905 | if (!array_key_exists($key, $array)) { |
|
906 | static::reportInvalidArgument(sprintf( |
|
907 | $message ?: 'Expected the key %s to exist.', |
|
908 | static::valueToString($key) |
|
909 | )); |
|
910 | } |
|
911 | } |
|
912 | ||
913 | public static function keyNotExists($array, $key, $message = '') |
|
914 | { |
|
@@ 913-921 (lines=9) @@ | ||
910 | } |
|
911 | } |
|
912 | ||
913 | public static function keyNotExists($array, $key, $message = '') |
|
914 | { |
|
915 | if (array_key_exists($key, $array)) { |
|
916 | static::reportInvalidArgument(sprintf( |
|
917 | $message ?: 'Expected the key %s to not exist.', |
|
918 | static::valueToString($key) |
|
919 | )); |
|
920 | } |
|
921 | } |
|
922 | ||
923 | public static function count($array, $number, $message = '') |
|
924 | { |
|
@@ 932-941 (lines=10) @@ | ||
929 | ); |
|
930 | } |
|
931 | ||
932 | public static function minCount($array, $min, $message = '') |
|
933 | { |
|
934 | if (count($array) < $min) { |
|
935 | static::reportInvalidArgument(sprintf( |
|
936 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
937 | count($array), |
|
938 | $min |
|
939 | )); |
|
940 | } |
|
941 | } |
|
942 | ||
943 | public static function maxCount($array, $max, $message = '') |
|
944 | { |
|
@@ 943-952 (lines=10) @@ | ||
940 | } |
|
941 | } |
|
942 | ||
943 | public static function maxCount($array, $max, $message = '') |
|
944 | { |
|
945 | if (count($array) > $max) { |
|
946 | static::reportInvalidArgument(sprintf( |
|
947 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
948 | count($array), |
|
949 | $max |
|
950 | )); |
|
951 | } |
|
952 | } |
|
953 | ||
954 | public static function countBetween($array, $min, $max, $message = '') |
|
955 | { |