Passed
Push — master ( 4959cd...65a92c )
by Marcel
17:47
created

FileExtension::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 4
dl 0
loc 5
rs 10
1
<?php
2
3
namespace App\Validator;
4
5
use Attribute;
6
use Symfony\Component\Validator\Constraint;
7
8
#[Attribute]
9
class FileExtension extends Constraint {
10
    /** @var string[] */
11
    public array $extensions;
12
13
    public string $message = 'File has the wrong format. Expected Format: {{ extensions }}';
14
15
    public function __construct(mixed $options = null, array $groups = null, mixed $payload = null, ?array $extensions = null) {
16
        parent::__construct($options, $groups, $payload);
17
18
        if($extensions !== null) {
19
            $this->extensions = $extensions;
20
        }
21
    }
22
}