1 | <?php |
||
13 | class StaticState implements StateInterface |
||
14 | { |
||
15 | /** |
||
16 | * Static state does not have namespace by default. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | private $namespace = ''; |
||
21 | |||
22 | /** |
||
23 | * Default sorter. |
||
24 | * |
||
25 | * @var string|null |
||
26 | */ |
||
27 | private $sorter = null; |
||
28 | |||
29 | /** |
||
30 | * Default sorting direction. |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | private $direction = SorterInterface::ASC; |
||
35 | |||
36 | /** |
||
37 | * Default limit. |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | private $limit = 25; |
||
42 | |||
43 | /** |
||
44 | * Default set of filters associated with their values. |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | private $filters = []; |
||
49 | |||
50 | /** |
||
51 | * @param string $sorter Default sorter |
||
52 | * @param array $filters Default set of filters in a form [filter => value] |
||
53 | * @param int $sortDirection Default sorter direction, ASC by default |
||
54 | * @param int $limit Default limit, 25 by default |
||
55 | */ |
||
56 | public function __construct( |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function isActive() |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function withNamespace($namespace) |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function getNamespace() |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function activeFilters() |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function getValue($filter, $default = null) |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function activeSorter() |
||
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | public function sortDirection() |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function getPage() |
||
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | public function getLimit() |
||
147 | } |