Completed
Pull Request — master (#3407)
by Antoine
05:48
created

PaginationOptions::isPaginationEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\DataProvider;
15
16
class PaginationOptions {
17
    private $paginationEnabled;
18
    private $paginationPageParameterName;
19
    private $clientItemsPerPage;
20
    private $itemsPerPageParameterName;
21
    private $paginationClientEnabled;
22
    private $paginationClientEnabledParameterName;
23
24
    public function __construct($paginationEnabled = true, string $paginationPageParameterName = 'page', bool $clientItemsPerPage = false, string $itemsPerPageParameterName = 'itemsPerPage', bool $paginationClientEnabled = false, string $paginationClientEnabledParameterName = 'pagination')
25
    {
26
        $this->paginationEnabled = $paginationEnabled;
27
        $this->paginationPageParameterName = $paginationPageParameterName;
28
        $this->clientItemsPerPage = $clientItemsPerPage;
29
        $this->itemsPerPageParameterName = $itemsPerPageParameterName;
30
        $this->paginationClientEnabled = $paginationClientEnabled;
31
        $this->paginationClientEnabledParameterName = $paginationClientEnabledParameterName;
32
    }
33
34
    public function isPaginationEnabled()
35
    {
36
        return $this->paginationEnabled;
37
    }
38
39
    public function getPaginationPageParameterName()
40
    {
41
        return $this->paginationPageParameterName;
42
    }
43
44
    public function getClientItemsPerPage()
45
    {
46
        return $this->clientItemsPerPage;
47
    }
48
49
    public function getItemsPerPageParameterName()
50
    {
51
        return $this->itemsPerPageParameterName;
52
    }
53
54
    public function getPaginationClientEnabled()
55
    {
56
        return $this->paginationClientEnabled;
57
    }
58
59
    public function getPaginationClientEnabledParameterName()
60
    {
61
        return $this->paginationClientEnabledParameterName;
62
    }
63
}
64