Passed
Push — master ( a7cb7c...0e8d9a )
by Jan-Marten
02:15
created

OperationFailure   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 40
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getException() 0 3 1
A getOperation() 0 3 1
1
<?php
2
/**
3
 * Copyright MediaCT. All rights reserved.
4
 * https://www.mediact.nl
5
 */
6
7
namespace Johmanx10\Transaction;
8
9
use Throwable;
10
11
class OperationFailure implements OperationFailureInterface
12
{
13
    /** @var OperationInterface */
14
    private $operation;
15
16
    /** @var Throwable|null */
17
    private $exception;
18
19
    /**
20
     * Constructor.
21
     *
22
     * @param OperationInterface $operation
23
     * @param Throwable|null     $exception
24
     */
25 2
    public function __construct(
26
        OperationInterface $operation,
27
        ?Throwable $exception
28
    ) {
29 2
        $this->operation = $operation;
30 2
        $this->exception = $exception;
31 2
    }
32
33
    /**
34
     * Get the failed operation.
35
     *
36
     * @return OperationInterface
37
     */
38 2
    public function getOperation(): OperationInterface
39
    {
40 2
        return $this->operation;
41
    }
42
43
    /**
44
     * Get the exception that caused the operation to fail.
45
     *
46
     * @return Throwable|null
47
     */
48 2
    public function getException(): ?Throwable
49
    {
50 2
        return $this->exception;
51
    }
52
}
53