Completed
Push — master ( 758879...28862c )
by Sebastian
11s
created

ActionFailed   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withMessage() 0 4 1
A fromPrevious() 0 4 1
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\CaptainHook\Exception;
11
12
/**
13
 * Class ActionFailed
14
 *
15
 * @package CaptainHook
16
 * @author  Sebastian Feldmann <[email protected]>
17
 * @link    https://github.com/sebastianfeldmann/captainhook
18
 * @since   Class available since Release 0.9.0
19
 */
20
class ActionFailed extends \Exception
21
{
22
    /**
23
     * Return a Action Failed exception.
24
     *
25
     * @param string $msg
26
     * @return \SebastianFeldmann\CaptainHook\Exception\ActionFailed
27
     */
28 13
    public static function withMessage($msg)
29
    {
30 13
        return new self($msg);
31
    }
32
33
    /**
34
     * Create a new exception based on a previous exception.
35
     *
36
     * @param  \SebastianFeldmann\CaptainHook\Exception\ActionFailed $exception
37
     * @return \SebastianFeldmann\CaptainHook\Exception\ActionFailed
38
     */
39 1
    public static function fromPrevious(ActionFailed $exception)
40
    {
41 1
        return new self($exception->getMessage(), $exception->getCode(), $exception);
42
    }
43
}
44