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

HasLengthHtmlOptions::getHtmlOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
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