Alfred/bot/Request.php

95 lines
1.5 KiB
PHP

<?php
namespace Shikiryu\Bot;
class Request
{
protected $token;
protected $user_id;
protected $username;
protected $post_id;
protected $timestamp;
protected $text;
/**
* Request constructor.
* @param array $data
*/
public function __construct(array $data)
{
if (isset($data['token'])) {
$this->token = $data['token'];
}
if (isset($data['user_id'])) {
$this->user_id = $data['user_id'];
}
if (isset($data['username'])) {
$this->username = $data['username'];
}
if (isset($data['post_id'])) {
$this->post_id = $data['post_id'];
}
if (isset($data['timestamp'])) {
$this->timestamp = $data['timestamp'];
}
if (isset($data['text'])) {
$this->text = $data['text'];
}
}
/**
* @return mixed
*/
public function getToken()
{
return $this->token;
}
/**
* @return mixed
*/
public function getUserId()
{
return $this->user_id;
}
/**
* @return mixed
*/
public function getUsername()
{
return $this->username;
}
/**
* @return mixed
*/
public function getPostId()
{
return $this->post_id;
}
/**
* @return mixed
*/
public function getTimestamp()
{
return $this->timestamp;
}
/**
* @return mixed
*/
public function getText()
{
return $this->text;
}
}