Scroller   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 86
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A scroller() 0 6 1
A scrollerBoundaryScale() 0 6 1
A scrollerDisplayBuffer() 0 6 1
A scrollerLoadingIndicator() 0 6 1
A scrollerRowHeight() 0 6 1
A scrollerServerWait() 0 6 1
1
<?php
2
3
namespace Yajra\DataTables\Html\Options\Plugins;
4
5
/**
6
 * DataTables - Scroller plugin option builder.
7
 *
8
 * @see https://datatables.net/extensions/scroller
9
 * @see https://datatables.net/reference/option/scroller
10
 * @see https://datatables.net/reference/option/#scroller
11
 */
12
trait Scroller
13
{
14
    /**
15
     * Set scroller option value.
16
     *
17
     * @param bool|array $value
18
     * @return $this
19
     * @see https://datatables.net/reference/option/scroller
20
     */
21
    public function scroller($value = true)
22
    {
23
        $this->attributes['scroller'] = $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 scroller boundaryScale option value.
30
     *
31
     * @param float $value
32
     * @return $this
33
     * @see https://datatables.net/reference/option/scroller.boundaryScale
34
     */
35
    public function scrollerBoundaryScale($value = 0.5)
36
    {
37
        $this->attributes['scroller']['boundaryScale'] = $value;
38
39
        return $this;
40
    }
41
42
    /**
43
     * Set scroller displayBuffer option value.
44
     *
45
     * @param int $value
46
     * @return $this
47
     * @see https://datatables.net/reference/option/scroller.displayBuffer
48
     */
49
    public function scrollerDisplayBuffer($value = 9)
50
    {
51
        $this->attributes['scroller']['displayBuffer'] = $value;
52
53
        return $this;
54
    }
55
56
    /**
57
     * Set scroller loadingIndicator option value.
58
     *
59
     * @param bool $value
60
     * @return $this
61
     * @see https://datatables.net/reference/option/scroller.loadingIndicator
62
     */
63
    public function scrollerLoadingIndicator(bool $value = true)
64
    {
65
        $this->attributes['scroller']['loadingIndicator'] = $value;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Set scroller rowHeight option value.
72
     *
73
     * @param int|string $value
74
     * @return $this
75
     * @see https://datatables.net/reference/option/scroller.rowHeight
76
     */
77
    public function scrollerRowHeight($value = 'auto')
78
    {
79
        $this->attributes['scroller']['rowHeight'] = $value;
80
81
        return $this;
82
    }
83
84
    /**
85
     * Set scroller serverWait option value.
86
     *
87
     * @param int $value
88
     * @return $this
89
     * @see https://datatables.net/reference/option/scroller.serverWait
90
     */
91
    public function scrollerServerWait($value = 200)
92
    {
93
        $this->attributes['scroller']['serverWait'] = $value;
94
95
        return $this;
96
    }
97
}
98