Completed
Push — master ( 6452b0...d576ea )
by Michael
05:58 queued 03:02
created

news_topics::news_topics()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
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 44 and the first side effect is on line 38.

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
 * - Developers TEAM TDM Xoops - (http://xoops.org)
5
 * ****************************************************************************
6
 *       NEWS - MODULE FOR XOOPS
7
 *        Copyright (c) 2007 - 2011
8
 *       TXMod Xoops (http://www.txmodxoops.org)
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  (at your option) any later version.
14
 *
15
 *  You may not change or alter any portion of this comment or credits
16
 *  of supporting developers from this source code or any supporting
17
 *  source code which is considered copyrighted (c) material of the
18
 *  original comment or credit authors.
19
 *
20
 *  This program is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  ------------------------------------------------------------------------
26
 *
27
 * @copyright       TXMod Xoops (http://www.txmodxoops.org)
28
 * @license         GPL see LICENSE
29
 * @package         news
30
 * @author          TXMod Xoops ([email protected])
31
 *
32
 * Version : 1.67 Tue 2012/02/13 22:29:36 : Timgno Exp $
33
 * ****************************************************************************
34
 */
35
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
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...
36
37
if (!class_exists('XoopsPersistableObjectHandler')) {
38
    include_once XOOPS_ROOT_PATH . '/kernel/object.php';
39
}
40
41
/**
42
 * Class news_topics
43
 */
44
class news_topics extends XoopsObject
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
45
{
46
    //Constructor
47
    /**
48
     *
49
     */
50
    public function __construct()
51
    {
52
        parent::__construct();
53
        $this->initVar('topic_id', XOBJ_DTYPE_INT, null, false, 4);
54
        $this->initVar('topic_pid', XOBJ_DTYPE_INT, null, false, 4);
55
        $this->initVar('topic_title', XOBJ_DTYPE_TXTBOX, null, false);
56
        $this->initVar('topic_imgurl', XOBJ_DTYPE_TXTBOX, null, false);
57
        $this->initVar('menu', XOBJ_DTYPE_INT, null, false, 1);
58
        $this->initVar('topic_frontpage', XOBJ_DTYPE_INT, null, false, 1);
59
        $this->initVar('topic_rssurl', XOBJ_DTYPE_TXTBOX, null, false);
60
        $this->initVar('topic_description', XOBJ_DTYPE_TXTAREA, null, false);
61
        $this->initVar('topic_color', XOBJ_DTYPE_TXTBOX, null, false);
62
    }
63
}
64
65
/**
66
 * Class newsnews_topicsHandler
67
 */
68
class newsnews_topicsHandler extends XoopsPersistableObjectHandler
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
69
{
70
    /**
71
     * @param null|object|XoopsDatabase $db
72
     */
73
    public function __construct(XoopsDatabase $db)
74
    {
75
        parent::__construct($db, 'news_topics', 'news_topics', 'topic_id', 'topic_pid');
76
    }
77
}
78