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

UniqueId::__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 UniqueId extends Constraint {
10
    /**
11
     * @var string
12
     */
13
    public string $propertyPath;
14
15
    public string $message = 'Id {{ id }} is used more than once. All ids must be unique.';
16
17
    public function __construct(mixed $options = null, array $groups = null, mixed $payload = null, ?string $propertyPath = null) {
18
        parent::__construct($options, $groups, $payload);
19
20
        if(!empty($propertyPath)) {
21
            $this->propertyPath = $propertyPath;
22
        }
23
    }
24
}