Completed
Push — master ( 8b59f7...62ee86 )
by Arjay
01:32
created

RowGroup::rowGroupUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Yajra\DataTables\Html\Options\Plugins;
4
5
/**
6
 * DataTables - RowGroup plugin option builder.
7
 *
8
 * @see https://datatables.net/extensions/rowgroup
9
 * @see https://datatables.net/reference/option/rowGroup
10
 * @see https://datatables.net/reference/option/#rowGroup
11
 */
12
trait RowGroup
13
{
14
    /**
15
     * Set rowGroup option value.
16
     *
17
     * @param bool|array $value
18
     * @return $this
19
     * @see https://datatables.net/reference/option/rowGroup
20
     */
21
    public function rowGroup($value = true)
22
    {
23
        $this->attributes['rowGroup'] = $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...
24
25
        return $this;
26
    }
27
28
    /**
29
     * Set rowGroup className option value.
30
     *
31
     * @param string $value
32
     * @return $this
33
     * @see https://datatables.net/reference/option/rowGroup.className
34
     */
35
    public function rowGroupUpdate($value = 'group')
36
    {
37
        $this->attributes['rowGroup']['className'] = $value;
38
39
        return $this;
40
    }
41
42
    /**
43
     * Set rowGroup dataSrc option value.
44
     *
45
     * @param mixed $value
46
     * @return $this
47
     * @see https://datatables.net/reference/option/rowGroup.dataSrc
48
     */
49
    public function rowGroupDataSrc($value = 0)
50
    {
51
        $this->attributes['rowGroup']['dataSrc'] = $value;
52
53
        return $this;
54
    }
55
56
    /**
57
     * Set rowGroup emptyDataGroup option value.
58
     *
59
     * @param mixed $value
60
     * @return $this
61
     * @see https://datatables.net/reference/option/rowGroup.emptyDataGroup
62
     */
63
    public function rowGroupEmptyDataGroup($value = 'No Group')
64
    {
65
        $this->attributes['rowGroup']['emptyDataGroup'] = $value;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Set rowGroup enable option value.
72
     *
73
     * @param bool $value
74
     * @return $this
75
     * @see https://datatables.net/reference/option/rowGroup.enable
76
     */
77
    public function rowGroupEnable(bool $value = true)
78
    {
79
        $this->attributes['rowGroup']['enable'] = $value;
80
81
        return $this;
82
    }
83
84
    /**
85
     * Set rowGroup endClassName option value.
86
     *
87
     * @param mixed $value
88
     * @return $this
89
     * @see https://datatables.net/reference/option/rowGroup.endClassName
90
     */
91
    public function rowGroupEndClassName($value = 'group-end')
92
    {
93
        $this->attributes['rowGroup']['endClassName'] = $value;
94
95
        return $this;
96
    }
97
98
    /**
99
     * Set rowGroup endRender option value.
100
     *
101
     * @param mixed $value
102
     * @return $this
103
     * @see https://datatables.net/reference/option/rowGroup.endRender
104
     */
105
    public function rowGroupEndRender($value)
106
    {
107
        $this->attributes['rowGroup']['endRender'] = $value;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Set rowGroup startClassName option value.
114
     *
115
     * @param mixed $value
116
     * @return $this
117
     * @see https://datatables.net/reference/option/rowGroup.startClassName
118
     */
119
    public function rowGroupStartClassName($value = 'group-start')
120
    {
121
        $this->attributes['rowGroup']['startClassName'] = $value;
122
123
        return $this;
124
    }
125
126
    /**
127
     * Set rowGroup startRender option value.
128
     *
129
     * @param mixed $value
130
     * @return $this
131
     * @see https://datatables.net/reference/option/rowGroup.startRender
132
     */
133
    public function rowGroupStartRender($value)
134
    {
135
        $this->attributes['rowGroup']['startRender'] = $value;
136
137
        return $this;
138
    }
139
}
140