ItemFileDriver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 11 2
1
<?php
2
/**
3
 * This file is part of the Shieldon package.
4
 *
5
 * (c) Terry L. <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * php version 7.1.0
11
 *
12
 * @category  Web-security
13
 * @package   Shieldon
14
 * @author    Terry Lin <[email protected]>
15
 * @copyright 2019 terrylinooo
16
 * @license   https://github.com/terrylinooo/shieldon/blob/2.x/LICENSE MIT
17
 * @link      https://github.com/terrylinooo/shieldon
18
 * @see       https://shieldon.io
19
 */
20
21
declare(strict_types=1);
22
23
namespace Shieldon\Firewall\Firewall\Driver;
24
25
use Shieldon\Firewall\Driver\FileDriver;
26
27
/**
28
 * Get File driver.
29
 */
30
class ItemFileDriver
31
{
32
    /**
33
     * Initialize and get the instance.
34
     *
35
     * @param array $setting The configuration of that driver.
36
     *
37
     * @return FileDriver|null
38
     */
39 86
    public static function get(array $setting)
40
    {
41 86
        $instance = null;
42
43 86
        if (empty($setting['directory_path'])) {
44 1
            return $instance;
45
        }
46
47 85
        $instance = new FileDriver($setting['directory_path']);
48
49 85
        return $instance;
50
    }
51
}
52