Completed
Pull Request — master (#87)
by Frederik
01:29
created

CommandContinuationRequestResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
A assertCompletion() 0 4 1
A assertContinuation() 0 4 1
A assertTagged() 0 4 1
A getBody() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol\Imap\Response;
5
6
use Genkgo\Mail\Exception\AssertionFailedException;
7
use Genkgo\Mail\Protocol\Imap\ResponseInterface;
8
9
final class CommandContinuationRequestResponse implements ResponseInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $line;
15
16
    /**
17
     * @param string $line
18
     */
19 10
    public function __construct(string $line)
20
    {
21 10
        $this->line = $line;
22 10
    }
23
24
    /**
25
     * @return string
26
     */
27 1
    public function __toString(): string
28
    {
29 1
        return \sprintf('+ %s', $this->line);
30
    }
31
32
    /**
33
     * @param CompletionResult $expectedResult
34
     * @return ResponseInterface
35
     * @throws AssertionFailedException
36
     */
37 1
    public function assertCompletion(CompletionResult $expectedResult): ResponseInterface
38
    {
39 1
        throw new AssertionFailedException();
40
    }
41
42
    /**
43
     * @return ResponseInterface
44
     */
45 6
    public function assertContinuation(): ResponseInterface
46
    {
47 6
        return $this;
48
    }
49
50
    /**
51
     * @return ResponseInterface
52
     * @throws AssertionFailedException
53
     */
54 2
    public function assertTagged(): ResponseInterface
55
    {
56 2
        throw new AssertionFailedException('A command continuous request is never tagged');
57
    }
58
59
    /**
60
     * @return string
61
     */
62 1
    public function getBody(): string
63
    {
64 1
        return $this->line;
65
    }
66
}
67