LegacyCallRequest::fromCallRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 App;
15
16
use Tarantool\Client\Request\CallRequest;
17
use Tarantool\Client\Request\Request;
18
19
final class LegacyCallRequest implements Request
20
{
21
    private const TYPE = 6;
22
23
    /** @var non-empty-array<int, string|array> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-array<int, string|array> at position 0 could not be parsed: Unknown type name 'non-empty-array' at position 0 in non-empty-array<int, string|array>.
Loading history...
24
    private $body;
25
26
    /**
27
     * @param non-empty-array<int, string|array> $body
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-array<int, string|array> at position 0 could not be parsed: Unknown type name 'non-empty-array' at position 0 in non-empty-array<int, string|array>.
Loading history...
28
     */
29
    private function __construct($body)
30
    {
31
        $this->body = $body;
32
    }
33
34
    public static function fromCallRequest(CallRequest $request) : self
35
    {
36
        return new self($request->getBody());
37
    }
38
39
    public function getType() : int
40
    {
41
        return self::TYPE;
42
    }
43
44
    public function getBody() : array
45
    {
46
        return $this->body;
47
    }
48
}
49