Completed
Push — master ( 0f6ac6...c701d2 )
by WEBEWEB
01:05
created

ArrayFieldsTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 38
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
     */
34
    public function addField($field) {
35
        $this->fields[] = $field;
36
        return $this;
37
    }
38
39
    /**
40
     * Get the fields.
41
     *
42
     * @return string[] Returns the fields.
43
     */
44
    public function getFields() {
45
        return $this->fields;
46
    }
47
48
    /**
49
     * Set the fields.
50
     *
51
     * @param string[] $fields The fields.
52
     */
53
    protected function setFields(array $fields) {
54
        $this->fields = $fields;
55
        return $this;
56
    }
57
}