| @@ 988-997 (lines=10) @@ | ||
| 985 | * |
|
| 986 | * @throws InvalidArgumentException |
|
| 987 | */ |
|
| 988 | public static function contains($value, $subString, $message = '') |
|
| 989 | { |
|
| 990 | if (false === \strpos($value, $subString)) { |
|
| 991 | static::reportInvalidArgument(\sprintf( |
|
| 992 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
| 993 | static::valueToString($value), |
|
| 994 | static::valueToString($subString) |
|
| 995 | )); |
|
| 996 | } |
|
| 997 | } |
|
| 998 | ||
| 999 | /** |
|
| 1000 | * @param mixed $value |
|
| @@ 1006-1015 (lines=10) @@ | ||
| 1003 | * |
|
| 1004 | * @throws InvalidArgumentException |
|
| 1005 | */ |
|
| 1006 | public static function notContains($value, $subString, $message = '') |
|
| 1007 | { |
|
| 1008 | if (false !== \strpos($value, $subString)) { |
|
| 1009 | static::reportInvalidArgument(\sprintf( |
|
| 1010 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
| 1011 | static::valueToString($value), |
|
| 1012 | static::valueToString($subString) |
|
| 1013 | )); |
|
| 1014 | } |
|
| 1015 | } |
|
| 1016 | ||
| 1017 | /** |
|
| 1018 | * @param mixed $value |
|
| @@ 1040-1049 (lines=10) @@ | ||
| 1037 | * |
|
| 1038 | * @throws InvalidArgumentException |
|
| 1039 | */ |
|
| 1040 | public static function startsWith($value, $prefix, $message = '') |
|
| 1041 | { |
|
| 1042 | if (0 !== \strpos($value, $prefix)) { |
|
| 1043 | static::reportInvalidArgument(\sprintf( |
|
| 1044 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
| 1045 | static::valueToString($value), |
|
| 1046 | static::valueToString($prefix) |
|
| 1047 | )); |
|
| 1048 | } |
|
| 1049 | } |
|
| 1050 | ||
| 1051 | /** |
|
| 1052 | * @psalm-assert string $value |
|