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

TaskCanceled   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
ccs 4
cts 6
cp 0.6667
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A task() 0 3 1
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