@@ 1034-1043 (lines=10) @@ | ||
1031 | * |
|
1032 | * @throws InvalidArgumentException |
|
1033 | */ |
|
1034 | public static function contains($value, $subString, $message = '') |
|
1035 | { |
|
1036 | if (false === \strpos($value, $subString)) { |
|
1037 | static::reportInvalidArgument(\sprintf( |
|
1038 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
1039 | static::valueToString($value), |
|
1040 | static::valueToString($subString) |
|
1041 | )); |
|
1042 | } |
|
1043 | } |
|
1044 | ||
1045 | /** |
|
1046 | * @psalm-pure |
|
@@ 1054-1063 (lines=10) @@ | ||
1051 | * |
|
1052 | * @throws InvalidArgumentException |
|
1053 | */ |
|
1054 | public static function notContains($value, $subString, $message = '') |
|
1055 | { |
|
1056 | if (false !== \strpos($value, $subString)) { |
|
1057 | static::reportInvalidArgument(\sprintf( |
|
1058 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1059 | static::valueToString($value), |
|
1060 | static::valueToString($subString) |
|
1061 | )); |
|
1062 | } |
|
1063 | } |
|
1064 | ||
1065 | /** |
|
1066 | * @psalm-pure |
|
@@ 1092-1101 (lines=10) @@ | ||
1089 | * |
|
1090 | * @throws InvalidArgumentException |
|
1091 | */ |
|
1092 | public static function startsWith($value, $prefix, $message = '') |
|
1093 | { |
|
1094 | if (0 !== \strpos($value, $prefix)) { |
|
1095 | static::reportInvalidArgument(\sprintf( |
|
1096 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1097 | static::valueToString($value), |
|
1098 | static::valueToString($prefix) |
|
1099 | )); |
|
1100 | } |
|
1101 | } |
|
1102 | ||
1103 | /** |
|
1104 | * @psalm-pure |
|
@@ 1112-1121 (lines=10) @@ | ||
1109 | * |
|
1110 | * @throws InvalidArgumentException |
|
1111 | */ |
|
1112 | public static function notStartsWith($value, $prefix, $message = '') |
|
1113 | { |
|
1114 | if (0 === \strpos($value, $prefix)) { |
|
1115 | static::reportInvalidArgument(\sprintf( |
|
1116 | $message ?: 'Expected a value not to start with %2$s. Got: %s', |
|
1117 | static::valueToString($value), |
|
1118 | static::valueToString($prefix) |
|
1119 | )); |
|
1120 | } |
|
1121 | } |
|
1122 | ||
1123 | /** |
|
1124 | * @psalm-pure |