Count::getSelectPart()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Xsolve\SalesforceClient\QueryBuilder\Expr\Select;
4
5
use Xsolve\SalesforceClient\QueryBuilder\Expr\ExprInterface;
6
7
class Count extends AbstractSelect implements ExprInterface
8
{
9
    /**
10
     * @var string|null
11
     */
12
    private $countedValue;
13
14 2
    public function __construct(string $countedValue = null)
15
    {
16 2
        $this->countedValue = $countedValue;
17 2
    }
18
19 46
    protected function getSelectPart(): string
20
    {
21 46
        if (null !== $this->countedValue) {
22 2
            return sprintf('COUNT(%s)', $this->countedValue);
23
        }
24
25 45
        return 'COUNT()';
26
    }
27
}
28