eee
This commit is contained in:
+2
-1
@@ -5,6 +5,7 @@ namespace Kiri;
|
|||||||
|
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use CurlHandle;
|
||||||
|
|
||||||
defined('SPLIT_URL') or define('SPLIT_URL', '/(http[s]?:\/\/)?(([\w\-_]+\.)+\w+(:\d+)?)((\/[a-zA-Z0-9\-]+)+[\/]?(\?[a-zA-Z]+=.*)?)?/');
|
defined('SPLIT_URL') or define('SPLIT_URL', '/(http[s]?:\/\/)?(([\w\-_]+\.)+\w+(:\d+)?)((\/[a-zA-Z0-9\-]+)+[\/]?(\?[a-zA-Z]+=.*)?)?/');
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ abstract class ClientAbstracts implements IClient
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var resource|\Swoole\Coroutine\Http\Client|\Swoole\Client|\CurlHandle
|
* @var resource|\Swoole\Coroutine\Http\Client|\Swoole\Client|CurlHandle
|
||||||
*/
|
*/
|
||||||
protected mixed $client;
|
protected mixed $client;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -26,7 +26,7 @@ class CoroutineClient extends ClientAbstracts
|
|||||||
* @param $path
|
* @param $path
|
||||||
* @param array|string $params
|
* @param array|string $params
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function request(string $method, $path, array|string $params = []): void
|
public function request(string $method, $path, array|string $params = []): void
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ class CoroutineClient extends ClientAbstracts
|
|||||||
/**
|
/**
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param array|string $data
|
* @param array|string $data
|
||||||
* @throws Exception 使用swoole协程方式请求
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function coroutine($url, array|string $data = []): void
|
private function coroutine($url, array|string $data = []): void
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ class CoroutineClient extends ClientAbstracts
|
|||||||
* @param $path
|
* @param $path
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function execute($path, $data): void
|
private function execute($path, $data): void
|
||||||
{
|
{
|
||||||
@@ -100,7 +100,7 @@ class CoroutineClient extends ClientAbstracts
|
|||||||
* @param $path
|
* @param $path
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function retry($path, $data): void
|
private function retry($path, $data): void
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-7
@@ -18,7 +18,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
* @param $method
|
* @param $method
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param array|string $params
|
* @param array|string $params
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function request($method, $path, array|string $params = []): void
|
public function request($method, $path, array|string $params = []): void
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
* @param $path
|
* @param $path
|
||||||
* @param $method
|
* @param $method
|
||||||
* @param $params
|
* @param $params
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function getCurlHandler($path, $method, $params): void
|
private function getCurlHandler($path, $method, $params): void
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function curlHandlerSslSet(): void
|
private function curlHandlerSslSet(): void
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
* @param $resource
|
* @param $resource
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param $method
|
* @param $method
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function do($resource, $path, $method): void
|
private function do($resource, $path, $method): void
|
||||||
{
|
{
|
||||||
@@ -143,7 +143,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function execute(): void
|
private function execute(): void
|
||||||
{
|
{
|
||||||
@@ -159,7 +159,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function retry(): void
|
private function retry(): void
|
||||||
{
|
{
|
||||||
@@ -186,7 +186,7 @@ class CurlClient extends ClientAbstracts
|
|||||||
/**
|
/**
|
||||||
* @param $output
|
* @param $output
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function explode($output): void
|
private function explode($output): void
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -42,7 +42,7 @@ class HttpParse
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function parse($data): string
|
public static function parse($data): string
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ class HttpParse
|
|||||||
* @param $t
|
* @param $t
|
||||||
* @param $qt
|
* @param $qt
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private static function ifElse($t, $qt): string
|
private static function ifElse($t, $qt): string
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ class HttpParse
|
|||||||
/**
|
/**
|
||||||
* @param mixed ...$object
|
* @param mixed ...$object
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private static function encode(...$object): string
|
private static function encode(...$object): string
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ class TcpClient
|
|||||||
* @param string $host
|
* @param string $host
|
||||||
* @param int $port
|
* @param int $port
|
||||||
* @param int $socket
|
* @param int $socket
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __construct(readonly public string $host, readonly public int $port, readonly public int $socket = SWOOLE_SOCK_TCP)
|
public function __construct(readonly public string $host, readonly public int $port, readonly public int $socket = SWOOLE_SOCK_TCP)
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ class TcpClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function reconnect(): void
|
public function reconnect(): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user