Completed
Push — master ( c0eda5...1ea1f4 )
by Sergey
03:04
created

Request::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
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
class Request
11
{
12
    /**
13
     * @var Deferred
14
     */
15
    private $deferred;
16
17
    /**
18
     * @var string
19
     */
20
    private $command;
21
22
    /**
23
     * @param string $command
24
     */
25
    public function __construct($command)
26
    {
27
        $this->deferred = new Deferred();
28
        $this->command = $command;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function command()
35
    {
36
        return $this->command;
37
    }
38
39
    /**
40
     * @return Promise|PromiseInterface
41
     */
42
    public function promise()
43
    {
44
        return $this->deferred->promise();
45
    }
46
47
    /**
48
     * @param mixed $value
49
     */
50
    public function resolve($value)
51
    {
52
        $this->deferred->resolve($value);
53
    }
54
55
    /**
56
     * @param Exception $exception
57
     */
58
    public function reject(Exception $exception)
59
    {
60
        $this->deferred->reject($exception);
61
    }
62
}
63