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

FormatterStartExceptionTrait::startException()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 3
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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\Traits;
13
14
use Exception;
15
use Shrikeh\GuzzleMiddleware\TimerLogger\Formatter\Exception\FormatterStartException;
16
17
/**
18
 * Trait FormatterStartExceptionTrait.
19
 */
20
trait FormatterStartExceptionTrait
21
{
22
    /**
23
     * @param Exception $e    The previous exception
24
     * @param string    $msg  A message to put in the exception
25
     * @param int       $code The error code
26
     *
27
     * @return FormatterStartException
28
     */
29
    private function startException(
30
        Exception $e,
31
        $msg,
32
        $code
33
    ) {
34
        if (!$e instanceof FormatterStartException) {
35
            $e = new FormatterStartException($msg, $code, $e);
36
        }
37
38
        return $e;
39
    }
40
}
41