PHP Class Telegram\Bot\Helpers\Emojify

Afficher le fichier Open project: irazasyed/telegram-bot-sdk

Protected Properties

Свойство Type Description
$emojiMap array The array mapping words to emoji.
$emojiMapFile string The path to the file containing the emoji map.
$wordMap array The array mapping emoji back to words.

Méthodes publiques

Méthode Description
getInstance ( ) : Emojify Returns the *Singleton* instance of this class.
setEmojiMapFile ( string $emojiMapFile ) : Emojify Set File Path to Emoji Map File.
text ( $text ) : mixed Alias of toEmoji()
toEmoji ( $text ) : mixed Translate Word to Emoji
toWord ( $text ) : mixed Translate Emoji to Word
translate ( $text ) : mixed Alias of toWord()

Méthodes protégées

Méthode Description
__construct ( ) Protected Emojify constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.
emojiToWordReplace ( $line, $replace, $delimiter ) : mixed Finds emojis and replaces them with text enclosed by the delimiter
getEmojiMap ( ) : array Get Emoji Map Array.
replace ( $line, $replace, boolean $toWord = false, string $delimiter = ':' ) : mixed Replace
setupEmojiMaps ( ) Setup Emoji Maps.
wordToEmojiReplace ( $line, $replace, $delimiter ) : mixed Finds words enclosed by the delimiter and converts them to the appropriate emoji character.

Private Methods

Méthode Description
__clone ( ) : void Private clone method to prevent cloning of the instance of the *Singleton* instance.
__wakeup ( ) : void Private unserialize method to prevent unserializing of the *Singleton* instance.

Method Details

__construct() protected méthode

Protected Emojify constructor to prevent creating a new instance of the *Singleton* via the new operator from outside of this class.
protected __construct ( )

emojiToWordReplace() protected méthode

Finds emojis and replaces them with text enclosed by the delimiter
protected emojiToWordReplace ( $line, $replace, $delimiter ) : mixed
$line
$replace
$delimiter
Résultat mixed

getEmojiMap() protected méthode

Get Emoji Map Array.
protected getEmojiMap ( ) : array
Résultat array

getInstance() public static méthode

Returns the *Singleton* instance of this class.
public static getInstance ( ) : Emojify
Résultat Emojify The *Singleton* instance.

replace() protected méthode

Replace
protected replace ( $line, $replace, boolean $toWord = false, string $delimiter = ':' ) : mixed
$line
$replace
$toWord boolean
$delimiter string
Résultat mixed

setEmojiMapFile() public méthode

Set File Path to Emoji Map File.
public setEmojiMapFile ( string $emojiMapFile ) : Emojify
$emojiMapFile string
Résultat Emojify

setupEmojiMaps() protected méthode

Setup Emoji Maps.
protected setupEmojiMaps ( )

text() public static méthode

Alias of toEmoji()
public static text ( $text ) : mixed
$text
Résultat mixed

toEmoji() public méthode

Translate Word to Emoji
public toEmoji ( $text ) : mixed
$text
Résultat mixed

toWord() public méthode

Translate Emoji to Word
public toWord ( $text ) : mixed
$text
Résultat mixed

translate() public static méthode

Alias of toWord()
public static translate ( $text ) : mixed
$text
Résultat mixed

wordToEmojiReplace() protected méthode

Finds words enclosed by the delimiter and converts them to the appropriate emoji character.
protected wordToEmojiReplace ( $line, $replace, $delimiter ) : mixed
$line
$replace
$delimiter
Résultat mixed

Property Details

$emojiMap protected_oe property

The array mapping words to emoji.
protected array $emojiMap
Résultat array

$emojiMapFile protected_oe property

The path to the file containing the emoji map.
protected string $emojiMapFile
Résultat string

$wordMap protected_oe property

The array mapping emoji back to words.
protected array $wordMap
Résultat array