ArrayFieldsTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 40
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addField() 0 4 1
A getFields() 0 3 1
A setFields() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the geo-api-library package.
5
 *
6
 * (c) 2020 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\GeoAPI\Model\Attribute;
13
14
/**
15
 * Array fields trait.
16
 *
17
 * @author webeweb <https://github.com/webeweb/>
18
 * @package WBW\Library\GeoAPI\Model\Attribute
19
 */
20
trait ArrayFieldsTrait {
21
22
    /**
23
     * Fields
24
     *
25
     * @var string[]
26
     */
27
    private $fields;
28
29
    /**
30
     * Add a field.
31
     *
32
     * @param string $field The field.
33
     * @return self Returns tis instance.
34
     */
35 5
    public function addField(string $field): self {
36 5
        $this->fields[] = $field;
37 5
        return $this;
38
    }
39
40
    /**
41
     * Get the fields.
42
     *
43
     * @return string[] Returns the fields.
44
     */
45 15
    public function getFields(): array {
46 15
        return $this->fields;
47
    }
48
49
    /**
50
     * Set the fields.
51
     *
52
     * @param string[] $fields The fields.
53
     * @return self Returns tis instance.
54
     */
55 180
    protected function setFields(array $fields): self {
56 180
        $this->fields = $fields;
57 180
        return $this;
58
    }
59
}