@@ -45,7 +45,7 @@ composer require josantonius/json
4545```
4646
4747The previous command will only install the necessary files,
48- if you prefer to ** download the entire source code** you can use:
48+ if you prefer to ** download the full source code** use:
4949
5050``` console
5151composer require josantonius/json --prefer-source
@@ -95,8 +95,8 @@ Get the contents of the JSON file:
9595/**
9696 * @param bool $asObject If true and the value is an array, it is returned as an object.
9797 *
98- * @throws GetFileException if the file could not be read.
99- * @throws JsonErrorException if the file contains invalid JSON.
98+ * @throws GetFileException
99+ * @throws JsonErrorException
100100 *
101101 * @return mixed the contents of the JSON file.
102102 */
@@ -108,15 +108,15 @@ Set the contents of a JSON or a key within the file:
108108``` php
109109/**
110110 * @param mixed $content The data that will be written to the file or a key within the file.
111- * @param string $dot The dot notation string representing the key to be modified within the file.
111+ * @param string $dot The dot notation representing the key to be modified within the file.
112112 *
113- * @throws GetFileException if the file could not be read.
114- * @throws JsonErrorException if the file contains invalid JSON.
115- * @throws CreateDirectoryException if the file could not be created.
116- * @throws CreateFileException if the directory could not be created.
117- * @throws NoIterableElementException if the location specified by $dot is not an array.
113+ * @throws GetFileException
114+ * @throws JsonErrorException
115+ * @throws CreateFileException
116+ * @throws CreateDirectoryException
117+ * @throws NoIterableElementException
118118 *
119- * @return mixed the content of the JSON file after the merge operation.
119+ * @return mixed the content of the JSON file after the set operation.
120120 */
121121public function set(mixed $content = [], string $dot = null): array|bool|int|null|string;
122122```
@@ -126,12 +126,12 @@ Merge the provided data with the contents of a JSON file or a key within the fil
126126``` php
127127/**
128128 * @param mixed $content The data that will be written to the file or a key within the file.
129- * @param string $dot The dot notation string representing the key to be modified within the file.
129+ * @param string $dot The dot notation representing the key to be modified within the file.
130130 *
131- * @throws GetFileException if the file could not be read.
132- * @throws JsonErrorException if the file contains invalid JSON.
133- * @throws NoIterableFileException if the file does not contain an array.
134- * @throws NoIterableElementException if the location specified by $dot is not an array.
131+ * @throws GetFileException
132+ * @throws JsonErrorException
133+ * @throws NoIterableFileException
134+ * @throws NoIterableElementException
135135 *
136136 * @return mixed the content of the JSON file after the merge operation.
137137 */
@@ -142,12 +142,12 @@ Remove and get the last element of a JSON file or a key within the file:
142142
143143``` php
144144/**
145- * @param string $dot The dot notation string representing the key to be modified within the file.
145+ * @param string $dot The dot notation representing the key to be modified within the file.
146146 *
147- * @throws GetFileException if the file could not be read.
148- * @throws JsonErrorException if the file contains invalid JSON.
149- * @throws NoIterableFileException if the file does not contain an array.
150- * @throws NoIterableElementException if the location specified by $dot is not an array.
147+ * @throws GetFileException
148+ * @throws JsonErrorException
149+ * @throws NoIterableFileException
150+ * @throws NoIterableElementException
151151 *
152152 * @return mixed|null the last value of JSON file, or null if array is empty.
153153 */
@@ -159,12 +159,12 @@ Add the provided data to the end of the contents of a JSON file or a key within
159159``` php
160160/**
161161 * @param mixed $content The data that will be written to the file or a key within the file.
162- * @param string $dot The dot notation string representing the key to be modified within the file.
162+ * @param string $dot The dot notation representing the key to be modified within the file.
163163 *
164- * @throws GetFileException if the file could not be read.
165- * @throws JsonErrorException if the file contains invalid JSON.
166- * @throws NoIterableFileException if the file does not contain an array.
167- * @throws NoIterableElementException if the location specified by $dot is not an array.
164+ * @throws GetFileException
165+ * @throws JsonErrorException
166+ * @throws NoIterableFileException
167+ * @throws NoIterableElementException
168168 *
169169 * @return mixed the content of the JSON file after the push operation.
170170 */
@@ -175,12 +175,12 @@ Remove and get the first element of a JSON file or a key within the file:
175175
176176``` php
177177/**
178- * @param string $dot The dot notation string representing the key to be modified within the file.
178+ * @param string $dot The dot notation representing the key to be modified within the file.
179179 *
180- * @throws GetFileException if the file could not be read.
181- * @throws JsonErrorException if the file contains invalid JSON.
182- * @throws NoIterableFileException if the file does not contain an array.
183- * @throws NoIterableElementException if the location specified by $dot is not an array.
180+ * @throws GetFileException
181+ * @throws JsonErrorException
182+ * @throws NoIterableFileException
183+ * @throws NoIterableElementException
184184 *
185185 * @return mixed|null the shifted value, or null if array is empty.
186186 */
@@ -191,12 +191,12 @@ Remove a key and its value from the contents of a JSON file:
191191
192192``` php
193193/**
194- * @param string $dot The dot notation string representing the key to be modified within the file.
194+ * @param string $dot The dot notation representing the key to be modified within the file.
195195 * @param bool $reindexed If true, the array will be re-indexed.
196196 *
197- * @throws GetFileException if the file could not be read.
198- * @throws JsonErrorException if the file contains invalid JSON.
199- * @throws NoIterableFileException if the file does not contain an array.
197+ * @throws GetFileException
198+ * @throws JsonErrorException
199+ * @throws NoIterableFileException
200200 *
201201 * @return array the content of the JSON file after the unset operation.
202202 */
@@ -208,12 +208,12 @@ Add the provided data to the beginning of the contents of a JSON file or a key w
208208``` php
209209/**
210210 * @param mixed $content The data that will be written to the file or a key within the file.
211- * @param string $dot The dot notation string representing the key to be modified within the file.
211+ * @param string $dot The dot notation representing the key to be modified within the file.
212212 *
213- * @throws GetFileException if the file could not be read.
214- * @throws JsonErrorException if the file contains invalid JSON.
215- * @throws NoIterableFileException if the file does not contain an array.
216- * @throws NoIterableElementException if the location specified by $dot is not an array.
213+ * @throws GetFileException
214+ * @throws JsonErrorException
215+ * @throws NoIterableFileException
216+ * @throws NoIterableElementException
217217 *
218218 * @return mixed the content of the JSON file after the unshift operation.
219219 */
@@ -223,12 +223,12 @@ public function unshift(mixed $content, string $dot = null): mixed;
223223## Exceptions Used
224224
225225``` php
226- use Josantonius\Json\Exceptions\CreateDirectoryException;
227- use Josantonius\Json\Exceptions\CreateFileException;
228- use Josantonius\Json\Exceptions\GetFileException;
229- use Josantonius\Json\Exceptions\JsonErrorException;
230- use Josantonius\Json\Exceptions\NoIterableElementException;
231- use Josantonius\Json\Exceptions\NoIterableFileException;
226+ use Josantonius\Json\Exceptions\GetFileException; // if file reading failed
227+ use Josantonius\Json\Exceptions\CreateFileException; // if file creation failed
228+ use Josantonius\Json\Exceptions\JsonErrorException; // if the file contains invalid JSON
229+ use Josantonius\Json\Exceptions\NoIterableFileException; // if the file isn't a JSON array
230+ use Josantonius\Json\Exceptions\CreateDirectoryException; // if directory creation failed
231+ use Josantonius\Json\Exceptions\NoIterableElementException; // if $dot isn't an array location
232232```
233233
234234## Usage
@@ -534,7 +534,7 @@ $json->push(['name' => 'bar']);
534534]
535535```
536536
537- ### Add the provided data to the end of the contents of a key within the file using dot notation
537+ ### Add provided data to the end of the contents of a key within the file using dot notation
538538
539539** ` file.json ` **
540540
@@ -603,7 +603,7 @@ $json->shift(); // 1
603603]
604604```
605605
606- ### Remove and get the first element of the contents of a key within the file using dot notation
606+ ### Remove and get the first item of the contents of a key within the file using dot notation
607607
608608** ` file.json ` **
609609
@@ -768,7 +768,7 @@ $json->unshift(0);
768768]
769769```
770770
771- ### Add the provided data to the beginning of the contents of a key within the file using dot notation
771+ ### Add the provided data to the beginning of the contents of a key within the file using dot
772772
773773** ` file.json ` **
774774
0 commit comments