改名
This commit is contained in:
@@ -113,11 +113,7 @@ class Server extends HttpService
|
|||||||
return 'ok';
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
Runtime::enableCoroutine(true, SWOOLE_HOOK_TCP |
|
Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_BLOCKING_FUNCTION);
|
||||||
SWOOLE_HOOK_UNIX | SWOOLE_HOOK_UDP | SWOOLE_HOOK_UDG |
|
|
||||||
SWOOLE_HOOK_SSL | SWOOLE_HOOK_TLS | SWOOLE_HOOK_SLEEP |
|
|
||||||
SWOOLE_HOOK_STREAM_FUNCTION | SWOOLE_HOOK_PROC
|
|
||||||
);
|
|
||||||
|
|
||||||
Coroutine::set(['enable_deadlock_check' => false]);
|
Coroutine::set(['enable_deadlock_check' => false]);
|
||||||
|
|
||||||
|
|||||||
+10
-16
@@ -42,27 +42,21 @@ class Service extends Component
|
|||||||
*/
|
*/
|
||||||
public function get($id, $try = true): mixed
|
public function get($id, $try = true): mixed
|
||||||
{
|
{
|
||||||
if (isset($this->_components[$id])) {
|
if (!isset($this->_components[$id])) {
|
||||||
return $this->_components[$id];
|
if (!isset($this->_definition[$id])) {
|
||||||
}
|
throw new ComponentException("Unknown component ID: $id");
|
||||||
if (!isset($this->_definition[$id]) && !isset($this->_alias[$id])) {
|
|
||||||
if ($try === false) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
throw new ComponentException("Unknown component ID: $id");
|
|
||||||
}
|
|
||||||
if (isset($this->_definition[$id])) {
|
|
||||||
$config = $this->_definition[$id];
|
$config = $this->_definition[$id];
|
||||||
if (is_object($config)) {
|
if (is_object($config)) {
|
||||||
return $this->_components[$id] = $config;
|
return $config;
|
||||||
}
|
}
|
||||||
$object = Snowflake::createObject($config);
|
$this->_components[$id] = Snowflake::createObject($config);
|
||||||
} else {
|
|
||||||
$config = $this->_alias[$id];
|
|
||||||
|
|
||||||
$object = Snowflake::createObject($config);
|
|
||||||
}
|
}
|
||||||
return $this->_components[$id] = $object;
|
$object = $this->_components[$id];
|
||||||
|
if (method_exists($object, 'afterInit')) {
|
||||||
|
$object->afterInit();
|
||||||
|
}
|
||||||
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user