IproApiResponse::onlySuccessful()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
namespace LaravelIproSoftwareApi;
4
5
use Illuminate\Http\Client\Response;
6
use LaravelIproSoftwareApi\Exceptions\UnexpectedApiResponseException;
7
8
class IproApiResponse extends Response
9
{
10
    public function onlySuccessful(): static
11
    {
12
        throw_if(!$this->successful(), new UnexpectedApiResponseException($this));
13
14
        return $this;
15
    }
16
}
17