Completed
Branch master (b334d3)
by Albert
13:42 queued 03:43
created

Required   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A verdict() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Albert221\Validation\Rule;
6
7
use Albert221\Validation\Verdict;
8
9 6
/**
10
 * Required validates whether given value is considered as existing or not.
11 6
 */
12 6
class Required extends Rule
13
{
14 6
    protected $message = 'This field is required.';
15
16 6
    /**
17
     * {@inheritdoc}
18
     */
19
    public function verdict($value): Verdict
20
    {
21
        $passes = false;
22
23
        if (null !== $value) {
24
            $passes = true;
25
        }
26
27
        return Verdict::create($passes, $this, $value);
0 ignored issues
show
Unused Code introduced by
The call to Verdict::create() has too many arguments starting with $value.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
28
    }
29
}
30