Conditions | 5 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 6 | public function __invoke(object $case, string $name, array $arguments): mixed |
|
25 | { |
||
26 | try { |
||
27 | /** @phpstan-ignore method.notFound */ |
||
28 | 6 | $value = $case->resolveMetaAttribute($name); |
|
29 | 4 | } catch (Throwable $e) { |
|
30 | /** @var UnitEnum $case */ |
||
31 | 4 | $key = Enums::resolveTranslationKey($case, $name); |
|
32 | |||
33 | /** @var array{array<string, mixed>, ?string, bool} $arguments */ |
||
34 | 4 | return ($key === $translation = Lang::get($key, ...$arguments)) ? throw $e : $translation; |
|
35 | } |
||
36 | |||
37 | 2 | return is_string($value) && method_exists($value, '__invoke') |
|
38 | 2 | ? call_user_func_array(App::make($value), $arguments) /** @phpstan-ignore argument.type */ |
|
39 | 2 | : $value; |
|
40 | } |
||
42 |