Completed
Push — master ( fc5d5e...ff4385 )
by Dragos
15:02
created

AbstractResponse::isStatusValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
     * Array of errors.
14
     *
15
     * @var array
16
     *
17
     * @JMS\SerializedName("ERRORS")
18
     * @JMS\Type("array<string, string>")
19
     */
20
    protected $errors = array();
21
22
    /**
23
     * The status of the entity created / updated.
24
     *
25
     * @var string
26
     *
27
     * @JMS\SerializedName("STATUS")
28
     * @JMS\Type("string")
29
     */
30
    protected $status;
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 3
    public function getErrors()
36
    {
37 3
        return $this->errors;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 102
    public function hasErrors()
44
    {
45 102
        return count($this->errors) !== 0;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getStatus()
52
    {
53
        return $this->status;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59 45
    public function setStatus($status)
60
    {
61 45
        $this->status = $status;
62 45
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function isStatusSuccess()
68
    {
69
        return $this->getStatus() === self::STATUS_SUCCESS;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function isStatusValid()
76
    {
77
        return $this->getStatus() === self::STATUS_VALID;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83
    public function isStatusInvalid()
84
    {
85
        return $this->getStatus() === self::STATUS_INVALID;
86
    }
87
}
88