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

TimersException::stop()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
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\ResponseTimeLogger\Exception;
13
14
use Exception;
15
use RuntimeException;
16
17
/**
18
 * Class TimersException.
19
 */
20 View Code Duplication
final class TimersException 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 TIMER_START_MSG = 'An error occurred while attempting to start the timer';
23
    const TIMER_START_CODE = 32;
24
25
    const TIMER_STOP_MSG = 'An error occurred while attempting to stop the timer';
26
    const TIMER_STOP_CODE = 64;
27
28
    /**
29
     * @param \Exception $e The timer exception
30
     *
31
     * @return TimersException
32
     */
33
    public static function start(Exception $e)
34
    {
35
        return new self(
36
            self::TIMER_STOP_MSG,
37
            self::TIMER_STOP_CODE,
38
            $e
39
        );
40
    }
41
42
    /**
43
     * @param \Exception $e The timer exception
44
     *
45
     * @return TimersException
46
     */
47
    public static function stop(Exception $e)
48
    {
49
        return new self(
50
            self::TIMER_STOP_MSG,
51
            self::TIMER_STOP_CODE,
52
            $e
53
        );
54
    }
55
}
56