UidCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 37
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toStream() 0 10 1
A getTag() 0 4 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