SortCondition::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace Netdudes\DataSourceryBundle\Query;
4
5
/**
6
 * Defines a sorting condition of a single column
7
 */
8
class SortCondition
9
{
10
    const ASC = 'ASC';
11
    const DESC = 'DESC';
12
13
    /**
14
     * Column identifier to sort by
15
     *
16
     * @var string
17
     */
18
    private $fieldName;
19
20
    /**
21
     * Method of sorting
22
     *
23
     * @var string
24
     */
25
    private $method;
26
27
    /**
28
     * Sort direction: ASC or DESC
29
     *
30
     * @var string
31
     */
32
    private $direction;
33
34
    /**
35
     * @param $fieldName
36
     * @param $method
37
     * @param $direction
38
     */
39
    public function __construct($fieldName, $method, $direction)
40
    {
41
        $this->fieldName = $fieldName;
42
        $this->method = $method;
43
        $this->direction = $direction;
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getFieldName()
50
    {
51
        return $this->fieldName;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getMethod()
58
    {
59
        return $this->method;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getDirection()
66
    {
67
        return $this->direction;
68
    }
69
}
70