40 public static function create( $msg, $code =
null, array $data =
null ) {
41 if ( is_array( $msg ) ) {
43 if ( isset( $msg[
'message'] ) ) {
44 if ( isset( $msg[
'params'] ) ) {
45 $msg = array_merge( [ $msg[
'message'] ], $msg[
'params'] );
47 $msg = [ $msg[
'message'] ];
74 public function __construct( $msg, $code =
null, array $data =
null ) {
75 if ( $msg instanceof
Message ) {
76 foreach ( get_class_vars( get_class( $this ) ) as $key => $value ) {
77 if ( isset( $msg->$key ) ) {
78 $this->$key = $msg->$key;
81 } elseif ( is_array( $msg ) ) {
82 $key = array_shift( $msg );
83 parent::__construct( $key, $msg );
85 parent::__construct( $msg );