mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
39 lines
967 B
PHP
39 lines
967 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ZM\Annotation\Http;
|
|
|
|
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
|
|
{
|
|
public function __construct(
|
|
/**
|
|
* @Required()
|
|
*/
|
|
public $route,
|
|
public $name = '',
|
|
public $request_method = ['GET', 'POST'],
|
|
/**
|
|
* Routing path params binding. eg. {"id"="\d+"}
|
|
*/
|
|
public $params = []
|
|
) {}
|
|
|
|
public static function make($route, $name = '', $request_method = ['GET', 'POST'], $params = []): static
|
|
{
|
|
return new static($route, $name, $request_method, $params);
|
|
}
|
|
}
|