Passed
Push — master ( da3b7a...881b2a )
by Hong
01:38
created

FileAdaptor::set()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
c 1
b 0
f 0
nc 3
nop 3
dl 0
loc 18
rs 10
1
<?php
2
3
/**
4
 * Phoole (PHP7.2+)
5
 *
6
 * @category  Library
7
 * @package   Phoole\Cache
8
 * @copyright Copyright (c) 2019 Hong Zhang
9
 */
10
declare(strict_types=1);
11
12
namespace Phoole\Cache\Adaptor;
13
14
use Phoole\Base\Storage\Filesystem;
15
16
/**
17
 * FileAdaptor
18
 *
19
 * @package Phoole\Cache
20
 */
21
class FileAdaptor extends Filesystem implements AdaptorInterface
22
{
23
    /**
24
     * @param string $rootPath   the cache directory
25
     * @param int    $hashLevel  directory hash depth
26
     * @throws       \RuntimeException  if mkdir failed
27
     */
28
    public function __construct(
29
        string $rootPath = '',
30
        int $hashLevel = 2
31
    ) {
32
        if (empty($rootPath)) {
33
            $rootPath = \sys_get_temp_dir() . \DIRECTORY_SEPARATOR . 'phoole_cache';
34
        }
35
        parent::__construct($rootPath, $hashLevel);
36
    }
37
}
38