Response   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 76
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getData() 0 4 1
A getServer() 0 4 1
1
<?php
2
3
4
namespace Beanie\Command;
5
6
7
use Beanie\Server\Server;
8
9
class Response
10
{
11
    // GLOBAL ERRORS
12
    const ERROR_BAD_FORMAT = 'BAD_FORMAT';
13
    const ERROR_INTERNAL_ERROR = 'INTERNAL_ERROR';
14
    const ERROR_OUT_OF_MEMORY = 'OUT_OF_MEMORY';
15
    const ERROR_UNKNOWN_COMMAND = 'UNKNOWN_COMMAND';
16
17
    // FAILURE RESPONSES
18
    const FAILURE_DEADLINE_SOON = 'DEADLINE_SOON';
19
    const FAILURE_DRAINING = 'DRAINING';
20
    const FAILURE_EXPECTED_CRLF = 'EXPECTED_CRLF';
21
    const FAILURE_JOB_TOO_BIG = 'JOB_TOO_BIG';
22
    const FAILURE_NOT_FOUND = 'NOT_FOUND';
23
    const FAILURE_NOT_IGNORED = 'NOT_IGNORED';
24
    const FAILURE_TIMED_OUT = 'TIMED_OUT';
25
26
    // SUCCESSFUL RESPONSES
27
    const RESPONSE_BURIED = 'BURIED';
28
    const RESPONSE_DELETED = 'DELETED';
29
    const RESPONSE_FOUND = 'FOUND';
30
    const RESPONSE_INSERTED = 'INSERTED';
31
    const RESPONSE_KICKED = 'KICKED';
32
    const RESPONSE_OK = 'OK';
33
    const RESPONSE_PAUSED = 'PAUSED';
34
    const RESPONSE_RELEASED = 'RELEASED';
35
    const RESPONSE_RESERVED = 'RESERVED';
36
    const RESPONSE_TOUCHED = 'TOUCHED';
37
    const RESPONSE_USING = 'USING';
38
    const RESPONSE_WATCHING = 'WATCHING';
39
40
    /** @var string */
41
    protected $name;
42
43
    /** @var mixed */
44
    protected $data;
45
46
    /** @var Server */
47
    protected $server;
48
49
    /**
50
     * @param string $name
51
     * @param mixed $data
52
     * @param Server $server
53
     */
54 39
    public function __construct($name, $data, Server $server)
55
    {
56 39
        $this->name = $name;
57 39
        $this->data = $data;
58 39
        $this->server = $server;
59 39
    }
60
61
    /**
62
     * @return string
63
     */
64 30
    public function getName()
65
    {
66 30
        return $this->name;
67
    }
68
69
    /**
70
     * @return mixed
71
     */
72 28
    public function getData()
73
    {
74 28
        return $this->data;
75
    }
76
77
    /**
78
     * @return Server
79
     */
80 18
    public function getServer()
81
    {
82 18
        return $this->server;
83
    }
84
}
85