StatusCommand::getTag()   A
last analyzed

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 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol\Imap\Request;
5
6
use Genkgo\Mail\Protocol\Imap\MailboxName;
7
use Genkgo\Mail\Protocol\Imap\MessageData\ItemList;
8
use Genkgo\Mail\Protocol\Imap\Tag;
9
use Genkgo\Mail\Stream\StringStream;
10
use Genkgo\Mail\StreamInterface;
11
12
final class StatusCommand extends AbstractCommand
13
{
14
    /**
15
     * @var ItemList
16
     */
17
    private $list;
18
19
    /**
20
     * @var Tag
21
     */
22
    private $tag;
23
24
    /**
25
     * @var MailboxName
26
     */
27
    private $mailbox;
28
29
    /**
30
     * @param Tag $tag
31
     * @param MailboxName $mailbox
32
     * @param ItemList $list
33
     */
34 1
    public function __construct(Tag $tag, MailboxName $mailbox, ItemList $list)
35
    {
36 1
        $this->list = $list;
37 1
        $this->tag = $tag;
38 1
        $this->mailbox = $mailbox;
39 1
    }
40
41
    /**
42
     * @return StreamInterface
43
     */
44 1
    protected function createStream(): StreamInterface
45
    {
46 1
        return new StringStream(
47 1
            \sprintf(
48 1
                'STATUS %s %s',
49 1
                (string)$this->mailbox,
50 1
                (string)$this->list
51
            )
52
        );
53
    }
54
55
    /**
56
     * @return Tag
57
     */
58 1
    public function getTag(): Tag
59
    {
60 1
        return $this->tag;
61
    }
62
}
63