- Added MethodNotAllowed interface
This commit is contained in:
		
							parent
							
								
									990f57b94e
								
							
						
					
					
						commit
						74a56bd72f
					
				| @ -1,6 +1,6 @@ | |||||||
| <?php | <?php | ||||||
| 
 | 
 | ||||||
| use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator }; | use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface,  }; | ||||||
| use function DI\autowire, DI\create, DI\get; | use function DI\autowire, DI\create, DI\get; | ||||||
| 
 | 
 | ||||||
| use Psr\Http\Message\ServerRequestInterface; | use Psr\Http\Message\ServerRequestInterface; | ||||||
| @ -17,4 +17,5 @@ return [ | |||||||
|     EmitterInterface::class => create(SapiEmitter::class), |     EmitterInterface::class => create(SapiEmitter::class), | ||||||
|     ThrowableHandlerInterface::class => autowire(ThrowableHandler::class), |     ThrowableHandlerInterface::class => autowire(ThrowableHandler::class), | ||||||
|     NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class), |     NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class), | ||||||
|  |     # MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
 | ||||||
| ]; | ]; | ||||||
|  | |||||||
| @ -2,8 +2,10 @@ | |||||||
| 
 | 
 | ||||||
| namespace Lean; | namespace Lean; | ||||||
| 
 | 
 | ||||||
|  | use League\Route\Http\Exception\MethodNotAllowedException; | ||||||
| use League\Route\Strategy; | use League\Route\Strategy; | ||||||
| use League\Route\Http\Exception\NotFoundException; | use League\Route\Http\Exception\NotFoundException; | ||||||
|  | use Lean\ApplicationStrategy\MethodNotAllowedInterface; | ||||||
| use Lean\ApplicationStrategy\NotFoundDecoratorInterface; | use Lean\ApplicationStrategy\NotFoundDecoratorInterface; | ||||||
| use Lean\ApplicationStrategy\ThrowableHandlerInterface; | use Lean\ApplicationStrategy\ThrowableHandlerInterface; | ||||||
| use Lean\Factory\HttpFactoryInterface; | use Lean\Factory\HttpFactoryInterface; | ||||||
| @ -31,4 +33,9 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy { | |||||||
|     { |     { | ||||||
|         return $this->getContainer()->get(ThrowableHandlerInterface::class); |         return $this->getContainer()->get(ThrowableHandlerInterface::class); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface | ||||||
|  |     { | ||||||
|  |         return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception); | ||||||
|  |     } | ||||||
| } | } | ||||||
							
								
								
									
										10
									
								
								src/ApplicationStrategy/MethodNotAllowedInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/ApplicationStrategy/MethodNotAllowedInterface.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | namespace Lean\ApplicationStrategy; | ||||||
|  | 
 | ||||||
|  | use Psr\Http\Server\MiddlewareInterface; | ||||||
|  | 
 | ||||||
|  | interface MethodNotAllowedInterface extends MiddlewareInterface | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user