2015-01-30 09:40:06 +01:00
|
|
|
# Contains
|
|
|
|
|
2017-03-27 22:04:13 +02:00
|
|
|
- `Contains(mixed $expectedValue)`
|
|
|
|
- `Contains(mixed $expectedValue, bool $identical)`
|
|
|
|
|
|
|
|
Validates if the input contains some value.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
|
|
|
For strings:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::contains('ipsum')->validate('lorem ipsum'); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
For arrays:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::contains('ipsum')->validate(['ipsum', 'lorem']); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
A second parameter may be passed for identical comparison instead
|
|
|
|
of equal comparison.
|
|
|
|
|
|
|
|
Message template for this validator includes `{{containsValue}}`.
|
|
|
|
|
2019-05-11 18:32:13 +02:00
|
|
|
## Categorization
|
|
|
|
|
|
|
|
- Arrays
|
|
|
|
- Strings
|
|
|
|
|
2017-03-27 22:04:13 +02:00
|
|
|
## Changelog
|
|
|
|
|
|
|
|
Version | Description
|
|
|
|
--------|-------------
|
|
|
|
0.3.9 | Created
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
2018-12-12 15:12:45 +01:00
|
|
|
- [ContainsAny](ContainsAny.md)
|
2017-03-28 11:53:14 +02:00
|
|
|
- [EndsWith](EndsWith.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Equals](Equals.md)
|
2018-06-23 16:24:48 +02:00
|
|
|
- [Equivalent](Equivalent.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Identical](Identical.md)
|
2017-03-28 11:53:14 +02:00
|
|
|
- [In](In.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Regex](Regex.md)
|
|
|
|
- [StartsWith](StartsWith.md)
|
|
|
|
- [Unique](Unique.md)
|