Completed
Push — master ( 0647d9...63117e )
by Sebastian
02:16
created

Required::validate()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
cc 4
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 20
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Linna Filter
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2017, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types = 1);
11
12
namespace Linna\Filter\Rules;
13
14
/**
15
 * Check required.
16
 */
17
class Required
18
{
19
    /**
20
     * Validate.
21
     *
22
     * @return bool
23
     */
24
    public function validate($received): bool
25
    {
26
        if (strlen($received) === 0 || $received === '' || $received === null) {
27
            return true;
28
        }
29
30
        return false;
31
    }
32
}
33