MapException::sequentialArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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