Code Duplication    Length = 21-23 lines in 3 locations

htdocs/lib2/logic/getNew.class.php 3 locations

@@ 281-302 (lines=22) @@
278
     * @param bool $includeText ???following??? add table-tag?
279
     * @return string HTML string used for smarty assign method
280
     */
281
    private function blogFeed($items = null, $url = null, $timeout = null, $includeText = null)
282
    {
283
        global $opt;
284
285
        if (!is_numeric($items) || $items === null) {
286
            $items = $opt['news']['count'];
287
        }
288
289
        if ($url === null || !is_string($url)) {
290
            $url = $opt['news']['include'];
291
        }
292
293
        if ($timeout === null || !is_numeric($timeout)) {
294
            $timeout = $opt['news']['timeout'];
295
        }
296
297
        if ($includeText === null || !is_bool($includeText)) {
298
            $includeText = false;
299
        }
300
301
        return RSSParser::parse($items, $url, $timeout, $includeText);
302
    }
303
304
    /**
305
     * forumFeed executes the RSSParser for type "forum"
@@ 313-333 (lines=21) @@
310
     * @param bool $includeText ???following??? add table-tag?
311
     * @return string HTML string used for smarty assign method
312
     */
313
    private function forumFeed($items = null, $url = null, $timeout = null, $includeText = null)
314
    {
315
        global $opt;
316
317
        if (!is_numeric($items) || $items === null) {
318
            $items = $opt['forum']['count'];
319
        }
320
321
        if ($url === null || !is_string($url)) {
322
            $url = $opt['forum']['url'];
323
        }
324
        if ($timeout === null || !is_numeric($timeout)) {
325
            $timeout = $opt['forum']['timeout'];
326
        }
327
328
        if ($includeText === null || !is_bool($includeText)) {
329
            $includeText = false;
330
        }
331
332
        return RSSParser::parse($items, $url, $timeout, $includeText);
333
    }
334
335
    /**
336
     * wikiFeed executes the RSSParser for type "wiki"
@@ 344-366 (lines=23) @@
341
     * @param int $timeout maximum seconds to wait for the requested page
342
     * @return string HTML string used for smarty assign method
343
     */
344
    private function wikiFeed($items = null, $url = null, $timeout = null, $includeText = null)
345
    {
346
        global $opt;
347
348
        if (!is_numeric($items) || $items === null) {
349
            $items = $opt['wikinews']['count'];
350
        }
351
352
        if (!is_string($url) || $url === null) {
353
            $url = $opt['wikinews']['url'];
354
        }
355
356
        if ($timeout === null || !is_numeric($timeout)) {
357
            $timeout = $opt['wikinews']['timeout'];
358
        }
359
360
        if ($includeText === null || !is_bool($includeText)) {
361
            $includeText = false;
362
        }
363
364
        // execute RSSParser
365
        return RSSParser::parse($items, $url, $timeout, $includeText);
366
    }
367
}
368