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

assertCompletion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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