Completed
Push — master ( d06bab...02e31a )
by Eugene
03:46
created

UpdateRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 30
ccs 13
cts 13
cp 1
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 12
    public function __construct($spaceId, $indexId, $key, array $operations)
15
    {
16 12
        $this->spaceId = $spaceId;
17 12
        $this->indexId = $indexId;
18 12
        $this->key = $key;
19 12
        $this->operations = $operations;
20 12
    }
21
22 12
    public function getType()
23
    {
24 12
        return self::TYPE_UPDATE;
25
    }
26
27 12
    public function getBody()
28
    {
29
        return [
30 12
            IProto::SPACE_ID => $this->spaceId,
31 12
            IProto::INDEX_ID => $this->indexId,
32 12
            IProto::KEY => [$this->key],
33 12
            IProto::TUPLE => $this->operations,
34
        ];
35
    }
36
}
37