mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-12 03:05:34 +08:00
add alias
This commit is contained in:
@@ -11,10 +11,15 @@ use Traversable;
|
||||
|
||||
abstract class AnnotationBase implements IteratorAggregate
|
||||
{
|
||||
public $method = '';
|
||||
public string $method = '';
|
||||
|
||||
/**
|
||||
* @var Closure|string
|
||||
*/
|
||||
public $class = '';
|
||||
|
||||
public array $group = [];
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$str = __CLASS__ . ': ';
|
||||
@@ -44,7 +49,7 @@ abstract class AnnotationBase implements IteratorAggregate
|
||||
*
|
||||
* @param Closure|string $method
|
||||
*/
|
||||
public function withMethod($method): AnnotationBase
|
||||
public function on($method): AnnotationBase
|
||||
{
|
||||
$this->method = $method;
|
||||
return $this;
|
||||
@@ -54,4 +59,19 @@ abstract class AnnotationBase implements IteratorAggregate
|
||||
{
|
||||
return new ArrayIterator($this);
|
||||
}
|
||||
|
||||
public function isInGroup(string $name): bool
|
||||
{
|
||||
return in_array($name, $this->group);
|
||||
}
|
||||
|
||||
public function addGroup(string $name)
|
||||
{
|
||||
$this->group[] = $name;
|
||||
}
|
||||
|
||||
public function getGroups(): array
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user