Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 6 |
Ratio | 26.09 % |
Changes | 0 |
1 | <?php |
||
12 | public function __construct(array $options) |
||
13 | { |
||
14 | $defaults = [ |
||
15 | 'page_size' => 50, |
||
16 | 'current_page' => 0, |
||
17 | 'orderings' => [], |
||
18 | 'variant' => null, |
||
19 | ]; |
||
20 | |||
21 | View Code Duplication | if ($diff = array_diff(array_keys($options), array_keys($defaults))) { |
|
22 | throw new \InvalidArgumentException(sprintf( |
||
23 | 'Invalid grid options "%s". Valid options: "%s"', |
||
24 | implode('", "', $diff), implode('", "', array_keys($defaults)) |
||
25 | )); |
||
26 | } |
||
27 | |||
28 | $options = array_merge($defaults, $options); |
||
29 | |||
30 | $this->currentPage = $options['current_page']; |
||
31 | $this->pageSize = $options['page_size']; |
||
32 | $this->orderings = $options['orderings']; |
||
33 | $this->variant = $options['variant']; |
||
34 | } |
||
35 | |||
61 |
This check marks private properties in classes that are never used. Those properties can be removed.