Skip to content

Commit 442bff5

Browse files
Update ToJSON.php
1 parent 21899fd commit 442bff5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Collections/ToJSON.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@
22

33
namespace DatabaseFactory\Collections {
44

5+
/**
6+
* Takes a collection of data and provides the ability to access
7+
* it as JSON
8+
*
9+
* @package DatabaseFactory\Collections
10+
* @author Jason Napolitano
11+
*
12+
* @version 1.0.0
13+
* @since 1.0.0
14+
* @license MIT <https://mit-license.org>
15+
*/
516
readonly class ToJSON implements \JsonSerializable
617
{
18+
/**
19+
* Constructor
20+
*/
721
public function __construct(private array $collection = [])
822
{
923
// ...
1024
}
1125

26+
/**
27+
* Specify data which should be serialized to JSON
28+
*
29+
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
30+
*/
1231
public function jsonSerialize(): array
1332
{
1433
return $this->collection;

0 commit comments

Comments
 (0)