Skip to content

Commit bccdae0

Browse files
committed
Add compress-string alias
1 parent b0f7585 commit bccdae0

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"traderinteractive/filter-dates": "^3.0",
3737
"traderinteractive/filter-floats": "^3.0",
3838
"traderinteractive/filter-ints": "^3.0",
39-
"traderinteractive/filter-strings": "^3.3.1"
39+
"traderinteractive/filter-strings": "^3.3.2"
4040
},
4141
"require-dev": {
4242
"php-coveralls/php-coveralls": "^1.0",

src/Filterer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ final class Filterer implements FiltererInterface
2020
'arrayize' => '\\TraderInteractive\\Filter\\Arrays::arrayize',
2121
'bool' => '\\TraderInteractive\\Filter\\Booleans::filter',
2222
'bool-convert' => '\\TraderInteractive\\Filter\\Booleans::convert',
23+
'compress-string' => '\\TraderInteractive\\Filter\\Strings::compress',
2324
'concat' => '\\TraderInteractive\\Filter\\Strings::concat',
2425
'date' => '\\TraderInteractive\\Filter\\DateTime::filter',
2526
'date-format' => '\\TraderInteractive\\Filter\\DateTime::format',

tests/FiltererTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@ public function provideValidFilterData() : array
226226
'options' => [],
227227
'result' => [true, ['field' => 'one or *****'], null, []],
228228
],
229+
'compress-string alias' => [
230+
'spec' => ['field' => [['compress-string']]],
231+
'input' => ['field' => ' a string with extra spaces '],
232+
'options' => [],
233+
'result' => [true, ['field' => 'a string with extra spaces'], null, []],
234+
],
235+
'compress-string alias include newlines' => [
236+
'spec' => ['field' => [['compress-string', true]]],
237+
'input' => ['field' => " a string\n with\nnewlines and extra spaces\n "],
238+
'options' => [],
239+
'result' => [true, ['field' => 'a string with newlines and extra spaces'], null, []],
240+
],
229241
];
230242
}
231243

0 commit comments

Comments
 (0)