Completed
Branch 4.0 (c710b5)
by Serhii
02:04
created

AbstractStorage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setDataDirectory() 0 11 2
getConfig() 0 1 ?
1
<?php
2
/**
3
 * @author Serhii Nekhaienko <[email protected]>
4
 * @license GPL
5
 * @copyright Serhii Nekhaienko &copy 2018
6
 * @version 4.0.0
7
 * @project browser-detector
8
 */
9
10
namespace EndorphinStudio\Detector\Storage;
11
12
use EndorphinStudio\Detector\Exception\StorageException;
13
14
abstract class AbstractStorage implements StorageInterface
15
{
16
    protected $dataDirectory;
17
18
    /**
19
     * @param string $directory
20
     * @throws StorageException
21
     */
22
    public function setDataDirectory(string $directory)
23
    {
24
        if (!is_dir($directory)) {
25
            $exception = new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $directory));
26
            $exception->setDirectory($exception);
27
            $exception->setProvider(static::class);
28
            throw $exception;
29
        }
30
31
        $this->dataDirectory = $directory;
32
    }
33
34
    public abstract function getConfig(): array;
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
35
}