OverQuotaException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
namespace CloudyCity\UCMarketingSDK\Kernel\Exceptions;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
class OverQuotaException extends ApiException
8
{
9
    /**
10
     * @var \Psr\Http\Message\ResponseInterface|null
11
     */
12
    public $response;
13
14
    /**
15
     * @var \Psr\Http\Message\ResponseInterface|\Doctrine\Common\Collections\ArrayCollection|array|object|string|null
16
     */
17
    public $formattedResponse;
18
19
    /**
20
     * HttpException constructor.
21
     *
22
     * @param $url
23
     * @param \Psr\Http\Message\ResponseInterface|null $response
24
     * @param mixed                                    $formattedResponse
25
     * @param int|null                                 $code
26
     */
27
    public function __construct($url, ResponseInterface $response = null, $formattedResponse = null, $code = null)
28
    {
29
        $quota = $formattedResponse['header']['quota'];
30
        $leftQuota = $formattedResponse['header']['leftQuota'];
31
        $message = "接口\"{$url}\"的配额{{$quota}}剩余{{$leftQuota}}";
32
33
        parent::__construct($message, $response, $formattedResponse, $code);
34
    }
35
}
36