| Conditions | 4 |
| Paths | 6 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4.0072 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | public function send(MessageInterface $message): void |
|
| 31 | { |
||
| 32 | 4 | $fromHeaders = $message->getHeader('from'); |
|
| 33 | 4 | if (!\is_array($fromHeaders)) { |
|
| 34 | $fromHeaders = \iterator_to_array($fromHeaders); |
||
| 35 | } |
||
| 36 | |||
| 37 | 4 | if (isset($fromHeaders[0])) { |
|
| 38 | 3 | $addressList = AddressList::fromString( |
|
| 39 | 3 | $fromHeaders[0]->getValue()->getRaw() |
|
| 40 | ); |
||
| 41 | |||
| 42 | 3 | if ($addressList->count() > 1) { |
|
| 43 | $message = $message |
||
| 44 | 2 | ->withHeader( |
|
| 45 | 2 | new Sender( |
|
| 46 | 2 | $addressList->first() |
|
| 47 | ) |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | 4 | $this->decoratedTransport->send($message); |
|
| 53 | 4 | } |
|
| 54 | } |
||
| 55 |