HasFeatures   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 170
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 0
dl 0
loc 170
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A autoWidth() 0 6 1
A deferRender() 0 6 1
A info() 0 6 1
A lengthChange() 0 6 1
A ordering() 0 6 1
A processing() 0 6 1
A scrollX() 0 6 1
A scrollY() 0 6 1
A paging() 0 6 1
A searching() 0 6 1
A serverSide() 0 6 1
A stateSave() 0 6 1
1
<?php
2
3
namespace Yajra\DataTables\Html\Options;
4
5
/**
6
 * DataTables - Features option builder.
7
 *
8
 * @see https://datatables.net/reference/option/
9
 */
10
trait HasFeatures
11
{
12
    /**
13
     * Set autoWidth option value.
14
     *
15
     * @param bool $value
16
     * @return $this
17
     * @see https://datatables.net/reference/option/autoWidth
18
     */
19
    public function autoWidth(bool $value = true)
20
    {
21
        $this->attributes['autoWidth'] = $value;
0 ignored issues
show
Bug introduced by
The property attributes 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...
22
23
        return $this;
24
    }
25
26
    /**
27
     * Set deferRender option value.
28
     *
29
     * @param bool $value
30
     * @return $this
31
     * @see https://datatables.net/reference/option/deferRender
32
     */
33
    public function deferRender(bool $value = true)
34
    {
35
        $this->attributes['deferRender'] = $value;
36
37
        return $this;
38
    }
39
40
    /**
41
     * Set info option value.
42
     *
43
     * @param bool $value
44
     * @return $this
45
     * @see https://datatables.net/reference/option/info
46
     */
47
    public function info(bool $value = true)
48
    {
49
        $this->attributes['info'] = $value;
50
51
        return $this;
52
    }
53
54
    /**
55
     * Set lengthChange option value.
56
     *
57
     * @param bool $value
58
     * @return $this
59
     * @see https://datatables.net/reference/option/lengthChange
60
     */
61
    public function lengthChange(bool $value = true)
62
    {
63
        $this->attributes['lengthChange'] = $value;
64
65
        return $this;
66
    }
67
68
    /**
69
     * Set ordering option value.
70
     *
71
     * @param bool $value
72
     * @return $this
73
     * @see https://datatables.net/reference/option/ordering
74
     */
75
    public function ordering(bool $value = true)
76
    {
77
        $this->attributes['ordering'] = $value;
78
79
        return $this;
80
    }
81
82
    /**
83
     * Set processing option value.
84
     *
85
     * @param bool $value
86
     * @return $this
87
     * @see https://datatables.net/reference/option/processing
88
     */
89
    public function processing(bool $value = true)
90
    {
91
        $this->attributes['processing'] = $value;
92
93
        return $this;
94
    }
95
96
    /**
97
     * Set scrollX option value.
98
     *
99
     * @param bool $value
100
     * @return $this
101
     * @see https://datatables.net/reference/option/scrollX
102
     */
103
    public function scrollX(bool $value = true)
104
    {
105
        $this->attributes['scrollX'] = $value;
106
107
        return $this;
108
    }
109
110
    /**
111
     * Set scrollY option value.
112
     *
113
     * @param bool|mixed $value
114
     * @return $this
115
     * @see https://datatables.net/reference/option/scrollY
116
     */
117
    public function scrollY($value = true)
118
    {
119
        $this->attributes['scrollY'] = $value;
120
121
        return $this;
122
    }
123
124
    /**
125
     * Set paging option value.
126
     *
127
     * @param bool $value
128
     * @return $this
129
     * @see https://datatables.net/reference/option/paging
130
     */
131
    public function paging(bool $value = true)
132
    {
133
        $this->attributes['paging'] = $value;
134
135
        return $this;
136
    }
137
138
    /**
139
     * Set searching option value.
140
     *
141
     * @param bool $value
142
     * @return $this
143
     * @see https://datatables.net/reference/option/searching
144
     */
145
    public function searching(bool $value = true)
146
    {
147
        $this->attributes['searching'] = $value;
148
149
        return $this;
150
    }
151
152
    /**
153
     * Set serverSide option value.
154
     *
155
     * @param bool $value
156
     * @return $this
157
     * @see https://datatables.net/reference/option/serverSide
158
     */
159
    public function serverSide(bool $value = true)
160
    {
161
        $this->attributes['serverSide'] = $value;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Set stateSave option value.
168
     *
169
     * @param bool $value
170
     * @return $this
171
     * @see https://datatables.net/reference/option/stateSave
172
     */
173
    public function stateSave(bool $value = true)
174
    {
175
        $this->attributes['stateSave'] = $value;
176
177
        return $this;
178
    }
179
}
180