1 | <?php |
||
28 | class Json implements ResultFormatter |
||
29 | { |
||
30 | /** |
||
31 | * @var int Bitmask of options to be passed to `json_encode` |
||
32 | */ |
||
33 | private $options = 0; |
||
34 | /** |
||
35 | * @var int Depth to be passed to the third parameter of `json_encode` Only used on php >= 5.5 |
||
36 | */ |
||
37 | private $depth = 512; |
||
38 | |||
39 | /** |
||
40 | * Supported option keys: |
||
41 | * |
||
42 | * * 'options': Json encoding options |
||
43 | * * 'depth': Maximum depths |
||
44 | * |
||
45 | * @param array $options |
||
46 | */ |
||
47 | 16 | public function __construct(array $options = []) |
|
52 | |||
53 | /** |
||
54 | * Generate a json representation of a `Result\Collection` |
||
55 | * |
||
56 | * The output is the json representation based on the array returned by |
||
57 | * `Pvra\Result\Collection::jsonSerialize()`. |
||
58 | * |
||
59 | * @param \Pvra\Result\Collection $collection The source collection |
||
60 | * @return string The returned json string |
||
61 | * @throws \Pvra\Result\Exceptions\ResultFileWriterException Thrown if json generation failed |
||
62 | * @see \Pvra\Result\Collection::jsonSerialize() Data source |
||
63 | */ |
||
64 | 12 | public function makePrintable(ResultCollection $collection) |
|
81 | } |
||
82 |