StoppingTaskException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Cerbero\ConsoleTasker\Exceptions;
4
5
use Cerbero\ConsoleTasker\Tasks\AbstractTask;
6
use RuntimeException;
7
8
/**
9
 * The exception stopping the execution of next tasks.
10
 *
11
 */
12
class StoppingTaskException extends RuntimeException
13
{
14
    /**
15
     * The failed task.
16
     *
17
     * @var AbstractTask
18
     */
19
    protected $task;
20
21
    /**
22
     * Instantiate the class.
23
     *
24
     * @param AbstractTask $task
25
     */
26
    public function __construct(AbstractTask $task)
27
    {
28
        parent::__construct($task->getError());
29
30
        $this->task = $task;
31
    }
32
33
    /**
34
     * Retrieve the failed task
35
     *
36
     * @return AbstractTask
37
     */
38
    public function getTask(): AbstractTask
39
    {
40
        return $this->task;
41
    }
42
}
43