Completed
Pull Request — master (#37)
by Eugene
09:23 queued 07:55
created

Delete::getBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
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 Delete implements Request
20
{
21
    private $spaceId;
22
    private $indexId;
23
    private $key;
24
25 8
    public function __construct(int $spaceId, int $indexId, array $key)
26
    {
27 8
        $this->spaceId = $spaceId;
28 8
        $this->indexId = $indexId;
29 8
        $this->key = $key;
30 8
    }
31
32 8
    public function getType() : int
33
    {
34 8
        return RequestTypes::DELETE;
35
    }
36
37 8
    public function getBody() : array
38
    {
39
        return [
40 8
            IProto::SPACE_ID => $this->spaceId,
41 8
            IProto::INDEX_ID => $this->indexId,
42 8
            IProto::KEY => $this->key,
43
        ];
44
    }
45
}
46