Failed Conditions
Push — v3.x ( 1f61fa...b0fa1f )
by Chad
02:14
created

AbstractCache::verifyKey()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Chadicus\Marvel\Api\Cache;
4
5
/**
6
 * A PSR-16 implementation which does not save or store any data.
7
 */
8
abstract class AbstractCache
9
{
10
    /**
11
     * Verifies the the given cache key is a legal value.
12
     *
13
     * @param mixed $key The cache key to validate.
14
     *
15
     * @return void
16
     *
17
     * @throws InvalidArgumentException Thrown if the $key string is not a legal value.
18
     */
19
    final protected function verifyKey($key)
20
    {
21
        if (is_string($key) && trim($key) !== '') {
22
            return;
23
        }
24
25
        throw new InvalidArgumentException('$key must be a valid non-empty string');
26
    }
27
}
28