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
@@ -5,7 +5,7 @@ namespace HttpServer;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Input;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
@@ -111,7 +111,7 @@ trait Action
/**
* @return string
*/
#[Pure] private function getWorkerPath(): string
private function getWorkerPath(): string
{
return "glob://" . ltrim(APP_PATH, '/') . '/storage/worker/*.sock';
}
+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]);
}
+2 -2
View File
@@ -9,7 +9,7 @@ declare(strict_types=1);
namespace HttpServer\Exception;
use JetBrains\PhpStorm\Pure;
use Throwable;
/**
@@ -26,7 +26,7 @@ class AuthException extends \Exception
* @param int $code
* @param Throwable|null $previous
*/
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = NULL)
public function __construct($message = "", $code = 0, Throwable $previous = NULL)
{
parent::__construct($message, 7000, $previous);
}
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace HttpServer\Exception;
use JetBrains\PhpStorm\Pure;
use Throwable;
/**
@@ -20,7 +20,7 @@ class ExitException extends \Exception
* @param int $code
* @param Throwable|null $previous
*/
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null)
public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
+4 -4
View File
@@ -6,7 +6,7 @@ namespace HttpServer\Http;
use Exception;
use HttpServer\Application;
use HttpServer\IInterface\AuthIdentity;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Exception\ComponentException;
@@ -186,7 +186,7 @@ class Request extends Application
/**
* @return string
*/
#[Pure] public function getCurrent(): string
public function getCurrent(): string
{
return current($this->explode);
}
@@ -360,7 +360,7 @@ class Request extends Application
/**
* @return mixed|null
*/
#[Pure] public function getIp()
public function getIp()
{
$headers = $this->headers->getHeaders();
if (!empty($headers['x-forwarded-for'])) return $headers['x-forwarded-for'];
@@ -372,7 +372,7 @@ class Request extends Application
/**
* @return string
*/
#[Pure] public function getRuntime(): string
public function getRuntime(): string
{
return sprintf('%.5f', microtime(TRUE) - $this->startTime);
}
+2 -2
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace HttpServer\Route\Filter;
use JetBrains\PhpStorm\Pure;
use Throwable;
class FilterException extends \Exception
@@ -18,7 +18,7 @@ class FilterException extends \Exception
* @param int $code
* @param Throwable|null $previous
*/
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null)
public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
+4 -4
View File
@@ -9,7 +9,7 @@ use Closure;
use HttpServer\Http\Request;
use Exception;
use HttpServer\Application;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Exception\NotFindClassException;
@@ -81,7 +81,7 @@ class Node extends Application
/**
* @return bool
*/
#[Pure] public function hasInterceptor(): bool
public function hasInterceptor(): bool
{
return count($this->_interceptors) > 0;
}
@@ -90,7 +90,7 @@ class Node extends Application
/**
* @return bool
*/
#[Pure] public function hasLimits(): bool
public function hasLimits(): bool
{
return count($this->_limits) > 0;
}
@@ -129,7 +129,7 @@ class Node extends Application
/**
* @return bool
*/
#[Pure] public function hasAfter(): bool
public function hasAfter(): bool
{
return count($this->_after) > 0;
}
+2 -2
View File
@@ -8,7 +8,7 @@ use Exception;
use HttpServer\Http\Request;
use HttpServer\IInterface\RouterInterface;
use HttpServer\Application;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Config;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
@@ -109,7 +109,7 @@ class Router extends Application implements RouterInterface
* @param $path
* @return string
*/
#[Pure] private function resolve($path): string
private function resolve($path): string
{
$paths = array_column($this->groupTacks, 'prefix');
if (empty($paths)) {