@@ 974-983 (lines=10) @@ | ||
971 | * |
|
972 | * @throws InvalidArgumentException |
|
973 | */ |
|
974 | public static function contains($value, $subString, $message = '') |
|
975 | { |
|
976 | if (false === \strpos($value, $subString)) { |
|
977 | static::reportInvalidArgument(\sprintf( |
|
978 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
979 | static::valueToString($value), |
|
980 | static::valueToString($subString) |
|
981 | )); |
|
982 | } |
|
983 | } |
|
984 | ||
985 | /** |
|
986 | * @psalm-pure |
|
@@ 994-1003 (lines=10) @@ | ||
991 | * |
|
992 | * @throws InvalidArgumentException |
|
993 | */ |
|
994 | public static function notContains($value, $subString, $message = '') |
|
995 | { |
|
996 | if (false !== \strpos($value, $subString)) { |
|
997 | static::reportInvalidArgument(\sprintf( |
|
998 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
999 | static::valueToString($value), |
|
1000 | static::valueToString($subString) |
|
1001 | )); |
|
1002 | } |
|
1003 | } |
|
1004 | ||
1005 | /** |
|
1006 | * @psalm-pure |
|
@@ 1032-1041 (lines=10) @@ | ||
1029 | * |
|
1030 | * @throws InvalidArgumentException |
|
1031 | */ |
|
1032 | public static function startsWith($value, $prefix, $message = '') |
|
1033 | { |
|
1034 | if (0 !== \strpos($value, $prefix)) { |
|
1035 | static::reportInvalidArgument(\sprintf( |
|
1036 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1037 | static::valueToString($value), |
|
1038 | static::valueToString($prefix) |
|
1039 | )); |
|
1040 | } |
|
1041 | } |
|
1042 | ||
1043 | /** |
|
1044 | * @psalm-pure |
|
@@ 1052-1061 (lines=10) @@ | ||
1049 | * |
|
1050 | * @throws InvalidArgumentException |
|
1051 | */ |
|
1052 | public static function notStartsWith($value, $prefix, $message = '') |
|
1053 | { |
|
1054 | if (0 === \strpos($value, $prefix)) { |
|
1055 | static::reportInvalidArgument(\sprintf( |
|
1056 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
1057 | static::valueToString($value), |
|
1058 | static::valueToString($prefix) |
|
1059 | )); |
|
1060 | } |
|
1061 | } |
|
1062 | ||
1063 | /** |
|
1064 | * @psalm-pure |