Completed
Pull Request — develop (#605)
by
unknown
14:48
created

ProxyExceptionListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
1
<?php
2
/**
3
 * ProxyExceptionListener
4
 */
5
namespace Graviton\ProxyApiBundle\Listener;
6
7
use Symfony\Component\HttpKernel\Exception\HttpException;
8
9
/**
10
 * Class ProxyExceptionListener
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class ProxyExceptionListener extends HttpException
17
{
18
    private $statusCode;
19
20
    /**
21
     * ProxyExceptionListener constructor.
22
     * @param int    $statusCode valid response status code
23
     * @param string $message    explain the reason
0 ignored issues
show
Documentation introduced by
Should the type for parameter $message not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
24
     * @param int    $code       default info code Bad Request
25
     */
26
    public function __construct(
27
        $statusCode,
28
        $message = null,
29
        $code = 400
30
    ) {
31
        $this->statusCode = empty($statusCode) ? 404 : $statusCode;
32
        $message = 'Proxy error: ' . $message;
33
34
        parent::__construct($statusCode, $message, null, [], $code);
35
    }
36
}
37