| Conditions | 4 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | 3 | public function negotiate(Client $client): void |
|
| 45 | { |
||
| 46 | 3 | if (empty($this->connection->getMetaData(['crypto']))) { |
|
| 47 | 3 | $reply = $client->request(new EhloCommand($this->ehlo)); |
|
| 48 | 3 | if ($reply->isCommandNotImplemented()) { |
|
| 49 | 1 | $reply = $client->request(new HeloCommand($this->ehlo)); |
|
| 50 | } |
||
| 51 | 3 | $reply->assertCompleted(); |
|
| 52 | |||
| 53 | 3 | $ehloResponse = new EhloResponse($reply); |
|
| 54 | |||
| 55 | 3 | if ($ehloResponse->isAdvertising('STARTTLS')) { |
|
| 56 | $client |
||
| 57 | 1 | ->request(new StartTlsCommand()) |
|
| 58 | 1 | ->assertCompleted(); |
|
| 59 | |||
| 60 | 1 | $this->connection->upgrade($this->crypto); |
|
| 61 | } |
||
| 62 | } |
||
| 63 | 3 | } |
|
| 64 | } |
||
| 65 |