MapException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A notValidKey() 0 5 1
A sequentialArray() 0 3 1
1
<?php namespace BuildR\Collection\Exception;
2
3
use BuildR\Foundation\Exception\Exception;
4
5
/**
6
 * Class MapException
7
 * @package BuildR\Collection\Exception
8
 *
9
 * @codeCoverageIgnore
10
 */
11
class MapException extends Exception {
12
13
    const MESSAGE_NON_VALID_KEY = "Only scalar keys allowed, %s given in!";
14
15
    const MESSAGE_NON_VALID_ARRAY = "This function only takes associative array as argument. Sequential given";
16
17
    /**
18
     * @param mixed $key
19
     *
20
     * @return self
21
     */
22
    public static function notValidKey($key) {
23
        $type = gettype($key);
24
25
        return self::createByFormat(self::MESSAGE_NON_VALID_KEY, [$type]);
26
    }
27
28
    /**
29
     * @return self
30
     */
31
    public function sequentialArray() {
32
        return self::createByFormat(self::MESSAGE_NON_VALID_ARRAY);
33
    }
34
35
}
36