cache_path()   A
last analyzed

Complexity

Conditions 5
Paths 8

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 5.1158

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 6
c 2
b 0
f 1
dl 0
loc 13
rs 9.6111
ccs 5
cts 6
cp 0.8333
cc 5
nc 8
nop 1
crap 5.1158
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';
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