1616class Queue
1717{
1818 private $ client ;
19- private $ tubeName ;
19+ private $ name ;
2020
2121 /**
2222 * @param \Tarantool|\Tarantool\Client\Client $client
23- * @param string $tubeName
23+ * @param string $name
2424 *
2525 * @throws \InvalidArgumentException
2626 */
27- public function __construct ($ client , $ tubeName )
27+ public function __construct ($ client , $ name )
2828 {
2929 if ($ client instanceof Client) {
3030 $ client = new ClientAdapter ($ client );
@@ -36,7 +36,15 @@ public function __construct($client, $tubeName)
3636 }
3737
3838 $ this ->client = $ client ;
39- $ this ->tubeName = $ tubeName ;
39+ $ this ->name = $ name ;
40+ }
41+
42+ /**
43+ * @return string
44+ */
45+ public function getName ()
46+ {
47+ return $ this ->name ;
4048 }
4149
4250 /**
@@ -48,7 +56,7 @@ public function __construct($client, $tubeName)
4856 public function put ($ data , array $ options = [])
4957 {
5058 $ args = $ options ? [$ data , $ options ] : [$ data ];
51- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :put " , $ args );
59+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :put " , $ args );
5260
5361 return Task::createFromTuple ($ result [0 ]);
5462 }
@@ -61,7 +69,7 @@ public function put($data, array $options = [])
6169 public function take ($ timeout = null )
6270 {
6371 $ args = null === $ timeout ? [] : [$ timeout ];
64- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :take " , $ args );
72+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :take " , $ args );
6573
6674 return empty ($ result [0 ]) ? null : Task::createFromTuple ($ result [0 ]);
6775 }
@@ -73,7 +81,7 @@ public function take($timeout = null)
7381 */
7482 public function ack ($ taskId )
7583 {
76- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :ack " , [$ taskId ]);
84+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :ack " , [$ taskId ]);
7785
7886 return Task::createFromTuple ($ result [0 ]);
7987 }
@@ -87,7 +95,7 @@ public function ack($taskId)
8795 public function release ($ taskId , array $ options = [])
8896 {
8997 $ args = $ options ? [$ taskId , $ options ] : [$ taskId ];
90- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :release " , $ args );
98+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :release " , $ args );
9199
92100 return Task::createFromTuple ($ result [0 ]);
93101 }
@@ -99,7 +107,7 @@ public function release($taskId, array $options = [])
99107 */
100108 public function peek ($ taskId )
101109 {
102- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :peek " , [$ taskId ]);
110+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :peek " , [$ taskId ]);
103111
104112 return Task::createFromTuple ($ result [0 ]);
105113 }
@@ -111,7 +119,7 @@ public function peek($taskId)
111119 */
112120 public function bury ($ taskId )
113121 {
114- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :bury " , [$ taskId ]);
122+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :bury " , [$ taskId ]);
115123
116124 return Task::createFromTuple ($ result [0 ]);
117125 }
@@ -123,7 +131,7 @@ public function bury($taskId)
123131 */
124132 public function kick ($ count )
125133 {
126- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :kick " , [$ count ]);
134+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :kick " , [$ count ]);
127135
128136 return $ result [0 ][0 ];
129137 }
@@ -135,14 +143,14 @@ public function kick($count)
135143 */
136144 public function delete ($ taskId )
137145 {
138- $ result = $ this ->client ->call ("queue.tube. $ this ->tubeName :delete " , [$ taskId ]);
146+ $ result = $ this ->client ->call ("queue.tube. $ this ->name :delete " , [$ taskId ]);
139147
140148 return Task::createFromTuple ($ result [0 ]);
141149 }
142150
143151 public function truncate ()
144152 {
145- $ this ->client ->call ("queue.tube. $ this ->tubeName :truncate " );
153+ $ this ->client ->call ("queue.tube. $ this ->name :truncate " );
146154 }
147155
148156 /**
@@ -154,7 +162,7 @@ public function truncate()
154162 */
155163 public function stats ($ path = null )
156164 {
157- $ result = $ this ->client ->call ('queue.stats ' , [$ this ->tubeName ]);
165+ $ result = $ this ->client ->call ('queue.stats ' , [$ this ->name ]);
158166
159167 if (null === $ path ) {
160168 return $ result [0 ][0 ];
0 commit comments