改名
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Date: 2018/5/24 0024
|
||||
* Time: 11:34
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Client;
|
||||
|
||||
@@ -25,31 +26,31 @@ use Swoole\Coroutine\Client as SCClient;
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
private $host = '';
|
||||
private string $host = '';
|
||||
|
||||
private $header = [];
|
||||
private array $header = [];
|
||||
|
||||
private $timeout = 0;
|
||||
private int $timeout = 0;
|
||||
|
||||
private $callback = null;
|
||||
private $method = 'get';
|
||||
private ?\Closure $callback = null;
|
||||
private string $method = 'get';
|
||||
|
||||
private $isSSL = false;
|
||||
private $agent = '';
|
||||
private $errorCodeField = '';
|
||||
private $errorMsgField = '';
|
||||
private $use_swoole = false;
|
||||
private bool $isSSL = false;
|
||||
private string $agent = '';
|
||||
private string $errorCodeField = '';
|
||||
private string $errorMsgField = '';
|
||||
private bool $use_swoole = false;
|
||||
|
||||
private $ssl_cert_file = '';
|
||||
private $ssl_key_file = '';
|
||||
private $ca = '';
|
||||
private $port = '';
|
||||
private string $ssl_cert_file = '';
|
||||
private string $ssl_key_file = '';
|
||||
private string $ca = '';
|
||||
private int $port = 80;
|
||||
|
||||
/** @var string $_message 错误信息 */
|
||||
private $_message = '';
|
||||
private $_data = '';
|
||||
private string $_message = '';
|
||||
private string $_data = '';
|
||||
|
||||
private $connect_timeout = 1;
|
||||
private int $connect_timeout = 1;
|
||||
|
||||
const GET = 'get';
|
||||
const PUT = 'put';
|
||||
@@ -92,17 +93,17 @@ class Client
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
public function getPort(): string
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $port
|
||||
* @param int $port
|
||||
*/
|
||||
public function setPort(string $port): void
|
||||
public function setPort(int $port): void
|
||||
{
|
||||
$this->port = $port;
|
||||
}
|
||||
@@ -135,17 +136,17 @@ class Client
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSslCertFile(): string
|
||||
public function hasSslCertFile(): bool
|
||||
{
|
||||
return !empty($this->ssl_cert_file) && file_exists($this->ssl_cert_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSslKeyFile(): string
|
||||
public function hasSslKeyFile(): bool
|
||||
{
|
||||
return !empty($this->ssl_key_file) && file_exists($this->ssl_key_file);
|
||||
}
|
||||
|
||||
+24
-24
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Client;
|
||||
|
||||
@@ -26,55 +26,55 @@ class Curl
|
||||
const PUT = 'put';
|
||||
|
||||
|
||||
private $curl_multi = [];
|
||||
private array $curl_multi = [];
|
||||
|
||||
private $headers = [
|
||||
private array $headers = [
|
||||
'Connection' => 'Keep-Alive',
|
||||
'Keep-Alive' => '300'
|
||||
];
|
||||
|
||||
/** @var Closure|array */
|
||||
private $callback;
|
||||
/** @var ?Closure */
|
||||
private ?\Closure $callback;
|
||||
|
||||
/** @var string */
|
||||
private $errorCodeField = '';
|
||||
private string $errorCodeField = '';
|
||||
|
||||
/** @var string */
|
||||
private $errorMsgField = '';
|
||||
private string $errorMsgField = '';
|
||||
|
||||
/** @var int */
|
||||
private $timeout = -1;
|
||||
private int $timeout = -1;
|
||||
|
||||
/** @var int */
|
||||
private $connection_timeout = 2;
|
||||
private int $connection_timeout = 2;
|
||||
|
||||
/** @var bool */
|
||||
private $useKeepAlive = true;
|
||||
private bool $useKeepAlive = true;
|
||||
|
||||
/** @var string */
|
||||
private $agent = '';
|
||||
private string $agent = '';
|
||||
|
||||
/** @var string */
|
||||
private $ssl_key = '';
|
||||
private string $ssl_key = '';
|
||||
|
||||
/** @var string */
|
||||
private $ssl_cert = '';
|
||||
private string $ssl_cert = '';
|
||||
|
||||
/** @var string */
|
||||
private $ssl_ca = '';
|
||||
private string $ssl_ca = '';
|
||||
|
||||
/** @var string */
|
||||
private $host = '127.0.0.1';
|
||||
private string $host = '127.0.0.1';
|
||||
|
||||
/** @var string */
|
||||
private $port = '9958';
|
||||
/** @var int */
|
||||
private int $port = 9958;
|
||||
|
||||
/** @var bool */
|
||||
private $isSsl = true;
|
||||
private bool $isSsl = true;
|
||||
|
||||
|
||||
/** @var Curl */
|
||||
private static $instance;
|
||||
private static Curl $instance;
|
||||
|
||||
/**
|
||||
* @return array|Closure
|
||||
@@ -85,9 +85,9 @@ class Curl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Closure $callback
|
||||
* @param Closure $callback
|
||||
*/
|
||||
public function setCallback($callback): void
|
||||
public function setCallback(Closure $callback): void
|
||||
{
|
||||
$this->callback = $callback;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ class Curl
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPort(): string
|
||||
public function getPort(): int
|
||||
{
|
||||
if (empty($this->port)) {
|
||||
return 80;
|
||||
@@ -315,9 +315,9 @@ class Curl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $port
|
||||
* @param int $port
|
||||
*/
|
||||
public function setPort(string $port): void
|
||||
public function setPort(int $port): void
|
||||
{
|
||||
$this->port = $port;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Client;
|
||||
|
||||
@@ -20,11 +20,11 @@ class Http2 extends Component
|
||||
{
|
||||
|
||||
/** @var H2Client[] */
|
||||
private $_clients = [];
|
||||
private array $_clients = [];
|
||||
|
||||
|
||||
/** @var Request[] */
|
||||
private $_requests = [];
|
||||
private array $_requests = [];
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Client;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Client;
|
||||
|
||||
@@ -19,14 +20,14 @@ class Result
|
||||
{
|
||||
public $code;
|
||||
public $message;
|
||||
public $count = 0;
|
||||
public $data;
|
||||
public $header;
|
||||
public $httpStatus = 200;
|
||||
public int $count = 0;
|
||||
public array|string $data;
|
||||
public array $header;
|
||||
public int $httpStatus = 200;
|
||||
|
||||
public $startTime = 0;
|
||||
public $requestTime = 0;
|
||||
public $runTime = 0;
|
||||
public int $startTime = 0;
|
||||
public int $requestTime = 0;
|
||||
public float $runTime = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user