Completed
Push — develop ( f102ca...488b09 )
by Mathias
20:12 queued 11:00
created

AbstractJobException::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2019 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Core\Queue\Exception;
12
13
/**
14
 * Base JobException class.
15
 * 
16
 * @author Mathias Gelhausen <[email protected]>
17
 * @todo write test 
18
 */
19
abstract class AbstractJobException extends \RuntimeException implements JobExceptionInterface
20
{
21
    /**
22
     * Options for the queue.
23
     *
24
     * @var array
25
     */
26
    protected $options = [];
27
28
    /**
29
     * AbstractJobException constructor.
30
     *
31
     * @param string|null $message
32
     * @param array       $options Options for the queue
33
     */
34 3
    public function __construct($message = null, array $options = [])
35
    {
36 3
        parent::__construct($message);
37
38 3
        $this->setOptions($options);
39 3
    }
40
41 3
    public function getOptions() : array
42
    {
43 3
        return array_merge(
44
            [
45 3
                'message' => $this->getMessage(),
46 3
                'trace'   => $this->getTraceAsString()
47
            ],
48 3
            $this->options
49
        );
50
51
    }
52
53 3
    public function setOptions(array $options) : void
54
    {
55 3
        $this->options = $options;
56 3
    }
57
58
59
}
60