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; |
15
|
|
|
|
16
|
|
|
final class RequestTypes |
17
|
|
|
{ |
18
|
|
|
public const SELECT = 1; |
19
|
|
|
public const INSERT = 2; |
20
|
|
|
public const REPLACE = 3; |
21
|
|
|
public const UPDATE = 4; |
22
|
|
|
public const DELETE = 5; |
23
|
|
|
public const AUTHENTICATE = 7; |
24
|
|
|
public const EVALUATE = 8; |
25
|
|
|
public const UPSERT = 9; |
26
|
|
|
public const CALL = 10; |
27
|
|
|
public const EXECUTE = 11; |
28
|
|
|
public const PREPARE = 13; |
29
|
|
|
public const PING = 64; |
30
|
|
|
|
31
|
|
|
private const ALL = [ |
32
|
|
|
self::SELECT => 'select', |
33
|
|
|
self::INSERT => 'insert', |
34
|
|
|
self::REPLACE => 'replace', |
35
|
|
|
self::UPDATE => 'update', |
36
|
|
|
self::DELETE => 'delete', |
37
|
|
|
self::AUTHENTICATE => 'authenticate', |
38
|
|
|
self::EVALUATE => 'evaluate', |
39
|
|
|
self::UPSERT => 'upsert', |
40
|
|
|
self::CALL => 'call', |
41
|
|
|
self::EXECUTE => 'execute', |
42
|
|
|
self::PREPARE => 'prepare', |
43
|
|
|
self::PING => 'ping', |
44
|
|
|
]; |
45
|
|
|
|
46
|
|
|
public static function getName(int $type) : string |
47
|
|
|
{ |
48
|
|
|
if (isset(self::ALL[$type])) { |
49
|
|
|
return self::ALL[$type]; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
throw new \InvalidArgumentException("Unknown request type #$type"); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
private function __construct() |
56
|
|
|
{ |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|