I boot/booted
This commit is contained in:
parent
72c8bf4ac8
commit
ddbca89cf7
|
|
@ -35,18 +35,20 @@ class Controller
|
||||||
/**
|
/**
|
||||||
* To be overridden by child classes if needed
|
* To be overridden by child classes if needed
|
||||||
* Called before need_auth check
|
* Called before need_auth check
|
||||||
|
* If return is exactly false, processing stops
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot(): void {}
|
public function boot() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be overridden by child classes if needed
|
* To be overridden by child classes if needed
|
||||||
* Called after need_auth check
|
* Called after need_auth check
|
||||||
|
* If return is exactly false, processing stops
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function booted(): void {}
|
public function booted() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be overridden by child classes if needed
|
* To be overridden by child classes if needed
|
||||||
|
|
@ -91,25 +93,25 @@ class Controller
|
||||||
$channelManager
|
$channelManager
|
||||||
);
|
);
|
||||||
|
|
||||||
$controller->boot();
|
if ($controller->boot() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (($controller->need_auth ?? true) && ! $connection->user) {
|
if (($controller->need_auth ?? true) && ! $connection->user) {
|
||||||
$e = $controller->error('Unauthorized');
|
$controller->error('Unauthorized');
|
||||||
|
|
||||||
$controller->unboot();
|
$controller->unboot();
|
||||||
|
return;
|
||||||
return $e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! method_exists($controllerClass, $method)) {
|
if (! method_exists($controllerClass, $method)) {
|
||||||
$e = self::send_error($connection, $message, 'Event could not be handled');
|
$controller->error($connection, $message, 'Event could not be handled');
|
||||||
|
|
||||||
$controller->unboot();
|
$controller->unboot();
|
||||||
|
return;
|
||||||
return $e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$controller->booted();
|
if ($controller->booted() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$payload = $controller->$method(
|
$payload = $controller->$method(
|
||||||
$connection,
|
$connection,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue