TimelineSearchRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getParams() 0 6 1
A __construct() 0 6 1
A setQuery() 0 5 1
1
<?php
2
3
namespace Osnova\Services\Timeline\Requests;
4
5
class TimelineSearchRequest extends TimelineRequest
6
{
7
    /** @var string */
8
    protected $query;
9
10
    /** @var string */
11
    protected $orderBy;
12
13
    /** @var int */
14
    protected $page;
15
16
    /**
17
     * TimelineSearchRequest constructor.
18
     *
19
     * @param string $orderBy
20
     * @param int    $page
21
     */
22
    public function __construct(string $orderBy, int $page = 1)
23
    {
24
        parent::__construct('', 0, 0);
25
26
        $this->orderBy = $orderBy;
27
        $this->page = $page;
28
    }
29
30
    /**
31
     * Set request query.
32
     *
33
     * @param string $query
34
     *
35
     * @return TimelineSearchRequest
36
     */
37
    public function setQuery(string $query)
38
    {
39
        $this->query = $query;
40
41
        return $this;
42
    }
43
44
    /**
45
     * Get parameters for the current request.
46
     *
47
     * @return array
48
     */
49
    public function getParams()
50
    {
51
        return [
52
            'query' => $this->query,
53
            'order_by' => $this->orderBy,
54
            'page' => $this->page,
55
        ];
56
    }
57
}
58