改名
This commit is contained in:
@@ -371,7 +371,7 @@ class Columns extends Component
|
|||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
$replace = preg_replace('/\(\d+(,\d+)?\)(\s+\w+)*/', '', $type);
|
$replace = preg_replace('/\(\d+(,\d+)?\)(\s+\w+)*/', '', $type);
|
||||||
if (str_contains(' ', $replace)) {
|
if (str_contains($replace, ' ')) {
|
||||||
$replace = explode(' ', $replace)[1];
|
$replace = explode(' ', $replace)[1];
|
||||||
}
|
}
|
||||||
return $replace;
|
return $replace;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
|||||||
namespace HttpServer\Client;
|
namespace HttpServer\Client;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Swoole\Coroutine\Http\Client as SClient;
|
use Swoole\Coroutine\Http\Client as SClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +63,7 @@ class Client extends ClientAbstracts
|
|||||||
}
|
}
|
||||||
return $this->fail($client->getStatusCode(), $message, $body, $client->getHeaders());
|
return $this->fail($client->getStatusCode(), $message, $body, $client->getHeaders());
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->addError($exception,'rpc');
|
$this->addError($exception, 'rpc');
|
||||||
return $this->fail(500, $exception->getMessage(), [
|
return $this->fail(500, $exception->getMessage(), [
|
||||||
'file' => $exception->getFile(),
|
'file' => $exception->getFile(),
|
||||||
'line' => $exception->getLine()
|
'line' => $exception->getLine()
|
||||||
@@ -94,7 +94,7 @@ class Client extends ClientAbstracts
|
|||||||
}
|
}
|
||||||
$client->setHeaders($this->getHeader());
|
$client->setHeaders($this->getHeader());
|
||||||
$client->setMethod(strtoupper($this->getMethod()));
|
$client->setMethod(strtoupper($this->getMethod()));
|
||||||
if (strtolower($this->getMethod()) == self::GET && !empty($data)) {
|
if ($this->isGet() && !empty($data)) {
|
||||||
$path .= '?' . $data;
|
$path .= '?' . $data;
|
||||||
} else {
|
} else {
|
||||||
$this->setData($this->mergeParams($data));
|
$this->setData($this->mergeParams($data));
|
||||||
@@ -111,7 +111,7 @@ class Client extends ClientAbstracts
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function settings(): array
|
#[Pure] private function settings(): array
|
||||||
{
|
{
|
||||||
$sslCert = $this->getSslCertFile();
|
$sslCert = $this->getSslCertFile();
|
||||||
$sslKey = $this->getSslKeyFile();
|
$sslKey = $this->getSslKeyFile();
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ class Curl extends ClientAbstracts
|
|||||||
* @param $method
|
* @param $method
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @return Result|bool|array|string
|
* @return Result|array|string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function request($method, $path, $params = []): Result|bool|array|string
|
public function request($method, $path, $params = []): Result|array|string
|
||||||
{
|
{
|
||||||
if ($method == self::GET) {
|
if ($method == self::GET) {
|
||||||
$path = $this->joinGetParams($path, $params);
|
$path = $this->joinGetParams($path, $params);
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
namespace HttpServer\Client;
|
namespace HttpServer\Client;
|
||||||
|
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
@@ -22,16 +23,17 @@ class HttpClient extends Component
|
|||||||
*/
|
*/
|
||||||
public static function NewRequest(): IClient
|
public static function NewRequest(): IClient
|
||||||
{
|
{
|
||||||
return Coroutine::getCid() > 0 ? Client::NewRequest() : Curl::NewRequest();
|
return Coroutine::getCid() > -1 ? Client::NewRequest() : Curl::NewRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Http2
|
* @return Http2
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function http2(): Http2
|
public static function http2(): Http2
|
||||||
{
|
{
|
||||||
return Snowflake::app()->http2;
|
return Snowflake::app()->get('http2');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user