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

Upsert   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
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 27
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 4 1
A getBody() 0 8 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
    public function __construct(int $spaceId, array $values, array $operations)
26
    {
27
        $this->spaceId = $spaceId;
28
        $this->values = $values;
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->values,
42
            IProto::OPERATIONS => $this->operations,
43
        ];
44
    }
45
}
46