OrderBy::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 3
nc 4
nop 3
crap 3
1
<?php
2
3
namespace Xsolve\SalesforceClient\QueryBuilder\Expr\OrderBy;
4
5
use Xsolve\SalesforceClient\QueryBuilder\Expr\ExprInterface;
6
7
class OrderBy extends AbstractOrderBy implements ExprInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $fields;
13
14
    /**
15
     * @var Order
16
     */
17
    private $order;
18
19
    /**
20
     * @var Strategy
21
     */
22
    private $strategy;
23
24 2
    public function __construct(
25
        array $fields,
26
        Order $order = null,
27
        Strategy $strategy = null
28
    ) {
29 2
        $this->fields = $fields;
30 2
        $this->order = null === $order ? Order::ASC() : $order;
31 2
        $this->strategy = null === $strategy ? Strategy::NULLS_FIRST() : $strategy;
32 2
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 4
    protected function getFields(): array
38
    {
39 4
        return $this->fields;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 4
    protected function getOrder(): Order
46
    {
47 4
        return $this->order;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 4
    protected function getStrategy(): Strategy
54
    {
55 4
        return $this->strategy;
56
    }
57
}
58