MediaWiki master
ApiRawMessage.php
Go to the documentation of this file.
1<?php
22
29class ApiRawMessage extends RawMessage implements IApiMessage {
31
41 public function __construct( $msg, $code = null, array $data = null ) {
42 if ( $msg instanceof RawMessage ) {
43 foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
44 if ( isset( $msg->$key ) ) {
45 $this->$key = $msg->$key;
46 }
47 }
48 } elseif ( is_array( $msg ) ) {
49 $key = array_shift( $msg );
50 parent::__construct( $key, $msg );
51 } else {
52 parent::__construct( $msg );
53 }
54 $this->setApiCode( $code, $data );
55 }
56}
setApiCode( $code, array $data=null)
Extension of RawMessage implementing IApiMessage.
__construct( $msg, $code=null, array $data=null)
Variant of the Message class.
string $key
The message key.
Definition Message.php:205
trait ApiMessageTrait
Trait to implement the IApiMessage interface for Message subclasses.
Interface for messages with machine-readable data for use by the API.