Order   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 25
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A jsonSerialize() 0 5 1
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2015-2022 Artem Rodygin
6
//
7
//  This file is part of DataTables Symfony bundle.
8
//
9
//  You should have received a copy of the MIT License along with
10
//  the bundle. If not, see <http://opensource.org/licenses/MIT>.
11
//
12
//----------------------------------------------------------------------
13
14
namespace DataTables;
15
16
/**
17
 * Ordering parameters as part of DataTables request.
18
 *
19
 * @see https://www.datatables.net/manual/server-side
20
 *
21
 * @property int    $column Column to which ordering should be applied
22
 * @property string $dir    Ordering direction for this column
23
 */
24
class Order extends ValueObject implements \JsonSerializable
25
{
26
    public const ASC  = 'asc';
27
    public const DESC = 'desc';
28
29
    protected $column;
30
    protected $dir;
31
32
    /**
33
     * Initializing constructor.
34
     */
35
    public function __construct(int $column, string $dir)
36
    {
37
        $this->column = $column;
38 1
        $this->dir    = $dir;
39
    }
40 1
41 1
    /**
42 1
     * {@inheritdoc}
43
     */
44
    public function jsonSerialize(): array
45
    {
46
        return [
47
            'column' => $this->column,
48
            'dir'    => $this->dir,
49 1
        ];
50
    }
51
}
52