1 | <?php |
||
12 | class Matcher implements MatcherInterface |
||
13 | { |
||
14 | /** |
||
15 | * {@inheritdoc} |
||
16 | */ |
||
17 | 28 | public function any() |
|
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 4 | public function annotatedWith($annotationName) |
|
26 | { |
||
27 | 4 | if (! class_exists($annotationName)) { |
|
28 | 1 | throw new InvalidAnnotationException($annotationName); |
|
29 | } |
||
30 | |||
31 | 3 | return new AnnotatedMatcher(__FUNCTION__, [$annotationName]); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 2 | public function subclassesOf($superClass) |
|
38 | { |
||
39 | 2 | if (! class_exists($superClass)) { |
|
40 | 1 | throw new InvalidArgumentException($superClass); |
|
41 | } |
||
42 | |||
43 | 1 | return new BuiltinMatcher(__FUNCTION__, [$superClass]); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 30 | public function startsWith($prefix) |
|
50 | { |
||
51 | 30 | if (! is_string($prefix)) { |
|
52 | 1 | throw new InvalidArgumentException($prefix); |
|
53 | } |
||
54 | |||
55 | 29 | return new BuiltinMatcher(__FUNCTION__, [$prefix]); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 1 | public function logicalOr(AbstractMatcher $matcherA, AbstractMatcher $matcherB) |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 1 | public function logicalAnd(AbstractMatcher $matcherA, AbstractMatcher $matcherB) |
|
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 1 | public function logicalNot(AbstractMatcher $matcher) |
|
81 | } |
||
82 |