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

AbstractHelper::init()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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