Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | namespace Dynart\Micro; |
4 | |
5 | /** |
6 | * Interface for annotation processing |
7 | * @package Dynart\Micro |
8 | */ |
9 | interface Annotation { |
10 | |
11 | const TYPE_CLASS = 'class'; |
12 | const TYPE_PROPERTY = 'property'; |
13 | const TYPE_METHOD = 'method'; |
14 | |
15 | /** |
16 | * The types of the annotation |
17 | * |
18 | * Can be: class, property, method |
19 | * |
20 | * @return array |
21 | */ |
22 | public function types(): array; |
23 | |
24 | /** |
25 | * The name of the annotation |
26 | * |
27 | * For example, if the name is 'route', then |
28 | * the AnnotationProcessor will search for '* @route ' in the comments first. |
29 | * |
30 | * @return string |
31 | */ |
32 | public function name(): string; |
33 | |
34 | /** |
35 | * The regular expression for processing the annotation if the name was found |
36 | * |
37 | * It will be used like this: |
38 | * |
39 | * Asterisk Space @`name` Space `regex` Space Asterisk in non greedy mode |
40 | * |
41 | * <pre> |
42 | * /\*\s\@{$this->name()}\s{$this->regex()}\s\*/U |
43 | * </pre> |
44 | * |
45 | * @return string |
46 | */ |
47 | public function regex(): string; |
48 | |
49 | /** |
50 | * Processes the annotation |
51 | * |
52 | * @param string $type The type of the annotation (can be: class, property, method) |
53 | * @param string $className The name of the class |
54 | * @param mixed $subject The reflected class/property/method (depends on the `$type`) |
55 | * @param string $comment The full comment without new lines |
56 | * @param array $matches The matches from the regex |
57 | */ |
58 | public function process(string $type, string $className, $subject, string $comment, array $matches): void; |
59 | } |