| 1 |
<?php |
| 2 |
namespace MediaWiki\Tests\Json; |
| 3 |
|
| 4 |
use Psr\Container\ContainerInterface; |
| 5 |
use Wikimedia\JsonCodec\JsonClassCodec; |
| 6 |
use Wikimedia\JsonCodec\JsonCodecable; |
| 7 |
use Wikimedia\JsonCodec\JsonCodecInterface; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class ManagedObject implements JsonCodecable { |
| 13 |
|
| 14 |
|
| 15 |
public string $name; |
| 16 |
|
| 17 |
public int $data; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public function __construct( string $name, int $data ) { |
| 28 |
$this->name = $name; |
| 29 |
$this->data = $data; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public static function jsonClassCodec( |
| 37 |
JsonCodecInterface $codec, ContainerInterface $serviceContainer |
| 38 |
): JsonClassCodec { |
| 39 |
return $serviceContainer->get( 'ManagedObjectFactory' ); |
| 40 |
} |
| 41 |
} |