2 namespace MediaWiki\Tests\Json
;
4 use Psr\Container\ContainerInterface
;
5 use Wikimedia\JsonCodec\JsonClassCodec
;
6 use Wikimedia\JsonCodec\JsonCodecable
;
7 use Wikimedia\JsonCodec\JsonCodecInterface
;
10 * Managed object which uses a factory in a service.
12 class ManagedObject
implements JsonCodecable
{
20 * Create a new ManagedObject which stores $property. This constructor
21 * shouldn't be invoked directly by anyone except ManagedObjectFactory.
27 public function __construct( string $name, int $data ) {
32 // Implement JsonCodecable by delegating serialization/deserialization
33 // to the 'ManagedObjectFactory' service.
36 public static function jsonClassCodec(
37 JsonCodecInterface
$codec, ContainerInterface
$serviceContainer
39 return $serviceContainer->get( 'ManagedObjectFactory' );