Completed
Pull Request — master (#37)
by Eugene
03:16
created

Upsert::getBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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