Conditions | 4 |
Paths | 8 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.0466 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 2 | public function findLocalCustomerBySyncKey(string|GoCardlessCustomer $id): ?GoCardlessCustomer |
|
37 | { |
||
38 | 2 | $id = $id instanceof GoCardlessCustomer ? $id->getSyncKey() : $id; |
|
39 | |||
40 | /** @var class-string<Model> $model */ |
||
41 | 2 | $model = $this->localCustomerModel; |
|
42 | |||
43 | 2 | $builder = in_array(SoftDeletes::class, class_uses_recursive($model)) |
|
44 | ? $model::withTrashed() |
||
45 | 2 | : new $model; |
|
46 | |||
47 | 2 | return $id ? $builder->whereKey($id)->first() : null; |
|
48 | } |
||
50 |