Completed
Push — master ( 38deb0...7544ac )
by Anton
11s
created

NegativeRule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 4 1
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Validator\Rule;
12
13
/**
14
 * Check for negative number
15
 *
16
 * @package Bluz\Validator\Rule
17
 */
18
class NegativeRule extends AbstractRule
19
{
20
    /**
21
     * @var string error template
22
     */
23
    protected $description = 'must be negative';
24
25
    /**
26
     * Check for negative number
27
     *
28
     * @param  string $input
29
     *
30
     * @return bool
31
     */
32 14
    public function validate($input): bool
33
    {
34 14
        return $input < 0;
35
    }
36
}
37