RequestException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 30
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A getRequest() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
declare(strict_types=1);
3
4
namespace Yproximite\Api\Exception;
5
6
use Psr\Http\Message\RequestInterface;
7
8
/**
9
 * Class RequestException
10
 */
11 View Code Duplication
class RequestException extends \RuntimeException implements ExceptionInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * @var RequestInterface
15
     */
16
    private $request;
17
18
    /**
19
     * @param string           $message
20
     * @param RequestInterface $request
21
     * @param \Exception|null  $previous
22
     */
23
    public function __construct(
24
        string $message,
25
        RequestInterface $request,
26
        \Exception $previous = null
27
    ) {
28
        parent::__construct($message, 0, $previous);
29
30
        $this->request = $request;
31
    }
32
33
    /**
34
     * @return RequestInterface
35
     */
36
    public function getRequest(): RequestInterface
37
    {
38
        return $this->request;
39
    }
40
}
41