Files
kiri-core/system/Annotation/Definition/Http.php
T

59 lines
828 B
PHP
Raw Normal View History

2020-08-31 22:33:50 +08:00
<?php
2020-08-31 23:28:17 +08:00
namespace Snowflake\Annotation\Definition;
2020-08-31 22:33:50 +08:00
use Closure;
use ReflectionClass;
use ReflectionException;
2020-08-31 23:28:17 +08:00
use Snowflake\Annotation\Annotation;
2020-08-31 22:33:50 +08:00
use Snowflake\Snowflake;
/**
* Class Http
* @package Snowflake\Annotation
*/
class Http extends Annotation
{
const HTTP_EVENT = 'http:event:';
/**
* @var string
2020-08-31 23:27:01 +08:00
* @Interceptor(LoginInterceptor)
2020-08-31 22:33:50 +08:00
*/
2020-08-31 23:27:01 +08:00
private $Interceptor = 'required|not empty';
2020-08-31 22:33:50 +08:00
/**
* @var string
*/
2020-08-31 23:27:01 +08:00
private $Limits = 'required|not empty';
2020-08-31 22:33:50 +08:00
2020-08-31 23:27:01 +08:00
protected $_annotations = [];
2020-08-31 22:33:50 +08:00
/**
2020-08-31 23:27:01 +08:00
* @param $events
* @return bool
2020-08-31 22:33:50 +08:00
*/
2020-08-31 23:27:01 +08:00
public function isLegitimate($events)
2020-08-31 22:33:50 +08:00
{
2020-08-31 23:27:01 +08:00
return isset($events[2]) && !empty($events[2]);
2020-08-31 22:33:50 +08:00
}
/**
* @param $name
* @param $events
* @return false|string
*/
public function getName($name, $events)
{
2020-08-31 23:27:01 +08:00
return self::HTTP_EVENT . $name . ':' . $events[2];
2020-08-31 22:33:50 +08:00
}
2020-08-31 23:27:01 +08:00
2020-08-31 22:33:50 +08:00
}