Request   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A promise() 0 3 1
A __construct() 0 4 1
A reject() 0 3 1
A resolve() 0 3 1
A command() 0 3 1
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