Passed
Push — master ( e1084c...1b59a4 )
by Fabien
02:20
created

FileExtensions::validateValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Configuration\Validator;
6
7
use Churn\Configuration\EditableConfig;
8
use Webmozart\Assert\Assert;
9
10
/**
11
 * @internal
12
 */
13
final class FileExtensions extends BaseValidator
14
{
15
    /**
16
     * Class constructor.
17
     */
18
    public function __construct()
19
    {
20
        parent::__construct('fileExtensions');
21
    }
22
23
    /**
24
     * @param EditableConfig $config The configuration object.
25
     * @param mixed $value The value to validate.
26
     */
27
    protected function validateValue(EditableConfig $config, $value): void
28
    {
29
        Assert::isArray($value, 'File extensions should be an array of strings');
30
        Assert::allString($value, 'File extensions should be an array of strings');
31
32
        $config->setFileExtensions($value);
33
    }
34
}
35