1 | <?php |
||
14 | class Query implements QueryInterface |
||
15 | { |
||
16 | /** |
||
17 | * Array of query attributes |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | private $_attributes = []; |
||
22 | |||
23 | /** |
||
24 | * Endpoint of query |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $_endpoint; |
||
29 | |||
30 | /** |
||
31 | * Query constructor. |
||
32 | * |
||
33 | * @param string $endpoint Path of endpoint |
||
34 | * @param array $attributes List of attributes which should be set |
||
35 | */ |
||
36 | 13 | public function __construct(string $endpoint = null, array $attributes = []) |
|
42 | |||
43 | /** |
||
44 | * Append to array yet another attribute of query |
||
45 | * |
||
46 | * @param string $word |
||
47 | * @return \RouterOS\Query |
||
48 | */ |
||
49 | 6 | public function add(string $word): Query |
|
54 | |||
55 | /** |
||
56 | * Get attributes array of current query |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | 8 | public function getAttributes(): array |
|
64 | |||
65 | /** |
||
66 | * Set array of attributes |
||
67 | * |
||
68 | * @param array $attributes |
||
69 | * @since 0.7 |
||
70 | * @return \RouterOS\Query |
||
71 | */ |
||
72 | 13 | public function setAttributes(array $attributes): Query |
|
77 | |||
78 | /** |
||
79 | * Get endpoint of current query |
||
80 | * |
||
81 | * @return string|null |
||
82 | */ |
||
83 | 8 | public function getEndpoint() |
|
87 | |||
88 | /** |
||
89 | * Set endpoint of query |
||
90 | * |
||
91 | * @param string|null $endpoint |
||
92 | * @since 0.7 |
||
93 | * @return \RouterOS\Query |
||
94 | */ |
||
95 | 13 | public function setEndpoint(string $endpoint = null): Query |
|
100 | |||
101 | /** |
||
102 | * Build body of query |
||
103 | * |
||
104 | * @return array |
||
105 | * @throws \RouterOS\Exceptions\QueryException |
||
106 | */ |
||
107 | 6 | public function getQuery(): array |
|
119 | } |
||
120 |