HasAttributes   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setAttributes() 0 6 2
A getAttributes() 0 4 1
1
<?php
2
3
4
namespace SmartWeb\ModuleTesting\Support\Concerns;
5
6
use ArrayAccess;
7
use Traversable;
8
9
10
/**
11
 * Trait HasAttributes
12
 *
13
 * @package SmartWeb\ModuleTesting\Support
14
 */
15
trait HasAttributes
16
{
17
    
18
    /**
19
     * @var array|ArrayAccess
20
     */
21
    protected $attributes = [];
22
    
23
    /**
24
     * @param array|ArrayAccess|Traversable $attributes
25
     */
26
    protected function setAttributes($attributes = [])
27
    {
28
        foreach ($attributes as $key => $value) {
29
            $this->attributes[$key] = $value;
30
        }
31
    }
32
    
33
    /**
34
     * @return array|ArrayAccess
35
     */
36
    public function getAttributes()
37
    {
38
        return $this->attributes;
39
    }
40
    
41
}
42