Passed
Push — master ( 48948a...a5130b )
by Christian
02:28
created

InvalidArgument::invalidIterable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RemotelyLiving\PHPCacheAdapter\Exceptions;
6
7
use Psr\Cache;
8
use Psr\SimpleCache;
9
10
// phpcs:disable
11
final class InvalidArgument extends RuntimeError implements Cache\InvalidArgumentException, SimpleCache\InvalidArgumentException
12
{
13
    private function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
14
    {
15
        parent::__construct(
16
            $message,
17
            $code,
18
            $previous
19
        );
20
    }
21
22
    /**
23
     * @param mixed $key
24
     */
25
    public static function invalidKey($key): self
26
    {
27
        return new self(var_export($key, true) . ' is not a valid cache key');
28
    }
29
30
    public static function invalidTTL(): self
31
    {
32
        return new self('TTL must be an integer or \DateTime');
33
    }
34
35
    public static function invalidIterable(): self
36
    {
37
        return new self('Value must be iterable');
38
    }
39
}
40
// phpcs:enable