@@ 1156-1165 (lines=10) @@ | ||
1153 | * |
|
1154 | * @throws InvalidArgumentException |
|
1155 | */ |
|
1156 | public static function contains($value, $subString, $message = '') |
|
1157 | { |
|
1158 | if (false === \strpos($value, $subString)) { |
|
1159 | static::reportInvalidArgument(\sprintf( |
|
1160 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
1161 | static::valueToString($value), |
|
1162 | static::valueToString($subString) |
|
1163 | )); |
|
1164 | } |
|
1165 | } |
|
1166 | ||
1167 | /** |
|
1168 | * @psalm-pure |
|
@@ 1176-1185 (lines=10) @@ | ||
1173 | * |
|
1174 | * @throws InvalidArgumentException |
|
1175 | */ |
|
1176 | public static function notContains($value, $subString, $message = '') |
|
1177 | { |
|
1178 | if (false !== \strpos($value, $subString)) { |
|
1179 | static::reportInvalidArgument(\sprintf( |
|
1180 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1181 | static::valueToString($value), |
|
1182 | static::valueToString($subString) |
|
1183 | )); |
|
1184 | } |
|
1185 | } |
|
1186 | ||
1187 | /** |
|
1188 | * @psalm-pure |
|
@@ 1214-1223 (lines=10) @@ | ||
1211 | * |
|
1212 | * @throws InvalidArgumentException |
|
1213 | */ |
|
1214 | public static function startsWith($value, $prefix, $message = '') |
|
1215 | { |
|
1216 | if (0 !== \strpos($value, $prefix)) { |
|
1217 | static::reportInvalidArgument(\sprintf( |
|
1218 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1219 | static::valueToString($value), |
|
1220 | static::valueToString($prefix) |
|
1221 | )); |
|
1222 | } |
|
1223 | } |
|
1224 | ||
1225 | /** |
|
1226 | * @psalm-pure |
|
@@ 1234-1243 (lines=10) @@ | ||
1231 | * |
|
1232 | * @throws InvalidArgumentException |
|
1233 | */ |
|
1234 | public static function notStartsWith($value, $prefix, $message = '') |
|
1235 | { |
|
1236 | if (0 === \strpos($value, $prefix)) { |
|
1237 | static::reportInvalidArgument(\sprintf( |
|
1238 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
1239 | static::valueToString($value), |
|
1240 | static::valueToString($prefix) |
|
1241 | )); |
|
1242 | } |
|
1243 | } |
|
1244 | ||
1245 | /** |
|
1246 | * @psalm-pure |