Completed
Pull Request — master (#3407)
by Antoine
06:51 queued 02:47
created

PaginationOptions::getClientItemsPerPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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
{
18
    private $paginationEnabled;
19
    private $paginationPageParameterName;
20
    private $clientItemsPerPage;
21
    private $itemsPerPageParameterName;
22
    private $paginationClientEnabled;
23
    private $paginationClientEnabledParameterName;
24
25
    public function __construct($paginationEnabled = true, string $paginationPageParameterName = 'page', bool $clientItemsPerPage = false, string $itemsPerPageParameterName = 'itemsPerPage', bool $paginationClientEnabled = false, string $paginationClientEnabledParameterName = 'pagination')
26
    {
27
        $this->paginationEnabled = $paginationEnabled;
28
        $this->paginationPageParameterName = $paginationPageParameterName;
29
        $this->clientItemsPerPage = $clientItemsPerPage;
30
        $this->itemsPerPageParameterName = $itemsPerPageParameterName;
31
        $this->paginationClientEnabled = $paginationClientEnabled;
32
        $this->paginationClientEnabledParameterName = $paginationClientEnabledParameterName;
33
    }
34
35
    public function isPaginationEnabled()
36
    {
37
        return $this->paginationEnabled;
38
    }
39
40
    public function getPaginationPageParameterName()
41
    {
42
        return $this->paginationPageParameterName;
43
    }
44
45
    public function getClientItemsPerPage()
46
    {
47
        return $this->clientItemsPerPage;
48
    }
49
50
    public function getItemsPerPageParameterName()
51
    {
52
        return $this->itemsPerPageParameterName;
53
    }
54
55
    public function getPaginationClientEnabled()
56
    {
57
        return $this->paginationClientEnabled;
58
    }
59
60
    public function getPaginationClientEnabledParameterName()
61
    {
62
        return $this->paginationClientEnabledParameterName;
63
    }
64
}
65