summaryrefslogtreecommitdiffstats
path: root/vendor/react/promise-timer/src/TimeoutException.php
blob: 7f03ba00a8c844c1baa65fd54bbc6b2e84e9b820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

namespace React\Promise\Timer;

use RuntimeException;

class TimeoutException extends RuntimeException
{
    /** @var float */
    private $timeout;

    /**
     * @param float                      $timeout
     * @param string|null                $message
     * @param int|null                   $code
     * @param null|\Exception|\Throwable $previous
     */
    public function __construct($timeout, $message = '', $code = 0, $previous = null)
    {
        // Preserve compatibility with our former nullable signature, but avoid invalid arguments for the parent constructor:
        parent::__construct((string) $message, (int) $code, $previous);

        $this->timeout = (float) $timeout;
    }

    /**
     * Get the timeout value in seconds.
     *
     * @return float
     */
    public function getTimeout()
    {
        return $this->timeout;
    }
}