Total Complexity | 5 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class VariableResolver |
||
15 | { |
||
16 | /** |
||
17 | * @var Collection |
||
18 | */ |
||
19 | protected $emails; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $context; |
||
25 | |||
26 | /** |
||
27 | * VariableResolver constructor. |
||
28 | * |
||
29 | * @param Collection $emails |
||
30 | * @param array $context |
||
31 | */ |
||
32 | final public function __construct(Collection $emails, array $context) |
||
33 | { |
||
34 | $this->emails = $emails; |
||
35 | $this->context = $context; |
||
36 | |||
37 | if (method_exists($this, 'boot')) { |
||
38 | app()->call([$this, 'boot']); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Resolver given variable. |
||
44 | * |
||
45 | * @param string $name |
||
46 | * @param string $email |
||
47 | * |
||
48 | * @return array |
||
49 | * |
||
50 | * @throws Exception |
||
51 | */ |
||
52 | final public function resolve(string $name, string $email): array |
||
63 | ]; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Get the variables from the context. |
||
68 | * |
||
69 | * @param string $key |
||
70 | * @param mixed $default |
||
71 | * |
||
72 | * @return mixed |
||
73 | */ |
||
74 | protected function get(string $key, $default = null) |
||
77 | } |
||
78 | } |