Completed
Push — master ( 5840b0...fcc03f )
by Frederik
04:51
created

QuitCapability   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A manifest() 0 7 1
A advertise() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol\Smtp\Capability;
5
6
use Genkgo\Mail\Protocol\ConnectionInterface;
7
use Genkgo\Mail\Protocol\Smtp\CapabilityInterface;
8
use Genkgo\Mail\Protocol\Smtp\Session;
9
10
final class QuitCapability implements CapabilityInterface
11
{
12
13
    /**
14
     * @param ConnectionInterface $connection
15
     * @param Session $session
16
     * @return Session
17
     */
18 3
    public function manifest(ConnectionInterface $connection, Session $session): Session
19
    {
20 3
        $connection->send('221 Thank you for listening');
21 3
        $connection->disconnect();
22
23 3
        return $session->withState(Session::STATE_DISCONNECT);
24
    }
25
26
    /**
27
     * @return string
28
     */
29 3
    public function advertise(): string
30
    {
31 3
        return 'QUIT';
32
    }
33
}