File: TimeoutException.php

package info (click to toggle)
php-malkusch-lock 2.2.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 412 kB
  • sloc: php: 2,193; makefile: 19
file content (29 lines) | stat: -rw-r--r-- 740 bytes parent folder | download
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
<?php

declare(strict_types=1);

namespace malkusch\lock\exception;

/**
 * Timeout exception.
 *
 * A timeout has been exceeded exception. Should only be used in contexts where
 * the lock is being acquired.
 *
 * @author Markus Malkusch <markus@malkusch.de>
 * @link bitcoin:1P5FAZ4QhXCuwYPnLZdk3PJsqePbu1UDDA Donations
 * @license WTFPL
 */
class TimeoutException extends LockAcquireException
{
    /**
     * Creates a new instance of the TimeoutException class.
     *
     * @param int $timeout The timeout in seconds.
     * @return self A timeout has been exceeded exception.
     */
    public static function create(int $timeout): self
    {
        return new self(\sprintf('Timeout of %d seconds exceeded.', $timeout));
    }
}