Options Objects ############### The library provides 3 classes to manipulate option sets in OOP way: * ``Arokettu\Json\DecodeOptions`` for decoding * ``Arokettu\Json\EncodeOptions`` for encoding * ``Arokettu\Json\ValidateOptions`` for validating Objects of all classes are immutable. Any change creates a new instance. Constructors ============ Default constructor ------------------- The default constructor is the least helpful constructor, it can be initialized with json options constants .. code-block:: php call([\Arokettu\Json\EncodeOptions::class, 'build'], [ 'throw_on_error' => true, 'unescaped_slashes' => true, 'unescaped_unicode' => true, ]); // Initialize options with existing options set to modify it $options = \Arokettu\Json\EncodeOptions::build( JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE, throw_on_error: false, ); Managing options in OOP way =========================== ``with*`` methods to set their respective flags, ``without*`` methods to unset them. Objects are immuuable so the methods create new instances of the options. Full list: .. code-block:: php withPrettyPrint() ->withoutThrowOnError() ; Value getters ============= .. code-block:: php value(); // get integer value $options->toInt(); // alias of value() $options->toString(); // export options list as a conjunction of base ext-json constants to a string Int getter can be used with vanilla ``ext-json`` methods: .. code-block:: php value()); String getter can be useful for debug or code generation .. code-block:: php toString(); // returns "JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR" $php = <<