Completed
Push — master ( f3cdf4...360009 )
by Beniamin
04:07
created

OrderExpression::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\QueryBuilder\Expression;
13
14
/**
15
 * @author Beniamin Jonatan Šimko <[email protected]>
16
 */
17
class OrderExpression implements ExpressionInterface
18
{
19
    const ORDER_ASC = 'ASC';
20
    const ORDER_DESC = 'DESC';
21
22
    /**
23
     * @var ExpressionInterface $wrappedExpression
24
     */
25
    private $wrappedExpression;
26
27
    /**
28
     * @var string $order
29
     */
30
    private $order;
31
32
    /**
33
     * @param ExpressionInterface $expression
34
     * @param string              $order
35
     */
36 1
    public function __construct(ExpressionInterface $expression, $order)
37
    {
38 1
        $this->wrappedExpression = $expression;
39 1
        $this->order = $order;
40 1
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45 1
    public function compile()
46
    {
47 1
        return $this->wrappedExpression->compile() . ' ' . $this->order;
48
    }
49
}