MediaWiki REL1_34
ApiRawMessage.php
Go to the documentation of this file.
1<?php
26class ApiRawMessage extends RawMessage implements IApiMessage {
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}
Extension of RawMessage implementing IApiMessage.
__construct( $msg, $code=null, array $data=null)
string $key
The message key.
Definition Message.php:204
Variant of the Message class.
trait ApiMessageTrait
Trait to implement the IApiMessage interface for Message subclasses.
Interface for messages with machine-readable data for use by the API.
setApiCode( $code, array $data=null)
Sets the machine-readable code for use by the API.