Conditions | 5 |
Paths | 5 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function exact($fields) |
||
24 | { |
||
25 | if (is_string($fields)) { |
||
26 | if ($this->includes->has($fields)) { |
||
27 | $this->query->with($fields); |
||
28 | } |
||
29 | |||
30 | return $this; |
||
31 | } |
||
32 | |||
33 | if (! is_array($fields)) { |
||
34 | throw new \InvalidArgumentException( |
||
35 | 'The exact() method expects a string or an array. '.gettype($fields).' given' |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | foreach (array_intersect($this->includes->keys(), $fields) as $field) { |
||
40 | $this->query->with($field); |
||
41 | } |
||
42 | |||
43 | return $this; |
||
44 | } |
||
45 | |||
59 |