Page MenuHomePhabricator (Chris)

Chat.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

Chat.php

<?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 Chat extends Entity
{
protected $id;
protected $title;
protected $first_name;
protected $last_name;
protected $username;
public function __construct(array $data)
{
$this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) {
throw new TelegramException('id is empty!');
}
$this->title = isset($data['title']) ? $data['title'] : null;
$this->first_name = isset($data['first_name']) ? $data['first_name'] : null;
$this->last_name = isset($data['last_name']) ? $data['last_name'] : null;
$this->username = isset($data['username']) ? $data['username'] : null;
}
public function isGroupChat()
{
if ($this->id < 0) {
return true;
} else {
return false;
}
}
public function isSingleChat()
{
return ! $this->isGroupChat();
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function getFirstName()
{
return $this->first_name;
}
public function getLastName()
{
return $this->last_name;
}
public function getUsername()
{
return $this->username;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 14, 11:09 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138386
Default Alt Text
Chat.php (1 KB)

Event Timeline