@@ 1149-1158 (lines=10) @@ | ||
1146 | * |
|
1147 | * @throws InvalidArgumentException |
|
1148 | */ |
|
1149 | public static function contains($value, $subString, $message = '') |
|
1150 | { |
|
1151 | if (false === \strpos($value, $subString)) { |
|
1152 | static::reportInvalidArgument(\sprintf( |
|
1153 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
1154 | static::valueToString($value), |
|
1155 | static::valueToString($subString) |
|
1156 | )); |
|
1157 | } |
|
1158 | } |
|
1159 | ||
1160 | /** |
|
1161 | * @psalm-pure |
|
@@ 1169-1178 (lines=10) @@ | ||
1166 | * |
|
1167 | * @throws InvalidArgumentException |
|
1168 | */ |
|
1169 | public static function notContains($value, $subString, $message = '') |
|
1170 | { |
|
1171 | if (false !== \strpos($value, $subString)) { |
|
1172 | static::reportInvalidArgument(\sprintf( |
|
1173 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1174 | static::valueToString($value), |
|
1175 | static::valueToString($subString) |
|
1176 | )); |
|
1177 | } |
|
1178 | } |
|
1179 | ||
1180 | /** |
|
1181 | * @psalm-pure |
|
@@ 1207-1216 (lines=10) @@ | ||
1204 | * |
|
1205 | * @throws InvalidArgumentException |
|
1206 | */ |
|
1207 | public static function startsWith($value, $prefix, $message = '') |
|
1208 | { |
|
1209 | if (0 !== \strpos($value, $prefix)) { |
|
1210 | static::reportInvalidArgument(\sprintf( |
|
1211 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1212 | static::valueToString($value), |
|
1213 | static::valueToString($prefix) |
|
1214 | )); |
|
1215 | } |
|
1216 | } |
|
1217 | ||
1218 | /** |
|
1219 | * @psalm-pure |