mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 13:08:16 +01:00
Refine decoders
This commit is contained in:
parent
d8f494172c
commit
61f2102302
@ -15,6 +15,7 @@ abstract class AbstractDecoder implements Decoder
|
||||
*
|
||||
* @param string $json
|
||||
* @return mixed
|
||||
* @throws Throwable
|
||||
*/
|
||||
abstract protected function decodeJson(string $json): mixed;
|
||||
|
||||
|
@ -3,17 +3,17 @@
|
||||
namespace Cerbero\JsonParser\Decoders;
|
||||
|
||||
/**
|
||||
* The decoder using the default JSON decoder.
|
||||
* The decoder using the built-in JSON decoder.
|
||||
*
|
||||
*/
|
||||
class JsonDecoder extends AbstractDecoder
|
||||
final class JsonDecoder extends AbstractDecoder
|
||||
{
|
||||
/**
|
||||
* Instantiate the class.
|
||||
*
|
||||
* @param bool $decodesToArray
|
||||
*/
|
||||
public function __construct(protected bool $decodesToArray = true)
|
||||
public function __construct(private bool $decodesToArray = true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ class JsonDecoder extends AbstractDecoder
|
||||
*
|
||||
* @param string $json
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function decodeJson(string $json): mixed
|
||||
{
|
||||
|
@ -3,17 +3,17 @@
|
||||
namespace Cerbero\JsonParser\Decoders;
|
||||
|
||||
/**
|
||||
* The simdjson decoder.
|
||||
* The decoder using the simdjson library.
|
||||
*
|
||||
*/
|
||||
class SimdjsonDecoder extends AbstractDecoder
|
||||
final class SimdjsonDecoder extends AbstractDecoder
|
||||
{
|
||||
/**
|
||||
* Instantiate the class.
|
||||
*
|
||||
* @param bool $decodesToArray
|
||||
*/
|
||||
public function __construct(protected bool $decodesToArray = true)
|
||||
public function __construct(private bool $decodesToArray = true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ class SimdjsonDecoder extends AbstractDecoder
|
||||
*
|
||||
* @param string $json
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
protected function decodeJson(string $json): mixed
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user