Passed
Push — master ( c0e693...644214 )
by Eugene
06:44
created

UpsertRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
/**
4
 * This file is part of the Tarantool Client package.
5
 *
6
 * (c) Eugene Leonovich <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Tarantool\Client\Request;
15
16
use Tarantool\Client\IProto;
17
use Tarantool\Client\RequestTypes;
18
19
final class UpsertRequest implements Request
20
{
21
    private $spaceId;
22
    private $tuple;
23
    private $operations;
24
25
    public function __construct(int $spaceId, array $tuple, array $operations)
26
    {
27
        $this->spaceId = $spaceId;
28
        $this->tuple = $tuple;
29
        $this->operations = $operations;
30
    }
31
32
    public function getType() : int
33
    {
34
        return RequestTypes::UPSERT;
35
    }
36
37
    public function getBody() : array
38
    {
39
        return [
40
            IProto::SPACE_ID => $this->spaceId,
41
            IProto::TUPLE => $this->tuple,
42
            IProto::OPERATIONS => $this->operations,
43
        ];
44
    }
45
}
46