| Conditions | 3 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 60 | 2 | final public static function fromArray(array $array): AbstractRecipient |
|
| 61 | { |
||
| 62 | 2 | return new static( |
|
| 63 | 2 | new AddressList( |
|
| 64 | 2 | \array_map( |
|
| 65 | function (array $pair) { |
||
| 66 | 2 | $count = \count($pair); |
|
| 67 | 2 | if ($count !== 1 && $count !== 2) { |
|
| 68 | 1 | throw new \InvalidArgumentException('Each recipient should have one or two elements: [<EmailAddress>] or [<EmailAddress>, <Name>]'); |
|
| 69 | } |
||
| 70 | 2 | [$emailAddress, $name] = $pair + [1 => '']; |
|
| 71 | 2 | return new Address( |
|
| 72 | 2 | new EmailAddress($emailAddress), |
|
| 73 | $name |
||
| 74 | ); |
||
| 75 | 2 | }, |
|
| 76 | 2 | $array |
|
| 77 | ) |
||
| 78 | ) |
||
| 79 | ); |
||
| 80 | } |
||
| 81 | } |
||
| 82 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.