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

AbstractStorage::getConfig()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 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
}