CacheException::getItemFromVariableArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace CMPayments\Cache\Exceptions;
2
3
use CMPayments\Exception\BaseException;
4
5
/**
6
 * Class CacheException
7
 *
8
 * @package CMPayments\Cache\Exceptions
9
 * @Author  Boy Wijnmaalen <[email protected]>
10
 */
11
class CacheException extends BaseException
12
{
13
    const ERROR_CACHE_FILENAME_NOT_SET       = 1;
14
    const ERROR_CACHE_DIRECTORY_NOT_WRITABLE = 2;
15
16
    protected $messages = [
17
        self::ERROR_CACHE_FILENAME_NOT_SET       => 'The cache filename option \'%s\' is not set',
18
        self::ERROR_CACHE_DIRECTORY_NOT_WRITABLE => 'The cache directory \'%s\' is not writable'
19
    ];
20
21
    /**
22
     * prepend class name to clarify error origin
23
     *
24
     * @param int    $code
25
     * @param null   $default
26
     * @param string $msgArray
27
     *
28
     * @return string
29
     */
30
    public function getItemFromVariableArray($code, $default = null, $msgArray = 'messages')
31
    {
32
        return (new \ReflectionClass($this))->getShortName() . ': ' . parent::getItemFromVariableArray($code, $default, $msgArray);
33
    }
34
}