Completed
Push — master ( b6a1f4...39b084 )
by Jared
02:16
created

OrderBy::orderBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace JAQB\Query\Traits;
4
5
trait OrderBy
6
{
7
    /**
8
     * @var OrderStatement
9
     */
10
    protected $orderBy;
11
12
    /**
13
     * Sets the order for the query.
14
     *
15
     * @param string|array $fields
16
     * @param string       $direction
17
     *
18
     * @return self
19
     */
20
    public function orderBy($fields, $direction = false)
21
    {
22
        $this->orderBy->addFields($fields, $direction);
23
24
        return $this;
25
    }
26
27
    /**
28
     * Gets the order by statement for the query.
29
     *
30
     * @return OrderByStatement
31
     */
32
    public function getOrderBy()
33
    {
34
        return $this->orderBy;
35
    }
36
}
37