@@ -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; |
@@ -6,9 +6,9 @@ |
||
6 | 6 | { |
7 | 7 | protected $xml; |
8 | 8 | |
9 | - /** |
|
10 | - * @var \LibXMLError |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var \LibXMLError |
|
11 | + */ |
|
12 | 12 | protected $nativeError; |
13 | 13 | |
14 | 14 | public function __construct(XMLHelper_SimpleXML $xml, \LibXMLError $nativeError) |
@@ -38,38 +38,38 @@ |
||
38 | 38 | */ |
39 | 39 | protected $text; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected $trimmed; |
45 | 45 | |
46 | - /** |
|
47 | - * @var int |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var int |
|
48 | + */ |
|
49 | 49 | protected $lineNumber; |
50 | 50 | |
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | 54 | protected $type; |
55 | 55 | |
56 | - /** |
|
57 | - * @var string |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var string |
|
58 | + */ |
|
59 | 59 | protected $varName = ''; |
60 | 60 | |
61 | - /** |
|
62 | - * @var string |
|
63 | - */ |
|
61 | + /** |
|
62 | + * @var string |
|
63 | + */ |
|
64 | 64 | protected $varValue = ''; |
65 | 65 | |
66 | 66 | protected $valueUnquoted = ''; |
67 | 67 | |
68 | 68 | protected $quoteStyle = ''; |
69 | 69 | |
70 | - /** |
|
71 | - * @var string |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var string |
|
72 | + */ |
|
73 | 73 | protected $sectionName = ''; |
74 | 74 | |
75 | 75 | public function __construct(string $text, int $lineNumber) |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class IniHelper_Section |
23 | 23 | { |
24 | - /** |
|
25 | - * @var IniHelper |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var IniHelper |
|
26 | + */ |
|
27 | 27 | protected $ini; |
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | 32 | protected $name; |
33 | 33 | |
34 | - /** |
|
35 | - * @var IniHelper_Line[] |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var IniHelper_Line[] |
|
36 | + */ |
|
37 | 37 | protected $lines = array(); |
38 | 38 | |
39 | 39 | public function __construct(IniHelper $ini, string $name) |
@@ -42,33 +42,33 @@ discard block |
||
42 | 42 | $this->name = $name; |
43 | 43 | } |
44 | 44 | |
45 | - /** |
|
46 | - * The section's name. |
|
47 | - * @return string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The section's name. |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getName() : string |
50 | 50 | { |
51 | 51 | return $this->name; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Whether this is the default section: this |
|
56 | - * is used internally to store all variables that |
|
57 | - * are not in any specific section. |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - */ |
|
54 | + /** |
|
55 | + * Whether this is the default section: this |
|
56 | + * is used internally to store all variables that |
|
57 | + * are not in any specific section. |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | 61 | public function isDefault() : bool |
62 | 62 | { |
63 | 63 | return $this->name === IniHelper::SECTION_DEFAULT; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Adds a line instance to the section. |
|
68 | - * |
|
69 | - * @param IniHelper_Line $line |
|
70 | - * @return IniHelper_Section |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Adds a line instance to the section. |
|
68 | + * |
|
69 | + * @param IniHelper_Line $line |
|
70 | + * @return IniHelper_Section |
|
71 | + */ |
|
72 | 72 | public function addLine(IniHelper_Line $line) : IniHelper_Section |
73 | 73 | { |
74 | 74 | $this->lines[] = $line; |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Converts the values contained in the section into |
|
81 | - * an associative array. |
|
82 | - * |
|
83 | - * @return array |
|
84 | - */ |
|
79 | + /** |
|
80 | + * Converts the values contained in the section into |
|
81 | + * an associative array. |
|
82 | + * |
|
83 | + * @return array |
|
84 | + */ |
|
85 | 85 | public function toArray() : array |
86 | 86 | { |
87 | 87 | $result = array(); |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | return $result; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Converts the section's lines into an INI string. |
|
119 | - * |
|
120 | - * @return string |
|
121 | - */ |
|
117 | + /** |
|
118 | + * Converts the section's lines into an INI string. |
|
119 | + * |
|
120 | + * @return string |
|
121 | + */ |
|
122 | 122 | public function toString() |
123 | 123 | { |
124 | 124 | $lines = array(); |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | return implode($this->ini->getEOLChar(), $lines); |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Deletes a line from the section. |
|
145 | - * |
|
146 | - * @param IniHelper_Line $toDelete |
|
147 | - * @return IniHelper_Section |
|
148 | - */ |
|
143 | + /** |
|
144 | + * Deletes a line from the section. |
|
145 | + * |
|
146 | + * @param IniHelper_Line $toDelete |
|
147 | + * @return IniHelper_Section |
|
148 | + */ |
|
149 | 149 | public function deleteLine(IniHelper_Line $toDelete) : IniHelper_Section |
150 | 150 | { |
151 | 151 | $keep = array(); |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * Sets the value of a variable, overwriting any existing value. |
|
167 | - * |
|
168 | - * @param string $name |
|
169 | - * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | - * @return IniHelper_Section |
|
171 | - */ |
|
165 | + /** |
|
166 | + * Sets the value of a variable, overwriting any existing value. |
|
167 | + * |
|
168 | + * @param string $name |
|
169 | + * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | + * @return IniHelper_Section |
|
171 | + */ |
|
172 | 172 | public function setValue(string $name, $value) : IniHelper_Section |
173 | 173 | { |
174 | 174 | $lines = $this->getLinesByVariable($name); |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | return $this; |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Adds a variable value to the section. Unlike setValue(), this |
|
234 | - * will not overwrite any existing value. If the name is an existing |
|
235 | - * variable name, it will be converted to duplicate keys. |
|
236 | - * |
|
237 | - * @param string $name |
|
238 | - * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | - * @return IniHelper_Section |
|
240 | - */ |
|
232 | + /** |
|
233 | + * Adds a variable value to the section. Unlike setValue(), this |
|
234 | + * will not overwrite any existing value. If the name is an existing |
|
235 | + * variable name, it will be converted to duplicate keys. |
|
236 | + * |
|
237 | + * @param string $name |
|
238 | + * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | + * @return IniHelper_Section |
|
240 | + */ |
|
241 | 241 | public function addValue(string $name, $value) : IniHelper_Section |
242 | 242 | { |
243 | 243 | // array value? Treat it as duplicate keys. |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | - /** |
|
299 | - * Retrieves all lines for the specified variable name. |
|
300 | - * |
|
301 | - * @param string $name |
|
302 | - * @return \AppUtils\IniHelper_Line[] |
|
303 | - */ |
|
298 | + /** |
|
299 | + * Retrieves all lines for the specified variable name. |
|
300 | + * |
|
301 | + * @param string $name |
|
302 | + * @return \AppUtils\IniHelper_Line[] |
|
303 | + */ |
|
304 | 304 | public function getLinesByVariable(string $name) |
305 | 305 | { |
306 | 306 | $result = array(); |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | - /** |
|
54 | - * Creates and returns a new instance of the CSV builder which |
|
55 | - * can be used to build CSV from scratch. |
|
56 | - * |
|
57 | - * @return CSVHelper_Builder |
|
58 | - */ |
|
53 | + /** |
|
54 | + * Creates and returns a new instance of the CSV builder which |
|
55 | + * can be used to build CSV from scratch. |
|
56 | + * |
|
57 | + * @return CSVHelper_Builder |
|
58 | + */ |
|
59 | 59 | public static function createBuilder() |
60 | 60 | { |
61 | 61 | return new CSVHelper_Builder(); |
62 | 62 | } |
63 | 63 | |
64 | - /** |
|
65 | - * @var string |
|
66 | - */ |
|
64 | + /** |
|
65 | + * @var string |
|
66 | + */ |
|
67 | 67 | protected $csv = ''; |
68 | 68 | |
69 | 69 | protected $data = array(); |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | |
73 | 73 | protected $headersPosition = self::HEADERS_NONE; |
74 | 74 | |
75 | - /** |
|
76 | - * Loads CSV data from a string. |
|
77 | - * |
|
78 | - * Note: Use the {@link hasErrors()} method to |
|
79 | - * check if the string could be parsed correctly |
|
80 | - * afterwards. |
|
81 | - * |
|
82 | - * @param string $string |
|
83 | - * @return CSVHelper |
|
84 | - */ |
|
75 | + /** |
|
76 | + * Loads CSV data from a string. |
|
77 | + * |
|
78 | + * Note: Use the {@link hasErrors()} method to |
|
79 | + * check if the string could be parsed correctly |
|
80 | + * afterwards. |
|
81 | + * |
|
82 | + * @param string $string |
|
83 | + * @return CSVHelper |
|
84 | + */ |
|
85 | 85 | public function loadString($string) |
86 | 86 | { |
87 | 87 | // remove any UTF byte order marks that may still be present in the string |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
98 | - /** |
|
99 | - * Loads CSV data from a file. |
|
100 | - * |
|
101 | - * Note: Use the {@link hasErrors()} method to |
|
102 | - * check if the string could be parsed correctly |
|
103 | - * afterwards. |
|
104 | - * |
|
105 | - * @param string $file |
|
106 | - * @throws FileHelper_Exception |
|
107 | - * @return CSVHelper |
|
108 | - * |
|
109 | - * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST |
|
110 | - * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS |
|
111 | - */ |
|
98 | + /** |
|
99 | + * Loads CSV data from a file. |
|
100 | + * |
|
101 | + * Note: Use the {@link hasErrors()} method to |
|
102 | + * check if the string could be parsed correctly |
|
103 | + * afterwards. |
|
104 | + * |
|
105 | + * @param string $file |
|
106 | + * @throws FileHelper_Exception |
|
107 | + * @return CSVHelper |
|
108 | + * |
|
109 | + * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST |
|
110 | + * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS |
|
111 | + */ |
|
112 | 112 | public function loadFile(string $file) : CSVHelper |
113 | 113 | { |
114 | 114 | $csv = FileHelper::readContents($file); |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | |
123 | 123 | protected $rowCount = 0; |
124 | 124 | |
125 | - /** |
|
126 | - * Specifies that headers are positioned on top, horizontally. |
|
127 | - * @return CSVHelper |
|
128 | - */ |
|
125 | + /** |
|
126 | + * Specifies that headers are positioned on top, horizontally. |
|
127 | + * @return CSVHelper |
|
128 | + */ |
|
129 | 129 | public function setHeadersTop() |
130 | 130 | { |
131 | 131 | return $this->setHeadersPosition(self::HEADERS_TOP); |
132 | 132 | } |
133 | 133 | |
134 | - /** |
|
135 | - * Specifies that headers are positioned on the left, vertically. |
|
136 | - * @return CSVHelper |
|
137 | - */ |
|
134 | + /** |
|
135 | + * Specifies that headers are positioned on the left, vertically. |
|
136 | + * @return CSVHelper |
|
137 | + */ |
|
138 | 138 | public function setHeadersLeft() |
139 | 139 | { |
140 | 140 | return $this->setHeadersPosition(self::HEADERS_LEFT); |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Specifies that there are no headers in the file (default). |
|
145 | - * @return CSVHelper |
|
146 | - */ |
|
143 | + /** |
|
144 | + * Specifies that there are no headers in the file (default). |
|
145 | + * @return CSVHelper |
|
146 | + */ |
|
147 | 147 | public function setHeadersNone() |
148 | 148 | { |
149 | 149 | return $this->setHeadersPosition(self::HEADERS_NONE); |
@@ -173,18 +173,18 @@ discard block |
||
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * Specifies where the headers are positioned in the |
|
178 | - * CSV, or turns them off entirely. Use the class constants |
|
179 | - * to ensure the value is correct. |
|
180 | - * |
|
181 | - * @param string $position |
|
182 | - * @throws CSVHelper_Exception |
|
183 | - * @return CSVHelper |
|
184 | - * @see CSVHelper::HEADERS_LEFT |
|
185 | - * @see CSVHelper::HEADERS_TOP |
|
186 | - * @see CSVHelper::HEADERS_NONE |
|
187 | - */ |
|
176 | + /** |
|
177 | + * Specifies where the headers are positioned in the |
|
178 | + * CSV, or turns them off entirely. Use the class constants |
|
179 | + * to ensure the value is correct. |
|
180 | + * |
|
181 | + * @param string $position |
|
182 | + * @throws CSVHelper_Exception |
|
183 | + * @return CSVHelper |
|
184 | + * @see CSVHelper::HEADERS_LEFT |
|
185 | + * @see CSVHelper::HEADERS_TOP |
|
186 | + * @see CSVHelper::HEADERS_NONE |
|
187 | + */ |
|
188 | 188 | public function setHeadersPosition($position) |
189 | 189 | { |
190 | 190 | $validPositions = array( |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | return $this; |
212 | 212 | } |
213 | 213 | |
214 | - /** |
|
215 | - * Resets all internal data, allowing to start entirely anew |
|
216 | - * with a new file, or to start building a new CSV file from |
|
217 | - * scratch. |
|
218 | - * |
|
219 | - * @return CSVHelper |
|
220 | - */ |
|
214 | + /** |
|
215 | + * Resets all internal data, allowing to start entirely anew |
|
216 | + * with a new file, or to start building a new CSV file from |
|
217 | + * scratch. |
|
218 | + * |
|
219 | + * @return CSVHelper |
|
220 | + */ |
|
221 | 221 | public function reset() |
222 | 222 | { |
223 | 223 | $this->data = array(); |
@@ -234,19 +234,19 @@ discard block |
||
234 | 234 | return $this->data; |
235 | 235 | } |
236 | 236 | |
237 | - /** |
|
238 | - * Retrieves the row at the specified index. |
|
239 | - * If there is no data at the index, this will |
|
240 | - * return an array populated with empty strings |
|
241 | - * for all available columns. |
|
242 | - * |
|
243 | - * Tip: Use the {@link rowExists()} method to check |
|
244 | - * whether the specified row exists. |
|
245 | - * |
|
246 | - * @param integer $index |
|
247 | - * @return array() |
|
248 | - * @see rowExists() |
|
249 | - */ |
|
237 | + /** |
|
238 | + * Retrieves the row at the specified index. |
|
239 | + * If there is no data at the index, this will |
|
240 | + * return an array populated with empty strings |
|
241 | + * for all available columns. |
|
242 | + * |
|
243 | + * Tip: Use the {@link rowExists()} method to check |
|
244 | + * whether the specified row exists. |
|
245 | + * |
|
246 | + * @param integer $index |
|
247 | + * @return array() |
|
248 | + * @see rowExists() |
|
249 | + */ |
|
250 | 250 | public function getRow($index) |
251 | 251 | { |
252 | 252 | if(isset($this->data[$index])) { |
@@ -256,63 +256,63 @@ discard block |
||
256 | 256 | return array_fill(0, $this->rowCount, ''); |
257 | 257 | } |
258 | 258 | |
259 | - /** |
|
260 | - * Checks whether the specified row exists in the data set. |
|
261 | - * @param integer $index |
|
262 | - * @return boolean |
|
263 | - */ |
|
259 | + /** |
|
260 | + * Checks whether the specified row exists in the data set. |
|
261 | + * @param integer $index |
|
262 | + * @return boolean |
|
263 | + */ |
|
264 | 264 | public function rowExists($index) |
265 | 265 | { |
266 | 266 | return isset($this->data[$index]); |
267 | 267 | } |
268 | 268 | |
269 | - /** |
|
270 | - * Counts the amount of rows in the parsed CSV, |
|
271 | - * excluding the headers if any, depending on |
|
272 | - * their position. |
|
273 | - * |
|
274 | - * @return integer |
|
275 | - */ |
|
269 | + /** |
|
270 | + * Counts the amount of rows in the parsed CSV, |
|
271 | + * excluding the headers if any, depending on |
|
272 | + * their position. |
|
273 | + * |
|
274 | + * @return integer |
|
275 | + */ |
|
276 | 276 | public function countRows() |
277 | 277 | { |
278 | 278 | return $this->rowCount; |
279 | 279 | } |
280 | 280 | |
281 | - /** |
|
282 | - * Counts the amount of rows in the parsed CSV, |
|
283 | - * excluding the headers if any, depending on |
|
284 | - * their position. |
|
285 | - * |
|
286 | - * @return integer |
|
287 | - */ |
|
281 | + /** |
|
282 | + * Counts the amount of rows in the parsed CSV, |
|
283 | + * excluding the headers if any, depending on |
|
284 | + * their position. |
|
285 | + * |
|
286 | + * @return integer |
|
287 | + */ |
|
288 | 288 | public function countColumns() |
289 | 289 | { |
290 | 290 | return $this->columnCount; |
291 | 291 | } |
292 | 292 | |
293 | - /** |
|
294 | - * Retrieves the headers, if any. Specify the position of the |
|
295 | - * headers first to ensure this works correctly. |
|
296 | - * |
|
297 | - * @return array Indexed array with header names. |
|
298 | - */ |
|
293 | + /** |
|
294 | + * Retrieves the headers, if any. Specify the position of the |
|
295 | + * headers first to ensure this works correctly. |
|
296 | + * |
|
297 | + * @return array Indexed array with header names. |
|
298 | + */ |
|
299 | 299 | public function getHeaders() |
300 | 300 | { |
301 | 301 | return $this->headers; |
302 | 302 | } |
303 | 303 | |
304 | - /** |
|
305 | - * Retrieves the column at the specified index. If there |
|
306 | - * is no column at the index, this returns an array |
|
307 | - * populated with empty strings. |
|
308 | - * |
|
309 | - * Tip: Use the {@link columnExists()} method to check |
|
310 | - * whether a column exists. |
|
311 | - * |
|
312 | - * @param integer $index |
|
313 | - * @return string[] |
|
314 | - * @see columnExists() |
|
315 | - */ |
|
304 | + /** |
|
305 | + * Retrieves the column at the specified index. If there |
|
306 | + * is no column at the index, this returns an array |
|
307 | + * populated with empty strings. |
|
308 | + * |
|
309 | + * Tip: Use the {@link columnExists()} method to check |
|
310 | + * whether a column exists. |
|
311 | + * |
|
312 | + * @param integer $index |
|
313 | + * @return string[] |
|
314 | + * @see columnExists() |
|
315 | + */ |
|
316 | 316 | public function getColumn($index) |
317 | 317 | { |
318 | 318 | $data = array(); |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | return $data; |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * Checks whether the specified column exists in the data set. |
|
333 | - * @param integer $index |
|
334 | - * @return boolean |
|
335 | - */ |
|
331 | + /** |
|
332 | + * Checks whether the specified column exists in the data set. |
|
333 | + * @param integer $index |
|
334 | + * @return boolean |
|
335 | + */ |
|
336 | 336 | public function columnExists($index) |
337 | 337 | { |
338 | 338 | if($index < $this->columnCount) { |
@@ -396,22 +396,22 @@ discard block |
||
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - /** |
|
400 | - * Checks whether any errors have been encountered |
|
401 | - * while parsing the CSV. |
|
402 | - * |
|
403 | - * @return boolean |
|
404 | - * @see getErrorMessages() |
|
405 | - */ |
|
399 | + /** |
|
400 | + * Checks whether any errors have been encountered |
|
401 | + * while parsing the CSV. |
|
402 | + * |
|
403 | + * @return boolean |
|
404 | + * @see getErrorMessages() |
|
405 | + */ |
|
406 | 406 | public function hasErrors() |
407 | 407 | { |
408 | 408 | return !empty($this->errors); |
409 | 409 | } |
410 | 410 | |
411 | - /** |
|
412 | - * Retrieves all error messages. |
|
413 | - * @return array |
|
414 | - */ |
|
411 | + /** |
|
412 | + * Retrieves all error messages. |
|
413 | + * @return array |
|
414 | + */ |
|
415 | 415 | public function getErrorMessages() |
416 | 416 | { |
417 | 417 | return $this->errors; |