Completed
Push — master ( fb3e81...9a96e3 )
by Oskar
04:01
created

InvalidKeyException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 40%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 22
ccs 4
cts 10
cp 0.4
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __toString() 0 8 2
1
<?php
2
3
namespace Anax\Cache;
4
5
/**
6
 *
7
 */
8
class InvalidKeyException extends \Exception implements \Psr\Cache\InvalidArgumentException
9
{
10
11
    private $invalidKeys;
12
13 1
    public function __construct($invalidKeys, $message = "", $code = 0, Exception $previous = null)
14
    {
15 1
        $this->invalidKeys = $invalidKeys;
16
        // make sure everything is assigned properly
17 1
        parent::__construct($message, $code, $previous);
18 1
    }
19
20
    // custom string representation of object
21
    public function __toString()
22
    {
23
        $stringValues = "";
24
        foreach ($this->invalidKeys as $val) {
25
            $stringValues .= implode(" ", $val);
26
        }
27
        return __CLASS__ . ": Invalid values in key ( {$stringValues} )\n";
28
    }
29
}
30