Commit 04e2d488 authored by Jack'lul's avatar Jack'lul

Add 'InputMessageContent' and it's 4 types

parent da0cc114
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InputContactMessageContent extends InputMessageContent
{
protected $phone_number;
protected $first_name;
protected $last_name;
public function __construct(array $data)
{
//parent::__construct($data);
$this->phone_number isset($data['phone_number']) ? $data['phone_number'] : null;
if (empty($this->phone_number)) {
throw new TelegramException('phone_number is empty!');
}
$this->first_name isset($data['first_name']) ? $data['first_name'] : null;
if (empty($this->first_name)) {
throw new TelegramException('first_name is empty!');
}
$this->last_name isset($data['last_name']) ? $data['last_name'] : null;
}
}
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InputLocationMessageContent extends InputMessageContent
{
protected $latitude;
protected $longitude;
public function __construct(array $data)
{
//parent::__construct($data);
$this->latitude isset($data['latitude']) ? $data['latitude'] : null;
if (empty($this->latitude)) {
throw new TelegramException('latitude is empty!');
}
$this->longitude isset($data['longitude']) ? $data['longitude'] : null;
if (empty($this->longitude)) {
throw new TelegramException('longitude is empty!');
}
}
}
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
class InputMessageContent extends Entity
{
}
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InputTextMessageContent extends InputMessageContent
{
protected $message_text;
protected $parse_mode;
protected $disable_web_page_preview;
public function __construct(array $data)
{
//parent::__construct($data);
$this->message_text isset($data['message_text']) ? $data['message_text'] : null;
if (empty($this->message_text)) {
throw new TelegramException('message_text is empty!');
}
$this->parse_mode isset($data['parse_mode']) ? $data['parse_mode'] : null;
$this->disable_web_page_preview isset($data['disable_web_page_preview']) ? $data['disable_web_page_preview'] : null;
}
}
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InputVenueMessageContent extends InputMessageContent
{
protected $latitude;
protected $longitude;
protected $title;
protected $address;
protected $foursquare_id;
public function __construct(array $data)
{
//parent::__construct($data);
$this->latitude isset($data['latitude']) ? $data['latitude'] : null;
if (empty($this->latitude)) {
throw new TelegramException('latitude is empty!');
}
$this->longitude isset($data['longitude']) ? $data['longitude'] : null;
if (empty($this->longitude)) {
throw new TelegramException('longitude is empty!');
}
$this->title isset($data['title']) ? $data['title'] : null;
if (empty($this->title)) {
throw new TelegramException('title is empty!');
}
$this->address isset($data['address']) ? $data['address'] : null;
if (empty($this->address)) {
throw new TelegramException('address is empty!');
}
$this->foursquare_id isset($data['foursquare_id']) ? $data['foursquare_id'] : null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment