Completed
Push — master ( 4cdc8a...86c904 )
by Joachim
01:27
created

BatchStatus::isSuccessful()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Loevgaard\Linkmobility\Response;
3
4
use Loevgaard\Linkmobility\Response\BatchStatus\Details;
5
use Loevgaard\Linkmobility\Response\BatchStatus\Stat;
6
7
class BatchStatus extends Response
8
{
9
    /**
10
     * @var Stat
11
     */
12
    protected $stat;
13
14
    /**
15
     * @var Details
16
     */
17
    protected $details;
18
19
    /**
20
     * @var int
21
     */
22
    protected $status;
23
24 6
    public function init()
25
    {
26 6
        parent::init();
27
28 6
        if(isset($this->data->status)) {
29 3
            $this->status = (int)$this->data->status;
30
        }
31
32 6
        if(isset($this->data->stat)) {
33 3
            $this->stat = new Stat($this->data->stat);
34
        }
35
36 6
        if(isset($this->data->details)) {
37 3
            $this->details = new Details($this->data->details);
38
        }
39 6
    }
40
41
    /**
42
     * Returns true if the request was successful
43
     *
44
     * @return bool
45
     */
46
    public function isSuccessful() {
47
        return $this->status >= 200 && $this->status < 300;
48
    }
49
}
50