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

DeleteCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

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