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

UidCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toStream() 0 7 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\ConcatenatedStream;
9
use Genkgo\Mail\Stream\StringStream;
10
use Genkgo\Mail\StreamInterface;
11
12
final class UidCommand implements RequestInterface
13
{
14
15
    /**
16
     * @var RequestInterface
17
     */
18
    private $request;
19
20
    /**
21
     * UidCommand constructor.
22
     * @param RequestInterface $request
23
     */
24
    public function __construct(RequestInterface $request)
25
    {
26
        $this->request = $request;
27
    }
28
29
    /**
30
     * @return StreamInterface
31
     */
32
    public function toStream(): StreamInterface
33
    {
34
        return new ConcatenatedStream([
0 ignored issues
show
Documentation introduced by
array(new \Genkgo\Mail\S...s->request->toStream()) is of type array<integer,object<Gen...il\\StreamInterface>"}>, but the function expects a object<Genkgo\Mail\Stream\iterable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
            new StringStream('UID '),
36
            $this->request->toStream()
37
        ]);
38
    }
39
40
    /**
41
     * @return Tag
42
     */
43
    public function getTag(): Tag
44
    {
45
        return $this->request->getTag();
46
    }
47
}