| Total Complexity | 8 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 73.32% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | final class AnnotationTarget |
||
| 10 | { |
||
| 11 | public const TARGET_CLASS = 1; |
||
| 12 | public const TARGET_METHOD = 2; |
||
| 13 | public const TARGET_PROPERTY = 4; |
||
| 14 | public const TARGET_ANNOTATION = 8; |
||
| 15 | public const TARGET_ALL = self::TARGET_CLASS |
||
| 16 | | self::TARGET_METHOD |
||
| 17 | | self::TARGET_PROPERTY |
||
| 18 | | self::TARGET_ANNOTATION; |
||
| 19 | |||
| 20 | /** @var int */ |
||
| 21 | private $target; |
||
| 22 | |||
| 23 | 10 | public function __construct(int $target) |
|
| 24 | { |
||
| 25 | 10 | $this->target = $target; |
|
| 26 | 10 | } |
|
| 27 | |||
| 28 | public static function fromAnnotation(Target $annotation) : self |
||
| 29 | { |
||
| 30 | return new self($annotation->targets); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function get() : int |
||
| 34 | { |
||
| 35 | return $this->target; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function class() : bool |
||
| 39 | { |
||
| 40 | return ($this->target & self::TARGET_CLASS) === self::TARGET_CLASS; |
||
| 41 | } |
||
| 42 | |||
| 43 | 3 | public function property() : bool |
|
| 46 | } |
||
| 47 | |||
| 48 | 2 | public function method() : bool |
|
| 49 | { |
||
| 50 | 2 | return ($this->target & self::TARGET_METHOD) === self::TARGET_METHOD; |
|
| 51 | } |
||
| 52 | |||
| 53 | 4 | public function annotation() : bool |
|
| 56 | } |
||
| 57 | |||
| 58 | 26 | public function all() : bool |
|
| 59 | { |
||
| 61 | } |
||
| 62 | } |
||
| 63 |