Completed
Push — develop ( cc8c81...372a4c )
by Barney
14s
created

FormatterStopException::level()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 1
dl 6
loc 6
rs 9.4285
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 Exception;
15
use RuntimeException;
16
17
/**
18
 * Class FormatterException.
19
 */
20 View Code Duplication
final class FormatterStopException 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...
21
{
22
    const MESSAGE_STOP_MSG = 'Error attempting to parse stop message for log';
23
    const MESSAGE_PARSE_CODE = 1;
24
25
    const LEVEL_STOP_MSG = 'Error determining log level for stop';
26
    const LEVEL_STOP_CODE = 2;
27
28
    /**
29
     * @param \Exception $e The previous exception
30
     *
31
     * @return FormatterStopException
32
     */
33
    public static function msg(Exception $e)
34
    {
35
        return new self(
36
            self::MESSAGE_STOP_MSG,
37
            self::MESSAGE_PARSE_CODE,
38
            $e
39
        );
40
    }
41
42
    /**
43
     * @param \Exception $e The previous exception
44
     *
45
     * @return FormatterStopException
46
     */
47
    public static function level(Exception $e)
48
    {
49
        return new self(
50
            self::LEVEL_STOP_MSG,
51
            self::LEVEL_STOP_CODE,
52
            $e
53
        );
54
    }
55
}
56