HasAttributes   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttributes() 0 4 1
A getAttribute() 0 4 2
A setAttribute() 0 6 1
A merge() 0 6 1
1
<?php
2
3
4
namespace Sco\Bankcard\Traits;
5
6
trait HasAttributes
7
{
8
    protected $attributes = [];
9
10
    public function getAttributes()
11
    {
12
        return $this->attributes;
13
    }
14
15
    public function getAttribute($name, $default = null)
16
    {
17
        return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
18
    }
19
20
    public function setAttribute($name, $value)
21
    {
22
        $this->attributes[$name] = $value;
23
24
        return $this;
25
    }
26
27
    public function merge(array $attributes)
28
    {
29
        $this->attributes = array_merge($this->attributes, $attributes);
30
31
        return $this;
32
    }
33
}
34