1 | <?php |
||
14 | class ColumnConfigurationBuilder |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $name = null; |
||
21 | |||
22 | /** |
||
23 | * @var callable |
||
24 | */ |
||
25 | private $callable = null; |
||
26 | |||
27 | /** |
||
28 | * @var Searchable |
||
29 | */ |
||
30 | private $searchable = null; |
||
31 | |||
32 | /** |
||
33 | * @var Orderable |
||
34 | */ |
||
35 | private $orderable = null; |
||
36 | |||
37 | /** |
||
38 | * ColumnConfigurationBuilder constructor. |
||
39 | */ |
||
40 | private function __construct() |
||
43 | |||
44 | /** |
||
45 | * Will create a new builder for a ColumnConfigurationBuilder. |
||
46 | * |
||
47 | * @return ColumnConfigurationBuilder |
||
48 | */ |
||
49 | public static function create() |
||
53 | |||
54 | /** |
||
55 | * @param string $name |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function name($name) |
||
63 | |||
64 | /** |
||
65 | * @param Searchable $searchable |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function searchable(Searchable $searchable) |
||
73 | |||
74 | /** |
||
75 | * @param Orderable $orderable |
||
76 | * @return $this |
||
77 | */ |
||
78 | public function orderable(Orderable $orderable) |
||
83 | |||
84 | /** |
||
85 | * @param callable $callable |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function withCallable($callable) |
||
93 | |||
94 | /** |
||
95 | * Will create the final ColumnConfiguration |
||
96 | * |
||
97 | * @return ColumnConfiguration |
||
98 | */ |
||
99 | public function build() |
||
108 | |||
109 | /** |
||
110 | * Will check if the name is empty and throws an exception if that is the case. |
||
111 | */ |
||
112 | private function checkName() |
||
118 | |||
119 | /** |
||
120 | * Will check if the orderable flag is correctly set, otherwise it will be set to the default NONE |
||
121 | */ |
||
122 | private function checkOrderable() |
||
128 | |||
129 | /** |
||
130 | * Will check if the searchable flag is correctly set, if not it will be set to the default NONE |
||
131 | */ |
||
132 | private function checkSearchable() |
||
138 | |||
139 | /** |
||
140 | * Will check if the callable is set and is executable, if not a sensible default will be set. |
||
141 | */ |
||
142 | private function checkCallable() |
||
164 | |||
165 | } |