Completed
Push — master ( 6c409f...23b86d )
by James
11s
created

InvalidArgumentException::fromKeyAndInvalidTTL()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 1
nop 2
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Roave\DoctrineSimpleCache\Exception;
5
6
class InvalidArgumentException
7
    extends \InvalidArgumentException
8
    implements \Psr\SimpleCache\InvalidArgumentException
9
{
10 2
    public static function fromKeyAndInvalidTTL(string $key, $ttl) : self
11
    {
12 2
        return new self(sprintf(
13 2
            'TTL for "%s" should be defined by an integer or a DateInterval, but %s is given.',
14
            $key,
15 2
            is_object($ttl) ? get_class($ttl) : gettype($ttl)
16
        ));
17
    }
18
}
19