mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 07:35:34 +08:00
update to 3.0.0-alpha2 (build 610): refactor driver
This commit is contained in:
51
src/ZM/Annotation/Http/Route.php
Normal file
51
src/ZM/Annotation/Http/Route.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ZM\Annotation\Http;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Common\Annotations\Annotation\Required;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
|
||||
/**
|
||||
* Class RequestMapping
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor()
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_METHOD)]
|
||||
class Route extends AnnotationBase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @Required()
|
||||
*/
|
||||
public $route = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name = '';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $request_method = ['GET', 'POST'];
|
||||
|
||||
/**
|
||||
* Routing path params binding. eg. {"id"="\d+"}
|
||||
* @var array
|
||||
*/
|
||||
public $params = [];
|
||||
|
||||
public function __construct($route, $name = '', $request_method = ['GET', 'POST'], $params = [])
|
||||
{
|
||||
$this->route = $route;
|
||||
$this->name = $name;
|
||||
$this->request_method = $request_method;
|
||||
$this->params = $params;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user