PHP Class Longman\TelegramBot\Entities\Entity

This is the base class for all entities.
显示文件 Open project: akalongman/php-telegram-bot Class Usage Examples

Public Methods

Method Description
__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

Protected Methods

Method Description
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

Method Details

__call() public method

Return the variable for the called getter or magically set properties dynamically.
public __call ( $method, $args ) : mixed | null
$method
$args
return mixed | null

__construct() public method

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

__toString() public method

Perform to string
public __toString ( ) : string
return string

assignMemberVariables() protected method

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

escapeMarkdown() public method

Escape markdown special characters
public escapeMarkdown ( string $string ) : string
$string string
return string

getProperty() public method

Get a property from the current Entity
public getProperty ( mixed $property, mixed $default = null ) : mixed
$property mixed
$default mixed
return mixed

makePrettyObjectArray() protected method

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
return array

subEntities() protected method

Get the list of the properties that are themselves Entities
protected subEntities ( ) : array
return array

toJson() public method

Perform to json
public toJson ( ) : string
return string

tryMention() public method

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
return string | null

validate() protected method

Perform any special entity validation
protected validate ( )