2020-03-02 16:14:20 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZM\Annotation\Swoole;
|
|
|
|
|
|
|
|
|
|
use Doctrine\Common\Annotations\Annotation\Required;
|
|
|
|
|
use Doctrine\Common\Annotations\Annotation\Target;
|
|
|
|
|
use ZM\Annotation\AnnotationBase;
|
|
|
|
|
use ZM\Annotation\Interfaces\Level;
|
|
|
|
|
use ZM\Annotation\Interfaces\Rule;
|
|
|
|
|
|
|
|
|
|
/**
|
2020-11-03 21:02:24 +08:00
|
|
|
* Class OnSwooleEvent
|
2020-03-02 16:14:20 +08:00
|
|
|
* @Annotation
|
|
|
|
|
* @Target("ALL")
|
|
|
|
|
* @package ZM\Annotation\Swoole
|
|
|
|
|
*/
|
2020-11-03 21:02:24 +08:00
|
|
|
class OnSwooleEvent extends AnnotationBase implements Rule, Level
|
2020-03-02 16:14:20 +08:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
* @Required
|
|
|
|
|
*/
|
|
|
|
|
public $type;
|
|
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
|
public $rule = "";
|
|
|
|
|
|
|
|
|
|
/** @var int */
|
|
|
|
|
public $level = 20;
|
|
|
|
|
|
|
|
|
|
public $callback = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getType(): string {
|
|
|
|
|
return $this->type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $type
|
|
|
|
|
*/
|
2020-03-05 12:03:14 +08:00
|
|
|
public function setType(string $type) {
|
2020-03-02 16:14:20 +08:00
|
|
|
$this->type = $type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getRule(): string {
|
|
|
|
|
return $this->rule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $rule
|
|
|
|
|
*/
|
2020-03-05 12:03:14 +08:00
|
|
|
public function setRule(string $rule) {
|
2020-03-02 16:14:20 +08:00
|
|
|
$this->rule = $rule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getLevel(): int {
|
|
|
|
|
return $this->level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $level
|
|
|
|
|
*/
|
2020-03-05 12:03:14 +08:00
|
|
|
public function setLevel(int $level) {
|
2020-03-02 16:14:20 +08:00
|
|
|
$this->level = $level;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-29 15:07:43 +08:00
|
|
|
}
|