Completed
Push — master ( 1c3c2e...248014 )
by Arjay
10:57
created

HasInternationalisation::language()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Yajra\DataTables\Html\Options;
4
5
/**
6
 * DataTables - Internationalisation option builder.
7
 *
8
 * @see https://datatables.net/reference/option/
9
 */
10
trait HasInternationalisation
11
{
12
    /**
13
     * Set language option value.
14
     *
15
     * @param string|array $value
16
     * @return $this
17
     * @see https://datatables.net/reference/option/language
18
     */
19
    public function language($value)
20
    {
21
        if (is_array($value)) {
22
            $this->attributes['language'] = $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...
23
        } else {
24
            $this->attributes['language']['url'] = $value;
25
        }
26
27
        return $this;
28
    }
29
}
30