Link Search Menu Expand Document

danog\MadelineProto\StrTools

Back to index

Author: Daniil Gentili daniil@daniil.it

Some tools.

Constants

  • danog\MadelineProto\StrTools::ALL_MIMES:

Method list:

  • mbStrlen(string $text): float|int
  • mbSubstr(string $text, int $offset, ?int $length): string
  • mbStrSplit(string $text, int $length): array
  • toCamelCase(string $input): string
  • toSnakeCase(string $input): string
  • markdownEscape(string $hwat): string
  • typeEscape(string $type): string
  • methodEscape(string $method): string
  • getMimeFromExtension(string $extension, string $default): string
  • getExtensionFromMime(string $mime): string
  • getExtensionFromLocation(mixed $location, string $default): string
  • getMimeFromFile(string $file): string
  • getMimeFromBuffer(string $buffer): string

Methods:

mbStrlen(string $text): float|int

Get Telegram UTF-8 length of string.

Parameters:

  • $text: string Text

mbSubstr(string $text, int $offset, ?int $length): string

Telegram UTF-8 multibyte substring.

Parameters:

  • $text: string Text to substring
  • $offset: int Offset
  • $length: ?int Length

mbStrSplit(string $text, int $length): array

Telegram UTF-8 multibyte split.

Parameters:

  • $text: string Text
  • $length: int Length

toCamelCase(string $input): string

Convert to camelCase.

Parameters:

  • $input: string String

toSnakeCase(string $input): string

Convert to snake_case.

Parameters:

  • $input: string String

markdownEscape(string $hwat): string

Escape string for markdown.

Parameters:

  • $hwat: string String to escape

typeEscape(string $type): string

Escape type name.

Parameters:

  • $type: string String to escape

methodEscape(string $method): string

Escape method name.

Parameters:

  • $method: string Method name

getMimeFromExtension(string $extension, string $default): string

Get mime type from file extension.

Parameters:

  • $extension: string File extension
  • $default: string Default mime type

getExtensionFromMime(string $mime): string

Get extension from mime type.

Parameters:

  • $mime: string MIME type

getExtensionFromLocation(mixed $location, string $default): string

Get extension from file location.

Parameters:

  • $location: mixed File location
  • $default: string Default extension

getMimeFromFile(string $file): string

Get mime type of file.

Parameters:

  • $file: string File

getMimeFromBuffer(string $buffer): string

Get mime type from buffer.

Parameters:

  • $buffer: string Buffer

Generated by danog/phpdoc