Completed
Pull Request — develop (#25)
by Barney
05:15
created

FormatterExceptionAbstract   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 29
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A level() 7 7 1
A msg() 7 7 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
/**
3
 * @codingStandardsIgnoreStart
4
 *
5
 * @author       Barney Hanlon <[email protected]>
6
 * @copyright    Barney Hanlon 2017
7
 * @license      https://opensource.org/licenses/MIT
8
 *
9
 * @codingStandardsIgnoreEnd
10
 */
11
12
namespace Shrikeh\GuzzleMiddleware\TimerLogger\Formatter\Exception;
13
14
use RuntimeException;
15
16 View Code Duplication
abstract class FormatterExceptionAbstract extends RuntimeException
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...
17
{
18
    /**
19
     * @param \Exception|null $e An optional previous Exception
20
     *
21
     * @return static
22
     */
23
    public static function msg(
24
        \Exception $e = null
25
    ) {
26
        return new static(
27
            static::MSG_MESSAGE,
0 ignored issues
show
Bug introduced by
The constant Shrikeh\GuzzleMiddleware...onAbstract::MSG_MESSAGE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
28
            static::MSG_CODE,
0 ignored issues
show
Bug introduced by
The constant Shrikeh\GuzzleMiddleware...ptionAbstract::MSG_CODE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
29
            $e
30
        );
31
    }
32
33
    /**
34
     * @param \Exception|null $e An optional previous Exception
35
     *
36
     * @return static
37
     */
38
    public static function level(
39
        \Exception $e = null
40
    ) {
41
        return new static(
42
            static::LEVEL_MESSAGE,
0 ignored issues
show
Bug introduced by
The constant Shrikeh\GuzzleMiddleware...Abstract::LEVEL_MESSAGE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
43
            static::LEVEL_CODE,
0 ignored issues
show
Bug introduced by
The constant Shrikeh\GuzzleMiddleware...ionAbstract::LEVEL_CODE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
44
            $e
45
        );
46
    }
47
}
48