Completed
Push — master ( bc462e...3c2183 )
by Daniel
07:13
created

ColumnMetadata   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 46
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 2
A getName() 0 4 1
A getType() 0 4 1
A getOptions() 0 4 1
A getTags() 0 4 1
A getGroups() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid\Metadata;
6
7
use Psi\Component\Grid\Grid;
8
9
final class ColumnMetadata
10
{
11
    private $name;
12
    private $type;
13
    private $groups = [];
14
    private $options = [];
15
16
    public function __construct(
17
        string $name,
18
        string $type,
19
        array $groups,
20
        array $options,
21
        array $tags
22
    ) {
23
        $this->name = $name;
24
        $this->type = $type;
25
        $this->groups = $groups ?: [ Grid::DEFAULT_GROUP ];
26
        $this->options = $options;
27
        $this->tags = $tags;
0 ignored issues
show
Bug introduced by
The property tags does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
    }
29
30
    public function getName(): string
31
    {
32
        return $this->name;
33
    }
34
35
    public function getType(): string
36
    {
37
        return $this->type;
38
    }
39
40
    public function getOptions(): array
41
    {
42
        return $this->options;
43
    }
44
45
    public function getTags(): array
46
    {
47
        return $this->tags;
48
    }
49
50
    public function getGroups(): array
51
    {
52
        return $this->groups;
53
    }
54
}
55