Skip to content

Commit

Permalink
Merge pull request #144 from LuckyCyborg/master
Browse files Browse the repository at this point in the history
Expose the inner Worker's onWorkerStop callback
  • Loading branch information
walkor authored Apr 15, 2018
2 parents d9ab179 + 7357ab2 commit 8ee5fd5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/SocketIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ public function onConnection($engine_socket)

public function on()
{
if(func_get_arg(0) === 'workerStart')
{
$this->worker->onWorkerStart = func_get_arg(1);
return;
$args = array_pad(func_get_args(), 2, null);

if ($args[0] === 'workerStart') {
$this->worker->onWorkerStart = $args[1];
} else if ($args[0] === 'workerStop') {
$this->worker->onWorkerStop = $args[1];
} else if ($args[0] !== null) {
return call_user_func_array(array($this->sockets, 'on'), $args);
}
return call_user_func_array(array($this->sockets, 'on'), func_get_args());
}

public function in()
Expand Down

0 comments on commit 8ee5fd5

Please sign in to comment.