@@ 984-993 (lines=10) @@ | ||
981 | * |
|
982 | * @throws InvalidArgumentException |
|
983 | */ |
|
984 | public static function contains($value, $subString, $message = '') |
|
985 | { |
|
986 | if (false === \strpos($value, $subString)) { |
|
987 | static::reportInvalidArgument(\sprintf( |
|
988 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
989 | static::valueToString($value), |
|
990 | static::valueToString($subString) |
|
991 | )); |
|
992 | } |
|
993 | } |
|
994 | ||
995 | /** |
|
996 | * @param mixed $value |
|
@@ 1002-1011 (lines=10) @@ | ||
999 | * |
|
1000 | * @throws InvalidArgumentException |
|
1001 | */ |
|
1002 | public static function notContains($value, $subString, $message = '') |
|
1003 | { |
|
1004 | if (false !== \strpos($value, $subString)) { |
|
1005 | static::reportInvalidArgument(\sprintf( |
|
1006 | $message ?: '%2$s was not expected to be contained in a value. Got: %s', |
|
1007 | static::valueToString($value), |
|
1008 | static::valueToString($subString) |
|
1009 | )); |
|
1010 | } |
|
1011 | } |
|
1012 | ||
1013 | /** |
|
1014 | * @param mixed $value |
|
@@ 1036-1045 (lines=10) @@ | ||
1033 | * |
|
1034 | * @throws InvalidArgumentException |
|
1035 | */ |
|
1036 | public static function startsWith($value, $prefix, $message = '') |
|
1037 | { |
|
1038 | if (0 !== \strpos($value, $prefix)) { |
|
1039 | static::reportInvalidArgument(\sprintf( |
|
1040 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
1041 | static::valueToString($value), |
|
1042 | static::valueToString($prefix) |
|
1043 | )); |
|
1044 | } |
|
1045 | } |
|
1046 | ||
1047 | /** |
|
1048 | * @param mixed $value |