Completed
Push — master ( 1515f3...575ef6 )
by Zoltán
26:39
created

MapException   A

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
class MapException extends Exception {
6
7
    const MESSAGE_NON_VALID_KEY = "Only scalar keys allowed, %s given in!";
8
9
    const MESSAGE_NON_VALID_ARRAY = "This function only takes associative array as argument. Sequential given";
10
11
    /**
12
     * @param mixed $key
13
     *
14
     * @return self
15
     */
16
    public static function notValidKey($key) {
17
        $type = gettype($key);
18
19
        return self::createByFormat(self::MESSAGE_NON_VALID_KEY, [$type]);
20
    }
21
22
    /**
23
     * @return self
24
     */
25
    public function sequentialArray() {
26
        return self::createByFormat(self::MESSAGE_NON_VALID_ARRAY);
27
    }
28
29
}
30