AbstractNullComparisonCondition   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2
ccs 13
cts 13
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A toString() 0 12 2
A isEmpty() 0 4 1
getOperator() 0 1 ?
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Puzzle\QueryBuilder\Conditions;
6
7
use Puzzle\QueryBuilder\Escaper;
8
use Puzzle\QueryBuilder\Type;
9
10
abstract class AbstractNullComparisonCondition extends AbstractCondition
11
{
12
    private
13
        $column;
1 ignored issue
show
Coding Style introduced by
The visibility should be declared for property $column.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
14
15 16
    public function __construct($column)
16
    {
17 16
        if($column instanceof Type)
18
        {
19 4
            $column = $column->getName();
20
        }
21
22 16
        $this->column = (string) $column;
23 16
    }
24
25 10
    public function toString(Escaper $escaper): string
26
    {
27 10
        if(empty($this->column))
28
        {
29 4
            return '';
30
        }
31
32 6
        return sprintf('%s %s',
33 6
            $this->column,
34 6
            $this->getOperator()
35
        );
36
    }
37
38 8
    public function isEmpty(): bool
39
    {
40 8
        return empty($this->column);
41
    }
42
43
    abstract protected function getOperator(): string;
44
}
45