1 | <?php |
||
12 | class ContentRange implements Range |
||
13 | { |
||
14 | /** |
||
15 | * @var float |
||
16 | */ |
||
17 | protected $start; |
||
18 | |||
19 | /** |
||
20 | * @var float |
||
21 | */ |
||
22 | protected $end; |
||
23 | |||
24 | /** |
||
25 | * @var float |
||
26 | */ |
||
27 | protected $total; |
||
28 | |||
29 | /** |
||
30 | * ContentRange constructor. |
||
31 | * |
||
32 | * @param string|\Symfony\Component\HttpFoundation\HeaderBag|\Illuminate\Http\Request $contentRange |
||
33 | */ |
||
34 | 20 | public function __construct($contentRange) |
|
57 | |||
58 | /** |
||
59 | * Converts the string value to float - throws exception if float value is exceeded. |
||
60 | * |
||
61 | * @param string $value |
||
62 | * |
||
63 | * @return float |
||
64 | * @throws \Symfony\Component\HttpKernel\Exception\HttpException |
||
65 | */ |
||
66 | 17 | protected function numericValue($value): float |
|
76 | |||
77 | /** |
||
78 | * {@inheritDoc} |
||
79 | */ |
||
80 | 7 | public function getStart(): float |
|
84 | |||
85 | /** |
||
86 | * {@inheritDoc} |
||
87 | */ |
||
88 | 7 | public function getEnd(): float |
|
92 | |||
93 | /** |
||
94 | * {@inheritDoc} |
||
95 | */ |
||
96 | 7 | public function getTotal(): float |
|
100 | |||
101 | /** |
||
102 | * {@inheritDoc} |
||
103 | */ |
||
104 | 2 | public function isFirst(): bool |
|
108 | |||
109 | /** |
||
110 | * {@inheritDoc} |
||
111 | */ |
||
112 | 6 | public function isLast(): bool |
|
116 | |||
117 | /** |
||
118 | * @return float |
||
119 | */ |
||
120 | 5 | public function getPercentage(): float |
|
124 | } |
||
125 |