Completed
Push — master ( 298e09...565401 )
by Ivannis Suárez
02:36
created

TimeoutException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
/*
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Async\Promise;
13
14
/**
15
 * Timeout Exception class.
16
 *
17
 * @author Karel Osorio Ramírez <[email protected]>
18
 */
19
class TimeoutException extends CancellationException
20
{
21
    /**
22
     * @var int|float
23
     */
24
    protected $time;
25
26
    /**
27
     * @param int|float $time
28
     * @param string    $message
29
     */
30
    public function __construct($time, $message = null)
31
    {
32
        $this->time = $time;
33
        if ($message !== null) {
34
            $message = \sprintf('The promise has been cancelled, timeout expired after %f seconds', $this->time);
35
        }
36
37
        parent::__construct($message);
38
    }
39
}
40