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

PaginationOptions   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 46
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getClientItemsPerPage() 0 3 1
A getPaginationPageParameterName() 0 3 1
A getItemsPerPageParameterName() 0 3 1
A isPaginationEnabled() 0 3 1
A getPaginationClientEnabled() 0 3 1
A __construct() 0 8 1
A getPaginationClientEnabledParameterName() 0 3 1
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