LengthValidator::aboveOrEqual()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace AndreDeBrito\PHPViaCep\Validators;
4
5
/**
6
 * Class LengthValidator [Validator]
7
 *
8
 * @author André de Brito <https://github.com/andredebrito>
9
 * @package AndredeBrito\PHPViaCep\Validators
10
 */
11
class LengthValidator {
12
13
    public static function equals($value, int $length): bool {
14
        if (mb_strlen(str_replace(" ", "",($value))) == $length) {
15
            return true;
16
        }
17
18
        return false;
19
    }
20
21
    public static function aboveOrEqual($value, int $minimum): bool {
22
        if (mb_strlen(str_replace(" ", "", ($value))) >= $minimum) {
23
            return true;
24
        }
25
26
        return false;
27
    }
28
 
29
30
}
31