Completed
Push — master ( 37a7f9...757b73 )
by Adriano
01:32
created

Sort::getMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PayGo\Transactions\Contracts\Query;
4
5
use PayGo\Transactions\Constants\SortModeConst;
6
7
/**
8
 * Class Sort
9
 * @package PayGo\Transactions\Contracts
10
 */
11 View Code Duplication
class Sort implements \JsonSerializable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * @var string
15
     */
16
    private $field;
17
18
    /**
19
     * @var string
20
     */
21
    private $mode = SortModeConst::ASC;
22
23
    /**
24
     * @return string
25
     */
26
    public function getField()
27
    {
28
        return $this->field;
29
    }
30
31
    /**
32
     * @param string $field
33
     * @return Sort
34
     */
35
    public function setField($field)
36
    {
37
        $this->field = $field;
38
        return $this;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getMode()
45
    {
46
        return $this->mode;
47
    }
48
49
    /**
50
     * @param string $mode
51
     * @return Sort
52
     */
53
    public function setMode($mode)
54
    {
55
        $this->mode = $mode;
56
        return $this;
57
    }
58
59
    /**
60
     * @return array|mixed
61
     */
62
    public function jsonSerialize()
63
    {
64
        return array_filter([
65
            "Field" => $this->field,
66
            "Mode" => $this->mode,
67
        ], function($val) { return !empty($val); });
68
    }
69
}