Completed
Push — master ( a72c28...44c621 )
by Dragos
07:31
created

AbstractResponse::getErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Speicher210\Fastbill\Api;
4
5
use JMS\Serializer\Annotation as JMS;
6
7
/**
8
 * Abstract service response.
9
 */
10
class AbstractResponse implements ResponseInterface
11
{
12
13
    /**
14
     * Array of errors.
15
     *
16
     * @var array
17
     *
18
     * @JMS\SerializedName("ERRORS")
19
     * @JMS\Type("array<string, string>")
20
     */
21
    protected $errors = array();
22
23
    /**
24
     * The status of the entity created / updated.
25
     *
26
     * @var string
27
     *
28
     * @JMS\SerializedName("STATUS")
29
     * @JMS\Type("string")
30
     */
31
    protected $status;
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 3
    public function getErrors()
37
    {
38 3
        return $this->errors;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 90
    public function hasErrors()
45
    {
46 90
        return count($this->errors) !== 0;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getStatus()
53
    {
54
        return $this->status;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 39
    public function setStatus($status)
61
    {
62 39
        $this->status = $status;
63 39
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function isStatusSuccess()
69
    {
70
        return $this->getStatus() === self::STATUS_SUCCESS;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function isStatusInvalid()
77
    {
78
        return $this->getStatus() === self::STATUS_INVALID;
79
    }
80
}
81