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

Response   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
ccs 6
cts 9
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A isSuccessful() 0 4 1
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