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

SelectCommand::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
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 10
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\Tag;
7
use Genkgo\Mail\Stream\StringStream;
8
use Genkgo\Mail\StreamInterface;
9
10
/**
11
 * Class SelectCommand
12
 * @package Genkgo\Mail\Protocol\Imap\Request
13
 */
14
final class SelectCommand extends AbstractCommand
15
{
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
    /**
21
     * @var Tag
22
     */
23
    private $tag;
24
25
    /**
26
     * SelectCommand constructor.
27
     * @param Tag $tag
28
     * @param string $name
29
     */
30
    public function __construct(Tag $tag, string $name)
31
    {
32
        $this->name = $name;
33
        $this->tag = $tag;
34
    }
35
36
    /**
37
     * @return StreamInterface
38
     */
39
    public function createStream(): StreamInterface
40
    {
41
        return new StringStream(
42
            sprintf(
43
                'SELECT %s',
44
                $this->name
45
            )
46
        );
47
    }
48
49
    /**
50
     * @return Tag
51
     */
52
    public function getTag(): Tag
53
    {
54
        return $this->tag;
55
    }
56
}