1 | <?php |
||
15 | class ClassPattern implements PatternInterface { |
||
16 | |||
17 | /** |
||
18 | * Result of this pattern will be body of the class |
||
19 | */ |
||
20 | const OUTPUT_BODY = 1; |
||
21 | |||
22 | /** |
||
23 | * Result of this pattern will be full class |
||
24 | */ |
||
25 | const OUTPUT_FULL = 2; |
||
26 | |||
27 | |||
28 | /** |
||
29 | * @var QueryStrategy |
||
30 | */ |
||
31 | private $nameQuery = null; |
||
32 | |||
33 | /** |
||
34 | * @var callable |
||
35 | */ |
||
36 | private $docCommentChecker; |
||
37 | |||
38 | /** |
||
39 | * @var callable[] |
||
40 | */ |
||
41 | private $modifierChecker; |
||
42 | |||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $outputType = self::OUTPUT_BODY; |
||
47 | |||
48 | |||
49 | /** |
||
50 | * By default we search for classes with any name |
||
51 | */ |
||
52 | 57 | public function __construct() { |
|
57 | |||
58 | |||
59 | /** |
||
60 | * @codeCoverageIgnore |
||
61 | * @deprecated |
||
62 | * @param string $name |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function nameIs($name) { |
||
69 | |||
70 | |||
71 | /** |
||
72 | * @param QueryStrategy|string $name |
||
73 | * @return $this |
||
74 | */ |
||
75 | 15 | public function withName($name) { |
|
86 | |||
87 | |||
88 | /** |
||
89 | * @return $this |
||
90 | */ |
||
91 | 3 | public function withDocComment() { |
|
99 | |||
100 | |||
101 | /** |
||
102 | * @return $this |
||
103 | */ |
||
104 | 57 | public function withPossibleDocComment() { |
|
105 | $this->docCommentChecker = function () { |
||
106 | |||
107 | 48 | }; |
|
108 | 57 | return $this; |
|
109 | } |
||
110 | |||
111 | |||
112 | /** |
||
113 | * @return $this |
||
114 | */ |
||
115 | 3 | public function withoutDocComment() { |
|
123 | |||
124 | |||
125 | /** |
||
126 | * @return $this |
||
127 | */ |
||
128 | 3 | public function outputBody() { |
|
132 | |||
133 | |||
134 | /** |
||
135 | * @return $this |
||
136 | */ |
||
137 | 21 | public function outputFull() { |
|
141 | |||
142 | |||
143 | /** |
||
144 | * @codeCoverageIgnore |
||
145 | * @deprecated |
||
146 | * @param QueryStrategy $strategy |
||
147 | * @return $this |
||
148 | */ |
||
149 | public function whereName(QueryStrategy $strategy) { |
||
153 | |||
154 | |||
155 | /** |
||
156 | * @inheritdoc |
||
157 | */ |
||
158 | 54 | public function __invoke(QuerySequence $querySequence) { |
|
206 | |||
207 | |||
208 | /** |
||
209 | * @return $this |
||
210 | */ |
||
211 | 57 | public function withAnyModifier() { |
|
217 | |||
218 | |||
219 | /** |
||
220 | * @param string $modifier |
||
221 | * @return $this |
||
222 | */ |
||
223 | 6 | public function withModifier($modifier) { |
|
234 | |||
235 | |||
236 | /** |
||
237 | * @param string $modifier |
||
238 | * @return $this |
||
239 | */ |
||
240 | public function withoutModifier($modifier) { |
||
249 | |||
250 | |||
251 | } |