Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function getInstance(string $mailableClass): Mailable |
||
22 | { |
||
23 | if (! class_exists($mailableClass)) { |
||
24 | throw new Exception("Mailable `{$mailableClass}` does not exist."); |
||
25 | } |
||
26 | |||
27 | $argumentValues = $this->getArguments($mailableClass); |
||
28 | |||
29 | return new $this->mailableClass(...$argumentValues); |
||
|
|||
30 | } |
||
31 | |||
48 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: