Conditions | 5 |
Paths | 8 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
31 | function query (...$name) { |
||
32 | if (count($name) === 1) { |
||
33 | $name = $name[0]; |
||
34 | } |
||
35 | /** |
||
36 | * @var string|string[] $name |
||
37 | */ |
||
38 | if (is_array($name)) { |
||
39 | $result = []; |
||
40 | foreach ($name as &$n) { |
||
41 | if (!array_key_exists($n, $this->query)) { |
||
42 | return null; |
||
43 | } |
||
44 | $result[$n] = $this->query[$n]; |
||
45 | } |
||
46 | return $result; |
||
47 | } |
||
48 | /** @noinspection OffsetOperationsInspection */ |
||
49 | return @$this->query[$name]; |
||
50 | } |
||
51 | } |
||
52 |