Static methods grouped by class and context.
More...
Static methods grouped by class and context.
◆ camelCase()
static string PhpBotFramework\Entities\Text::camelCase |
( |
|
$str, |
|
|
array |
$noStrip = [] |
|
) |
| |
|
static |
Convert a string into camelCase style.
Take a look here to learn more.
- Parameters
-
string | $str | The string to convert. |
array | $noStrip | |
- Returns
- string $str The input string converted to camelCase.
◆ getHashtags()
static array PhpBotFramework\Entities\Text::getHashtags |
( |
string |
$string | ) |
|
|
static |
Get hashtag contained in a string.
Check hashtags in a string using a regular expression. All valid hashtags will be returned in an array. See the following StackOverflow thread to learn more.
- Parameters
-
$string | The string to check for hashtags. |
- Returns
- array An array of valid hashtags, can be empty.
◆ paginateItems()
static string PhpBotFramework\Utilities\Paginator::paginateItems |
( |
|
$items, |
|
|
int |
$index, |
|
|
Keyboard & |
$keyboard, |
|
|
callable |
$format_item, |
|
|
int |
$item_per_page = 3 , |
|
|
string |
$prefix = 'list' , |
|
|
string |
$delimiter = DELIMITER |
|
) |
| |
|
static |
Paginate a number of items got as a result by a query.
Take items to show in the page $index, delimiting in by $delimiter, and call the closure $format_item on each item paginated. Taking a select query result, take items that have to be shown on page of index $index (calculated with $item_per_page).
- Parameters
-
mixed | $items | Result of a select query using pdo object. |
int | $index | Index of the page to show. |
PhpBotFramework\Entities\InlineKeyboard | $keyboard | Inline keyboard object to call PhpBotFramework\Entities\InlineKeyboard::addListKeyboard() on it for browsing results. |
closure | $format_item | A closure that take the item to paginate and the keyboard. You can use it to format the item and add some inline keyboard button for each item. |
string | $prefix | Prefix to pass to InlineKeyboard::addListKeyboard. |
string | $delimiter | A string that will be used to concatenate each item. |
- Returns
- string The string message with the items of page $index, with $delimiter between each of them.
- See also
- PhpBotFramework\Entities\InlineKeyboard
◆ removeUsernameFormattation()
static string PhpBotFramework\Entities\Text::removeUsernameFormattation |
( |
string |
$string, |
|
|
string |
$tag |
|
) |
| |
|
static |
Remove HTML formattation from Telegram usernames.
Remove the $modificator html formattation from a message containing Telegram usernames.
- Parameters
-
string | $string | to parse. |
string | $tag | Formattation tag to remove. |
- Returns
- string The string, modified if there are usernames. Otherwise $string.