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

MapException::notValidKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 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