Skip to content

Commit 7a68263

Browse files
authored
Merge pull request #78 from chadicus/master
Add alias for Strings::stripTags
2 parents a9949d3 + 06e6d8c commit 7a68263

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ build_failure_conditions:
1919
- 'elements.rating(< C).new.exists'
2020
- 'issues.label("coding-style").new.exists'
2121
- 'issues.severity(>= MAJOR).new.exists'
22-
- 'project.metric("scrutinizer.quality", < 7)'
22+
- 'project.metric("scrutinizer.quality", < 6.37)'

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

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"traderinteractive/filter-dates": "^3.0",
3636
"traderinteractive/filter-floats": "^3.0",
3737
"traderinteractive/filter-ints": "^3.0",
38-
"traderinteractive/filter-strings": "^3.0"
38+
"traderinteractive/filter-strings": "^3.1"
3939
},
4040
"require-dev": {
4141
"php-coveralls/php-coveralls": "^1.0",

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)