Code Duplication    Length = 16-16 lines in 2 locations

includes/api/ApiMessage.php 2 locations

@@ 148-163 (lines=16) @@
145
	 * @param array|null $data
146
	 * @return ApiMessage
147
	 */
148
	public function __construct( $msg, $code = null, array $data = null ) {
149
		if ( $msg instanceof Message ) {
150
			foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
151
				if ( isset( $msg->$key ) ) {
152
					$this->$key = $msg->$key;
153
				}
154
			}
155
		} elseif ( is_array( $msg ) ) {
156
			$key = array_shift( $msg );
157
			parent::__construct( $key, $msg );
158
		} else {
159
			parent::__construct( $msg );
160
		}
161
		$this->apiCode = $code;
162
		$this->apiData = (array)$data;
163
	}
164
}
165
166
/**
@@ 182-197 (lines=16) @@
179
	 * @param string|null $code
180
	 * @param array|null $data
181
	 */
182
	public function __construct( $msg, $code = null, array $data = null ) {
183
		if ( $msg instanceof RawMessage ) {
184
			foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
185
				if ( isset( $msg->$key ) ) {
186
					$this->$key = $msg->$key;
187
				}
188
			}
189
		} elseif ( is_array( $msg ) ) {
190
			$key = array_shift( $msg );
191
			parent::__construct( $key, $msg );
192
		} else {
193
			parent::__construct( $msg );
194
		}
195
		$this->apiCode = $code;
196
		$this->apiData = (array)$data;
197
	}
198
}
199