MediaWiki  1.34.0
ApiRawMessage.php
Go to the documentation of this file.
1 <?php
26 class ApiRawMessage extends RawMessage implements IApiMessage {
27  use ApiMessageTrait;
28 
37  public function __construct( $msg, $code = null, array $data = null ) {
38  if ( $msg instanceof RawMessage ) {
39  foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
40  if ( isset( $msg->$key ) ) {
41  $this->$key = $msg->$key;
42  }
43  }
44  } elseif ( is_array( $msg ) ) {
45  $key = array_shift( $msg );
46  parent::__construct( $key, $msg );
47  } else {
48  parent::__construct( $msg );
49  }
50  $this->setApiCode( $code, $data );
51  }
52 }
IApiMessage
Interface for messages with machine-readable data for use by the API.
Definition: IApiMessage.php:39
ApiRawMessage
Extension of RawMessage implementing IApiMessage.
Definition: ApiRawMessage.php:26
ApiRawMessage\__construct
__construct( $msg, $code=null, array $data=null)
Definition: ApiRawMessage.php:37
IApiMessage\setApiCode
setApiCode( $code, array $data=null)
Sets the machine-readable code for use by the API.
ApiMessageTrait
trait ApiMessageTrait
Trait to implement the IApiMessage interface for Message subclasses.
Definition: ApiMessageTrait.php:28
RawMessage
Variant of the Message class.
Definition: RawMessage.php:34