Passed
Pull Request — master (#192)
by Sergei
02:16
created

InputField   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 37
ccs 0
cts 12
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ariaDescribedBy() 0 5 1
A ariaLabel() 0 5 1
A form() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form\Field\Base;
6
7
abstract class InputField extends AbstractField
8
{
9
    /**
10
     * Identifies the element (or elements) that describes the object.
11
     *
12
     * @link https://w3c.github.io/aria/#aria-describedby
13
     */
14
    public function ariaDescribedBy(string $value): static
15
    {
16
        $new = clone $this;
17
        $new->inputTagAttributes['aria-describedby'] = $value;
18
        return $new;
19
    }
20
21
    /**
22
     * Defines a string value that labels the current element.
23
     *
24
     * @link https://w3c.github.io/aria/#aria-label
25
     */
26
    public function ariaLabel(string $value): static
27
    {
28
        $new = clone $this;
29
        $new->inputTagAttributes['aria-label'] = $value;
30
        return $new;
31
    }
32
33
    /**
34
     * Specifies the form element the tag input element belongs to. The value of this attribute must be the ID
35
     * attribute of a form element in the same document.
36
     *
37
     * @link https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form
38
     */
39
    public function form(string $value): static
40
    {
41
        $new = clone $this;
42
        $new->inputTagAttributes['form'] = $value;
43
        return $new;
44
    }
45
}
46