Passed
Push — master ( 2d6ed9...31b4e9 )
by PHPinnacle
05:04
created

TaskCanceled::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
nc 1
nop 2
dl 0
loc 5
c 0
b 0
f 0
cc 2
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
/**
3
 * This file is part of PHPinnacle/Ensign.
4
 *
5
 * (c) PHPinnacle Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types = 1);
12
13
namespace PHPinnacle\Ensign\Exception;
14
15
final class TaskCanceled extends EnsignException
16
{
17
    /**
18
     * @var int
19
     */
20
    private $task;
21
22
    /**
23
     * @param int    $task
24
     * @param string $reason
25
     */
26 1
    public function __construct(int $task, string $reason)
27
    {
28 1
        $this->task = $task;
29
30 1
        parent::__construct($reason ?: 'Task %d was cancelled');
31 1
    }
32
33
    /**
34
     * @return int
35
     */
36
    public function task(): int
37
    {
38
        return $this->task;
39
    }
40
}
41