CustomField::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace mb24dev\AmoCRM\Entity;
4
5
/**
6
 * Class CustomField
7
 * @package mb24dev\AmoCRM\Entity
8
 */
9
class CustomField implements AmoEntityInterface
10
{
11
    private $id;
12
    private $values;
13
14
    /**
15
     * CustomField constructor.
16
     * @param $id
17
     * @param $values
18
     */
19
    public function __construct($id, $values)
20
    {
21
        $this->id = $id;
22
        $this->values = $values;
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function toAmoArray()
29
    {
30
        return [
31
            'id' => $this->id,
32
            'values' => array_map(function (Value $value) {
33
                return $value->toAmoArray();
34
            }, $this->values)
35
        ];
36
    }
37
38
39
}