ColumnConfiguration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 80
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getSearch() 0 4 1
A getOrder() 0 4 1
A getName() 0 4 1
A getCallable() 0 4 1
1
<?php
2
3
namespace OpenSkill\Datatable\Columns;
4
5
use OpenSkill\Datatable\Columns\Orderable\Orderable;
6
use OpenSkill\Datatable\Columns\Searchable\Searchable;
7
8
/**
9
 * Class ColumnConfiguration
10
 * @package OpenSkill\Datatable\Columns
11
 *
12
 * The ColumnConfiguration is used to describe a column on the datatable. It contains all possible configuration options
13
 * so the data can be evaluated as well as the views can create a javascript representation of this configuration.
14
 */
15
class ColumnConfiguration
16
{
17
18
    /**
19
     * @var string The internal name of the column configuration
20
     */
21
    private $name;
22
23
    /**
24
     * @var Searchable Determines if the column can be searched on or not
25
     */
26
    private $searchable;
27
28
    /**
29
     * @var Orderable Determines if the column can be ordered on or not
30
     */
31
    private $orderable;
32
33
    /**
34
     * @var callable The function the user defines that should be called when the value of the columns should be calculated
35
     */
36
    private $callable;
37
38
    /**
39
     * ColumnConfiguration constructor.
40
     * As the class is immutable, all properties have to be set here
41
     *
42
     * @param string $name The internal name of the column configuration
43
     * @param callable $callable the function to call when the value should be calculated
44
     * @param Searchable $isSearchable If the column should be searchable
45
     * @param Orderable $isOrderable If the column should be orderable
46
     */
47
    public function __construct($name, $callable, Searchable $isSearchable, Orderable $isOrderable)
48
    {
49
        $this->name = $name;
50
        $this->callable = $callable;
51
        $this->searchable = $isSearchable;
52
        $this->orderable = $isOrderable;
53
    }
54
55
    /**
56
     * Will return the searchable column configuration
57
     *
58
     * @return Searchable
59
     */
60
    public function getSearch()
61
    {
62
        return $this->searchable;
63
    }
64
65
    /**
66
     * Will return the orderable column configuration
67
     *
68
     * @return Orderable
69
     */
70
    public function getOrder()
71
    {
72
        return $this->orderable;
73
    }
74
75
    /**
76
     * Will return the internal name of this column configuration
77
     *
78
     * @return string
79
     */
80
    public function getName()
81
    {
82
        return $this->name;
83
    }
84
85
    /**
86
     * Will return the function that will be executed upon calculation.
87
     *
88
     * @return callable
89
     */
90
    public function getCallable()
91
    {
92
        return $this->callable;
93
    }
94
}