Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | final public function resolve(string $variable, string $email): array |
||
46 | { |
||
47 | $name = Str::before($variable, ':'); |
||
48 | |||
49 | $arguments[] = $email; |
||
|
|||
50 | |||
51 | if (Str::contains($variable, ':')) { |
||
52 | $arguments = array_merge($arguments, explode(',', Str::after($variable, $name . ':'))); |
||
53 | } |
||
54 | |||
55 | $method = 'get' . ucfirst($name) . 'Variable'; |
||
56 | |||
57 | if (!method_exists($this, $method)) { |
||
58 | throw new Exception('Method ' . $method . ' should be defined.'); |
||
59 | } |
||
60 | |||
61 | return [ |
||
62 | 'name' => $name, |
||
63 | 'content' => call_user_func([$this, $method], ...$arguments) |
||
64 | ]; |
||
66 | } |