Completed
Push — master ( 30460b...74da27 )
by wen
03:07
created

Column   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDefaults() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
4
namespace Sco\Admin\Column;
5
6
use Sco\Attributes\HasOriginalAndAttributesTrait;
7
8
abstract class Column
9
{
10
    use HasOriginalAndAttributesTrait;
11
12
    protected $defaultsOptions = [
13
        'key'      => '',
14
        'title'    => '',
15
        'sortable' => true,
16
        'width'    => 0,
17
    ];
18
19
    protected $defaults = [];
20
21
    public function __construct($options)
22
    {
23
        $this->setOriginal(array_merge($this->getDefaults(), $options));
24
    }
25
26
    protected function getDefaults()
27
    {
28
        return array_merge($this->defaultsOptions, $this->defaults);
29
    }
30
31
    function __toString()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
32
    {
33
        return $this->toJson();
34
    }
35
}
36