wiki.techinc.nl/includes/libs/Message/MessageParam.php
Bartosz Dziewoński c7f52f0ddb Make MessageValue implement JsonDeserializable
MessageValue and friends are pure value objects and newable, so
it makes sense for them to be (de)serializable too. There are some
places where we want to serialize messages, such as in ParserOutput.

The structure of the resulting JSON is inspired by the way we
represent Message objects as plain values elsewhere in MediaWiki,
e.g. StatusValue::getStatusArray().

Co-Authored-By: C. Scott Ananian <cscott@cscott.net>
Depends-On: Ia32f95a6bdf342262b4ef044140527f0676402b9
Depends-On: I7bafe80cd36c2558517f474871148286350a4e76
Change-Id: Id47d58b5e26707fa0e0dbdd37418c0d54c8dd503
2024-06-12 15:47:37 -04:00

43 lines
830 B
PHP

<?php
namespace Wikimedia\Message;
use MediaWiki\Json\JsonDeserializable;
use MediaWiki\Json\JsonDeserializableTrait;
/**
* Value object representing a message parameter that consists of a list of values.
*
* Message parameter classes are pure value objects and are newable and (de)serializable.
*/
abstract class MessageParam implements JsonDeserializable {
use JsonDeserializableTrait;
protected $type;
protected $value;
/**
* Get the type of the parameter.
*
* @return string One of the ParamType constants
*/
public function getType() {
return $this->type;
}
/**
* Get the input value of the parameter
*
* @return mixed
*/
public function getValue() {
return $this->value;
}
/**
* Dump the object for testing/debugging
*
* @return string
*/
abstract public function dump();
}