Completed
Pull Request — master (#14)
by Dmitry
09:30 queued 06:45
created

UpdateRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getType() 0 4 1
A getBody() 0 9 1
1
<?php
2
3
namespace Tarantool\Client\Request;
4
5
use Tarantool\Client\IProto;
6
7
class UpdateRequest implements Request
8
{
9
    private $spaceId;
10
    private $indexId;
11
    private $key;
12
    private $operations;
13
14
    public function __construct($spaceId, $indexId, array $key, array $operations)
15
    {
16
        $this->spaceId = $spaceId;
17
        $this->indexId = $indexId;
18
        $this->key = $key;
19
        $this->operations = $operations;
20
    }
21
22
    public function getType()
23
    {
24
        return self::TYPE_UPDATE;
25
    }
26
27
    public function getBody()
28
    {
29
        return [
30
            IProto::SPACE_ID => $this->spaceId,
31
            IProto::INDEX_ID => $this->indexId,
32
            IProto::KEY => $this->key,
33
            IProto::TUPLE => $this->operations,
34
        ];
35
    }
36
}
37