ObjectColumn::isSortable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace XoopsModules\Smartobject;
2
3
/**
4
 * Contains the classes responsible for displaying a simple table filled with records of SmartObjects
5
 *
6
 * @license    GNU
7
 * @author     marcan <[email protected]>
8
 * @link       http://smartfactory.ca The SmartFactory
9
 * @package    SmartObject
10
 * @subpackage SmartObjectTable
11
 */
12
13
use XoopsModules\Smartobject;
14
15
/**
16
 * SmartObjectColumn class
17
 *
18
 * Class representing a single column of a SmartObjectTable
19
 *
20
 * @package SmartObject
21
 * @author  marcan <[email protected]>
22
 * @link    http://smartfactory.ca The SmartFactory
23
 */
24
class ObjectColumn
25
{
26
    public $_keyname;
27
    public $_align;
28
    public $_width;
29
    public $_customMethodForValue;
30
    public $_extraParams;
31
    public $_sortable;
32
    public $_customCaption;
33
34
    /**
35
     * SmartObjectColumn constructor.
36
     * @param        $keyname
37
     * @param string $align
38
     * @param bool   $width
39
     * @param bool   $customMethodForValue
40
     * @param bool   $param
41
     * @param bool   $customCaption
42
     * @param bool   $sortable
43
     */
44
    public function __construct(
45
        $keyname,
46
        $align = 'left',
47
        $width = false,
48
        $customMethodForValue = false,
49
        $param = false,
50
        $customCaption = false,
51
        $sortable = true
52
    ) {
53
        $this->_keyname              = $keyname;
54
        $this->_align                = $align;
55
        $this->_width                = $width;
56
        $this->_customMethodForValue = $customMethodForValue;
57
        $this->_sortable             = $sortable;
58
        $this->_param                = $param;
0 ignored issues
show
Bug introduced by
The property _param does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
59
        $this->_customCaption        = $customCaption;
60
    }
61
62
    public function getKeyName()
63
    {
64
        return $this->_keyname;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getAlign()
71
    {
72
        return $this->_align;
73
    }
74
75
    /**
76
     * @return bool
77
     */
78
    public function isSortable()
79
    {
80
        return $this->_sortable;
81
    }
82
83
    /**
84
     * @return bool|string
85
     */
86
    public function getWidth()
87
    {
88
        if ($this->_width) {
89
            $ret = $this->_width;
90
        } else {
91
            $ret = '';
92
        }
93
94
        return $ret;
95
    }
96
97
    /**
98
     * @return bool
99
     */
100
    public function getCustomCaption()
101
    {
102
        return $this->_customCaption;
103
    }
104
}
105