@@ -24,56 +24,56 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class PaginationHelper |
26 | 26 | { |
27 | - /** |
|
28 | - * @var int |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var int |
|
29 | + */ |
|
30 | 30 | protected $total; |
31 | 31 | |
32 | - /** |
|
33 | - * @var int |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var int |
|
34 | + */ |
|
35 | 35 | protected $perPage; |
36 | 36 | |
37 | - /** |
|
38 | - * @var int |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var int |
|
39 | + */ |
|
40 | 40 | protected $current; |
41 | 41 | |
42 | - /** |
|
43 | - * @var int |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var int |
|
44 | + */ |
|
45 | 45 | protected $next = 0; |
46 | 46 | |
47 | - /** |
|
48 | - * @var int |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @var int |
|
49 | + */ |
|
50 | 50 | protected $prev = 0; |
51 | 51 | |
52 | - /** |
|
53 | - * @var int |
|
54 | - */ |
|
52 | + /** |
|
53 | + * @var int |
|
54 | + */ |
|
55 | 55 | protected $last = 0; |
56 | 56 | |
57 | - /** |
|
58 | - * @var int |
|
59 | - */ |
|
57 | + /** |
|
58 | + * @var int |
|
59 | + */ |
|
60 | 60 | protected $adjacentPages = 3; |
61 | 61 | |
62 | - /** |
|
63 | - * @var int |
|
64 | - */ |
|
62 | + /** |
|
63 | + * @var int |
|
64 | + */ |
|
65 | 65 | protected $offsetEnd = 0; |
66 | 66 | |
67 | - /** |
|
68 | - * @var int |
|
69 | - */ |
|
67 | + /** |
|
68 | + * @var int |
|
69 | + */ |
|
70 | 70 | protected $offsetStart = 0; |
71 | 71 | |
72 | - /** |
|
73 | - * @param int $totalItems The total amount of items available. |
|
74 | - * @param int $itemsPerPage How many items to display per page. |
|
75 | - * @param int $currentPage The current page number (1-based) |
|
76 | - */ |
|
72 | + /** |
|
73 | + * @param int $totalItems The total amount of items available. |
|
74 | + * @param int $itemsPerPage How many items to display per page. |
|
75 | + * @param int $currentPage The current page number (1-based) |
|
76 | + */ |
|
77 | 77 | public function __construct(int $totalItems, int $itemsPerPage, int $currentPage) |
78 | 78 | { |
79 | 79 | $this->total = $totalItems; |
@@ -83,34 +83,34 @@ discard block |
||
83 | 83 | $this->calculate(); |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Sets the amount of adjacent pages to display next to the |
|
88 | - * current one when using the pages list. |
|
89 | - * |
|
90 | - * @param int $amount |
|
91 | - * @return PaginationHelper |
|
92 | - */ |
|
86 | + /** |
|
87 | + * Sets the amount of adjacent pages to display next to the |
|
88 | + * current one when using the pages list. |
|
89 | + * |
|
90 | + * @param int $amount |
|
91 | + * @return PaginationHelper |
|
92 | + */ |
|
93 | 93 | public function setAdjacentPages(int $amount) : PaginationHelper |
94 | 94 | { |
95 | 95 | $this->adjacentPages = $amount; |
96 | 96 | return $this; |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Whether there is a next page after the current page. |
|
101 | - * @return bool |
|
102 | - */ |
|
99 | + /** |
|
100 | + * Whether there is a next page after the current page. |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | 103 | public function hasNextPage() : bool |
104 | 104 | { |
105 | 105 | return $this->next > 0; |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * The next page number. Returns the last page |
|
110 | - * number if there is no next page. |
|
111 | - * |
|
112 | - * @return int |
|
113 | - */ |
|
108 | + /** |
|
109 | + * The next page number. Returns the last page |
|
110 | + * number if there is no next page. |
|
111 | + * |
|
112 | + * @return int |
|
113 | + */ |
|
114 | 114 | public function getNextPage() : int |
115 | 115 | { |
116 | 116 | if($this->next === 0) { |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | return $this->next; |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Whether there is a previous page before the current page. |
|
125 | - * @return bool |
|
126 | - */ |
|
123 | + /** |
|
124 | + * Whether there is a previous page before the current page. |
|
125 | + * @return bool |
|
126 | + */ |
|
127 | 127 | public function hasPreviousPage() : bool |
128 | 128 | { |
129 | 129 | return $this->prev > 0; |
130 | 130 | } |
131 | 131 | |
132 | - /** |
|
133 | - * The previous page number. Returns the first page |
|
134 | - * number if there is no previous page. |
|
135 | - * |
|
136 | - * @return int |
|
137 | - */ |
|
132 | + /** |
|
133 | + * The previous page number. Returns the first page |
|
134 | + * number if there is no previous page. |
|
135 | + * |
|
136 | + * @return int |
|
137 | + */ |
|
138 | 138 | public function getPreviousPage() : int |
139 | 139 | { |
140 | 140 | if($this->prev === 0) { |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | return $this->prev; |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Retrieves the last page number. |
|
149 | - * @return int |
|
150 | - */ |
|
147 | + /** |
|
148 | + * Retrieves the last page number. |
|
149 | + * @return int |
|
150 | + */ |
|
151 | 151 | public function getLastPage() : int |
152 | 152 | { |
153 | 153 | return $this->last; |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * Whether there is more than one page, i.e. whether |
|
158 | - * pagination is required at all. |
|
159 | - * |
|
160 | - * @return bool |
|
161 | - */ |
|
156 | + /** |
|
157 | + * Whether there is more than one page, i.e. whether |
|
158 | + * pagination is required at all. |
|
159 | + * |
|
160 | + * @return bool |
|
161 | + */ |
|
162 | 162 | public function hasPages() : bool |
163 | 163 | { |
164 | 164 | return $this->last > 1; |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | return $this->current; |
170 | 170 | } |
171 | 171 | |
172 | - /** |
|
173 | - * Retrieves a list of page numbers for a page |
|
174 | - * navigator, to quickly jump between pages. |
|
175 | - * |
|
176 | - * @return int[] |
|
177 | - */ |
|
172 | + /** |
|
173 | + * Retrieves a list of page numbers for a page |
|
174 | + * navigator, to quickly jump between pages. |
|
175 | + * |
|
176 | + * @return int[] |
|
177 | + */ |
|
178 | 178 | public function getPageNumbers() : array |
179 | 179 | { |
180 | 180 | $adjacent = $this->adjacentPages; |
@@ -250,66 +250,66 @@ discard block |
||
250 | 250 | return $numbers; |
251 | 251 | } |
252 | 252 | |
253 | - /** |
|
254 | - * Whether the specified page number is the current page. |
|
255 | - * |
|
256 | - * @param int $pageNumber |
|
257 | - * @return bool |
|
258 | - */ |
|
253 | + /** |
|
254 | + * Whether the specified page number is the current page. |
|
255 | + * |
|
256 | + * @param int $pageNumber |
|
257 | + * @return bool |
|
258 | + */ |
|
259 | 259 | public function isCurrentPage(int $pageNumber) : bool |
260 | 260 | { |
261 | 261 | return $pageNumber === $this->current; |
262 | 262 | } |
263 | 263 | |
264 | - /** |
|
265 | - * Retrieves the 1-based starting offset of |
|
266 | - * items currently displayed in the page. |
|
267 | - * |
|
268 | - * Note: Use this to create a text like |
|
269 | - * "showing entries x to y". |
|
270 | - * |
|
271 | - * @return int |
|
272 | - * @see PaginationHelper::getOffsetEnd() |
|
273 | - */ |
|
264 | + /** |
|
265 | + * Retrieves the 1-based starting offset of |
|
266 | + * items currently displayed in the page. |
|
267 | + * |
|
268 | + * Note: Use this to create a text like |
|
269 | + * "showing entries x to y". |
|
270 | + * |
|
271 | + * @return int |
|
272 | + * @see PaginationHelper::getOffsetEnd() |
|
273 | + */ |
|
274 | 274 | public function getItemsStart() : int |
275 | 275 | { |
276 | 276 | return $this->getOffsetStart() + 1; |
277 | 277 | } |
278 | 278 | |
279 | - /** |
|
280 | - * Retrieves the 1-based ending offset of |
|
281 | - * items currently displayed in the page. |
|
282 | - * |
|
283 | - * Note: Use this to create a text like |
|
284 | - * "showing entries x to y". |
|
285 | - * |
|
286 | - * @return int |
|
287 | - * @see PaginationHelper::getOffsetStart() |
|
288 | - */ |
|
279 | + /** |
|
280 | + * Retrieves the 1-based ending offset of |
|
281 | + * items currently displayed in the page. |
|
282 | + * |
|
283 | + * Note: Use this to create a text like |
|
284 | + * "showing entries x to y". |
|
285 | + * |
|
286 | + * @return int |
|
287 | + * @see PaginationHelper::getOffsetStart() |
|
288 | + */ |
|
289 | 289 | public function getItemsEnd() : int |
290 | 290 | { |
291 | 291 | return $this->getOffsetEnd() + 1; |
292 | 292 | } |
293 | 293 | |
294 | - /** |
|
295 | - * Retrieves the 0-based starting offset of |
|
296 | - * items currently displayed in the page. |
|
297 | - * |
|
298 | - * @return int |
|
299 | - * @see PaginationHelper::getItemsStart() |
|
300 | - */ |
|
294 | + /** |
|
295 | + * Retrieves the 0-based starting offset of |
|
296 | + * items currently displayed in the page. |
|
297 | + * |
|
298 | + * @return int |
|
299 | + * @see PaginationHelper::getItemsStart() |
|
300 | + */ |
|
301 | 301 | public function getOffsetStart() : int |
302 | 302 | { |
303 | 303 | return $this->offsetStart; |
304 | 304 | } |
305 | 305 | |
306 | - /** |
|
307 | - * Retrieves the 0-based ending offset of |
|
308 | - * items currently displayed in the page. |
|
309 | - * |
|
310 | - * @return int |
|
311 | - * @see PaginationHelper::getItemsEnd() |
|
312 | - */ |
|
306 | + /** |
|
307 | + * Retrieves the 0-based ending offset of |
|
308 | + * items currently displayed in the page. |
|
309 | + * |
|
310 | + * @return int |
|
311 | + * @see PaginationHelper::getItemsEnd() |
|
312 | + */ |
|
313 | 313 | public function getOffsetEnd() : int |
314 | 314 | { |
315 | 315 | return $this->offsetEnd; |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | return $this instanceof SVNHelper_Target_Folder; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Runs an update of the file or folder. |
|
81 | - * @return SVNHelper_Command_Update |
|
82 | - */ |
|
79 | + /** |
|
80 | + * Runs an update of the file or folder. |
|
81 | + * @return SVNHelper_Command_Update |
|
82 | + */ |
|
83 | 83 | public function runUpdate() |
84 | 84 | { |
85 | 85 | $cmd = $this->createUpdate(); |
@@ -88,55 +88,55 @@ discard block |
||
88 | 88 | return $cmd; |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Creates an update command instance for the target file or folder. |
|
93 | - * @return SVNHelper_Command_Update |
|
94 | - */ |
|
91 | + /** |
|
92 | + * Creates an update command instance for the target file or folder. |
|
93 | + * @return SVNHelper_Command_Update |
|
94 | + */ |
|
95 | 95 | public function createUpdate() |
96 | 96 | { |
97 | 97 | return $this->helper->createUpdate($this); |
98 | 98 | } |
99 | 99 | |
100 | - /** |
|
101 | - * Creates a status command instance for the target file or folder. |
|
102 | - * @return SVNHelper_Command_Status |
|
103 | - */ |
|
100 | + /** |
|
101 | + * Creates a status command instance for the target file or folder. |
|
102 | + * @return SVNHelper_Command_Status |
|
103 | + */ |
|
104 | 104 | public function createStatus() |
105 | 105 | { |
106 | 106 | return $this->helper->createStatus($this); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Creates an info command instance for the target file or folder. |
|
111 | - * @return SVNHelper_Command_Info |
|
112 | - */ |
|
109 | + /** |
|
110 | + * Creates an info command instance for the target file or folder. |
|
111 | + * @return SVNHelper_Command_Info |
|
112 | + */ |
|
113 | 113 | public function createInfo() |
114 | 114 | { |
115 | 115 | return $this->helper->createInfo($this); |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Creates a commit command instance for the target file or folder. |
|
120 | - * @param string $message |
|
121 | - * @return SVNHelper_Command_Commit |
|
122 | - */ |
|
118 | + /** |
|
119 | + * Creates a commit command instance for the target file or folder. |
|
120 | + * @param string $message |
|
121 | + * @return SVNHelper_Command_Commit |
|
122 | + */ |
|
123 | 123 | public function createCommit($message) |
124 | 124 | { |
125 | 125 | return $this->helper->createCommit($this, $message); |
126 | 126 | } |
127 | 127 | |
128 | - /** |
|
129 | - * Creates an add command instance for the target file or folder. |
|
130 | - * @return SVNHelper_Command_Add |
|
131 | - */ |
|
128 | + /** |
|
129 | + * Creates an add command instance for the target file or folder. |
|
130 | + * @return SVNHelper_Command_Add |
|
131 | + */ |
|
132 | 132 | public function createAdd() |
133 | 133 | { |
134 | 134 | return $this->helper->createAdd($this); |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * @return SVNHelper_Command_Status |
|
139 | - */ |
|
137 | + /** |
|
138 | + * @return SVNHelper_Command_Status |
|
139 | + */ |
|
140 | 140 | public function getStatus() |
141 | 141 | { |
142 | 142 | $cmd = $this->createStatus(); |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - /** |
|
158 | - * Whether the target is versioned or needs to be added. |
|
159 | - * @return boolean |
|
160 | - */ |
|
157 | + /** |
|
158 | + * Whether the target is versioned or needs to be added. |
|
159 | + * @return boolean |
|
160 | + */ |
|
161 | 161 | public function isVersioned() |
162 | 162 | { |
163 | 163 | return $this->getInfo()->isVersioned(); |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | $this->cache = array(); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Retrieves information on the target. |
|
175 | - * @return SVNHelper_Command_Info |
|
176 | - */ |
|
173 | + /** |
|
174 | + * Retrieves information on the target. |
|
175 | + * @return SVNHelper_Command_Info |
|
176 | + */ |
|
177 | 177 | public function getInfo() |
178 | 178 | { |
179 | 179 | if(!isset($this->cache['info'])) { |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | return $this->cache['info']; |
184 | 184 | } |
185 | 185 | |
186 | - /** |
|
187 | - * Commits the target file or folder. If it has |
|
188 | - * not been added to the repository yet, it is |
|
189 | - * added automatically beforehand. If it does |
|
190 | - * not need to be committed, no changes are made. |
|
191 | - * |
|
192 | - * @param string $message |
|
193 | - * @return SVNHelper_Target |
|
194 | - */ |
|
186 | + /** |
|
187 | + * Commits the target file or folder. If it has |
|
188 | + * not been added to the repository yet, it is |
|
189 | + * added automatically beforehand. If it does |
|
190 | + * not need to be committed, no changes are made. |
|
191 | + * |
|
192 | + * @param string $message |
|
193 | + * @return SVNHelper_Target |
|
194 | + */ |
|
195 | 195 | public function runCommit($message) |
196 | 196 | { |
197 | 197 | if(!$this->isVersioned()) { |
@@ -44,12 +44,12 @@ |
||
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - /** |
|
48 | - * Whether the file or folder has already been committed |
|
49 | - * and has no pending changes. |
|
50 | - * |
|
51 | - * @return boolean |
|
52 | - */ |
|
47 | + /** |
|
48 | + * Whether the file or folder has already been committed |
|
49 | + * and has no pending changes. |
|
50 | + * |
|
51 | + * @return boolean |
|
52 | + */ |
|
53 | 53 | public function isCommitted() |
54 | 54 | { |
55 | 55 | $status = $this->target->getStatus(); |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | return $result; |
29 | 29 | } |
30 | 30 | |
31 | - /** |
|
32 | - * @var SVNHelper_Command_Update_Status[] |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var SVNHelper_Command_Update_Status[] |
|
33 | + */ |
|
34 | 34 | protected $stati; |
35 | 35 | |
36 | 36 | protected $revision; |
37 | 37 | |
38 | - /** |
|
39 | - * Parses the command output to find out which files have been modified, and how. |
|
40 | - * @param SVNHelper_CommandResult $result |
|
41 | - */ |
|
38 | + /** |
|
39 | + * Parses the command output to find out which files have been modified, and how. |
|
40 | + * @param SVNHelper_CommandResult $result |
|
41 | + */ |
|
42 | 42 | protected function parseResult(SVNHelper_CommandResult $result) |
43 | 43 | { |
44 | 44 | $this->stati = array(); |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | return $this->getByStatus('a'); |
120 | 120 | } |
121 | 121 | |
122 | - /** |
|
123 | - * Whether there were files with the specified status code. |
|
124 | - * @param string $status |
|
125 | - * @return boolean |
|
126 | - */ |
|
122 | + /** |
|
123 | + * Whether there were files with the specified status code. |
|
124 | + * @param string $status |
|
125 | + * @return boolean |
|
126 | + */ |
|
127 | 127 | protected function hasStatus($status) |
128 | 128 | { |
129 | 129 | $this->execute(); |
@@ -33,19 +33,19 @@ |
||
33 | 33 | $this->match = $matchedString; |
34 | 34 | } |
35 | 35 | |
36 | - /** |
|
37 | - * The zero-based start position of the string in the haystack. |
|
38 | - * @return int |
|
39 | - */ |
|
36 | + /** |
|
37 | + * The zero-based start position of the string in the haystack. |
|
38 | + * @return int |
|
39 | + */ |
|
40 | 40 | public function getPosition() : int |
41 | 41 | { |
42 | 42 | return $this->position; |
43 | 43 | } |
44 | 44 | |
45 | - /** |
|
46 | - * The exact string that was matched, respecting the case as found in needle. |
|
47 | - * @return string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The exact string that was matched, respecting the case as found in needle. |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getMatchedString() : string |
50 | 50 | { |
51 | 51 | return $this->match; |
@@ -4,37 +4,37 @@ discard block |
||
4 | 4 | |
5 | 5 | class SVNHelper_CommandResult |
6 | 6 | { |
7 | - /** |
|
8 | - * @var SVNHelper_Command |
|
9 | - */ |
|
7 | + /** |
|
8 | + * @var SVNHelper_Command |
|
9 | + */ |
|
10 | 10 | protected $command; |
11 | 11 | |
12 | - /** |
|
13 | - * @var string[] |
|
14 | - */ |
|
12 | + /** |
|
13 | + * @var string[] |
|
14 | + */ |
|
15 | 15 | protected $output; |
16 | 16 | |
17 | - /** |
|
18 | - * @var SVNHelper_CommandError[] |
|
19 | - */ |
|
17 | + /** |
|
18 | + * @var SVNHelper_CommandError[] |
|
19 | + */ |
|
20 | 20 | protected $errors = array(); |
21 | 21 | |
22 | - /** |
|
23 | - * @var SVNHelper_CommandError[] |
|
24 | - */ |
|
22 | + /** |
|
23 | + * @var SVNHelper_CommandError[] |
|
24 | + */ |
|
25 | 25 | protected $warnings = array(); |
26 | 26 | |
27 | - /** |
|
28 | - * The actual command that has been executed |
|
29 | - * @var string |
|
30 | - */ |
|
27 | + /** |
|
28 | + * The actual command that has been executed |
|
29 | + * @var string |
|
30 | + */ |
|
31 | 31 | protected $commandLine; |
32 | 32 | |
33 | - /** |
|
34 | - * @param SVNHelper_Command $command |
|
35 | - * @param string[] $output |
|
36 | - * @param SVNHelper_CommandError[] $errors |
|
37 | - */ |
|
33 | + /** |
|
34 | + * @param SVNHelper_Command $command |
|
35 | + * @param string[] $output |
|
36 | + * @param SVNHelper_CommandError[] $errors |
|
37 | + */ |
|
38 | 38 | public function __construct(SVNHelper_Command $command, $commandLine, $output, $errors) |
39 | 39 | { |
40 | 40 | $this->command = $command; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | return $this->command; |
87 | 87 | } |
88 | 88 | |
89 | - /** |
|
90 | - * Retrieves all error messages. |
|
91 | - * |
|
92 | - * @param bool $asString |
|
93 | - * @return string|string[] |
|
94 | - */ |
|
89 | + /** |
|
90 | + * Retrieves all error messages. |
|
91 | + * |
|
92 | + * @param bool $asString |
|
93 | + * @return string|string[] |
|
94 | + */ |
|
95 | 95 | public function getErrorMessages(bool $asString=false) |
96 | 96 | { |
97 | 97 | if($asString) { |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class ConvertHelper_ByteConverter |
25 | 25 | { |
26 | - /** |
|
27 | - * @var int |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var int |
|
28 | + */ |
|
29 | 29 | protected $bytes; |
30 | 30 | |
31 | 31 | public function __construct(int $bytes) |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - /** |
|
43 | - * Detects the size matching the byte value for the specified base. |
|
44 | - * |
|
45 | - * @param int $base |
|
46 | - * @return ConvertHelper_StorageSizeEnum_Size |
|
47 | - */ |
|
42 | + /** |
|
43 | + * Detects the size matching the byte value for the specified base. |
|
44 | + * |
|
45 | + * @param int $base |
|
46 | + * @return ConvertHelper_StorageSizeEnum_Size |
|
47 | + */ |
|
48 | 48 | protected function detectSize(int $base) : ConvertHelper_StorageSizeEnum_Size |
49 | 49 | { |
50 | 50 | $sizes = $this->getSizesSorted($base); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | return ConvertHelper_StorageSizeEnum::getSizeByName('b'); |
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * Retrieves all storage sizes for the specified base, |
|
75 | - * sorted from smallest byte size to highest. |
|
76 | - * |
|
77 | - * @param int $base |
|
78 | - * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[] |
|
79 | - */ |
|
73 | + /** |
|
74 | + * Retrieves all storage sizes for the specified base, |
|
75 | + * sorted from smallest byte size to highest. |
|
76 | + * |
|
77 | + * @param int $base |
|
78 | + * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[] |
|
79 | + */ |
|
80 | 80 | protected function getSizesSorted(int $base) |
81 | 81 | { |
82 | 82 | $sizes = ConvertHelper_StorageSizeEnum::getSizesByBase($base); |
@@ -89,16 +89,16 @@ discard block |
||
89 | 89 | return $sizes; |
90 | 90 | } |
91 | 91 | |
92 | - /** |
|
93 | - * Converts the byte value to a human readable string, e.g. "5 KB", "140 MB". |
|
94 | - * |
|
95 | - * @param int $precision The amount of decimals (rounded up) |
|
96 | - * @param int $base The base to calculate bytes with. |
|
97 | - * @return string |
|
98 | - * |
|
99 | - * @see ConvertHelper_StorageSizeEnum::BASE_10 |
|
100 | - * @see ConvertHelper_StorageSizeEnum::BASE_2 |
|
101 | - */ |
|
92 | + /** |
|
93 | + * Converts the byte value to a human readable string, e.g. "5 KB", "140 MB". |
|
94 | + * |
|
95 | + * @param int $precision The amount of decimals (rounded up) |
|
96 | + * @param int $base The base to calculate bytes with. |
|
97 | + * @return string |
|
98 | + * |
|
99 | + * @see ConvertHelper_StorageSizeEnum::BASE_10 |
|
100 | + * @see ConvertHelper_StorageSizeEnum::BASE_2 |
|
101 | + */ |
|
102 | 102 | public function toString(int $precision, int $base=ConvertHelper_StorageSizeEnum::BASE_10) : string |
103 | 103 | { |
104 | 104 | $size = $this->detectSize($base); |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | return round($this->bytes / $size->getBytes(), $precision) . ' ' . $size->getSuffix(); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Converts the byte value to the amount of the corresponding units (KB, MB...). |
|
111 | - * |
|
112 | - * @param int $precision The amount of decimals (rounded up) |
|
113 | - * @param string $sizeName The lowercase storage size name (e.g. "kb", "kib") |
|
114 | - * @return float |
|
115 | - */ |
|
109 | + /** |
|
110 | + * Converts the byte value to the amount of the corresponding units (KB, MB...). |
|
111 | + * |
|
112 | + * @param int $precision The amount of decimals (rounded up) |
|
113 | + * @param string $sizeName The lowercase storage size name (e.g. "kb", "kib") |
|
114 | + * @return float |
|
115 | + */ |
|
116 | 116 | public function toNumber(int $precision, string $sizeName) : float |
117 | 117 | { |
118 | 118 | $size = ConvertHelper_StorageSizeEnum::getSizeByName($sizeName); |
@@ -120,56 +120,56 @@ discard block |
||
120 | 120 | return round($this->bytes / $size->getBytes(), $precision); |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Converts the bytes to Kilobytes. |
|
125 | - * |
|
126 | - * @param int $precision Amount of decimals (rounded up) |
|
127 | - * @return float |
|
128 | - */ |
|
123 | + /** |
|
124 | + * Converts the bytes to Kilobytes. |
|
125 | + * |
|
126 | + * @param int $precision Amount of decimals (rounded up) |
|
127 | + * @return float |
|
128 | + */ |
|
129 | 129 | public function toKilobytes(int $precision=1) : float |
130 | 130 | { |
131 | 131 | return $this->toNumber($precision, 'kb'); |
132 | 132 | } |
133 | 133 | |
134 | - /** |
|
135 | - * Converts the bytes to Megabytes. |
|
136 | - * |
|
137 | - * @param int $precision Amount of decimals (rounded up) |
|
138 | - * @return float |
|
139 | - */ |
|
134 | + /** |
|
135 | + * Converts the bytes to Megabytes. |
|
136 | + * |
|
137 | + * @param int $precision Amount of decimals (rounded up) |
|
138 | + * @return float |
|
139 | + */ |
|
140 | 140 | public function toMegabytes(int $precision=1) : float |
141 | 141 | { |
142 | 142 | return $this->toNumber($precision, 'mb'); |
143 | 143 | } |
144 | 144 | |
145 | - /** |
|
146 | - * Converts the bytes to Gigabytes. |
|
147 | - * |
|
148 | - * @param int $precision Amount of decimals (rounded up) |
|
149 | - * @return float |
|
150 | - */ |
|
145 | + /** |
|
146 | + * Converts the bytes to Gigabytes. |
|
147 | + * |
|
148 | + * @param int $precision Amount of decimals (rounded up) |
|
149 | + * @return float |
|
150 | + */ |
|
151 | 151 | public function toGigabytes(int $precision=1) : float |
152 | 152 | { |
153 | 153 | return $this->toNumber($precision, 'gb'); |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * Converts the bytes to Terabytes. |
|
158 | - * |
|
159 | - * @param int $precision Amount of decimals (rounded up) |
|
160 | - * @return float |
|
161 | - */ |
|
156 | + /** |
|
157 | + * Converts the bytes to Terabytes. |
|
158 | + * |
|
159 | + * @param int $precision Amount of decimals (rounded up) |
|
160 | + * @return float |
|
161 | + */ |
|
162 | 162 | public function toTerabytes(int $precision=1) : float |
163 | 163 | { |
164 | 164 | return $this->toNumber($precision, 'tb'); |
165 | 165 | } |
166 | 166 | |
167 | - /** |
|
168 | - * Converts the bytes to Petabytes. |
|
169 | - * |
|
170 | - * @param int $precision Amount of decimals (rounded up) |
|
171 | - * @return float |
|
172 | - */ |
|
167 | + /** |
|
168 | + * Converts the bytes to Petabytes. |
|
169 | + * |
|
170 | + * @param int $precision Amount of decimals (rounded up) |
|
171 | + * @return float |
|
172 | + */ |
|
173 | 173 | public function toPetabytes(int $precision=1) : float |
174 | 174 | { |
175 | 175 | return $this->toNumber($precision, 'pb'); |
@@ -25,34 +25,34 @@ |
||
25 | 25 | */ |
26 | 26 | class ConvertHelper_StorageSizeEnum_Size |
27 | 27 | { |
28 | - /** |
|
29 | - * @var string |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var string |
|
30 | + */ |
|
31 | 31 | protected $name; |
32 | 32 | |
33 | - /** |
|
34 | - * @var int |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var int |
|
35 | + */ |
|
36 | 36 | protected $base; |
37 | 37 | |
38 | - /** |
|
39 | - * @var int |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var int |
|
40 | + */ |
|
41 | 41 | protected $exponent; |
42 | 42 | |
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | protected $singular; |
47 | 47 | |
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | 51 | protected $plural; |
52 | 52 | |
53 | - /** |
|
54 | - * @var string |
|
55 | - */ |
|
53 | + /** |
|
54 | + * @var string |
|
55 | + */ |
|
56 | 56 | protected $suffix; |
57 | 57 | |
58 | 58 | public function __construct(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural) |
@@ -14,9 +14,9 @@ |
||
14 | 14 | * @see http://www.xmlsoft.org/html/libxml-xmlerror.html |
15 | 15 | */ |
16 | 16 | |
17 | - /** |
|
18 | - * @var string $list |
|
19 | - */ |
|
17 | + /** |
|
18 | + * @var string $list |
|
19 | + */ |
|
20 | 20 | $list = file_get_contents('libxmlerrors.txt'); |
21 | 21 | $outputFile = 'LibXML.php'; |
22 | 22 | $lines = explode("\n", $list); |