Issues (33)

src/OperationFailure.php (1 issue)

1
<?php
0 ignored issues
show
Header blocks must be separated by a single blank line
Loading history...
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