1 | <?php |
||
17 | class ClassPattern implements PatternInterface { |
||
18 | |||
19 | /** |
||
20 | * Result of this pattern will be body of the class |
||
21 | */ |
||
22 | const OUTPUT_BODY = 1; |
||
23 | |||
24 | /** |
||
25 | * Result of this pattern will be full class |
||
26 | */ |
||
27 | const OUTPUT_FULL = 2; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * @var QueryStrategy |
||
32 | */ |
||
33 | private $nameQuery = null; |
||
34 | |||
35 | /** |
||
36 | * @var callable |
||
37 | */ |
||
38 | private $docCommentChecker; |
||
39 | |||
40 | /** |
||
41 | * @var callable[] |
||
42 | */ |
||
43 | private $modifierChecker; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | private $outputType = self::OUTPUT_FULL; |
||
49 | |||
50 | |||
51 | /** |
||
52 | 57 | * By default we search for classes with any name |
|
53 | 57 | */ |
|
54 | 57 | public function __construct() { |
|
59 | |||
60 | |||
61 | /** |
||
62 | * @param QueryStrategy|string $name |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function withName($name) : self { |
||
76 | 15 | ||
77 | 9 | ||
78 | 10 | /** |
|
79 | 6 | * @return $this |
|
80 | 4 | */ |
|
81 | 3 | public function withDocComment() : self { |
|
89 | |||
90 | |||
91 | 3 | /** |
|
92 | * @return $this |
||
93 | 3 | */ |
|
94 | 3 | public function withPossibleDocComment() : self { |
|
100 | |||
101 | |||
102 | /** |
||
103 | * @return $this |
||
104 | 57 | */ |
|
105 | public function withoutDocComment() : self { |
||
113 | |||
114 | |||
115 | 3 | /** |
|
116 | * @return $this |
||
117 | 3 | */ |
|
118 | 3 | public function outputBody() : self { |
|
122 | |||
123 | |||
124 | /** |
||
125 | * @return $this |
||
126 | */ |
||
127 | public function outputFull() : self { |
||
131 | |||
132 | |||
133 | /** |
||
134 | * @inheritdoc |
||
135 | */ |
||
136 | public function __invoke(QuerySequence $querySequence) { |
||
188 | |||
189 | 54 | ||
190 | 54 | /** |
|
191 | 36 | * @return $this |
|
192 | */ |
||
193 | public function withAnyModifier() : self { |
||
199 | 51 | ||
200 | 30 | ||
201 | /** |
||
202 | * @param string $modifier |
||
203 | * @return $this |
||
204 | 21 | */ |
|
205 | public function withModifier(string $modifier) : self { |
||
216 | |||
217 | |||
218 | /** |
||
219 | * @param string $modifier |
||
220 | * @return $this |
||
221 | */ |
||
222 | public function withoutModifier(string $modifier) : self { |
||
231 | |||
232 | |||
233 | } |