Conditions | 5 |
Paths | 2 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | protected function applySelectorQuery() |
||
42 | { |
||
43 | if (is_null($this->selector)) { |
||
44 | return $this; |
||
45 | } |
||
46 | |||
47 | $active = Selector::parseSelected(); |
||
48 | |||
49 | $this->selector->getSelectors()->each(function ($selector, $column) use ($active) { |
||
50 | if (!array_key_exists($column, $active)) { |
||
51 | return; |
||
52 | } |
||
53 | |||
54 | $values = $active[$column]; |
||
55 | |||
56 | if ($selector['type'] == 'one') { |
||
57 | $values = current($values); |
||
58 | } |
||
59 | |||
60 | if (is_null($selector['query'])) { |
||
61 | $this->model()->whereIn($column, $values); |
||
62 | } else { |
||
63 | call_user_func($selector['query'], $this->model(), $values); |
||
64 | } |
||
65 | }); |
||
66 | |||
67 | return $this; |
||
68 | } |
||
69 | |||
79 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.