2020-08-31 01:27:08 +08:00
|
|
|
<?php
|
2020-10-29 18:17:25 +08:00
|
|
|
declare(strict_types=1);
|
2020-08-31 01:27:08 +08:00
|
|
|
|
|
|
|
|
namespace HttpServer;
|
|
|
|
|
|
|
|
|
|
|
2021-07-27 00:35:50 +08:00
|
|
|
use Annotation\Inject;
|
2021-04-26 12:45:29 +08:00
|
|
|
use Exception;
|
2021-02-20 17:30:03 +08:00
|
|
|
use HttpServer\Abstracts\HttpService;
|
2020-08-31 01:27:08 +08:00
|
|
|
use HttpServer\Http\HttpHeaders;
|
|
|
|
|
use HttpServer\Http\HttpParams;
|
|
|
|
|
use HttpServer\Http\Request;
|
2021-07-27 00:35:50 +08:00
|
|
|
use HttpServer\Http\Response;
|
|
|
|
|
use Snowflake\Abstracts\Input;
|
2021-02-08 17:01:03 +08:00
|
|
|
use Snowflake\Abstracts\TraitApplication;
|
2020-08-31 01:27:08 +08:00
|
|
|
use Snowflake\Snowflake;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class WebController
|
2020-08-31 12:38:32 +08:00
|
|
|
* @package Snowflake\Snowflake\Web
|
2021-04-22 14:37:28 +08:00
|
|
|
* @property-read HttpParams $input
|
2021-07-27 00:41:00 +08:00
|
|
|
* @property-read HttpHeaders $header
|
2020-08-31 01:27:08 +08:00
|
|
|
*/
|
2021-07-27 00:35:50 +08:00
|
|
|
class Controller
|
2020-08-31 01:27:08 +08:00
|
|
|
{
|
|
|
|
|
|
2021-07-27 00:35:50 +08:00
|
|
|
use TraitApplication;
|
2021-02-08 17:01:03 +08:00
|
|
|
|
2020-09-10 15:54:14 +08:00
|
|
|
|
2021-07-27 00:35:50 +08:00
|
|
|
/**
|
|
|
|
|
* inject request
|
|
|
|
|
*
|
|
|
|
|
* @var \HttpServer\Http\Request
|
|
|
|
|
*/
|
|
|
|
|
#[Inject(className: 'request', withContext: true)]
|
2021-07-27 00:42:16 +08:00
|
|
|
protected ?Request $request = null;
|
2020-09-10 15:54:14 +08:00
|
|
|
|
2021-03-29 17:29:39 +08:00
|
|
|
|
2021-07-27 00:41:00 +08:00
|
|
|
/**
|
|
|
|
|
* @var \HttpServer\Http\HttpParams
|
|
|
|
|
*/
|
|
|
|
|
#[Inject(className: 'input', withContext: true)]
|
2021-07-27 00:42:16 +08:00
|
|
|
protected ?HttpParams $input = null;
|
2021-07-27 00:41:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var \HttpServer\Http\HttpHeaders
|
|
|
|
|
*/
|
|
|
|
|
#[Inject(className: 'header', withContext: true)]
|
2021-07-27 00:42:16 +08:00
|
|
|
protected ?HttpHeaders $header = null;
|
2021-07-27 00:41:00 +08:00
|
|
|
|
|
|
|
|
|
2021-07-27 00:35:50 +08:00
|
|
|
/**
|
|
|
|
|
* inject response
|
|
|
|
|
*
|
|
|
|
|
* @var \HttpServer\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
#[Inject('response')]
|
2021-07-27 00:42:16 +08:00
|
|
|
protected ?Response $response = null;
|
2020-11-10 18:04:42 +08:00
|
|
|
|
|
|
|
|
|
2020-08-31 01:27:08 +08:00
|
|
|
}
|