Completed
Push — master ( 630cca...f9ea9b )
by Philip
02:37
created

Boolean::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 9
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Valdi package.
5
 *
6
 * (c) Philip Lehmann-Böhm <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Valdi\Validator;
13
14
/**
15
 * Validator for booleans.
16
 */
17
class Boolean implements ValidatorInterface {
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function isValid($value, array $parameters) {
23
        return in_array($value, array(
24
            '', null,
25
            true, false,
26
            1, 0,
27
            '1', '0',
28
            'on', 'off',
29
            'yes', 'no'
30
        ), true);
31
    }
32
}
33