Fields::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * Author: Nil Portugués Calderó <[email protected]>
5
 * Date: 9/01/16
6
 * Time: 15:30.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace NilPortugues\Foundation\Domain\Model\Repository;
12
13
use NilPortugues\Foundation\Domain\Model\Repository\Contracts\Fields as FieldsInterface;
14
15
/**
16
 * Class Fields.
17
 */
18
class Fields implements FieldsInterface
19
{
20
    /**
21
     * @var array
22
     */
23
    private $fields = [];
24
25
    /**
26
     * Fields constructor.
27
     *
28
     * @param array $fields
29
     */
30
    public function __construct(array $fields = [])
31
    {
32
        $this->fields = $fields;
33
    }
34
35
    /**
36
     * @param string $field
37
     */
38
    public function add($field)
39
    {
40
        $this->fields[] = (string) $field;
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    public function get()
47
    {
48
        return (array) $this->fields;
49
    }
50
}
51