| @@ 1135-1144 (lines=10) @@ | ||
| 1132 | * |
|
| 1133 | * @throws InvalidArgumentException |
|
| 1134 | */ |
|
| 1135 | public static function contains($value, $subString, $message = '') |
|
| 1136 | { |
|
| 1137 | if (false === \strpos($value, $subString)) { |
|
| 1138 | static::reportInvalidArgument(\sprintf( |
|
| 1139 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
| 1140 | static::valueToString($value), |
|
| 1141 | static::valueToString($subString) |
|
| 1142 | )); |
|
| 1143 | } |
|
| 1144 | } |
|
| 1145 | ||
| 1146 | /** |
|
| 1147 | * @psalm-pure |
|
| @@ 1155-1164 (lines=10) @@ | ||
| 1152 | * |
|
| 1153 | * @throws InvalidArgumentException |
|
| 1154 | */ |
|
| 1155 | public static function notContains($value, $subString, $message = '') |
|
| 1156 | { |
|
| 1157 | if (false !== \strpos($value, $subString)) { |
|
| 1158 | static::reportInvalidArgument(\sprintf( |
|
| 1159 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
| 1160 | static::valueToString($value), |
|
| 1161 | static::valueToString($subString) |
|
| 1162 | )); |
|
| 1163 | } |
|
| 1164 | } |
|
| 1165 | ||
| 1166 | /** |
|
| 1167 | * @psalm-pure |
|
| @@ 1193-1202 (lines=10) @@ | ||
| 1190 | * |
|
| 1191 | * @throws InvalidArgumentException |
|
| 1192 | */ |
|
| 1193 | public static function startsWith($value, $prefix, $message = '') |
|
| 1194 | { |
|
| 1195 | if (0 !== \strpos($value, $prefix)) { |
|
| 1196 | static::reportInvalidArgument(\sprintf( |
|
| 1197 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
| 1198 | static::valueToString($value), |
|
| 1199 | static::valueToString($prefix) |
|
| 1200 | )); |
|
| 1201 | } |
|
| 1202 | } |
|
| 1203 | ||
| 1204 | /** |
|
| 1205 | * @psalm-pure |
|
| @@ 1213-1222 (lines=10) @@ | ||
| 1210 | * |
|
| 1211 | * @throws InvalidArgumentException |
|
| 1212 | */ |
|
| 1213 | public static function notStartsWith($value, $prefix, $message = '') |
|
| 1214 | { |
|
| 1215 | if (0 === \strpos($value, $prefix)) { |
|
| 1216 | static::reportInvalidArgument(\sprintf( |
|
| 1217 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
| 1218 | static::valueToString($value), |
|
| 1219 | static::valueToString($prefix) |
|
| 1220 | )); |
|
| 1221 | } |
|
| 1222 | } |
|
| 1223 | ||
| 1224 | /** |
|
| 1225 | * @psalm-pure |
|