ApiResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 4
c 2
b 0
f 1
dl 0
loc 8
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A HasError() 0 2 2
A BodyResponse() 0 2 1
1
<?php
2
3
4
namespace FNDEV\vShpare;
5
6
7
use GuzzleHttp\Psr7\Response;
8
use Psr\Http\Message\ResponseInterface;
9
10
class ApiResponse
11
{
12
    const OK=200;
13
    public static function BodyResponse(ResponseInterface $response){
14
        return json_decode($response->getBody());
15
    }
16
    public static function HasError(ResponseInterface $response){
17
        return !($response->getStatusCode()>=200 and $response->getStatusCode() <300);
18
    }
19
}