Issues (6)

memo.php (2 issues)

Labels
1
<?php
2
3
$input = '   hoge  fuga ';
4
$rule  = ['trim', 'empty_to_null'];
5
6
$result = Normalizer::normalize($input, $rule);
7
8
var_dump($result);
9
// 'hoge  fuga'
10
11
$n = new Normalizer([
12
    'name'   => ['trim', 'empty_to_null'],
13
    'age'    => ['trim', 'empty_to_null', 'integer'],
14
    'gender' => ['trim', 'empty_to_null', 'integer'],
15
]);
16
17
$normalized = $n->normalize([
18
    'name'   => '    hoge  fuga ',
19
    'age'    => ' 20 ',
20
]);
21
22
var_dump($result);
23
// [
24
//   'name'   => 'hoge  fuga',
25
//   'age'    => 20,
26
//   'gender' => null,
27
// ]
28
29
// Advanced Filters
30
31
Filter::map([
32
    '1' => 'male',
33
    '2' => 'female',
34
]);
35
Filter::substitute('aaa', 'bbb');
36
37
// Add Filter
38
39
// Filter Set
40
Normalizer::STRING;
0 ignored issues
show
The constant Normalizer::STRING was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
41
Normalizer::INTEGER;
0 ignored issues
show
The constant Normalizer::INTEGER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
43
44
var_dump($normalized);