Completed
Pull Request — master (#200)
by Raffael
16:31
created

Validator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * balloon
7
 *
8
 * @copyright   Copryright (c) 2012-2018 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Balloon\Filesystem\Storage;
13
14
use InvalidArgumentException;
15
16
class Validator
17
{
18
    /**
19
     * Validate options.
20
     */
21
    public static function validate(array $options): array
22
    {
23
        $adapter = null;
24
        if (isset($options['adapter'])) {
25
            $adapter = $options['adapter'];
26
        }
27
28
        if (!isset(Factory::ADAPTERS[$adapter])) {
29
            throw new InvalidArgumentException('valid storage adapter is required');
30
        }
31
32
        return $options;
33
    }
34
}
35