Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2declare( strict_types=1 );
3
4/**
5 * @license GPL-2.0-or-later
6 * @file
7 */
8
9namespace Wikimedia\JsonCodec;
10
11use Psr\Container\ContainerInterface;
12
13/**
14 * Classes implementing this interface support round-trip JSON
15 * serialization/deserialization via a JsonClassCodec object
16 * (which may maintain state and/or consult service objects).
17 * It requires a single static method to be defined which
18 * allows the creation of an appropriate JsonClassCodec
19 * for this class.
20 */
21interface JsonCodecable {
22
23    /**
24     * Create a JsonClassCodec which can serialize/deserialize instances of
25     * this class.
26     * @param JsonCodecInterface $codec A codec which can be used to handle
27     *  certain cases of implicit typing in the generated JSON; see
28     *  `JsonCodecInterface` for details.  It should not be necessary for
29     *  most class codecs to use this, as recursive
30     *  serialization/deserialization is handled by default.
31     * @param ContainerInterface $serviceContainer A service container
32     * @return JsonClassCodec A JsonClassCodec appropriate for objects of
33     *  this type.
34     */
35    public static function jsonClassCodec(
36        JsonCodecInterface $codec,
37        ContainerInterface $serviceContainer
38    ): JsonClassCodec;
39}