Search::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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
 * Search parameters as part of DataTables request.
18
 *
19
 * @see https://www.datatables.net/manual/server-side
20
 *
21
 * @property string $value Search value
22
 * @property bool   $regex Whether the search value should be treated as a regular expression for advanced searching
23
 */
24
class Search extends ValueObject implements \JsonSerializable
25
{
26
    protected $value;
27
    protected $regex;
28
29
    /**
30
     * Initializing constructor.
31
     */
32
    public function __construct(string $value = null, bool $regex = false)
33
    {
34
        $this->value = $value;
35 1
        $this->regex = $regex;
36
    }
37 1
38 1
    /**
39 1
     * {@inheritdoc}
40
     */
41
    public function jsonSerialize(): array
42
    {
43
        return [
44
            'value' => $this->value,
45
            'regex' => $this->regex,
46 1
        ];
47
    }
48
}
49