@@ -46,12 +46,12 @@ class ApiCall
46
46
/**
47
47
* @var array|Node[]
48
48
*/
49
- private static array $ nodes ;
49
+ private array $ nodes ;
50
50
51
51
/**
52
52
* @var Node|null
53
53
*/
54
- private static ?Node $ nearestNode ;
54
+ private ?Node $ nearestNode ;
55
55
56
56
/**
57
57
* @var int
@@ -73,8 +73,8 @@ public function __construct(Configuration $config)
73
73
$ this ->config = $ config ;
74
74
$ this ->logger = $ config ->getLogger ();
75
75
$ this ->client = $ config ->getClient ();
76
- static :: $ nodes = $ this ->config ->getNodes ();
77
- static :: $ nearestNode = $ this ->config ->getNearestNode ();
76
+ $ this -> nodes = $ this ->config ->getNodes ();
77
+ $ this -> nearestNode = $ this ->config ->getNearestNode ();
78
78
$ this ->nodeIndex = 0 ;
79
79
$ this ->initializeNodes ();
80
80
}
@@ -84,11 +84,11 @@ public function __construct(Configuration $config)
84
84
*/
85
85
private function initializeNodes (): void
86
86
{
87
- if (static :: $ nearestNode !== null ) {
88
- $ this ->setNodeHealthCheck (static :: $ nearestNode , true );
87
+ if ($ this -> nearestNode !== null ) {
88
+ $ this ->setNodeHealthCheck ($ this -> nearestNode , true );
89
89
}
90
90
91
- foreach (static :: $ nodes as &$ node ) {
91
+ foreach ($ this -> nodes as &$ node ) {
92
92
$ this ->setNodeHealthCheck ($ node , true );
93
93
}
94
94
}
@@ -332,16 +332,16 @@ public function setNodeHealthCheck(Node $node, bool $isHealthy): void
332
332
*/
333
333
public function getNode (): Lib \Node
334
334
{
335
- if (static :: $ nearestNode !== null ) {
336
- if (static :: $ nearestNode ->isHealthy () || $ this ->nodeDueForHealthCheck (static :: $ nearestNode )) {
337
- return static :: $ nearestNode ;
335
+ if ($ this -> nearestNode !== null ) {
336
+ if ($ this -> nearestNode ->isHealthy () || $ this ->nodeDueForHealthCheck ($ this -> nearestNode )) {
337
+ return $ this -> nearestNode ;
338
338
}
339
339
}
340
340
$ i = 0 ;
341
- while ($ i < count (static :: $ nodes )) {
341
+ while ($ i < count ($ this -> nodes )) {
342
342
$ i ++;
343
- $ node = static :: $ nodes [$ this ->nodeIndex ];
344
- $ this ->nodeIndex = ($ this ->nodeIndex + 1 ) % count (static :: $ nodes );
343
+ $ node = $ this -> nodes [$ this ->nodeIndex ];
344
+ $ this ->nodeIndex = ($ this ->nodeIndex + 1 ) % count ($ this -> nodes );
345
345
if ($ node ->isHealthy () || $ this ->nodeDueForHealthCheck ($ node )) {
346
346
return $ node ;
347
347
}
@@ -351,7 +351,7 @@ public function getNode(): Lib\Node
351
351
* None of the nodes are marked healthy, but some of them could have become healthy since last health check.
352
352
* So we will just return the next node.
353
353
*/
354
- return static :: $ nodes [$ this ->nodeIndex ];
354
+ return $ this -> nodes [$ this ->nodeIndex ];
355
355
}
356
356
357
357
/**
0 commit comments