Passed
Branch master (d63766)
by Ryuichi
02:15
created

DelegateException::enableHandled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace WebStream\Exception;
3
4
/**
5
 * ApplicationException
6
 * @author Ryuichi TANAKA.
7
 * @since 2014/05/05
8
 * @version 0.4
9
 */
10
class DelegateException extends ApplicationException
11
{
12
    /**
13
     * @var bool ハンドリング可否
14
     */
15
    private $isHandled;
16
17
    /**
18
     * @var \Exception 例外オブジェクト
19
     */
20
    private $originException;
21
22
    /**
23
     * constructor
24
     * @param \Exception 例外オブジェクト
25
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment 例外オブジェクト at position 0 could not be parsed: Unknown type name '例外オブジェクト' at position 0 in 例外オブジェクト.
Loading history...
26 4
    public function __construct(\Exception $originException)
27
    {
28 4
        parent::__construct($originException->getMessage(), 500, $originException);
29 4
        $this->originException = $originException;
30 4
        $this->isHandled = false;
31 4
    }
32
33
    /**
34
     * オリジナルの例外を返却する
35
     * @return \Exception 例外オブジェクト
36
     */
37
    public function getOriginException()
38
    {
39
        return $this->originException;
40
    }
41
42
    /**
43
     * ハンドリング可否を返却する
44
     * @return bool ハンドリング可否
45
     */
46
    public function isHandled()
47
    {
48
        return $this->isHandled;
49
    }
50
51
    /**
52
     * ハンドリングを許可する
53
     */
54 4
    public function enableHandled()
55
    {
56 4
        $this->isHandled = true;
57 4
    }
58
}
59