This commit is contained in:
2020-12-17 14:12:44 +08:00
parent 9516baef92
commit 33e5416dda
38 changed files with 100 additions and 101 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ declare(strict_types=1);
namespace HttpServer\Client;
use Exception;
use JetBrains\PhpStorm\Pure;
use Swoole\Coroutine\Http\Client as SClient;
/**
@@ -112,7 +112,7 @@ class Client extends ClientAbstracts
/**
* @return array
*/
#[Pure] private function settings(): array
private function settings(): array
{
$sslCert = $this->getSslCertFile();
$sslKey = $this->getSslKeyFile();
+9 -9
View File
@@ -6,7 +6,7 @@ namespace HttpServer\Client;
use Closure;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Component;
use Snowflake\Core\Help;
use Snowflake\Core\JSON;
@@ -58,7 +58,7 @@ abstract class ClientAbstracts extends Component implements IClient
/**
* @return static
*/
#[Pure] public static function NewRequest(): static
public static function NewRequest(): static
{
return new static();
}
@@ -415,7 +415,7 @@ abstract class ClientAbstracts extends Component implements IClient
/**
* @return int
*/
#[Pure] public function getPort(): int
public function getPort(): int
{
if ($this->isSSL()) {
return 443;
@@ -512,7 +512,7 @@ abstract class ClientAbstracts extends Component implements IClient
* @param $url
* @return bool
*/
#[Pure] protected function isHttp($url): bool
protected function isHttp($url): bool
{
return str_starts_with($url, 'http://');
}
@@ -521,7 +521,7 @@ abstract class ClientAbstracts extends Component implements IClient
* @param $url
* @return bool
*/
#[Pure] protected function isHttps($url): bool
protected function isHttps($url): bool
{
return str_starts_with($url, 'https://');
}
@@ -673,7 +673,7 @@ abstract class ClientAbstracts extends Component implements IClient
* @return bool
* check isPost Request
*/
#[Pure] public function isPost(): bool
public function isPost(): bool
{
return strtolower($this->method) === self::POST;
}
@@ -684,7 +684,7 @@ abstract class ClientAbstracts extends Component implements IClient
*
* check isGet Request
*/
#[Pure] public function isGet(): bool
public function isGet(): bool
{
return strtolower($this->method) === self::GET;
}
@@ -695,7 +695,7 @@ abstract class ClientAbstracts extends Component implements IClient
* @return array|string
* 将请求参数进行编码
*/
#[Pure] protected function paramEncode($arr): array|string
protected function paramEncode($arr): array|string
{
if (!is_array($arr)) {
return $arr;
@@ -761,7 +761,7 @@ abstract class ClientAbstracts extends Component implements IClient
* @param $params
* @return string
*/
#[Pure] protected function joinGetParams($path, $params): string
protected function joinGetParams($path, $params): string
{
if (empty($params)) {
return $path;
+2 -2
View File
@@ -5,7 +5,7 @@ namespace HttpServer\Client;
use Exception;
use JetBrains\PhpStorm\Pure;
/**
* Class Curl
@@ -209,7 +209,7 @@ class Curl extends ClientAbstracts
/**
* @return array
*/
#[Pure] private function parseHeaderMat(): array
private function parseHeaderMat(): array
{
$headers = [];
foreach ($this->getHeader() as $key => $val) {
+2 -2
View File
@@ -4,7 +4,7 @@
namespace HttpServer\Client;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Component;
use Snowflake\Snowflake;
use Swoole\Coroutine;
@@ -29,7 +29,7 @@ class HttpClient extends Component
/**
* @return Http2
*/
#[Pure] public static function http2(): Http2
public static function http2(): Http2
{
return Snowflake::app()->http2;
}
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace HttpServer\Client;
use Exception;
use JetBrains\PhpStorm\Pure;
/**
* Class Result
@@ -143,7 +143,7 @@ class Result
/**
* @return bool
*/
#[Pure] public function httpIsOk(): bool
public function httpIsOk(): bool
{
return in_array($this->httpStatus, [100, 101, 200, 201, 202, 203, 204, 205, 206]);
}