Passed
Push — 2.x ( e966a7...a2237c )
by Terry
02:13
created

ItemFileDriver::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
rs 10
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
11
declare(strict_types=1);
12
13
namespace Shieldon\Firewall\Firewall\Driver;
14
15
use Shieldon\Firewall\Driver\FileDriver;
16
17
/**
18
 * Get File driver.
19
 */
20
class ItemFileDriver
21
{
22
    /**
23
     * Initialize and get the instance.
24
     *
25
     * @param array $setting The configuration of that driver.
26
     *
27
     * @return FileDriver|null
28
     */
29
    public static function get(array $setting)
30
    {
31
        $instance = null;
32
33
        if (empty($setting['directory_path'])) {
34
            return $instance;
35
        }
36
37
        $instance = new FileDriver($setting['directory_path']);
38
39
        return $instance;
40
    }
41
}