1 | <?php |
||
27 | class JsonConverter |
||
28 | { |
||
29 | use ValidatorTrait; |
||
30 | |||
31 | /** |
||
32 | * PHP's json_encode options flags |
||
33 | * |
||
34 | * @var int |
||
35 | */ |
||
36 | protected $options = 0; |
||
37 | |||
38 | /** |
||
39 | * Set PHP's json_encode options flags |
||
40 | * |
||
41 | * @param int $options |
||
42 | * |
||
43 | * @return self |
||
44 | */ |
||
45 | 2 | public function options(int $options): self |
|
53 | |||
54 | /** |
||
55 | * Convert an Record collection into a Json string |
||
56 | * |
||
57 | * @param array|Traversable $records the CSV records collection |
||
58 | * |
||
59 | * @throws RuntimeException if the conversion fails |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | 4 | public function convert($records): string |
|
77 | } |
||
78 |