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

AbstractHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

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