UidCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
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\Request;
5
6
use Genkgo\Mail\Protocol\Imap\RequestInterface;
7
use Genkgo\Mail\Protocol\Imap\Tag;
8
use Genkgo\Mail\Stream\StringStream;
9
use Genkgo\Mail\StreamInterface;
10
11
final class UidCommand implements RequestInterface
12
{
13
    /**
14
     * @var RequestInterface
15
     */
16
    private $request;
17
18
    /**
19
     * @param RequestInterface $request
20
     */
21 1
    public function __construct(RequestInterface $request)
22
    {
23 1
        $this->request = $request;
24 1
    }
25
26
    /**
27
     * @return StreamInterface
28
     */
29 1
    public function toStream(): StreamInterface
30
    {
31 1
        return new StringStream(
32 1
            \sprintf(
33 1
                '%s UID %s',
34 1
                (string)$this->getTag(),
35 1
                $this->getTag()->extractBodyFromLine((string) $this->request->toStream())
36
            )
37
        );
38
    }
39
40
    /**
41
     * @return Tag
42
     */
43 1
    public function getTag(): Tag
44
    {
45 1
        return $this->request->getTag();
46
    }
47
}
48