@@ 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 | * @psalm-pure |
|
@@ 1008-1017 (lines=10) @@ | ||
1005 | * |
|
1006 | * @throws InvalidArgumentException |
|
1007 | */ |
|
1008 | public static function notContains($value, $subString, $message = '') |
|
1009 | { |
|
1010 | if (false !== \strpos($value, $subString)) { |
|
1011 | static::reportInvalidArgument(\sprintf( |
|
1012 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1013 | static::valueToString($value), |
|
1014 | static::valueToString($subString) |
|
1015 | )); |
|
1016 | } |
|
1017 | } |
|
1018 | ||
1019 | /** |
|
1020 | * @psalm-pure |
|
@@ 1046-1055 (lines=10) @@ | ||
1043 | * |
|
1044 | * @throws InvalidArgumentException |
|
1045 | */ |
|
1046 | public static function startsWith($value, $prefix, $message = '') |
|
1047 | { |
|
1048 | if (0 !== \strpos($value, $prefix)) { |
|
1049 | static::reportInvalidArgument(\sprintf( |
|
1050 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1051 | static::valueToString($value), |
|
1052 | static::valueToString($prefix) |
|
1053 | )); |
|
1054 | } |
|
1055 | } |
|
1056 | ||
1057 | /** |
|
1058 | * @psalm-pure |
|
@@ 1066-1075 (lines=10) @@ | ||
1063 | * |
|
1064 | * @throws InvalidArgumentException |
|
1065 | */ |
|
1066 | public static function notStartsWith($value, $prefix, $message = '') |
|
1067 | { |
|
1068 | if (0 === \strpos($value, $prefix)) { |
|
1069 | static::reportInvalidArgument(\sprintf( |
|
1070 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
1071 | static::valueToString($value), |
|
1072 | static::valueToString($prefix) |
|
1073 | )); |
|
1074 | } |
|
1075 | } |
|
1076 | ||
1077 | /** |
|
1078 | * @psalm-pure |