| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 19 |