@@ -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 | - * @return \AppUtils\IniHelper |
|
78 | - * @throws IniHelper_Exception |
|
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 | + * @return \AppUtils\IniHelper |
|
78 | + * @throws IniHelper_Exception |
|
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); |