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

UpdateRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 4
crap 2
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