Passed
Push — master ( d3e687...4990f6 )
by Michael
02:43
created

XmlrssHandler::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
nc 1
nop 1
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php namespace XoopsModules\Newbb;
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 23 and the first side effect is on line 17.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/**
4
 * NewBB 5.0x,  the forum module for XOOPS project
5
 *
6
 * @copyright      XOOPS Project (https://xoops.org)
7
 * @license        GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
8
 * @author         Taiwen Jiang (phppp or D.J.) <[email protected]>
9
 * @since          4.00
10
 * @package        module::newbb
11
 */
12
13
use XoopsModules\Newbb;
14
15
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
16
17
defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php');
18
//load_functions('locale');
19
20
/**
21
 * Class XmlrssHandler
22
 */
23
class XmlrssHandler
24
{
25
    /**
26
     * @return Xmlrss
27
     */
28
    public function create()
29
    {
30
        $xmlrss = new Newbb\Xmlrss();
31
32
        return $xmlrss;
33
    }
34
35
    /**
36
     * @param $rss
37
     * @return array
38
     */
39
    public function get(Xmlrss $rss)
40
    {
41
        $rss_array                      = [];
42
        $rss_array['xml_version']       = $rss->xml_version;
43
        $rss_array['xml_encoding']      = $rss->xml_encoding;
44
        $rss_array['rss_version']       = $rss->rss_version;
45
        $rss_array['channel_title']     = $rss->channel_title;
46
        $rss_array['channel_link']      = $rss->channel_link;
47
        $rss_array['channel_desc']      = $rss->channel_desc;
48
        $rss_array['channel_lastbuild'] = $rss->channel_lastbuild;
49
        $rss_array['channel_webmaster'] = $rss->channel_webmaster;
50
        $rss_array['channel_editor']    = $rss->channel_editor;
51
        $rss_array['channel_category']  = $rss->channel_category;
52
        $rss_array['channel_generator'] = $rss->channel_generator;
53
        $rss_array['channel_language']  = $rss->channel_language;
54
        $rss_array['image_title']       = $rss->channel_title;
55
        $rss_array['image_url']         = $rss->image_url;
56
        $rss_array['image_link']        = $rss->channel_link;
57
        $rss_array['image_width']       = $rss->image_width;
58
        $rss_array['image_height']      = $rss->image_height;
59
        $rss_array['items']             = $rss->items;
60
61
        return $rss_array;
62
    }
63
}
64