Passed
Push — master ( f17b13...8bf1e0 )
by Radu
01:33
created

SearchHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 3
1
<?php
2
namespace WebServCo\Framework\DataTables;
3
4
class SearchHelper extends AbstractHelper
5
{
6
    public static function init($data, $required = [])
7
    {
8
        parent::init($data, ['value', 'regex']);
9
10
        foreach (['value', 'regex'] as $item) {
11
            if (!isset($data[$item])) {
12
                throw new \InvalidArgumentException(sprintf('Missing parameter: %s', $item));
13
            }
14
        }
15
16
        return new Search($data['value'], $data['regex']);
17
    }
18
}
19