@@ -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(); |
@@ -7,9 +7,9 @@ |
||
7 | 7 | * @author Sebastian Mordziol <[email protected]> |
8 | 8 | */ |
9 | 9 | |
10 | - /** |
|
11 | - * Examples environment config |
|
12 | - */ |
|
10 | + /** |
|
11 | + * Examples environment config |
|
12 | + */ |
|
13 | 13 | require_once '../prepend.php'; |
14 | 14 | |
15 | 15 | use function AppUtils\parseURL; |
@@ -17,33 +17,33 @@ |
||
17 | 17 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
18 | 18 | } |
19 | 19 | |
20 | - /** |
|
21 | - * The composer autoloader |
|
22 | - */ |
|
20 | + /** |
|
21 | + * The composer autoloader |
|
22 | + */ |
|
23 | 23 | require_once $autoload; |
24 | 24 | |
25 | - /** |
|
26 | - * Translation global function. |
|
27 | - * @return string |
|
28 | - */ |
|
25 | + /** |
|
26 | + * Translation global function. |
|
27 | + * @return string |
|
28 | + */ |
|
29 | 29 | function t() |
30 | 30 | { |
31 | 31 | return call_user_func_array('\AppLocalize\t', func_get_args()); |
32 | 32 | } |
33 | 33 | |
34 | - /** |
|
35 | - * Translation global function. |
|
36 | - * @return string |
|
37 | - */ |
|
34 | + /** |
|
35 | + * Translation global function. |
|
36 | + * @return string |
|
37 | + */ |
|
38 | 38 | function pt() |
39 | 39 | { |
40 | 40 | return call_user_func_array('\AppLocalize\pt', func_get_args()); |
41 | 41 | } |
42 | 42 | |
43 | - /** |
|
44 | - * Translation global function. |
|
45 | - * @return string |
|
46 | - */ |
|
43 | + /** |
|
44 | + * Translation global function. |
|
45 | + * @return string |
|
46 | + */ |
|
47 | 47 | function pts() |
48 | 48 | { |
49 | 49 | return call_user_func_array('\AppLocalize\pts', func_get_args()); |
@@ -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; |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * The end of line character used in the INI source string. |
|
65 | - * @return string |
|
66 | - */ |
|
63 | + /** |
|
64 | + * The end of line character used in the INI source string. |
|
65 | + * @return string |
|
66 | + */ |
|
67 | 67 | public function getEOLChar() : string |
68 | 68 | { |
69 | 69 | return $this->eol; |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Factory method: creates a new helper instance loading the |
|
74 | - * ini content from the specified file. |
|
75 | - * |
|
76 | - * @param string $iniPath |
|
77 | - * @throws IniHelper_Exception |
|
78 | - * @return \AppUtils\IniHelper |
|
79 | - */ |
|
72 | + /** |
|
73 | + * Factory method: creates a new helper instance loading the |
|
74 | + * ini content from the specified file. |
|
75 | + * |
|
76 | + * @param string $iniPath |
|
77 | + * @throws IniHelper_Exception |
|
78 | + * @return \AppUtils\IniHelper |
|
79 | + */ |
|
80 | 80 | public static function createFromFile(string $iniPath) |
81 | 81 | { |
82 | 82 | $iniPath = FileHelper::requireFileExists($iniPath); |
@@ -96,35 +96,35 @@ discard block |
||
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Factory method: Creates a new ini helper instance from an ini string. |
|
101 | - * |
|
102 | - * @param string $iniContent |
|
103 | - * @return \AppUtils\IniHelper |
|
104 | - */ |
|
99 | + /** |
|
100 | + * Factory method: Creates a new ini helper instance from an ini string. |
|
101 | + * |
|
102 | + * @param string $iniContent |
|
103 | + * @return \AppUtils\IniHelper |
|
104 | + */ |
|
105 | 105 | public static function createFromString(string $iniContent) |
106 | 106 | { |
107 | 107 | return new IniHelper($iniContent); |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * Factory method: Creates a new empty ini helper. |
|
112 | - * |
|
113 | - * @return \AppUtils\IniHelper |
|
114 | - */ |
|
110 | + /** |
|
111 | + * Factory method: Creates a new empty ini helper. |
|
112 | + * |
|
113 | + * @return \AppUtils\IniHelper |
|
114 | + */ |
|
115 | 115 | public static function createNew() |
116 | 116 | { |
117 | 117 | return self::createFromString(''); |
118 | 118 | } |
119 | 119 | |
120 | - /** |
|
121 | - * Adds a new data section, and returns the section instance. |
|
122 | - * If a section with the name already exists, returns that |
|
123 | - * section instead of creating a new one. |
|
124 | - * |
|
125 | - * @param string $name |
|
126 | - * @return IniHelper_Section |
|
127 | - */ |
|
120 | + /** |
|
121 | + * Adds a new data section, and returns the section instance. |
|
122 | + * If a section with the name already exists, returns that |
|
123 | + * section instead of creating a new one. |
|
124 | + * |
|
125 | + * @param string $name |
|
126 | + * @return IniHelper_Section |
|
127 | + */ |
|
128 | 128 | public function addSection(string $name) : IniHelper_Section |
129 | 129 | { |
130 | 130 | if(!isset($this->sections[$name])) { |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | return $this->sections[$name]; |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves a section by its name, if it exists. |
|
139 | - * |
|
140 | - * @param string $name |
|
141 | - * @return IniHelper_Section|NULL |
|
142 | - */ |
|
137 | + /** |
|
138 | + * Retrieves a section by its name, if it exists. |
|
139 | + * |
|
140 | + * @param string $name |
|
141 | + * @return IniHelper_Section|NULL |
|
142 | + */ |
|
143 | 143 | public function getSection(string $name) : ?IniHelper_Section |
144 | 144 | { |
145 | 145 | if(isset($this->sections[$name])) { |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | return null; |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Gets the data from the INI file as an associative array. |
|
154 | - * |
|
155 | - * @return array |
|
156 | - */ |
|
152 | + /** |
|
153 | + * Gets the data from the INI file as an associative array. |
|
154 | + * |
|
155 | + * @return array |
|
156 | + */ |
|
157 | 157 | public function toArray() : array |
158 | 158 | { |
159 | 159 | $result = array(); |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | return $result; |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * Saves the INI content to the target file. |
|
178 | - * |
|
179 | - * @param string $filePath |
|
180 | - * @return IniHelper |
|
181 | - * @throws FileHelper_Exception |
|
182 | - * |
|
183 | - * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE |
|
184 | - * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
|
185 | - * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
|
186 | - */ |
|
176 | + /** |
|
177 | + * Saves the INI content to the target file. |
|
178 | + * |
|
179 | + * @param string $filePath |
|
180 | + * @return IniHelper |
|
181 | + * @throws FileHelper_Exception |
|
182 | + * |
|
183 | + * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE |
|
184 | + * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
|
185 | + * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
|
186 | + */ |
|
187 | 187 | public function saveToFile(string $filePath) : IniHelper |
188 | 188 | { |
189 | 189 | FileHelper::saveFile($filePath, $this->saveToString()); |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | return $this; |
192 | 192 | } |
193 | 193 | |
194 | - /** |
|
195 | - * Returns the INI content as string. |
|
196 | - * |
|
197 | - * @return string |
|
198 | - */ |
|
194 | + /** |
|
195 | + * Returns the INI content as string. |
|
196 | + * |
|
197 | + * @return string |
|
198 | + */ |
|
199 | 199 | public function saveToString() : string |
200 | 200 | { |
201 | 201 | $parts = array(); |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | return implode($this->eol, $parts); |
209 | 209 | } |
210 | 210 | |
211 | - /** |
|
212 | - * Sets or adds the value of a setting in the INI content. |
|
213 | - * If the setting does not exist, it is added. Otherwise, |
|
214 | - * the existing value is overwritten. |
|
215 | - * |
|
216 | - * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>. |
|
217 | - * @param mixed $value |
|
218 | - * @return IniHelper |
|
219 | - */ |
|
211 | + /** |
|
212 | + * Sets or adds the value of a setting in the INI content. |
|
213 | + * If the setting does not exist, it is added. Otherwise, |
|
214 | + * the existing value is overwritten. |
|
215 | + * |
|
216 | + * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>. |
|
217 | + * @param mixed $value |
|
218 | + * @return IniHelper |
|
219 | + */ |
|
220 | 220 | public function setValue(string $path, $value) : IniHelper |
221 | 221 | { |
222 | 222 | $path = $this->parsePath($path); |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | return $this; |
236 | 236 | } |
237 | 237 | |
238 | - /** |
|
239 | - * Checks whether a section with the specified name exists. |
|
240 | - * |
|
241 | - * @param string $name |
|
242 | - * @return bool |
|
243 | - */ |
|
238 | + /** |
|
239 | + * Checks whether a section with the specified name exists. |
|
240 | + * |
|
241 | + * @param string $name |
|
242 | + * @return bool |
|
243 | + */ |
|
244 | 244 | public function sectionExists(string $name) : bool |
245 | 245 | { |
246 | 246 | foreach($this->sections as $section) { |
@@ -252,23 +252,23 @@ discard block |
||
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
255 | - /** |
|
256 | - * Retrieves the default section, which is used to add |
|
257 | - * values in the root of the document. |
|
258 | - * |
|
259 | - * @return IniHelper_Section |
|
260 | - */ |
|
255 | + /** |
|
256 | + * Retrieves the default section, which is used to add |
|
257 | + * values in the root of the document. |
|
258 | + * |
|
259 | + * @return IniHelper_Section |
|
260 | + */ |
|
261 | 261 | public function getDefaultSection() : IniHelper_Section |
262 | 262 | { |
263 | 263 | return $this->addSection(self::SECTION_DEFAULT); |
264 | 264 | } |
265 | 265 | |
266 | - /** |
|
267 | - * Retrieves all variable lines for the specified path. |
|
268 | - * |
|
269 | - * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>. |
|
270 | - * @return array|\AppUtils\IniHelper_Line[] |
|
271 | - */ |
|
266 | + /** |
|
267 | + * Retrieves all variable lines for the specified path. |
|
268 | + * |
|
269 | + * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>. |
|
270 | + * @return array|\AppUtils\IniHelper_Line[] |
|
271 | + */ |
|
272 | 272 | public function getLinesByVariable(string $path) |
273 | 273 | { |
274 | 274 | $path = $this->parsePath($path); |
@@ -23,101 +23,101 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class SVNHelper |
25 | 25 | { |
26 | - /** |
|
27 | - * @var integer |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var integer |
|
28 | + */ |
|
29 | 29 | const ERROR_LOCAL_PATH_DOES_NOT_EXIST = 22401; |
30 | 30 | |
31 | - /** |
|
32 | - * @var integer |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var integer |
|
33 | + */ |
|
34 | 34 | const ERROR_INVALID_REP_URL = 22402; |
35 | 35 | |
36 | - /** |
|
37 | - * @var integer |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var integer |
|
38 | + */ |
|
39 | 39 | const ERROR_PATH_IS_OUTSIDE_REPOSITORY = 22403; |
40 | 40 | |
41 | - /** |
|
42 | - * @var integer |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var integer |
|
43 | + */ |
|
44 | 44 | const ERROR_TARGET_FOLDER_IS_A_FILE = 22404; |
45 | 45 | |
46 | - /** |
|
47 | - * @var integer |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var integer |
|
48 | + */ |
|
49 | 49 | const ERROR_CANNOT_ADD_INEXISTENT_FILE = 22405; |
50 | 50 | |
51 | - /** |
|
52 | - * @var integer |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var integer |
|
53 | + */ |
|
54 | 54 | const ERROR_TARGET_PATH_NOT_FOUND = 22406; |
55 | 55 | |
56 | - /** |
|
57 | - * @var integer |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var integer |
|
58 | + */ |
|
59 | 59 | const ERROR_INVALID_TARGET_TYPE = 22407; |
60 | 60 | |
61 | - /** |
|
62 | - * @var integer |
|
63 | - */ |
|
61 | + /** |
|
62 | + * @var integer |
|
63 | + */ |
|
64 | 64 | const ERROR_INVALID_LOG_CALLBACK = 22408; |
65 | 65 | |
66 | - /** |
|
67 | - * @var SVNHelper_Target_Folder |
|
68 | - */ |
|
66 | + /** |
|
67 | + * @var SVNHelper_Target_Folder |
|
68 | + */ |
|
69 | 69 | protected $target; |
70 | 70 | |
71 | - /** |
|
72 | - * @var string |
|
73 | - */ |
|
71 | + /** |
|
72 | + * @var string |
|
73 | + */ |
|
74 | 74 | protected $path; |
75 | 75 | |
76 | - /** |
|
77 | - * @var string |
|
78 | - */ |
|
76 | + /** |
|
77 | + * @var string |
|
78 | + */ |
|
79 | 79 | protected $url; |
80 | 80 | |
81 | - /** |
|
82 | - * @var string |
|
83 | - */ |
|
81 | + /** |
|
82 | + * @var string |
|
83 | + */ |
|
84 | 84 | protected $user; |
85 | 85 | |
86 | - /** |
|
87 | - * @var string |
|
88 | - */ |
|
86 | + /** |
|
87 | + * @var string |
|
88 | + */ |
|
89 | 89 | protected $pass; |
90 | 90 | |
91 | - /** |
|
92 | - * @var array |
|
93 | - */ |
|
91 | + /** |
|
92 | + * @var array |
|
93 | + */ |
|
94 | 94 | protected $options = array( |
95 | 95 | 'binaries-path' => '' |
96 | 96 | ); |
97 | 97 | |
98 | - /** |
|
99 | - * @var boolean |
|
100 | - */ |
|
98 | + /** |
|
99 | + * @var boolean |
|
100 | + */ |
|
101 | 101 | protected $isWindows = false; |
102 | 102 | |
103 | - /** |
|
104 | - * @var array |
|
105 | - */ |
|
103 | + /** |
|
104 | + * @var array |
|
105 | + */ |
|
106 | 106 | protected $normalize = array( |
107 | 107 | 'from' => '\\', |
108 | 108 | 'to' => '/' |
109 | 109 | ); |
110 | 110 | |
111 | - /** |
|
112 | - * @var string |
|
113 | - */ |
|
111 | + /** |
|
112 | + * @var string |
|
113 | + */ |
|
114 | 114 | protected $sourcePath; |
115 | 115 | |
116 | - /** |
|
117 | - * @param string $repPath The path to the repository |
|
118 | - * @param string $repURL The SVN URL to the repository |
|
119 | - * @throws SVNHelper_Exception |
|
120 | - */ |
|
116 | + /** |
|
117 | + * @param string $repPath The path to the repository |
|
118 | + * @param string $repURL The SVN URL to the repository |
|
119 | + * @throws SVNHelper_Exception |
|
120 | + */ |
|
121 | 121 | public function __construct(string $repPath, string $repURL) |
122 | 122 | { |
123 | 123 | $this->isWindows = substr(PHP_OS, 0, 3) == 'WIN'; |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | return $this->pass; |
179 | 179 | } |
180 | 180 | |
181 | - /** |
|
182 | - * Normalizes slashes in the path according to the |
|
183 | - * operating system, i.e. forward slashes for NIX-systems |
|
184 | - * and backward slashes for Windows. |
|
185 | - * |
|
186 | - * @param string $path An absolute path to normalize |
|
187 | - * @param bool $relativize Whether to return a path relative to the repository |
|
188 | - * @throws SVNHelper_Exception |
|
189 | - * @return string |
|
190 | - */ |
|
181 | + /** |
|
182 | + * Normalizes slashes in the path according to the |
|
183 | + * operating system, i.e. forward slashes for NIX-systems |
|
184 | + * and backward slashes for Windows. |
|
185 | + * |
|
186 | + * @param string $path An absolute path to normalize |
|
187 | + * @param bool $relativize Whether to return a path relative to the repository |
|
188 | + * @throws SVNHelper_Exception |
|
189 | + * @return string |
|
190 | + */ |
|
191 | 191 | public function normalizePath($path, $relativize=false) |
192 | 192 | { |
193 | 193 | if(empty($path)) { |
@@ -222,32 +222,32 @@ discard block |
||
222 | 222 | ); |
223 | 223 | } |
224 | 224 | |
225 | - /** |
|
226 | - * Retrieves the path slash style according to the |
|
227 | - * current operating system. |
|
228 | - * |
|
229 | - * @return string |
|
230 | - */ |
|
225 | + /** |
|
226 | + * Retrieves the path slash style according to the |
|
227 | + * current operating system. |
|
228 | + * |
|
229 | + * @return string |
|
230 | + */ |
|
231 | 231 | public function getSlash() |
232 | 232 | { |
233 | 233 | return $this->normalize['to']; |
234 | 234 | } |
235 | 235 | |
236 | - /** |
|
237 | - * Keeps instances of files. |
|
238 | - * @var SVNHelper_Target[] |
|
239 | - */ |
|
236 | + /** |
|
237 | + * Keeps instances of files. |
|
238 | + * @var SVNHelper_Target[] |
|
239 | + */ |
|
240 | 240 | protected $targets = array(); |
241 | 241 | |
242 | - /** |
|
243 | - * Retrieves a file instance from the SVN repository: |
|
244 | - * this allows all possible operations on the file as |
|
245 | - * well as accessing more information on it. |
|
246 | - * |
|
247 | - * @param string $path A path to the file, relative to the repository path or absolute. |
|
248 | - * @return SVNHelper_Target_File |
|
249 | - * @throws SVNHelper_Exception |
|
250 | - */ |
|
242 | + /** |
|
243 | + * Retrieves a file instance from the SVN repository: |
|
244 | + * this allows all possible operations on the file as |
|
245 | + * well as accessing more information on it. |
|
246 | + * |
|
247 | + * @param string $path A path to the file, relative to the repository path or absolute. |
|
248 | + * @return SVNHelper_Target_File |
|
249 | + * @throws SVNHelper_Exception |
|
250 | + */ |
|
251 | 251 | public function getFile($path) |
252 | 252 | { |
253 | 253 | $path = $this->filterPath($path); |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | return $this->getTarget('File', $this->relativizePath($path)); |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * Retrieves a folder instance from the SVN repository: |
|
260 | - * This allows all possible operations on the folder as |
|
261 | - * well as accessing more information on it. |
|
262 | - * |
|
263 | - * @param string $path |
|
264 | - * @return SVNHelper_Target_Folder |
|
265 | - * @throws SVNHelper_Exception |
|
266 | - */ |
|
258 | + /** |
|
259 | + * Retrieves a folder instance from the SVN repository: |
|
260 | + * This allows all possible operations on the folder as |
|
261 | + * well as accessing more information on it. |
|
262 | + * |
|
263 | + * @param string $path |
|
264 | + * @return SVNHelper_Target_Folder |
|
265 | + * @throws SVNHelper_Exception |
|
266 | + */ |
|
267 | 267 | public function getFolder($path) |
268 | 268 | { |
269 | 269 | $path = $this->filterPath($path); |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | return $this->getTarget('Folder', $this->relativizePath($path)); |
272 | 272 | } |
273 | 273 | |
274 | - /** |
|
275 | - * Passes the path through realpath and ensures it exists. |
|
276 | - * |
|
277 | - * @param string $path |
|
278 | - * @throws SVNHelper_Exception |
|
279 | - * @return string |
|
280 | - */ |
|
274 | + /** |
|
275 | + * Passes the path through realpath and ensures it exists. |
|
276 | + * |
|
277 | + * @param string $path |
|
278 | + * @throws SVNHelper_Exception |
|
279 | + * @return string |
|
280 | + */ |
|
281 | 281 | protected function filterPath($path) |
282 | 282 | { |
283 | 283 | if(empty($path)) { |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
305 | - /** |
|
306 | - * Retrieves a target file or folder within the repository. |
|
307 | - * |
|
308 | - * @param string $type The target type, "File" or "Folder". |
|
309 | - * @param string $relativePath A path relative to the root folder. |
|
310 | - * @return SVNHelper_Target |
|
311 | - */ |
|
305 | + /** |
|
306 | + * Retrieves a target file or folder within the repository. |
|
307 | + * |
|
308 | + * @param string $type The target type, "File" or "Folder". |
|
309 | + * @param string $relativePath A path relative to the root folder. |
|
310 | + * @return SVNHelper_Target |
|
311 | + */ |
|
312 | 312 | protected function getTarget($type, $relativePath) |
313 | 313 | { |
314 | 314 | $key = $type.':'.$relativePath; |
@@ -356,33 +356,33 @@ discard block |
||
356 | 356 | return $this->url; |
357 | 357 | } |
358 | 358 | |
359 | - /** |
|
360 | - * Updates the whole SVN repository from the root folder. |
|
361 | - * @return SVNHelper_CommandResult |
|
362 | - */ |
|
359 | + /** |
|
360 | + * Updates the whole SVN repository from the root folder. |
|
361 | + * @return SVNHelper_CommandResult |
|
362 | + */ |
|
363 | 363 | public function runUpdate() |
364 | 364 | { |
365 | 365 | return $this->createUpdate($this->target)->execute(); |
366 | 366 | } |
367 | 367 | |
368 | - /** |
|
369 | - * Creates an update command for the target file or folder. |
|
370 | - * This can be configured further before it is executed. |
|
371 | - * |
|
372 | - * @param SVNHelper_Target $target |
|
373 | - * @return SVNHelper_Command_Update |
|
374 | - */ |
|
368 | + /** |
|
369 | + * Creates an update command for the target file or folder. |
|
370 | + * This can be configured further before it is executed. |
|
371 | + * |
|
372 | + * @param SVNHelper_Target $target |
|
373 | + * @return SVNHelper_Command_Update |
|
374 | + */ |
|
375 | 375 | public function createUpdate(SVNHelper_Target $target) |
376 | 376 | { |
377 | 377 | return $this->createCommand('Update', $target); |
378 | 378 | } |
379 | 379 | |
380 | - /** |
|
381 | - * Creates an add command for the targt file or folder. |
|
382 | - * |
|
383 | - * @param SVNHelper_Target $target |
|
384 | - * @return SVNHelper_Command_Add |
|
385 | - */ |
|
380 | + /** |
|
381 | + * Creates an add command for the targt file or folder. |
|
382 | + * |
|
383 | + * @param SVNHelper_Target $target |
|
384 | + * @return SVNHelper_Command_Add |
|
385 | + */ |
|
386 | 386 | public function createAdd(SVNHelper_Target $target) |
387 | 387 | { |
388 | 388 | return $this->createCommand('Add', $target); |
@@ -399,12 +399,12 @@ discard block |
||
399 | 399 | return $this->createCommand('Info', $target); |
400 | 400 | } |
401 | 401 | |
402 | - /** |
|
403 | - * Creates a status command for the target file or folder. |
|
404 | - * |
|
405 | - * @param SVNHelper_Target $target |
|
406 | - * @return SVNHelper_Command_Status |
|
407 | - */ |
|
402 | + /** |
|
403 | + * Creates a status command for the target file or folder. |
|
404 | + * |
|
405 | + * @param SVNHelper_Target $target |
|
406 | + * @return SVNHelper_Command_Status |
|
407 | + */ |
|
408 | 408 | public function createStatus(SVNHelper_Target $target) |
409 | 409 | { |
410 | 410 | return $this->createCommand('Status', $target); |
@@ -429,28 +429,28 @@ discard block |
||
429 | 429 | return $cmd; |
430 | 430 | } |
431 | 431 | |
432 | - /** |
|
433 | - * Creates a path relative to the repository for the target |
|
434 | - * file or folder, from an absolute path. |
|
435 | - * |
|
436 | - * @param string $path An absolute path. |
|
437 | - * @return string |
|
438 | - */ |
|
432 | + /** |
|
433 | + * Creates a path relative to the repository for the target |
|
434 | + * file or folder, from an absolute path. |
|
435 | + * |
|
436 | + * @param string $path An absolute path. |
|
437 | + * @return string |
|
438 | + */ |
|
439 | 439 | public function relativizePath($path) |
440 | 440 | { |
441 | 441 | return $this->normalizePath($path, true); |
442 | 442 | } |
443 | 443 | |
444 | - /** |
|
445 | - * Adds a folder: creates it as necessary (recursive), |
|
446 | - * and adds it to be committed if it is not versioned yet. |
|
447 | - * Use this instead of {@link getFolder()} when you are |
|
448 | - * not sure that it exists yet, and will need it. |
|
449 | - * |
|
450 | - * @param string $path Absolute or relative path to the folder |
|
451 | - * @throws SVNHelper_Exception |
|
452 | - * @return SVNHelper_Target_Folder |
|
453 | - */ |
|
444 | + /** |
|
445 | + * Adds a folder: creates it as necessary (recursive), |
|
446 | + * and adds it to be committed if it is not versioned yet. |
|
447 | + * Use this instead of {@link getFolder()} when you are |
|
448 | + * not sure that it exists yet, and will need it. |
|
449 | + * |
|
450 | + * @param string $path Absolute or relative path to the folder |
|
451 | + * @throws SVNHelper_Exception |
|
452 | + * @return SVNHelper_Target_Folder |
|
453 | + */ |
|
454 | 454 | public function addFolder($path) |
455 | 455 | { |
456 | 456 | if(is_dir($path)) { |
@@ -500,14 +500,14 @@ discard block |
||
500 | 500 | |
501 | 501 | protected static $logCallback; |
502 | 502 | |
503 | - /** |
|
504 | - * Sets the callback function/method to use for |
|
505 | - * SVH helper log messages. This gets the message |
|
506 | - * and the SVNHelper instance as parameters. |
|
507 | - * |
|
508 | - * @param callable $callback |
|
509 | - * @throws SVNHelper_Exception |
|
510 | - */ |
|
503 | + /** |
|
504 | + * Sets the callback function/method to use for |
|
505 | + * SVH helper log messages. This gets the message |
|
506 | + * and the SVNHelper instance as parameters. |
|
507 | + * |
|
508 | + * @param callable $callback |
|
509 | + * @throws SVNHelper_Exception |
|
510 | + */ |
|
511 | 511 | public static function setLogCallback($callback) |
512 | 512 | { |
513 | 513 | if(!is_callable($callback)) { |
@@ -528,22 +528,22 @@ discard block |
||
528 | 528 | } |
529 | 529 | } |
530 | 530 | |
531 | - /** |
|
532 | - * Retrieves information about the file, and adds it |
|
533 | - * to be committed later if it not versioned yet. |
|
534 | - * |
|
535 | - * @param string $path |
|
536 | - * @return SVNHelper_Target_File |
|
537 | - */ |
|
531 | + /** |
|
532 | + * Retrieves information about the file, and adds it |
|
533 | + * to be committed later if it not versioned yet. |
|
534 | + * |
|
535 | + * @param string $path |
|
536 | + * @return SVNHelper_Target_File |
|
537 | + */ |
|
538 | 538 | public function addFile($path) |
539 | 539 | { |
540 | 540 | return $this->getFile($path)->runAdd(); |
541 | 541 | } |
542 | 542 | |
543 | - /** |
|
544 | - * Commits all changes in the repository. |
|
545 | - * @param string $message The commit message to log. |
|
546 | - */ |
|
543 | + /** |
|
544 | + * Commits all changes in the repository. |
|
545 | + * @param string $message The commit message to log. |
|
546 | + */ |
|
547 | 547 | public function runCommit($message) |
548 | 548 | { |
549 | 549 | $this->createCommit($this->getFolder($this->path), $message)->execute(); |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | 'WriteThreshold' => 100 |
37 | 37 | ); |
38 | 38 | |
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | 42 | protected $file; |
43 | 43 | |
44 | - /** |
|
45 | - * @var \ZipArchive |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var \ZipArchive |
|
46 | + */ |
|
47 | 47 | protected $zip; |
48 | 48 | |
49 | 49 | public function __construct(string $targetFile) |
@@ -51,35 +51,35 @@ discard block |
||
51 | 51 | $this->file = $targetFile; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Sets an option, among the available options: |
|
56 | - * |
|
57 | - * <ul> |
|
58 | - * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
59 | - * </ul> |
|
60 | - * |
|
61 | - * @param string $name |
|
62 | - * @param mixed $value |
|
63 | - * @return ZIPHelper |
|
64 | - */ |
|
54 | + /** |
|
55 | + * Sets an option, among the available options: |
|
56 | + * |
|
57 | + * <ul> |
|
58 | + * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li> |
|
59 | + * </ul> |
|
60 | + * |
|
61 | + * @param string $name |
|
62 | + * @param mixed $value |
|
63 | + * @return ZIPHelper |
|
64 | + */ |
|
65 | 65 | public function setOption(string $name, $value) : ZIPHelper |
66 | 66 | { |
67 | 67 | $this->options[$name] = $value; |
68 | 68 | return $this; |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Adds a file to the zip. By default, the file is stored |
|
73 | - * with the same name in the root of the zip. Use the optional |
|
74 | - * parameter to change the location in the zip. |
|
75 | - * |
|
76 | - * @param string $filePath |
|
77 | - * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
78 | - * @throws ZIPHelper_Exception |
|
79 | - * @return bool |
|
80 | - * |
|
81 | - * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
82 | - */ |
|
71 | + /** |
|
72 | + * Adds a file to the zip. By default, the file is stored |
|
73 | + * with the same name in the root of the zip. Use the optional |
|
74 | + * parameter to change the location in the zip. |
|
75 | + * |
|
76 | + * @param string $filePath |
|
77 | + * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root. |
|
78 | + * @throws ZIPHelper_Exception |
|
79 | + * @return bool |
|
80 | + * |
|
81 | + * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
|
82 | + */ |
|
83 | 83 | public function addFile(string $filePath, ?string $zipPath=null) : bool |
84 | 84 | { |
85 | 85 | $this->open(); |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | return $fileName; |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * Like {@link ZIPHelper::download()}, but deletes the |
|
260 | - * file after sending it to the browser. |
|
261 | - * |
|
262 | - * @param string|NULL $fileName Override the ZIP's file name for the download |
|
263 | - * @see ZIPHelper::download() |
|
264 | - */ |
|
258 | + /** |
|
259 | + * Like {@link ZIPHelper::download()}, but deletes the |
|
260 | + * file after sending it to the browser. |
|
261 | + * |
|
262 | + * @param string|NULL $fileName Override the ZIP's file name for the download |
|
263 | + * @see ZIPHelper::download() |
|
264 | + */ |
|
265 | 265 | public function downloadAndDelete(?string $fileName=null) |
266 | 266 | { |
267 | 267 | $this->download($fileName); |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | FileHelper::deleteFile($this->file); |
270 | 270 | } |
271 | 271 | |
272 | - /** |
|
273 | - * Extracts all files and folders from the zip to the |
|
274 | - * target folder. If no folder is specified, the files |
|
275 | - * are extracted into the same folder as the zip itself. |
|
276 | - * |
|
277 | - * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
278 | - * @return boolean |
|
279 | - */ |
|
272 | + /** |
|
273 | + * Extracts all files and folders from the zip to the |
|
274 | + * target folder. If no folder is specified, the files |
|
275 | + * are extracted into the same folder as the zip itself. |
|
276 | + * |
|
277 | + * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
|
278 | + * @return boolean |
|
279 | + */ |
|
280 | 280 | public function extractAll(?string $outputFolder=null) : bool |
281 | 281 | { |
282 | 282 | if(empty($outputFolder)) { |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - /** |
|
293 | - * @return \ZipArchive |
|
294 | - */ |
|
292 | + /** |
|
293 | + * @return \ZipArchive |
|
294 | + */ |
|
295 | 295 | public function getArchive() : \ZipArchive |
296 | 296 | { |
297 | 297 | $this->open(); |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | return $this->zip; |
300 | 300 | } |
301 | 301 | |
302 | - /** |
|
303 | - * JSON encodes the specified data and adds the json as |
|
304 | - * a file in the ZIP archive. |
|
305 | - * |
|
306 | - * @param mixed $data |
|
307 | - * @param string $zipPath |
|
308 | - * @return boolean |
|
309 | - */ |
|
302 | + /** |
|
303 | + * JSON encodes the specified data and adds the json as |
|
304 | + * a file in the ZIP archive. |
|
305 | + * |
|
306 | + * @param mixed $data |
|
307 | + * @param string $zipPath |
|
308 | + * @return boolean |
|
309 | + */ |
|
310 | 310 | public function addJSON($data, $zipPath) |
311 | 311 | { |
312 | 312 | return $this->addString( |
@@ -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) { |