PHP Class Longman\TelegramBot\Entities\Entity

This is the base class for all entities.
Afficher le fichier Open project: akalongman/php-telegram-bot Class Usage Examples

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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

__construct() public méthode

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

__toString() public méthode

Perform to string
public __toString ( ) : string
Résultat string

assignMemberVariables() protected méthode

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

escapeMarkdown() public méthode

Escape markdown special characters
public escapeMarkdown ( string $string ) : string
$string string
Résultat string

getProperty() public méthode

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

makePrettyObjectArray() protected méthode

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
Résultat array

subEntities() protected méthode

Get the list of the properties that are themselves Entities
protected subEntities ( ) : array
Résultat array

toJson() public méthode

Perform to json
public toJson ( ) : string
Résultat string

tryMention() public méthode

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
Résultat string | null

validate() protected méthode

Perform any special entity validation
protected validate ( )