Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function getMenu() |
||
27 | { |
||
28 | if (!isset($this->menu)) { |
||
29 | $this->menu['events']['type'] = EventTypeQuery::create() |
||
30 | ->useEventQuery() |
||
31 | ->filterByRemoved(false) |
||
32 | ->filterByDate(['min' => new DateTime()]) |
||
33 | ->endUse() |
||
34 | ->distinct() |
||
35 | ->find(); |
||
36 | |||
37 | $this->menu['groups'] = GroupQuery::create() |
||
38 | ->distinct() |
||
39 | ->find(); |
||
40 | } |
||
41 | |||
42 | return $this->menu; |
||
43 | } |
||
44 | |||
57 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: