Completed
Push — master ( a8687a...737d23 )
by Joachim
07:33
created

Response::isSuccessful()   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 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
namespace Loevgaard\Linkmobility\Response;
3
4
abstract class Response implements ResponseInterface
5
{
6
    protected $data;
7
8
    /**
9
     * @var bool
10
     */
11
    protected $successful;
12
13 1
    public function __construct($data)
14
    {
15 1
        $this->successful = true;
16 1
        $this->data = $data;
17
18 1
        if (is_array($data) && isset($data['errors'])) {
19
            $this->successful = false;
20
        } else {
21 1
            $this->init();
22
        }
23 1
    }
24
25
    /**
26
     * @return bool
27
     */
28
    public function isSuccessful(): bool
29
    {
30
        return $this->successful;
31
    }
32
}
33