Completed
Push — master ( dd23a3...589bb6 )
by Nick
05:48 queued 02:41
created

GoalAddResponse::getErrors()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 0
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
class GoalAddResponse extends Entity
6
{
7
    /**
8
     * @param array $array
9
     */
10
    public function __construct(array $array = [])
11
    {
12
        parent::__construct($array);
13
    }
14
15
    /**
16
     * Gets the 'status' parameter.
17
     *
18
     * @return string The status of the addition
19
     */
20
    public function getStatus()
21
    {
22
        return $this->getEntityValue('status', '');
23
    }
24
25
    /**
26
     * Gets the 'status' parameter.
27
     *
28
     * @return Error[]|null The errors, if there were any
29
     */
30 View Code Duplication
    public function getErrors()
31
    {
32
        $ret = [];
33
        $errors = $this->getEntityValue('errors', []);
34
        if (empty($errors)) {
35
            return null;
36
        }
37
        foreach ($errors as $error) {
38
            $ret[] = new Error($error);
39
        }
40
41
        return $ret;
42
    }
43
}
44