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