52 lines
909 B
PHP
52 lines
909 B
PHP
<?php
|
|
|
|
namespace App\Events\Matrix;
|
|
|
|
/**
|
|
* A matrix message event
|
|
*
|
|
* Array
|
|
* (
|
|
* [age] => 37
|
|
* [content] => Array
|
|
* (
|
|
* [body] => This is my text
|
|
* [m.mentions] => Array
|
|
* (
|
|
* )
|
|
*
|
|
* [msgtype] => m.text
|
|
* )
|
|
*
|
|
* [event_id] => $fkpvy3qDkAGlB55nvqcH8mUfSxzELtaJ9TKJs6GP9us
|
|
* [origin_server_ts] => 1717917709298
|
|
* [room_id] => !bbXofZepRYOhKjihLH:matrix.dege.au
|
|
* [sender] => @deon:matrix.dege.au
|
|
* [type] => m.room.message
|
|
* [unsigned] => Array
|
|
* (
|
|
* [age] => 37
|
|
* )
|
|
*
|
|
* [user_id] => @deon:matrix.dege.au
|
|
* )
|
|
*/
|
|
class Message extends Base
|
|
{
|
|
public function __get($key)
|
|
{
|
|
switch ($key) {
|
|
case 'message':
|
|
return object_get($this->_data,'content.body');
|
|
|
|
case 'sender':
|
|
return object_get($this->_data,$key);
|
|
|
|
case 'ts':
|
|
return object_get($this->_data,'origin_server_ts');
|
|
|
|
default:
|
|
return parent::__get($key);
|
|
}
|
|
}
|
|
} |