Column   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 1
b 0
f 0
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A jsonSerialize() 0 8 1
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2015-2022 Artem Rodygin
6
//
7
//  This file is part of DataTables Symfony bundle.
8
//
9
//  You should have received a copy of the MIT License along with
10
//  the bundle. If not, see <http://opensource.org/licenses/MIT>.
11
//
12
//----------------------------------------------------------------------
13
14
namespace DataTables;
15
16
/**
17
 * Column parameters as part of DataTables request.
18
 *
19
 * @see https://www.datatables.net/manual/server-side
20
 *
21
 * @property string $data       Column's data source
22
 * @property string $name       Column's name
23
 * @property bool   $searchable Flag to indicate if this column is searchable or not
24
 * @property bool   $orderable  Flag to indicate if this column is orderable or not
25
 * @property Search $search     Search value to apply to this specific column
26
 */
27
class Column extends ValueObject implements \JsonSerializable
28
{
29
    protected $data;
30
    protected $name;
31
    protected $searchable;
32
    protected $orderable;
33
    protected $search;
34
35
    /**
36
     * Initializing constructor.
37
     */
38
    public function __construct(string $data, string $name, bool $searchable, bool $orderable, Search $search)
39
    {
40
        $this->data       = $data;
41
        $this->name       = $name;
42
        $this->searchable = $searchable;
43
        $this->orderable  = $orderable;
44 1
        $this->search     = $search;
45
    }
46 1
47 1
    /**
48 1
     * {@inheritdoc}
49 1
     */
50 1
    public function jsonSerialize(): array
51 1
    {
52
        return [
53
            'data'       => $this->data,
54
            'name'       => $this->name,
55
            'searchable' => $this->searchable,
56
            'orderable'  => $this->orderable,
57
            'search'     => $this->search->jsonSerialize(),
58 1
        ];
59
    }
60
}
61