These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SMW\Test; |
||
4 | |||
5 | use ParserOutput; |
||
6 | use ReflectionClass; |
||
7 | use SMW\MessageFormatter; |
||
8 | use SMW\ParserData; |
||
9 | use SMW\ParserParameterFormatter; |
||
10 | use SMW\RecurringEventsParserFunction; |
||
11 | use SMW\Settings; |
||
12 | use SMW\Subobject; |
||
13 | use Title; |
||
14 | |||
15 | /** |
||
16 | * @covers \SMW\RecurringEventsParserFunction |
||
17 | * |
||
18 | * |
||
19 | * @group SMW |
||
20 | * @group SMWExtension |
||
21 | * |
||
22 | * @license GNU GPL v2+ |
||
23 | * @since 1.9 |
||
24 | * |
||
25 | * @author mwjames |
||
26 | */ |
||
27 | class RecurringEventsParserFunctionTest extends \PHPUnit_Framework_TestCase { |
||
28 | |||
29 | public function testCanConstruct() { |
||
30 | |||
31 | $subobject = new Subobject( Title::newFromText( __METHOD__ ) ); |
||
32 | |||
33 | $settings = $this->getMockBuilder( '\SMW\Settings' ) |
||
34 | ->disableOriginalConstructor() |
||
35 | ->getMock(); |
||
36 | |||
37 | $parserData = $this->getMockBuilder( '\SMW\ParserData' ) |
||
38 | ->disableOriginalConstructor() |
||
39 | ->getMock(); |
||
40 | |||
41 | $messageFormatter = $this->getMockBuilder( '\SMW\MessageFormatter' ) |
||
42 | ->disableOriginalConstructor() |
||
43 | ->getMock(); |
||
44 | |||
45 | $this->assertInstanceOf( |
||
46 | '\SMW\RecurringEventsParserFunction', |
||
47 | new RecurringEventsParserFunction( |
||
48 | $parserData, |
||
49 | $subobject, |
||
50 | $messageFormatter, |
||
51 | $settings |
||
52 | ) |
||
53 | ); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @dataProvider recurringEventsDataProvider |
||
58 | */ |
||
59 | public function testParse( array $params, array $expected ) { |
||
60 | |||
61 | $instance = $this->acquireInstance( |
||
62 | Title::newFromText( __METHOD__ ), |
||
63 | new ParserOutput() |
||
64 | ); |
||
65 | |||
66 | $result = $instance->parse( new ParserParameterFormatter( $params ) ); |
||
67 | |||
68 | $this->assertTrue( $result !== '' ? $expected['errors'] : !$expected['errors'] ); |
||
69 | |||
70 | $reflector = new ReflectionClass( '\SMW\RecurringEventsParserFunction' ); |
||
71 | $events = $reflector->getProperty( 'events' ); |
||
72 | $events->setAccessible( true ); |
||
73 | |||
74 | $this->assertEquals( |
||
75 | $expected['parameters'], |
||
76 | $events->getValue( $instance )->getParameters() |
||
77 | ); |
||
78 | } |
||
79 | |||
80 | public function recurringEventsDataProvider() { |
||
81 | |||
82 | $provider = array(); |
||
83 | |||
84 | // #0 |
||
85 | // {{#set_recurring_event:property=Has birthday |
||
86 | // |start=01 Feb 1970 |
||
87 | // |has title= Birthday |
||
88 | // |unit=year |
||
89 | // |period=12 |
||
90 | // |limit=3 |
||
91 | // }} |
||
92 | $provider[] = array( |
||
93 | array( |
||
94 | 'property=Has birthday', |
||
95 | 'start=01 Feb 1970', |
||
96 | 'has title=Birthday', |
||
97 | 'unit=month', |
||
98 | 'period=12', |
||
99 | 'limit=3' |
||
100 | ), |
||
101 | array( |
||
102 | 'errors' => false, |
||
103 | 'dates' => array( |
||
104 | '1 February 1970', |
||
105 | '1 February 1971 00:00:00', |
||
106 | '1 February 1972 00:00:00', |
||
107 | '1 February 1973 00:00:00' |
||
108 | ), |
||
109 | 'property' => array( |
||
110 | 'Has birthday', |
||
111 | 'Has title' |
||
112 | ), |
||
113 | 'parameters' => array( |
||
114 | 'has title' => array( 'Birthday' ) |
||
115 | ) |
||
116 | ) |
||
117 | ); |
||
118 | |||
119 | // #1 |
||
120 | // {{#set_recurring_event:property=Has birthday |
||
121 | // |start=01 Feb 1972 02:00 |
||
0 ignored issues
–
show
|
|||
122 | // |has title=Test 12 |
||
123 | // |unit=week |
||
124 | // |period=4 |
||
125 | // |limit=3 |
||
126 | // }} |
||
127 | $provider[] = array( |
||
128 | array( |
||
129 | 'property=Has birthday', |
||
130 | 'start=01 Feb 1972 02:00', |
||
131 | 'has title=Test 2', |
||
132 | 'unit=week', |
||
133 | 'period=4', |
||
134 | 'limit=3' |
||
135 | ), |
||
136 | array( |
||
137 | 'errors' => false, |
||
138 | 'dates' => array( |
||
139 | '1 February 1972 02:00:00', |
||
140 | '29 February 1972 02:00:00', |
||
141 | '28 March 1972 02:00:00', |
||
142 | '25 April 1972 02:00:00' |
||
143 | ), |
||
144 | 'property' => array( |
||
145 | 'Has birthday', |
||
146 | 'Has title' |
||
147 | ), |
||
148 | 'parameters' => array( |
||
149 | 'has title' => array( 'Test 2' ) |
||
150 | ) |
||
151 | ) |
||
152 | ); |
||
153 | |||
154 | // #2 |
||
155 | // {{#set_recurring_event:property=Has date |
||
156 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
157 | // |unit=week |
||
158 | // |period=1 |
||
159 | // |limit=4 |
||
160 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
161 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
162 | // }} |
||
163 | $provider[] = array( |
||
164 | array( |
||
165 | 'property=Has date', |
||
166 | 'start=January 4, 2010', |
||
167 | 'unit=week', |
||
168 | 'period=1', |
||
169 | 'limit=4', |
||
170 | 'include=March 16, 2010;March 23, 2010', |
||
171 | 'exclude=January 18, 2010;January 25, 2010' |
||
172 | ), |
||
173 | array( |
||
174 | 'errors' => false, |
||
175 | 'dates' => array( |
||
176 | '4 January 2010', |
||
177 | '11 January 2010 00:00:00', |
||
178 | '1 February 2010 00:00:00', |
||
179 | 'March 16, 2010', |
||
180 | 'March 23, 2010' |
||
181 | ), |
||
182 | 'property' => 'Has date', |
||
183 | 'parameters' => array() |
||
184 | ) |
||
185 | ); |
||
186 | |||
187 | |||
188 | // #3 |
||
189 | // {{#set_recurring_event:property=Has date |
||
190 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
191 | // |unit=week |
||
192 | // |period=1 |
||
193 | // |limit=4 |
||
194 | // |include=March 16, 2010;March 23, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
195 | // |exclude=January 18, 2010;January 25, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
46% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
196 | // }} |
||
197 | $provider[] = array( |
||
198 | array( |
||
199 | 'property=Has date', |
||
200 | 'start=January 4, 2010', |
||
201 | 'unit=week', |
||
202 | 'period=1', |
||
203 | 'limit=4', |
||
204 | 'include=March 16, 2010;March 23, 2010', |
||
205 | '+sep=;', 'exclude=January 18, 2010;January 25, 2010', |
||
206 | '+sep=;' |
||
207 | ), |
||
208 | array( |
||
209 | 'errors' => false, |
||
210 | 'dates' => array( |
||
211 | '4 January 2010', |
||
212 | '11 January 2010 00:00:00', |
||
213 | '1 February 2010 00:00:00', |
||
214 | 'March 16, 2010', |
||
215 | 'March 23, 2010' |
||
216 | ), |
||
217 | 'property' => 'Has date', |
||
218 | 'parameters' => array() |
||
219 | ) |
||
220 | ); |
||
221 | |||
222 | // #4 Named page reference pointer |
||
223 | // {{#set_recurring_event:FooBar |
||
224 | // |property=Has birthday |
||
225 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
226 | // |unit=week |
||
227 | // |period=1 |
||
228 | // |limit=4 |
||
229 | // |include=March 16, 2010;March 23, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
230 | // |exclude=January 18, 2010;January 25, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
46% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
231 | // }} |
||
232 | $provider[] = array( |
||
233 | array( |
||
234 | 'FooBar', |
||
235 | 'property=Has birthday', |
||
236 | 'start=January 4, 2010', |
||
237 | 'unit=week', |
||
238 | 'period=1', |
||
239 | 'limit=4', |
||
240 | 'include=March 16, 2010;March 23, 2010', |
||
241 | '+sep=;', 'exclude=January 18, 2010;January 25, 2010', |
||
242 | '+sep=;' |
||
243 | ), |
||
244 | array( |
||
245 | 'errors' => false, |
||
246 | 'dates' => array( |
||
247 | '4 January 2010', |
||
248 | '11 January 2010 00:00:00', |
||
249 | '1 February 2010 00:00:00', |
||
250 | 'March 16, 2010', |
||
251 | 'March 23, 2010' |
||
252 | ), |
||
253 | 'property' => 'Has birthday', |
||
254 | 'parameters' => array() |
||
255 | ) |
||
256 | ); |
||
257 | |||
258 | // #5 Simulate first parameter starting being - raising an error |
||
259 | // {{#set_recurring_event:- |
||
260 | // property=Has date |
||
261 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
262 | // |unit=week |
||
263 | // |period=1 |
||
264 | // |limit=4 |
||
265 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
266 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
267 | // }} |
||
268 | $provider[] = array( |
||
269 | array( |
||
270 | '-', |
||
271 | 'property=Has date', |
||
272 | 'start=January 4, 2010', |
||
273 | 'unit=week', |
||
274 | 'period=1', |
||
275 | 'limit=4', |
||
276 | 'include=March 16, 2010;March 23, 2010', |
||
277 | 'exclude=January 18, 2010;January 25, 2010' |
||
278 | ), |
||
279 | array( |
||
280 | 'errors' => false, |
||
281 | 'dates' => array(), |
||
282 | 'property' => '', |
||
283 | 'parameters' => array() |
||
284 | ) |
||
285 | ); |
||
286 | |||
287 | // #6 Simulate first parameter starting with - raising an error |
||
288 | // {{#set_recurring_event:-Foo |
||
289 | // property=Has date |
||
290 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
291 | // |unit=week |
||
292 | // |period=1 |
||
293 | // |limit=4 |
||
294 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
295 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
296 | // }} |
||
297 | $provider[] = array( |
||
298 | array( |
||
299 | '-Foo', |
||
300 | 'property=Has date', |
||
301 | 'start=January 4, 2010', |
||
302 | 'unit=week', |
||
303 | 'period=1', |
||
304 | 'limit=4', |
||
305 | 'include=March 16, 2010;March 23, 2010', |
||
306 | 'exclude=January 18, 2010;January 25, 2010' |
||
307 | ), |
||
308 | array( |
||
309 | 'errors' => true, |
||
310 | 'dates' => array(), |
||
311 | 'property' => '', |
||
312 | 'parameters' => array() |
||
313 | ) |
||
314 | ); |
||
315 | |||
316 | // #7 Simulate first parameter starting with a underscore raising an error |
||
317 | // {{#set_recurring_event:_FooBar |
||
318 | // property=Has date |
||
319 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
320 | // |unit=week |
||
321 | // |period=1 |
||
322 | // |limit=4 |
||
323 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
324 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
325 | // }} |
||
326 | $provider[] = array( |
||
327 | array( |
||
328 | '_FooBar', |
||
329 | 'property=Has date', |
||
330 | 'start=January 4, 2010', |
||
331 | 'unit=week', |
||
332 | 'period=1', |
||
333 | 'limit=4', |
||
334 | 'include=March 16, 2010;March 23, 2010', |
||
335 | 'exclude=January 18, 2010;January 25, 2010' |
||
336 | ), |
||
337 | array( |
||
338 | 'errors' => true, |
||
339 | 'dates' => array(), |
||
340 | 'property' => '', |
||
341 | 'parameters' => array() |
||
342 | ) |
||
343 | ); |
||
344 | |||
345 | // #8 Simulate start date has wrong type |
||
346 | // {{#set_recurring_event:property=Has date |
||
347 | // |start=??? |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
348 | // |unit=week |
||
349 | // |period=1 |
||
350 | // |limit=4 |
||
351 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
352 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
353 | // }} |
||
354 | $provider[] = array( |
||
355 | array( |
||
356 | 'property=Has date', |
||
357 | 'start=???', |
||
358 | 'unit=week', |
||
359 | 'period=1', |
||
360 | 'limit=4', |
||
361 | 'include=March 16, 2010;March 23, 2010', |
||
362 | 'exclude=January 18, 2010;January 25, 2010' |
||
363 | ), |
||
364 | array( |
||
365 | 'errors' => true, |
||
366 | 'dates' => array(), |
||
367 | 'property' => '', |
||
368 | 'parameters' => array() |
||
369 | ) |
||
370 | ); |
||
371 | |||
372 | // #9 Simulate missing start date |
||
373 | // {{#set_recurring_event:property=Has date |
||
374 | // |start= |
||
375 | // |unit=week |
||
376 | // |period=1 |
||
377 | // |limit=4 |
||
378 | // |include=March 16, 2010;March 23, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
379 | // |exclude=January 18, 2010;January 25, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
48% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
380 | // }} |
||
381 | $provider[] = array( |
||
382 | array( |
||
383 | 'property=Has date', |
||
384 | 'start=', |
||
385 | 'unit=week', |
||
386 | 'period=1', |
||
387 | 'limit=4', |
||
388 | 'include=March 16, 2010;March 23, 2010', |
||
389 | 'exclude=January 18, 2010;January 25, 2010' |
||
390 | ), |
||
391 | array( |
||
392 | 'errors' => true, |
||
393 | 'dates' => array(), |
||
394 | 'property' => '', |
||
395 | 'parameters' => array() |
||
396 | ) |
||
397 | ); |
||
398 | |||
399 | // #10 Simulate missing property |
||
400 | // {{#set_recurring_event:property= |
||
401 | // |start=January 4, 2010 |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
40% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
402 | // |unit=week |
||
403 | // |period=1 |
||
404 | // |limit=4 |
||
405 | // |include=March 16, 2010;March 23, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
406 | // |exclude=January 18, 2010;January 25, 2010|+sep=; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
46% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
407 | // }} |
||
408 | $provider[] = array( |
||
409 | array( |
||
410 | 'property=', |
||
411 | 'start=January 4, 2010', |
||
412 | 'unit=week', 'period=1', |
||
413 | 'limit=4', |
||
414 | 'include=March 16, 2010;March 23, 2010', |
||
415 | '+sep=;', |
||
416 | 'exclude=January 18, 2010;January 25, 2010', |
||
417 | '+sep=;' |
||
418 | ), |
||
419 | array( |
||
420 | 'errors' => true, |
||
421 | 'dates' => array(), |
||
422 | 'property' => '', |
||
423 | 'parameters' => array() |
||
424 | ) |
||
425 | ); |
||
426 | |||
427 | return $provider; |
||
428 | } |
||
429 | |||
430 | /** |
||
431 | * @return RecurringEventsParserFunction |
||
432 | */ |
||
433 | private function acquireInstance( Title $title, ParserOutput $parserOutput ) { |
||
434 | |||
435 | $settings = array( |
||
436 | 'smwgDefaultNumRecurringEvents' => 100, |
||
437 | 'smwgMaxNumRecurringEvents' => 100 |
||
438 | ); |
||
439 | |||
440 | return new RecurringEventsParserFunction( |
||
441 | new ParserData( $title, $parserOutput ), |
||
442 | new Subobject( $title ), |
||
443 | new MessageFormatter( \Language::factory( 'en' ) ), |
||
444 | Settings::newFromArray( $settings ) |
||
445 | ); |
||
446 | } |
||
447 | |||
448 | } |
||
449 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.