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

OrderExpression   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 33
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compile() 0 4 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
}