Completed
Push — master ( a1d3b0...f47b8c )
by Nikola
02:43
created

BaseConfig::defaults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MonologFactory\Config;
6
7
use MonologFactory\Exception\InvalidConfig;
8
9
abstract class BaseConfig
10
{
11
    /**
12
     * @throws InvalidConfig
13
     */
14 16
    final protected static function filter(array $config): array
15
    {
16 16
        $config = array_merge(static::defaults(), $config);
17
18 16
        static::validate($config);
19
20 12
        return $config;
21
    }
22
23
    protected static function defaults(): array
24
    {
25
        return [];
26
    }
27
28
    /**
29
     * @throws InvalidConfig
30
     */
31
    abstract protected static function validate(array $config): void;
32
}
33