FileAdaptor::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 2
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
}