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

InvalidKeyException::__toString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 6
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