@@ -53,6 +53,10 @@ abstract class WSConnectorAbstract implements ConnectorInterface
5353 */
5454 protected $ maxNumberOfTriesToCallApi = 3 ;
5555
56+ /**
57+ * list of connectors by connector name
58+ * @var Client[]
59+ */
5660 protected static $ connection ;
5761 protected static $ currentId ;
5862
@@ -150,11 +154,14 @@ public function orderNodesByTimeout($orderNodesByTimeout)
150154 */
151155 public function getConnection ()
152156 {
153- if (self ::$ connection === null ) {
157+ if (
158+ !isset (self ::$ connection [static ::class])
159+ || self ::$ connection [static ::class] === null
160+ ) {
154161 $ this ->newConnection ($ this ->getCurrentUrl ());
155162 }
156163
157- return self ::$ connection ;
164+ return self ::$ connection[ static ::class] ;
158165 }
159166
160167 /**
@@ -164,17 +171,17 @@ public function getConnection()
164171 */
165172 public function newConnection ($ nodeUrl )
166173 {
167- self ::$ connection = new Client ($ nodeUrl , ['timeout ' => $ this ->wsTimeoutSeconds ]);
174+ self ::$ connection[ static ::class] = new Client ($ nodeUrl , ['timeout ' => $ this ->wsTimeoutSeconds ]);
168175
169- return self ::$ connection ;
176+ return self ::$ connection[ static ::class] ;
170177 }
171178
172179 public function getCurrentUrl ()
173180 {
174181 if (
175- !isset (static ::$ currentNodeURL [$ this -> getPlatform () ])
176- || static ::$ currentNodeURL [$ this -> getPlatform () ] === null
177- || !in_array (static ::$ currentNodeURL [$ this -> getPlatform () ], static ::$ nodeURL )
182+ !isset (static ::$ currentNodeURL [static ::class ])
183+ || static ::$ currentNodeURL [static ::class ] === null
184+ || !in_array (static ::$ currentNodeURL [static ::class ], static ::$ nodeURL )
178185 ) {
179186 if (is_array (static ::$ nodeURL )) {
180187 $ this ->reserveNodeUrlList = static ::$ nodeURL ;
@@ -183,10 +190,10 @@ public function getCurrentUrl()
183190 $ url = static ::$ nodeURL ;
184191 }
185192
186- static ::$ currentNodeURL [$ this -> getPlatform () ] = $ url ;
193+ static ::$ currentNodeURL [static ::class ] = $ url ;
187194 }
188195
189- return static ::$ currentNodeURL [$ this -> getPlatform () ];
196+ return static ::$ currentNodeURL [static ::class ];
190197 }
191198
192199 public function isExistReserveNodeUrl ()
@@ -196,7 +203,7 @@ public function isExistReserveNodeUrl()
196203
197204 protected function setReserveNodeUrlToCurrentUrl ()
198205 {
199- static ::$ currentNodeURL [$ this -> getPlatform () ] = array_shift ($ this ->reserveNodeUrlList );
206+ static ::$ currentNodeURL [static ::class ] = array_shift ($ this ->reserveNodeUrlList );
200207 }
201208
202209 public function connectToReserveNode ()
@@ -211,11 +218,14 @@ public function connectToReserveNode()
211218
212219 public function getCurrentId ()
213220 {
214- if (self ::$ currentId === null ) {
215- self ::$ currentId = 1 ;
221+ if (
222+ !isset (self ::$ currentId [static ::class])
223+ || self ::$ currentId [static ::class] === null
224+ ) {
225+ self ::$ currentId [static ::class] = 1 ;
216226 }
217227
218- return self ::$ currentId ;
228+ return self ::$ currentId[ static ::class] ;
219229 }
220230
221231 public function getPlatform ()
@@ -225,7 +235,7 @@ public function getPlatform()
225235
226236 public function setCurrentId ($ id )
227237 {
228- self ::$ currentId = $ id ;
238+ self ::$ currentId[ static ::class] = $ id ;
229239 }
230240
231241 public function getNextId ()
0 commit comments