Request::reject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace seregazhuk\React\Memcached\Request;
4
5
use Exception;
6
use React\Promise\Deferred;
7
use React\Promise\Promise;
8
use React\Promise\PromiseInterface;
9
10
final class Request
11
{
12
    private $deferred;
13
14
    private $command;
15
16
    public function __construct(string $command)
17
    {
18
        $this->deferred = new Deferred();
19
        $this->command = $command;
20
    }
21
22
    public function command(): string
23
    {
24
        return $this->command;
25
    }
26
27
    /**
28
     * @return Promise|PromiseInterface
29
     */
30
    public function promise()
31
    {
32
        return $this->deferred->promise();
33
    }
34
35
    /**
36
     * @param mixed $value
37
     */
38
    public function resolve($value): void
39
    {
40
        $this->deferred->resolve($value);
41
    }
42
43
    public function reject(Exception $exception): void
44
    {
45
        $this->deferred->reject($exception);
46
    }
47
}
48