Skip to content

Commit 54e10aa

Browse files
bhargav3ihor
authored andcommitted
Refactored Api class to unlock undocumented/unimplemented supervisor methods (#2)
Refactored Api class to unlock undocumented/unimplemented supervisor methods
1 parent 09a0333 commit 54e10aa

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.idea
1+
/.idea
2+
/composer.lock
3+
/vendor

Supervisor/Api.php

+32-32
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($host = '127.0.0.1', $port = 9001, $username = '', $
3535
* @return array
3636
* @throws \Exception
3737
*/
38-
private function _call($method, array $params = [])
38+
function __call($method, array $params = [])
3939
{
4040
if (strpos($method, '.') === false) {
4141
$method = 'supervisor.' . $method;
@@ -75,7 +75,7 @@ private function _call($method, array $params = [])
7575
*/
7676
public function getApiVersion()
7777
{
78-
return $this->_call('getAPIVersion');
78+
return $this->__call('getAPIVersion');
7979
}
8080

8181
/**
@@ -86,7 +86,7 @@ public function getApiVersion()
8686
*/
8787
public function getSupervisorVersion()
8888
{
89-
return $this->_call('getSupervisorVersion');
89+
return $this->__call('getSupervisorVersion');
9090
}
9191

9292
/**
@@ -103,7 +103,7 @@ public function getSupervisorVersion()
103103
*/
104104
public function getIdentification()
105105
{
106-
return $this->_call('getIdentification');
106+
return $this->__call('getIdentification');
107107
}
108108

109109
/**
@@ -142,7 +142,7 @@ public function getIdentification()
142142
*/
143143
public function getState()
144144
{
145-
return $this->_call('getState');
145+
return $this->__call('getState');
146146
}
147147

148148
/**
@@ -153,7 +153,7 @@ public function getState()
153153
*/
154154
public function getPid()
155155
{
156-
return $this->_call('getPID');
156+
$this->__call('getPID');
157157
}
158158

159159
/**
@@ -183,7 +183,7 @@ public function getPid()
183183
*/
184184
public function readLog($offset, $length)
185185
{
186-
return $this->_call('readLog', [$offset, $length]);
186+
$this->__call('readLog', [$offset, $length]);
187187
}
188188

189189
/**
@@ -197,7 +197,7 @@ public function readLog($offset, $length)
197197
*/
198198
public function clearLog()
199199
{
200-
return $this->_call('clearLog');
200+
$this->__call('clearLog');
201201
}
202202

203203
/**
@@ -213,7 +213,7 @@ public function clearLog()
213213
*/
214214
public function shutdown()
215215
{
216-
return $this->_call('shutdown');
216+
$this->__call('shutdown');
217217
}
218218

219219
/**
@@ -230,7 +230,7 @@ public function shutdown()
230230
*/
231231
public function restart()
232232
{
233-
return $this->_call('restart');
233+
$this->__call('restart');
234234
}
235235

236236
/**
@@ -258,7 +258,7 @@ public function restart()
258258
*/
259259
public function getProcessInfo($name)
260260
{
261-
return $this->_call('getProcessInfo', [$name]);
261+
$this->__call('getProcessInfo', [$name]);
262262
}
263263

264264
/**
@@ -272,7 +272,7 @@ public function getProcessInfo($name)
272272
*/
273273
public function getAllProcessInfo()
274274
{
275-
return $this->_call('getAllProcessInfo');
275+
$this->__call('getAllProcessInfo');
276276
}
277277

278278
/**
@@ -285,7 +285,7 @@ public function getAllProcessInfo()
285285
*/
286286
public function startProcess($name, $wait = true)
287287
{
288-
return $this->_call('startProcess', [$name, $wait]);
288+
$this->__call('startProcess', [$name, $wait]);
289289
}
290290

291291
/**
@@ -298,7 +298,7 @@ public function startProcess($name, $wait = true)
298298
*/
299299
public function stopProcess($name, $wait = true)
300300
{
301-
return $this->_call('stopProcess', [$name, $wait]);
301+
return $this->__call('stopProcess', [$name, $wait]);
302302
}
303303

304304
/**
@@ -311,7 +311,7 @@ public function stopProcess($name, $wait = true)
311311
*/
312312
public function startProcessGroup($name, $wait = true)
313313
{
314-
return $this->_call('startProcessGroup', [$name, $wait]);
314+
$this->__call('startProcessGroup', [$name, $wait]);
315315
}
316316

317317
/**
@@ -324,7 +324,7 @@ public function startProcessGroup($name, $wait = true)
324324
*/
325325
public function stopProcessGroup($name, $wait = true)
326326
{
327-
return $this->_call('stopProcessGroup', [$name, $wait]);
327+
$this->__call('stopProcessGroup', [$name, $wait]);
328328
}
329329

330330
/**
@@ -336,7 +336,7 @@ public function stopProcessGroup($name, $wait = true)
336336
*/
337337
public function startAllProcesses($wait = true)
338338
{
339-
return $this->_call('startAllProcesses', [$wait]);
339+
$this->__call('startAllProcesses', [$wait]);
340340
}
341341

342342
/**
@@ -348,7 +348,7 @@ public function startAllProcesses($wait = true)
348348
*/
349349
public function stopAllProcesses($wait = true)
350350
{
351-
return $this->_call('stopAllProcesses', [$wait]);
351+
$this->__call('stopAllProcesses', [$wait]);
352352
}
353353

354354
/**
@@ -365,7 +365,7 @@ public function stopAllProcesses($wait = true)
365365
*/
366366
public function sendProcessStdin($name, $chars)
367367
{
368-
return $this->_call('sendProcessStdin', [$name, $chars]);
368+
$this->__call('sendProcessStdin', [$name, $chars]);
369369
}
370370

371371
/**
@@ -378,7 +378,7 @@ public function sendProcessStdin($name, $chars)
378378
*/
379379
public function sendRemoteCommEvent($type, $data)
380380
{
381-
return $this->_call('sendRemoteCommEvent', [$type, $data]);
381+
$this->__call('sendRemoteCommEvent', [$type, $data]);
382382
}
383383

384384
/**
@@ -390,7 +390,7 @@ public function sendRemoteCommEvent($type, $data)
390390
*/
391391
public function addProcessGroup($name)
392392
{
393-
return $this->_call('addProcessGroup', [$name]);
393+
$this->__call('addProcessGroup', [$name]);
394394
}
395395

396396
/**
@@ -402,7 +402,7 @@ public function addProcessGroup($name)
402402
*/
403403
public function removeProcessGroup($name)
404404
{
405-
return $this->_call('removeProcessGroup', [$name]);
405+
return $this->__call('removeProcessGroup', [$name]);
406406
}
407407

408408
/**
@@ -416,7 +416,7 @@ public function removeProcessGroup($name)
416416
*/
417417
public function readProcessStdoutLog($name, $offset, $length)
418418
{
419-
return $this->_call('readProcessStdoutLog', [$name, $offset, $length]);
419+
$this->__call('readProcessStdoutLog', [$name, $offset, $length]);
420420
}
421421

422422
/**
@@ -430,7 +430,7 @@ public function readProcessStdoutLog($name, $offset, $length)
430430
*/
431431
public function readProcessStderrLog($name, $offset, $length)
432432
{
433-
return $this->_call('readProcessStderrLog', [$name, $offset, $length]);
433+
$this->__call('readProcessStderrLog', [$name, $offset, $length]);
434434
}
435435

436436
/**
@@ -450,7 +450,7 @@ public function readProcessStderrLog($name, $offset, $length)
450450
*/
451451
public function tailProcessStdoutLog($name, $offset, $length)
452452
{
453-
return $this->_call('tailProcessStdoutLog', [$name, $offset, $length]);
453+
$this->__call('tailProcessStdoutLog', [$name, $offset, $length]);
454454
}
455455

456456
/**
@@ -470,7 +470,7 @@ public function tailProcessStdoutLog($name, $offset, $length)
470470
*/
471471
public function tailProcessStderrLog($name, $offset, $length)
472472
{
473-
return $this->_call('tailProcessStderrLog', [$name, $offset, $length]);
473+
$this->__call('tailProcessStderrLog', [$name, $offset, $length]);
474474
}
475475

476476
/**
@@ -482,7 +482,7 @@ public function tailProcessStderrLog($name, $offset, $length)
482482
*/
483483
public function clearProcessLogs($name)
484484
{
485-
return $this->_call('clearProcessLogs', $name);
485+
$this->__call('clearProcessLogs', $name);
486486
}
487487

488488
/**
@@ -493,7 +493,7 @@ public function clearProcessLogs($name)
493493
*/
494494
public function clearAllProcessLogs()
495495
{
496-
return $this->_call('clearAllProcessLogs');
496+
$this->__call('clearAllProcessLogs');
497497
}
498498

499499
/**
@@ -504,7 +504,7 @@ public function clearAllProcessLogs()
504504
*/
505505
public function listMethods()
506506
{
507-
return $this->_call('system.listMethods');
507+
$this->__call('system.listMethods');
508508
}
509509

510510
/**
@@ -516,7 +516,7 @@ public function listMethods()
516516
*/
517517
public function methodHelp($name)
518518
{
519-
return $this->_call('system.methodHelp', ['supervisor.' . $name]);
519+
$this->__call('system.methodHelp', ['supervisor.' . $name]);
520520
}
521521

522522
/**
@@ -529,7 +529,7 @@ public function methodHelp($name)
529529
*/
530530
public function methodSignature($name)
531531
{
532-
return $this->_call('system.methodSignature', ['supervisor.' . $name]);
532+
$this->__call('system.methodSignature', ['supervisor.' . $name]);
533533
}
534534

535535
/**
@@ -544,7 +544,7 @@ public function methodSignature($name)
544544
*/
545545
public function multicall(array $calls)
546546
{
547-
return $this->_call('system.multicall', [$calls]);
547+
$this->__call('system.multicall', [$calls]);
548548
}
549549

550550
}

0 commit comments

Comments
 (0)