Test Setup Failed
Push — master ( 562b48...254002 )
by Gabriel
04:15 queued 14s
created

application.php ➔ cache_path()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4.074

Importance

Changes 0
Metric Value
cc 4
nc 8
nop 1
dl 0
loc 14
ccs 5
cts 6
cp 0.8333
crap 4.074
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
if (!function_exists('cache_path')) {
4
    /**
5
     * @param null $path
6
     * @return string
7
     */
8
    function cache_path($path = null)
9
    {
10 7
        $base = '/tmp';
11
12 7
        if (defined('CACHE_PATH')) {
13 7
            $base = CACHE_PATH;
14
        }
15
16 7
        if (function_exists('app')) {
17
            $base = app('path.storage').DIRECTORY_SEPARATOR.'cache';
18
        }
19
20 7
        return $base.($path ? DIRECTORY_SEPARATOR.$path : $path);
21
    }
22
}
23
24
25
if (!function_exists('cache')) {
26
    /**
27
     * @return \Nip\Cache\Manager
28
     */
29
    function cache()
30
    {
31
        if (function_exists('app')) {
32
//            $base = app('cache') . DIRECTORY_SEPARATOR . 'cache';
33
        }
34
35
        return \Nip\Cache\Manager::instance();
36
    }
37
}
38