Cache::_getResultFile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * CakeCMS Core
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package     Core
10
 * @license     MIT
11
 * @copyright   MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link        https://github.com/CakeCMS/Core".
13
 * @author      Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Core\Less;
17
18
use JBZoo\Utils\FS;
19
use JBZoo\Utils\Str;
20
use JBZoo\Utils\Slug;
21
use JBZoo\Less\Cache as JCache;
22
23
/**
24
 * Class Cache
25
 *
26
 * @package Union\Core\Lib\Less
27
 */
28
class Cache extends JCache
29
{
30
31
    /**
32
     * Get result full file path.
33
     *
34
     * @return string
35
     */
36
    protected function _getResultFile()
37
    {
38
        //  Normalize relative path
39
        $relPath = Slug::filter($this->_hash, '_');
40
        $relPath = Str::low($relPath);
41
42
        if (!$this->_options->get('debug')) {
43
            $relPath .= '.min';
44
        }
45
46
        //  Get full clean path
47
        $fullPath = FS::real($this->_options->get('cache_path')) . '/' . $relPath . '.css';
48
        $fullPath = FS::clean($fullPath);
49
50
        return $fullPath;
51
    }
52
}
53