@@ -49,7 +49,7 @@ public function exists(): bool
49
49
*
50
50
* @param bool $asObject If true and the value is an array, it is returned as an object.
51
51
*
52
- * @throws GetFileException if the file could not be read .
52
+ * @throws GetFileException if file reading failed .
53
53
* @throws JsonErrorException if the file contains invalid JSON.
54
54
*
55
55
* @return mixed the contents of the JSON file.
@@ -71,15 +71,15 @@ public function get(bool $asObject = false): mixed
71
71
* Set the contents of a JSON or a key within the file.
72
72
*
73
73
* @param mixed $content The data that will be written to the file or a key within the file.
74
- * @param string $dot The dot notation string representing the key to be modified within the file.
74
+ * @param string $dot The dot notation representing the key to be modified within the file.
75
75
*
76
- * @throws GetFileException if the file could not be read .
76
+ * @throws GetFileException if file reading failed .
77
77
* @throws JsonErrorException if the file contains invalid JSON.
78
- * @throws CreateDirectoryException if the file could not be created .
79
- * @throws CreateFileException if the directory could not be created .
80
- * @throws NoIterableElementException if the location specified by $dot is not an array.
78
+ * @throws CreateFileException if file creation failed .
79
+ * @throws CreateDirectoryException if directory creation failed .
80
+ * @throws NoIterableElementException if $dot isn't an array location .
81
81
*
82
- * @return mixed the content of the JSON file after the merge operation.
82
+ * @return mixed the content of the JSON file after the set operation.
83
83
*/
84
84
public function set (mixed $ content = [], string $ dot = null ): array |bool |int |null |string
85
85
{
@@ -97,12 +97,12 @@ public function set(mixed $content = [], string $dot = null): array|bool|int|nul
97
97
* Merge the provided data with the contents of a JSON file or a key within the file.
98
98
*
99
99
* @param mixed $content The data that will be written to the file or a key within the file.
100
- * @param string $dot The dot notation string representing the key to be modified within the file.
100
+ * @param string $dot The dot notation representing the key to be modified within the file.
101
101
*
102
- * @throws GetFileException if the file could not be read .
102
+ * @throws GetFileException if file reading failed .
103
103
* @throws JsonErrorException if the file contains invalid JSON.
104
- * @throws NoIterableFileException if the file does not contain an array.
105
- * @throws NoIterableElementException if the location specified by $dot is not an array.
104
+ * @throws NoIterableFileException if the file isn't a JSON array.
105
+ * @throws NoIterableElementException if $dot isn't an array location .
106
106
*
107
107
* @return mixed the content of the JSON file after the merge operation.
108
108
*/
@@ -123,12 +123,12 @@ public function merge(array|object $content, string $dot = null): array
123
123
/**
124
124
* Remove and get the last element of a JSON file or a key within the file.
125
125
*
126
- * @param string $dot The dot notation string representing the key to be modified within the file.
126
+ * @param string $dot The dot notation representing the key to be modified within the file.
127
127
*
128
- * @throws GetFileException if the file could not be read .
128
+ * @throws GetFileException if file reading failed .
129
129
* @throws JsonErrorException if the file contains invalid JSON.
130
- * @throws NoIterableFileException if the file does not contain an array.
131
- * @throws NoIterableElementException if the location specified by $dot is not an array.
130
+ * @throws NoIterableFileException if the file isn't a JSON array.
131
+ * @throws NoIterableElementException if $dot isn't an array location .
132
132
*
133
133
* @return mixed|null the last value of JSON file, or null if array is empty.
134
134
*/
@@ -152,12 +152,12 @@ public function pop(string $dot = null): mixed
152
152
* Add the provided data to the end of the contents of a JSON file or a key within the file.
153
153
*
154
154
* @param mixed $content The data that will be written to the file or a key within the file.
155
- * @param string $dot The dot notation string representing the key to be modified within the file.
155
+ * @param string $dot The dot notation representing the key to be modified within the file.
156
156
*
157
- * @throws GetFileException if the file could not be read .
157
+ * @throws GetFileException if file reading failed .
158
158
* @throws JsonErrorException if the file contains invalid JSON.
159
- * @throws NoIterableFileException if the file does not contain an array.
160
- * @throws NoIterableElementException if the location specified by $dot is not an array.
159
+ * @throws NoIterableFileException if the file isn't a JSON array.
160
+ * @throws NoIterableElementException if $dot isn't an array location .
161
161
*
162
162
* @return mixed the content of the JSON file after the push operation.
163
163
*/
@@ -179,12 +179,12 @@ public function push(mixed $content, string $dot = null): array
179
179
/**
180
180
* Remove and get the first element of a JSON file or a key within the file.
181
181
*
182
- * @param string $dot The dot notation string representing the key to be modified within the file.
182
+ * @param string $dot The dot notation representing the key to be modified within the file.
183
183
*
184
- * @throws GetFileException if the file could not be read .
184
+ * @throws GetFileException if file reading failed .
185
185
* @throws JsonErrorException if the file contains invalid JSON.
186
- * @throws NoIterableFileException if the file does not contain an array.
187
- * @throws NoIterableElementException if the location specified by $dot is not an array.
186
+ * @throws NoIterableFileException if the file isn't a JSON array.
187
+ * @throws NoIterableElementException if $dot isn't an array location .
188
188
*
189
189
* @return mixed|null the shifted value, or null if array is empty.
190
190
*/
@@ -207,12 +207,12 @@ public function shift(string $dot = null): mixed
207
207
/**
208
208
* Remove a key and its value from the contents of a JSON file.
209
209
*
210
- * @param string $dot The dot notation string representing the key to be modified within the file.
210
+ * @param string $dot The dot notation representing the key to be modified within the file.
211
211
* @param bool $reindexed If true, the array will be re-indexed.
212
212
*
213
- * @throws GetFileException if the file could not be read .
213
+ * @throws GetFileException if file reading failed .
214
214
* @throws JsonErrorException if the file contains invalid JSON.
215
- * @throws NoIterableFileException if the file does not contain an array.
215
+ * @throws NoIterableFileException if the file isn't a JSON array.
216
216
*
217
217
* @return array the content of the JSON file after the unset operation.
218
218
*/
@@ -230,12 +230,12 @@ public function unset(string $dot, bool $reindexed = false): array
230
230
* Add the provided data to the beginning of the contents of a JSON file or a key within the file.
231
231
*
232
232
* @param mixed $content The data that will be written to the file or a key within the file.
233
- * @param string $dot The dot notation string representing the key to be modified within the file.
233
+ * @param string $dot The dot notation representing the key to be modified within the file.
234
234
*
235
- * @throws GetFileException if the file could not be read .
235
+ * @throws GetFileException if file reading failed .
236
236
* @throws JsonErrorException if the file contains invalid JSON.
237
- * @throws NoIterableFileException if the file does not contain an array.
238
- * @throws NoIterableElementException if the location specified by $dot is not an array.
237
+ * @throws NoIterableFileException if the file isn't a JSON array.
238
+ * @throws NoIterableElementException if $dot isn't an array location .
239
239
*
240
240
* @return mixed the content of the JSON file after the unshift operation.
241
241
*/
@@ -257,13 +257,12 @@ public function unshift(mixed $content, string $dot = null): mixed
257
257
/**
258
258
* Modify a nested array key by a dot notation string.
259
259
*
260
- * @param string $type The type of modification to perform on the array.
261
- * This can be: merge|pop|push|set|unset.
260
+ * @param string $type The type of operation to perform on the array.
262
261
* @param mixed $array The array that will be modified.
263
262
* @param mixed $dot The dot notation string representing the key of the nested array.
264
263
* @param mixed $content The value that will be set or pushed to the array.
265
264
*
266
- * @throws NoIterableElementException if the location specified by $dot is not an array.
265
+ * @throws NoIterableElementException if $dot isn't an array location .
267
266
*
268
267
* @return mixed the contents that have been written to the file after the unshift operation.
269
268
*/
@@ -311,8 +310,8 @@ protected function modifyArrayByDot(string $type, array &$array, string $dot, mi
311
310
*
312
311
* @param mixed $content The data to be encoded as JSON and saved to the file.
313
312
*
314
- * @throws CreateFileException if the directory could not be created .
315
- * @throws CreateDirectoryException if the file could not be created .
313
+ * @throws CreateFileException if directory creation failed .
314
+ * @throws CreateDirectoryException if file creation failed .
316
315
*
317
316
* @return mixed the contents that have been saved to the file.
318
317
*/
@@ -339,8 +338,8 @@ protected function saveToJsonFile(mixed $content): mixed
339
338
* @param mixed $data The array to check.
340
339
* @param string $param The dot notation or filepath.
341
340
*
342
- * @throws NoIterableFileException if the file does not contain an array.
343
- * @throws NoIterableElementException if the location specified by $dot is not an array.
341
+ * @throws NoIterableFileException if the file isn't a JSON array.
342
+ * @throws NoIterableElementException if $dot isn't an array location .
344
343
*/
345
344
protected function failIfNotArray (string $ type , mixed $ data , string $ param ): void
346
345
{
0 commit comments