This commit is contained in:
2020-11-16 13:46:24 +08:00
parent ce668251fc
commit a088b6f9c5
2 changed files with 18 additions and 7 deletions
+14 -5
View File
@@ -5,6 +5,7 @@ namespace HttpServer\Client;
use Snowflake\Abstracts\Component;
use Swoole\Coroutine;
/**
@@ -14,9 +15,17 @@ use Snowflake\Abstracts\Component;
class ClientDriver extends Component
{
public function __call($name)
{
/**
* @param $name
* @return IClient
*/
public function __call($name): IClient
{
if (Coroutine::getCid() > 0) {
return Client::NewRequest();
} else {
return Curl::NewRequest();
}
}
}
}
}