Completed
Pull Request — master (#87)
by Frederik
03:37
created

CommandContinuationRequestResponse   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 86.67%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 0
loc 68
ccs 13
cts 15
cp 0.8667
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
A getBody() 0 4 1
A assertCompletion() 0 4 1
A assertContinuation() 0 4 1
A assertTagged() 0 4 1
A assertParsed() 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 7
    public function assertContinuation(): ResponseInterface
46
    {
47 7
        return $this;
48
    }
49
50
    /**
51
     * @return ResponseInterface
52
     * @throws AssertionFailedException
53
     */
54 7
    public function assertTagged(): ResponseInterface
55
    {
56 7
        throw new AssertionFailedException('A command continuous request is never tagged');
57
    }
58
59
    /**
60
     * @param string $className
61
     * @return ResponseInterface
62
     * @throws AssertionFailedException
63
     */
64
    public function assertParsed(string $className): ResponseInterface
65
    {
66
        throw new AssertionFailedException('A command continuous response is never parsed');
67
    }
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getBody(): string
73
    {
74 1
        return $this->line;
75
    }
76
}
77