Count::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 1
crap 1
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