Completed
Pull Request — master (#42)
by Frederik
02:00
created

RenameCommand::getTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Tag;
8
use Genkgo\Mail\Stream\StringStream;
9
use Genkgo\Mail\StreamInterface;
10
11
/**
12
 * Class RenameCommand
13
 * @package Genkgo\Mail\Protocol\Imap\Request
14
 */
15
final class RenameCommand extends AbstractCommand
16
{
17
    /**
18
     * @var Tag
19
     */
20
    private $tag;
21
    /**
22
     * @var MailboxName
23
     */
24
    private $mailbox;
25
    /**
26
     * @var MailboxName
27
     */
28
    private $newName;
29
30
    /**
31
     * FetchCommand constructor.
32
     * @param Tag $tag
33
     * @param MailboxName $mailbox
34
     * @param MailboxName $newName
35
     */
36
    public function __construct(Tag $tag, MailboxName $mailbox, MailboxName $newName)
37
    {
38
        $this->tag = $tag;
39
        $this->mailbox = $mailbox;
40
        $this->newName = $newName;
41
    }
42
43
    /**
44
     * @return StreamInterface
45
     */
46
    protected function createStream(): StreamInterface
47
    {
48
        return new StringStream(
49
            sprintf(
50
                'RENAME %s %s',
51
                (string)$this->mailbox,
52
                (string)$this->newName
53
            )
54
        );
55
    }
56
57
    /**
58
     * @return Tag
59
     */
60
    public function getTag(): Tag
61
    {
62
        return $this->tag;
63
    }
64
}