Completed
Push — master ( 4cc554...e2bb59 )
by Nico
01:55
created

TokenBool   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 4 2
A getType() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @license     http://opensource.org/licenses/mit-license.php MIT
7
 * @link        https://github.com/nicoSWD
8
 * @author      Nicolas Oelgart <[email protected]>
9
 */
10
namespace nicoSWD\Rules\Tokens;
11
12
use nicoSWD\Rules\TokenType;
13
14
final class TokenBool extends BaseToken
15
{
16 22
    public function getType(): int
17
    {
18 22
        return TokenType::VALUE;
19
    }
20
21
    /**
22
     * @return bool
23
     * @SuppressWarnings(PHPMD.BooleanGetMethodName)
24
     */
25 22
    public function getValue()
26
    {
27 22
        return ($this->value === true || strtolower((string) $this->value) === 'true');
28
    }
29
}
30