Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function addAction(array $attributes = [], $prepend = false) |
||
17 | { |
||
18 | $attributes = array_merge([ |
||
19 | 'defaultContent' => '', |
||
20 | 'data' => 'action', |
||
21 | 'name' => 'action', |
||
22 | 'title' => 'Action', |
||
23 | 'render' => null, |
||
24 | 'orderable' => false, |
||
25 | 'searchable' => false, |
||
26 | 'exportable' => false, |
||
27 | 'printable' => true, |
||
28 | 'footer' => '', |
||
29 | ], $attributes); |
||
30 | |||
31 | if ($prepend) { |
||
32 | $this->collection->prepend(new Column($attributes)); |
||
|
|||
33 | } else { |
||
34 | $this->collection->push(new Column($attributes)); |
||
35 | } |
||
36 | |||
37 | return $this; |
||
38 | } |
||
39 | } |
||
40 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: