Total Complexity | 3 |
Total Lines | 18 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait ForUser |
||
8 | { |
||
9 | public ?\Closure $findIdUsing = null; |
||
10 | |||
11 | 4 | protected function findId(Model $model) |
|
12 | { |
||
13 | 4 | if (is_callable($this->findIdUsing)) { |
|
14 | 1 | return call_user_func_array($this->findIdUsing, [$model]); |
|
|
|||
15 | } |
||
16 | |||
17 | 3 | return $model->getKey(); |
|
18 | } |
||
19 | |||
20 | 8 | public function findIdUsing(?\Closure $findIdUsing): static |
|
25 | } |
||
26 | } |
||
27 |