Issues (55)

src/Request/PrepareRequest.php (2 issues)

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\Keys;
17
use Tarantool\Client\RequestTypes;
18
19
final class PrepareRequest implements Request
20
{
21
    /** @var non-empty-array<int, int|string> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-array<int, int|string> at position 0 could not be parsed: Unknown type name 'non-empty-array' at position 0 in non-empty-array<int, int|string>.
Loading history...
22
    private $body;
23
24
    /**
25
     * @param non-empty-array<int, int|string> $body
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-array<int, int|string> at position 0 could not be parsed: Unknown type name 'non-empty-array' at position 0 in non-empty-array<int, int|string>.
Loading history...
26
     */
27 28
    private function __construct($body)
28
    {
29 28
        $this->body = $body;
30
    }
31
32 20
    public static function fromSql(string $sql) : self
33
    {
34 20
        return new self([Keys::SQL_TEXT => $sql]);
35
    }
36
37 24
    public static function fromStatementId(int $statementId) : self
38
    {
39 24
        return new self([Keys::STMT_ID => $statementId]);
40
    }
41
42 28
    public function getType() : int
43
    {
44 28
        return RequestTypes::PREPARE;
45
    }
46
47 28
    public function getBody() : array
48
    {
49 28
        return $this->body;
50
    }
51
}
52