Passed
Push — issue-20 ( 81b6c3 )
by Benoit
08:32
created

LessThanOrEqual::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JBen87\ParsleyBundle\Constraint\Constraints;
6
7
use JBen87\ParsleyBundle\Constraint\Constraint;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
final class LessThanOrEqual extends Constraint
11
{
12
    private int $value;
13
14
    public function __construct(array $options = [])
15
    {
16
        parent::__construct($options);
17
18
        $this->value = $options['value'];
19
    }
20
21
    protected function getAttribute(): string
22
    {
23
        return 'data-parsley-lte';
24
    }
25
26
    protected function getValue(): string
27
    {
28
        return (string) $this->value;
29
    }
30
31
    protected function configureOptions(OptionsResolver $resolver): void
32
    {
33
        $resolver
34
            ->setRequired(['value'])
35
            ->setAllowedTypes('value', ['int'])
36
        ;
37
    }
38
}
39