1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of Rivescript-php |
4
|
|
|
* |
5
|
|
|
* (c) Johnny Mast <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Axiom\Rivescript\Cortex\ResponseQueue; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* ResponseQueueItem class |
15
|
|
|
* |
16
|
|
|
* The ResponseQueueItem represents one response in the ResponseQueue. |
17
|
|
|
* |
18
|
|
|
* PHP version 7.4 and higher. |
19
|
|
|
* |
20
|
|
|
* @category Core |
21
|
|
|
* @package Cortext\ResponseQueue |
22
|
|
|
* @author Johnny Mast <[email protected]> |
23
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
24
|
|
|
* @link https://github.com/axiom-labs/rivescript-php |
25
|
|
|
* @since 0.4.0 |
26
|
|
|
*/ |
27
|
|
|
class ResponseQueueItem |
28
|
|
|
{ |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The command prefix. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
public string $command = ""; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* The response type. |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
public string $type = 'atomic'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The sort order of the response. |
46
|
|
|
* |
47
|
|
|
* @var int |
48
|
|
|
*/ |
49
|
|
|
public int $order = 0; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Local parser options at this item. |
53
|
|
|
* |
54
|
|
|
* @var array<string, string> |
55
|
|
|
*/ |
56
|
|
|
public array $options = []; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* ResponseQueueItem constructor. |
60
|
|
|
* |
61
|
|
|
* @param string $command The command prefix. |
62
|
|
|
* @param string $type The type of response. |
63
|
|
|
* @param int $order The order of the response. |
64
|
|
|
* @param array<string,string> $options The local interpreter options. |
65
|
|
|
*/ |
66
|
|
|
public function __construct(string $command, string $type, int $order = 0, array $options = []) |
67
|
|
|
{ |
68
|
|
|
$this->command = $command; |
69
|
|
|
$this->type = $type; |
70
|
|
|
$this->order = $order; |
71
|
|
|
$this->options = $options; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Return the command string. |
76
|
|
|
* |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getCommand(): string |
80
|
|
|
{ |
81
|
|
|
return $this->command; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|