TriggerException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 7
c 2
b 1
f 0
nc 1
nop 3
dl 0
loc 11
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
1
<?php
2
namespace ApigilityClient\Http\Response;
3
4
use Zend\Http\Client as ZendHttpClient,
5
    Zend\Http\Response as ZendHttpResponse;
6
7
use ApigilityClient\Exception\RuntimeException;
8
9
class TriggerException
10
{
11
12
    /**
13
     * Throws an exception
14
     *
15
     * @param  Zend\Http\Client   $client
16
     * @param  Zend\Http\Response $response
17
     * @param  string|null        $message
18
     * @throws ApigilityClient\Exception\RuntimeException
19
     */
20
    public function __construct(ZendHttpClient $client, ZendHttpResponse $response, $message = null)
0 ignored issues
show
Unused Code introduced by
The parameter $client is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $message is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
        $error = json_decode($response->getBody());
23
24
        throw new RuntimeException(sprintf(
25
            'Erro "%s/%s". %s',
26
            $error->status,
27
            $error->title,
28
            $error->detail
29
        ));
30
    }
31
}
32