BoolReplacingStrategy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 16
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isApplicable() 0 3 1
A replace() 0 9 3
1
<?php
2
3
namespace Xsolve\SalesforceClient\QueryBuilder\Visitor\Parameters;
4
5
class BoolReplacingStrategy implements ReplacingStrategyInterface
6
{
7 9
    public function isApplicable(Type $type): bool
8
    {
9 9
        return Type::BOOL() === $type;
10
    }
11
12 7
    public function replace($value): string
13
    {
14 7
        if (in_array($value, ['true', 'false'], true)) {
15 2
            return $value;
16
        }
17
18 5
        $boolValue = (bool) $value;
19
20 5
        return $boolValue ? 'true' : 'false';
21
    }
22
}
23