forked from silverstripe/silverstripe-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnnotationDefinitionInterface.php
More file actions
60 lines (52 loc) · 1.89 KB
/
AnnotationDefinitionInterface.php
File metadata and controls
60 lines (52 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php declare(strict_types=1);
namespace SilverStripe\Config\Transformer\AnnotationTransformer;
use ReflectionClass;
use ReflectionMethod;
interface AnnotationDefinitionInterface
{
const COLLECT_CLASS = 1;
const COLLECT_CONSTRUCTOR = 2;
const COLLECT_METHODS = 4;
/**
* Return a bitwise integer combining COLLECT_* constants indicating what doc blocks to collect annotations from
*
* @return int
*/
public function defineCollectionScopes(): int;
/**
* Indicates whether annotations should be collected from the given class
*
* @param string $className
* @return bool
*/
public function shouldCollect(string $className): bool;
/**
* Indicates whether annotations should be collected from the given method within the given class
*
* @param ReflectionClass $class
* @param ReflectionMethod $method
* @return bool
*/
public function shouldCollectFromMethod(ReflectionClass $class, ReflectionMethod $method): bool;
/**
* Get an array of annotations to look for. For example 'Foo' would indicate that '@Foo' should be matched
*
* @return array
*/
public function getAnnotationStrings(): array;
/**
* Create config from a matched annotation.
*
* @param string $annotation The annotation string that was matched (defined in @see getAnnotationStrings)
* @param array $arguments An array of strings that were passed as arguments (eg. @Foo(argument1,argument2)
* @param int $context A COLLECT_* constant that indicates what context this annotation was found in
* @param string|null $contextDetail A method name, provided the context of the annotation was a method
* @return array
*/
public function createConfigForAnnotation(
string $annotation,
array $arguments,
int $context,
?string $contextDetail = null
): array;
}