@@ 1012-1021 (lines=10) @@ | ||
1009 | * |
|
1010 | * @throws InvalidArgumentException |
|
1011 | */ |
|
1012 | public static function contains($value, $subString, $message = '') |
|
1013 | { |
|
1014 | if (false === \strpos($value, $subString)) { |
|
1015 | static::reportInvalidArgument(\sprintf( |
|
1016 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
1017 | static::valueToString($value), |
|
1018 | static::valueToString($subString) |
|
1019 | )); |
|
1020 | } |
|
1021 | } |
|
1022 | ||
1023 | /** |
|
1024 | * @psalm-pure |
|
@@ 1032-1041 (lines=10) @@ | ||
1029 | * |
|
1030 | * @throws InvalidArgumentException |
|
1031 | */ |
|
1032 | public static function notContains($value, $subString, $message = '') |
|
1033 | { |
|
1034 | if (false !== \strpos($value, $subString)) { |
|
1035 | static::reportInvalidArgument(\sprintf( |
|
1036 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1037 | static::valueToString($value), |
|
1038 | static::valueToString($subString) |
|
1039 | )); |
|
1040 | } |
|
1041 | } |
|
1042 | ||
1043 | /** |
|
1044 | * @psalm-pure |
|
@@ 1070-1079 (lines=10) @@ | ||
1067 | * |
|
1068 | * @throws InvalidArgumentException |
|
1069 | */ |
|
1070 | public static function startsWith($value, $prefix, $message = '') |
|
1071 | { |
|
1072 | if (0 !== \strpos($value, $prefix)) { |
|
1073 | static::reportInvalidArgument(\sprintf( |
|
1074 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1075 | static::valueToString($value), |
|
1076 | static::valueToString($prefix) |
|
1077 | )); |
|
1078 | } |
|
1079 | } |
|
1080 | ||
1081 | /** |
|
1082 | * @psalm-pure |
|
@@ 1090-1099 (lines=10) @@ | ||
1087 | * |
|
1088 | * @throws InvalidArgumentException |
|
1089 | */ |
|
1090 | public static function notStartsWith($value, $prefix, $message = '') |
|
1091 | { |
|
1092 | if (0 === \strpos($value, $prefix)) { |
|
1093 | static::reportInvalidArgument(\sprintf( |
|
1094 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
1095 | static::valueToString($value), |
|
1096 | static::valueToString($prefix) |
|
1097 | )); |
|
1098 | } |
|
1099 | } |
|
1100 | ||
1101 | /** |
|
1102 | * @psalm-pure |