45 lines
968 B
PHP
45 lines
968 B
PHP
<?php
|
|
|
|
namespace Slack\Event;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use Slack\Base as SlackBase;
|
|
|
|
abstract class Base extends SlackBase
|
|
{
|
|
public function __construct(array $request)
|
|
{
|
|
Log::info(sprintf('SEb:Slack Event Initialised [%s]',get_class($this)),['m'=>__METHOD__]);
|
|
|
|
parent::__construct($request);
|
|
}
|
|
|
|
/**
|
|
* Enable getting values for keys in the response
|
|
*
|
|
* @note: This method is limited to certain values to ensure integrity reasons
|
|
* @note: Classes should return:
|
|
* + channel_id,
|
|
* + team_id,
|
|
* + ts,
|
|
* + user_id
|
|
* @param string $key
|
|
* @return mixed|object
|
|
*/
|
|
public function __get(string $key)
|
|
{
|
|
switch ($key) {
|
|
case 'channel_id':
|
|
// For interactive post responses, the channel ID is "channel"
|
|
return object_get($this->_data,$key) ?: object_get($this->_data,'channel');
|
|
|
|
case 'enterprise_id':
|
|
case 'team_id':
|
|
case 'ts':
|
|
case 'user_id':
|
|
return object_get($this->_data,$key);
|
|
}
|
|
}
|
|
}
|