1 | <?php |
||
12 | class NavigateRange |
||
13 | { |
||
14 | /** |
||
15 | * @var Configuration |
||
16 | */ |
||
17 | protected $config; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $left_offset = -1; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $right_offset = -1; |
||
28 | |||
29 | /** |
||
30 | * @param Configuration $config |
||
31 | */ |
||
32 | 11 | public function __construct(Configuration $config) |
|
36 | |||
37 | /** |
||
38 | * @return int |
||
39 | */ |
||
40 | 10 | public function getLeftOffset() |
|
44 | |||
45 | /** |
||
46 | * @return int |
||
47 | */ |
||
48 | 10 | public function getRightOffset() |
|
52 | |||
53 | /** |
||
54 | * @return NavigateRange |
||
55 | */ |
||
56 | 10 | protected function buildOffset() |
|
57 | { |
||
58 | 10 | if ($this->left_offset < 0) { |
|
59 | 10 | $this |
|
60 | 10 | ->definitionOffset() |
|
61 | 10 | ->adjustmentLargeLeftOffset() |
|
62 | 10 | ->adjustmentLargeRightOffset() |
|
63 | 10 | ->adjustmentLowerLeftOffset(); |
|
64 | 10 | } |
|
65 | |||
66 | 10 | return $this; |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * Definition of offset to the left and to the right of the selected page. |
||
71 | * |
||
72 | * @return NavigateRange |
||
73 | */ |
||
74 | 10 | protected function definitionOffset() |
|
81 | |||
82 | /** |
||
83 | * Adjustment, if the offset is too large left. |
||
84 | * |
||
85 | * @return NavigateRange |
||
86 | */ |
||
87 | 10 | protected function adjustmentLargeLeftOffset() |
|
97 | |||
98 | /** |
||
99 | * Adjustment, if the offset is too large right. |
||
100 | * |
||
101 | * @return NavigateRange |
||
102 | */ |
||
103 | 10 | protected function adjustmentLargeRightOffset() |
|
117 | |||
118 | /** |
||
119 | * Left offset should point not lower of the first page. |
||
120 | * |
||
121 | * @return NavigateRange |
||
122 | */ |
||
123 | 10 | protected function adjustmentLowerLeftOffset() |
|
131 | } |
||
132 |