Passed
Push — master ( afbbde...fe4f70 )
by Gabriel
05:06 queued 02:38
created

application.php ➔ cache()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 8
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
if (!function_exists('cache_path')) {
4
    /**
5
     * @param null $path
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $path is correct as it would always require null to be passed?
Loading history...
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') && app()->has('path.storage')) {
17
            $base = app('path.storage').DIRECTORY_SEPARATOR.'cache';
0 ignored issues
show
Bug introduced by
Are you sure app('path.storage') of type mixed|object can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
            $base = /** @scrutinizer ignore-type */ app('path.storage').DIRECTORY_SEPARATOR.'cache';
Loading history...
18
        }
19
20 7
        return $base.($path ? DIRECTORY_SEPARATOR.$path : $path);
0 ignored issues
show
introduced by
$path is of type null, thus it always evaluated to false.
Loading history...
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