From 91af6b3a5f42c6cf7eb51b3770e8ccfa0add70ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 01:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ActionManager.php | 41 --------------------- src/Aspect.php | 1 + src/Aspect/AbstractsAspect.php | 1 + src/Aspect/JoinPoint.php | 1 + src/Aspect/OnAspectInterface.php | 1 + src/Aspect/OnJoinPointInterface.php | 1 + src/Aspect/TestAspect.php | 25 ------------- src/Base/AbstractHandler.php | 2 +- src/Base/ClosureController.php | 1 + src/Base/CoreMiddleware.php | 1 + src/Base/EventDispatchHelper.php | 1 + src/Base/ExceptionHandlerDispatcher.php | 1 + src/Base/MethodErrorController.php | 6 ++- src/Base/Middleware.php | 1 + src/Base/NotFoundController.php | 6 ++- src/Constrict/ConstrictRequest.php | 1 + src/Constrict/ConstrictResponse.php | 1 + src/Constrict/Message.php | 1 + src/Constrict/RequestMethod.php | 35 ++++++++++++++++++ src/Constrict/Stream.php | 1 + src/Constrict/Uri.php | 1 + src/ContentType.php | 1 + src/ControllerInterpreter.php | 1 + src/DataGrip.php | 1 + src/Handler.php | 1 + src/HttpRequestHandler.php | 1 + src/HttpResponseEmitter.php | 1 + src/Inject/AbstractRequestMethod.php | 1 + src/Inject/Aspect.php | 1 + src/Inject/Controller.php | 1 + src/Inject/Delete.php | 3 +- src/Inject/Filter.php | 1 + src/Inject/Get.php | 3 +- src/Inject/Head.php | 3 +- src/Inject/Interceptor.php | 1 + src/Inject/Middleware.php | 1 + src/Inject/Options.php | 3 +- src/Inject/Other.php | 1 + src/Inject/Post.php | 3 +- src/Inject/Put.php | 3 +- src/Inject/QueryData.php | 1 + src/Interface/ExceptionHandlerInterface.php | 1 + src/Interface/InjectRouteInterface.php | 1 + src/Interface/OnRequestInterface.php | 1 + src/Interface/ValidatorInterface.php | 1 + src/Request.php | 1 + src/Response.php | 1 + src/Router.php | 3 +- src/RouterCollector.php | 4 +- src/Server.php | 1 + src/StreamResponse.php | 1 + src/Validator/Inject/Email.php | 1 + src/Validator/Inject/Ignore.php | 1 + src/Validator/Inject/In.php | 1 + src/Validator/Inject/Length.php | 1 + src/Validator/Inject/Max.php | 1 + src/Validator/Inject/MaxLength.php | 1 + src/Validator/Inject/Min.php | 1 + src/Validator/Inject/MinLength.php | 1 + src/Validator/Inject/Must.php | 1 + src/Validator/Inject/NotEmpty.php | 1 + src/Validator/Inject/NotIn.php | 1 + src/Validator/Inject/NotNull.php | 1 + src/Validator/Inject/Phone.php | 1 + src/Validator/Inject/Required.php | 1 + src/Validator/Inject/Round.php | 1 + src/Validator/Validator.php | 1 + src/Validator/ValidatorMiddleware.php | 1 + 68 files changed, 115 insertions(+), 79 deletions(-) delete mode 100644 src/ActionManager.php delete mode 100644 src/Aspect/TestAspect.php create mode 100644 src/Constrict/RequestMethod.php diff --git a/src/ActionManager.php b/src/ActionManager.php deleted file mode 100644 index 12938b3..0000000 --- a/src/ActionManager.php +++ /dev/null @@ -1,41 +0,0 @@ - []]; - } - static::$array[$class][$method] = $handler; - } - - - /** - * @param string $class - * @param string $method - * @return array|null - */ - public static function get(string $class, string $method): ?Handler - { - if (isset(static::$array[$class])) { - return static::$array[$class][$method] ?? null; - } - return null; - } - - -} diff --git a/src/Aspect.php b/src/Aspect.php index 0eca0a2..4b354e0 100644 --- a/src/Aspect.php +++ b/src/Aspect.php @@ -1,4 +1,5 @@ process(); - - var_dump('111'); - - return $result; - } - -} diff --git a/src/Base/AbstractHandler.php b/src/Base/AbstractHandler.php index 61d9b44..b351068 100644 --- a/src/Base/AbstractHandler.php +++ b/src/Base/AbstractHandler.php @@ -1,8 +1,8 @@ response->failure(405, "method allow."); + return $this->response->withStatus(405, "method allow."); } } diff --git a/src/Base/Middleware.php b/src/Base/Middleware.php index 668e1a5..65de3ed 100644 --- a/src/Base/Middleware.php +++ b/src/Base/Middleware.php @@ -1,4 +1,5 @@ response->failure(404, "not found page."); + return $this->response->withStatus(404, "not found page."); } } diff --git a/src/Constrict/ConstrictRequest.php b/src/Constrict/ConstrictRequest.php index cdf6c11..dd75819 100644 --- a/src/Constrict/ConstrictRequest.php +++ b/src/Constrict/ConstrictRequest.php @@ -1,4 +1,5 @@ 'POST', + self::REQUEST_GET => 'GET', + self::REQUEST_HEAD => 'HEAD', + self::REQUEST_OPTIONS => 'OPTIONS', + self::REQUEST_DELETE => 'DELETE', + self::REQUEST_PUT => 'PUT' + }; + } + + +} diff --git a/src/Constrict/Stream.php b/src/Constrict/Stream.php index e9ab05c..ec6d050 100644 --- a/src/Constrict/Stream.php +++ b/src/Constrict/Stream.php @@ -1,4 +1,5 @@