Skip to content

Commit d06375d

Browse files
committed
Add alias for Strings::stripTags
1 parent 0244d41 commit d06375d

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ $value = \TraderInteractive\Filter\Strings::explode('abc,def,ghi');
223223
assert($value === ['abc', 'def', 'ghi']);
224224
```
225225

226+
#### Strings::stripTags
227+
Aliased in the filterer as `strip-tags`, this filter is essentially a wrapper around the built-in [`strip_tags`](http://php.net/manual/en/function.strip-tags.php) function. However, unlike the
228+
native function the stripTags method will return null when given a null value.
229+
```php
230+
$value = \TraderInteractive\Filter\Strings::stripTags('A string with <p>tags</p>');
231+
assert($value === 'a string with tags');
232+
```
233+
226234
#### Url::filter
227235
Aliased in the filterer as `url`, this filter verifies that the argument is a URL string according to
228236
[RFC2396](http://www.faqs.org/rfcs/rfc2396). The second parameter can be set to `true` to allow

src/Filterer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ final class Filterer
2929
'url' => '\TraderInteractive\Filter\Url::filter',
3030
'email' => '\TraderInteractive\Filter\Email::filter',
3131
'explode' => '\TraderInteractive\Filter\Strings::explode',
32+
'strip-tags' => '\TraderInteractive\Filter\Strings::stripTags',
3233
'flatten' => '\TraderInteractive\Filter\Arrays::flatten',
3334
'date' => '\TraderInteractive\Filter\DateTime::filter',
3435
'date-format' => '\TraderInteractive\Filter\DateTime::format',

0 commit comments

Comments
 (0)