Passed
Push — main ( e8b2a6...414ddb )
by Thierry
02:24
created

InputValidationTrait::feedback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Lagdo\UiBuilder\Component\Base\Traits;
4
5
trait InputValidationTrait
6
{
7
    /**
8
     * @param bool $required
9
     *
10
     * @return static
11
     */
12
    public function required(bool $required = true): static
13
    {
14
        $this->element()->setAttribute('required', $required);
0 ignored issues
show
Bug introduced by
It seems like element() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $this->/** @scrutinizer ignore-call */ 
15
               element()->setAttribute('required', $required);
Loading history...
15
        return $this;
16
    }
17
18
    /**
19
     * @param bool $valid
20
     * @param string $message
21
     *
22
     * @return static
23
     */
24
    public function feedback(bool $valid, string $message = ''): static
0 ignored issues
show
Unused Code introduced by
The parameter $valid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function feedback(/** @scrutinizer ignore-unused */ bool $valid, string $message = ''): static

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $message is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function feedback(bool $valid, /** @scrutinizer ignore-unused */ string $message = ''): static

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        return $this;
27
    }
28
29
    /**
30
     * @param bool $valid
31
     * @param string $message
32
     *
33
     * @return static
34
     */
35
    public function tooltip(bool $valid, string $message = ''): static
0 ignored issues
show
Unused Code introduced by
The parameter $valid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function tooltip(/** @scrutinizer ignore-unused */ bool $valid, string $message = ''): static

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $message is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function tooltip(bool $valid, /** @scrutinizer ignore-unused */ string $message = ''): static

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
    {
37
        return $this;
38
    }
39
}
40