改名
This commit is contained in:
@@ -13,9 +13,9 @@ use Swoole\Coroutine;
|
||||
class Context extends BaseContext
|
||||
{
|
||||
|
||||
protected static $_requests = [];
|
||||
protected static array $_requests = [];
|
||||
|
||||
protected static $_response = [];
|
||||
protected static array $_response = [];
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Http;
|
||||
|
||||
@@ -12,14 +12,14 @@ use Snowflake\Snowflake;
|
||||
class File
|
||||
{
|
||||
|
||||
public $name = '';
|
||||
public $tmp_name = '';
|
||||
public $error = '';
|
||||
public $type = '';
|
||||
public $size = '';
|
||||
public string $name = '';
|
||||
public string $tmp_name = '';
|
||||
public string $error = '';
|
||||
public string $type = '';
|
||||
public string $size = '';
|
||||
|
||||
private $newName = '';
|
||||
private $errorInfo = [
|
||||
private string $newName = '';
|
||||
private array $errorInfo = [
|
||||
0 => 'UPLOAD_ERR_OK.',
|
||||
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
|
||||
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Date: 2018/4/8 0008
|
||||
* Time: 17:51
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace HttpServer\Http\Formatter;
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Date: 2018/4/8 0008
|
||||
* Time: 17:18
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace HttpServer\Http\Formatter;
|
||||
|
||||
use Exception;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Date: 2018/4/8 0008
|
||||
* Time: 17:29
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace HttpServer\Http\Formatter;
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ use HttpServer\IInterface\IFormatter;
|
||||
class XmlFormatter extends Application implements IFormatter
|
||||
{
|
||||
|
||||
public $data = '';
|
||||
public ?string $data = '';
|
||||
|
||||
/** @var Response */
|
||||
public $status;
|
||||
public Response $status;
|
||||
|
||||
public $header = [];
|
||||
public array $header = [];
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
@@ -61,7 +61,7 @@ class XmlFormatter extends Application implements IFormatter
|
||||
* @param SimpleXMLElement $dom
|
||||
* @param $data
|
||||
*/
|
||||
public function toXml($dom, $data)
|
||||
public function toXml(SimpleXMLElement $dom, $data)
|
||||
{
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_numeric($key)) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Date: 2019-03-18
|
||||
* Time: 14:54
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace HttpServer\Http;
|
||||
|
||||
/**
|
||||
@@ -18,12 +18,12 @@ class HttpHeaders
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $headers = [];
|
||||
private array $headers = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $response = [];
|
||||
private array $response = [];
|
||||
|
||||
/**
|
||||
* HttpHeaders constructor.
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
* Date: 2019-03-18
|
||||
* Time: 14:54
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace HttpServer\Http;
|
||||
|
||||
use Exception;
|
||||
use HttpServer\Exception\RequestException;
|
||||
use Snowflake\Core\Help;
|
||||
use Snowflake\Core\JSON;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -21,13 +22,13 @@ class HttpParams
|
||||
{
|
||||
|
||||
/** @var array */
|
||||
private $body = [];
|
||||
private array $body = [];
|
||||
|
||||
/** @var array */
|
||||
private $gets = [];
|
||||
private array $gets = [];
|
||||
|
||||
/** @var array */
|
||||
private $files = [];
|
||||
private array $files = [];
|
||||
|
||||
/**
|
||||
* HttpParams constructor.
|
||||
|
||||
+12
-11
@@ -1,14 +1,15 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Http;
|
||||
|
||||
use Snowflake\Core\Help;
|
||||
use Exception;
|
||||
use HttpServer\Application;
|
||||
use HttpServer\IInterface\AuthIdentity;
|
||||
use Snowflake\Core\JSON;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
use function router;
|
||||
|
||||
defined('REQUEST_OK') or define('REQUEST_OK', 0);
|
||||
defined('REQUEST_FAIL') or define('REQUEST_FAIL', 500);
|
||||
@@ -32,26 +33,26 @@ class Request extends Application
|
||||
{
|
||||
|
||||
/** @var int $fd */
|
||||
public $fd = 0;
|
||||
public int $fd = 0;
|
||||
|
||||
/** @var HttpParams */
|
||||
public $params;
|
||||
public HttpParams $params;
|
||||
|
||||
/** @var HttpHeaders */
|
||||
public $headers;
|
||||
public HttpHeaders $headers;
|
||||
|
||||
/** @var bool */
|
||||
public $isCli = FALSE;
|
||||
public bool $isCli = FALSE;
|
||||
|
||||
/** @var float */
|
||||
public $startTime;
|
||||
public float $startTime;
|
||||
|
||||
public $uri = '';
|
||||
public string $uri = '';
|
||||
|
||||
public $statusCode = 200;
|
||||
public int $statusCode = 200;
|
||||
|
||||
/** @var string[] */
|
||||
private $explode = [];
|
||||
private array $explode = [];
|
||||
|
||||
const PLATFORM_MAC_OX = 'mac';
|
||||
const PLATFORM_IPHONE = 'iphone';
|
||||
@@ -62,7 +63,7 @@ class Request extends Application
|
||||
/**
|
||||
* @var AuthIdentity|null
|
||||
*/
|
||||
private $_grant = null;
|
||||
private ?AuthIdentity $_grant = null;
|
||||
|
||||
|
||||
/**
|
||||
@@ -212,7 +213,7 @@ class Request extends Application
|
||||
public function adapter()
|
||||
{
|
||||
if (!$this->isHead()) {
|
||||
return router()->runHandler();
|
||||
return router()->dispatch();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Date: 2018/4/24 0024
|
||||
* Time: 19:39
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Http;
|
||||
|
||||
@@ -14,9 +15,7 @@ use HttpServer\Http\Formatter\JsonFormatter;
|
||||
use HttpServer\Http\Formatter\XmlFormatter;
|
||||
use Exception;
|
||||
use Snowflake\Core\Help;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Snowflake;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Http\Response as SResponse;
|
||||
use Swoole\Http2\Response as S2Response;
|
||||
|
||||
@@ -31,20 +30,20 @@ class Response extends Application
|
||||
const XML = 'xml';
|
||||
const HTML = 'html';
|
||||
|
||||
/** @var string */
|
||||
public $format = null;
|
||||
/** @var ?string */
|
||||
public ?string $format = null;
|
||||
|
||||
/** @var int */
|
||||
public $statusCode = 200;
|
||||
public int $statusCode = 200;
|
||||
|
||||
/** @var SResponse */
|
||||
public $response;
|
||||
public $isWebSocket = false;
|
||||
public $headers = [];
|
||||
public SResponse $response;
|
||||
public bool $isWebSocket = false;
|
||||
public array $headers = [];
|
||||
|
||||
private $startTime = 0;
|
||||
private int $startTime = 0;
|
||||
|
||||
private $_format_maps = [
|
||||
private array $_format_maps = [
|
||||
self::JSON => JsonFormatter::class,
|
||||
self::XML => XmlFormatter::class,
|
||||
self::HTML => HtmlFormatter::class
|
||||
|
||||
Reference in New Issue
Block a user