BooleanValidation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isBooleanValid() 0 8 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Imedia\Ammit\Domain;
5
6
/**
7
 * @author Guillaume MOREL <[email protected]>
8
 */
9
class BooleanValidation
10
{
11
    /**
12
     * Valid against UUID format
13
     * @param mixed $value String to validate
14
     * @return bool
15
     */
16
    public function isBooleanValid($value): bool
17
    {
18
        if (in_array($value, [true, false, 1, 0, '1', '0', 'true', 'false'], true)) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return in_array($value, ...true', 'false'), true);.
Loading history...
19
            return true;
20
        }
21
22
        return false;
23
    }
24
}
25