Completed
Push — master ( b4a558...04db93 )
by wen
03:09
created

Columns::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
4
namespace Sco\Admin\Column;
5
6
use JsonSerializable;
7
use Illuminate\Contracts\Support\Arrayable;
8
use Illuminate\Contracts\Support\Jsonable;
9
use Sco\Admin\Contracts\Column\Columns as ColumnsContract;
10
use Sco\Attributes\HasAttributesTrait;
11
12
class Columns implements ColumnsContract, Arrayable, Jsonable, JsonSerializable
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: jsonSerialize, toArray, toJson
Loading history...
13
{
14
    use HasAttributesTrait;
15
16
    public function __construct(array $columns)
17
    {
18
        foreach ($columns as $column) {
19
            $this->addColumn($column);
20
        }
21
    }
22
23
    public function addColumn($column)
24
    {
25
        $columnClass = config('admin.column');
26
        $this->setAttribute($column['key'], new $columnClass($column));
27
    }
28
}
29