Skip to content

Commit a13e9f6

Browse files
committed
Add docs to README for UuidFilter
1 parent 4d56f65 commit a13e9f6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ $value = '{ "string": "value", "array": [1, 2, 3] }';
152152
assert($value === ['string' => 'value', 'array' => [1, 2, 3]]);
153153
```
154154

155+
#### UuidFilter::filter
156+
157+
This filter verifies a given string is a valid universally unique identifier.
158+
159+
The second parameter can be set to `true` to allow null values through without an error.
160+
161+
The third parameter determines which UUID version the value will be validated against. By default, the filter will succeed if the values matches version 1, 2, 3, 4, 5, 6, or 7
162+
163+
```php
164+
$value = '1a42403c-a29d-11ef-b864-0242ac120002';
165+
$filtered = \TraderInteractive\Filter\UuidFilter::filter($value);
166+
assert($value === $filtered);
167+
```
168+
155169
#### XmlFilter::filter
156170

157171
This filter ensures the given string is valid XML.

0 commit comments

Comments
 (0)