Passed
Push — html-like-rules ( 103434...8dd614 )
by Dmitriy
02:20 queued 11s
created

HasLengthHtmlOptions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getHtmlOptions() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form\HtmlOptions;
6
7
use Yiisoft\Validator\Rule\HasLength;
8
9
class HasLengthHtmlOptions implements HtmlOptionsProvider
10
{
11
    private HasLength $validator;
12
13 5
    public function __construct(HasLength $validator)
14
    {
15 5
        $this->validator = $validator;
16 5
    }
17
18 2
    public function getHtmlOptions(): array
19
    {
20 2
        $options = $this->validator->getOptions();
21
        return [
22 2
            'minlength' => $options['min'],
23 2
            'maxlength' => $options['max'],
24
        ];
25
    }
26
}
27