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

SearchHelper::init()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 2
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