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

InputField::ariaDescribedBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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