PHP Класс Longman\TelegramBot\Entities\Entity

This is the base class for all entities.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__call ( $method, $args ) : mixed | null Return the variable for the called getter or magically set properties dynamically.
__construct ( array $data, string $bot_name = '' ) Entity constructor.
__toString ( ) : string Perform to string
escapeMarkdown ( string $string ) : string Escape markdown special characters
getProperty ( mixed $property, mixed $default = null ) : mixed Get a property from the current Entity
toJson ( ) : string Perform to json
tryMention ( boolean $escape_markdown = false ) : string | null Try to mention the user

Защищенные методы

Метод Описание
assignMemberVariables ( array $data ) Helper to set member variables
makePrettyObjectArray ( string $class, string $property ) : array Return an array of nice objects from an array of object arrays
subEntities ( ) : array Get the list of the properties that are themselves Entities
validate ( ) Perform any special entity validation

Описание методов

__call() публичный Метод

Return the variable for the called getter or magically set properties dynamically.
public __call ( $method, $args ) : mixed | null
$method
$args
Результат mixed | null

__construct() публичный Метод

Entity constructor.
public __construct ( array $data, string $bot_name = '' )
$data array
$bot_name string

__toString() публичный Метод

Perform to string
public __toString ( ) : string
Результат string

assignMemberVariables() защищенный Метод

Helper to set member variables
protected assignMemberVariables ( array $data )
$data array

escapeMarkdown() публичный Метод

Escape markdown special characters
public escapeMarkdown ( string $string ) : string
$string string
Результат string

getProperty() публичный Метод

Get a property from the current Entity
public getProperty ( mixed $property, mixed $default = null ) : mixed
$property mixed
$default mixed
Результат mixed

makePrettyObjectArray() защищенный Метод

This method is used to generate pretty object arrays mainly for PhotoSize and Entities object arrays.
protected makePrettyObjectArray ( string $class, string $property ) : array
$class string
$property string
Результат array

subEntities() защищенный Метод

Get the list of the properties that are themselves Entities
protected subEntities ( ) : array
Результат array

toJson() публичный Метод

Perform to json
public toJson ( ) : string
Результат string

tryMention() публичный Метод

Mention the user with the username otherwise print first and last name if the $escape_markdown argument is true special characters are escaped from the output
public tryMention ( boolean $escape_markdown = false ) : string | null
$escape_markdown boolean
Результат string | null

validate() защищенный Метод

Perform any special entity validation
protected validate ( )