Link Search Menu Expand Document

danog\MadelineProto\AsyncTools

Back to index

Author: Daniil Gentili daniil@daniil.it

Async tools.

Constants

  • danog\MadelineProto\AsyncTools::ALL_MIMES:

Method list:

  • flock(string $file, int $operation, float $polling, ?\Amp\Cancellation $token, ?\Closure $failureCb): mixed
  • sleep(float $time)
  • readLine(string $prompt)
  • echo(string $string)
  • mbStrlen(string $text)
  • mbSubstr(string $text, int $offset, null|int $length)
  • mbStrSplit(string $text, int $length): string[]
  • toCamelCase(string $input)
  • toSnakeCase(string $input)
  • markdownEscape(string $hwat)
  • typeEscape(string $type)
  • methodEscape(string $method)
  • getMimeFromExtension(string $extension, string $default)
  • getExtensionFromMime(string $mime)
  • getExtensionFromLocation(mixed $location, string $default)
  • getMimeFromFile(string $file)
  • getMimeFromBuffer(string $buffer)

Methods:

flock(string $file, int $operation, float $polling, ?\Amp\Cancellation $token, ?\Closure $failureCb): mixed

Asynchronously lock a file Resolves with a callbable that MUST eventually be called in order to release the lock.

Parameters:

  • $file: string File to lock
  • $operation: int Locking mode
  • $polling: float Polling interval
  • $token: ?\Amp\Cancellation Cancellation token
  • $failureCb: ?\Closure Failure callback, called only once if the first locking attempt fails.

See also:

  • \Amp\Cancellation
  • \Closure

sleep(float $time)

Asynchronously sleep.

Parameters:

  • $time: float Number of seconds to sleep for

readLine(string $prompt)

Asynchronously read line.

Parameters:

  • $prompt: string Prompt

echo(string $string)

Asynchronously write to stdout/browser.

Parameters:

  • $string: string Message to echo

mbStrlen(string $text)

Get Telegram UTF-8 length of string.

Parameters:

  • $text: string Text

mbSubstr(string $text, int $offset, null|int $length)

Telegram UTF-8 multibyte substring.

Parameters:

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

mbStrSplit(string $text, int $length): string[]

Telegram UTF-8 multibyte split.

Parameters:

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

toCamelCase(string $input)

Convert to camelCase.

Parameters:

  • $input: string String

toSnakeCase(string $input)

Convert to snake_case.

Parameters:

  • $input: string String

markdownEscape(string $hwat)

Escape string for markdown.

Parameters:

  • $hwat: string String to escape

typeEscape(string $type)

Escape type name.

Parameters:

  • $type: string String to escape

methodEscape(string $method)

Escape method name.

Parameters:

  • $method: string Method name

getMimeFromExtension(string $extension, string $default)

Get mime type from file extension.

Parameters:

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

getExtensionFromMime(string $mime)

Get extension from mime type.

Parameters:

  • $mime: string MIME type

getExtensionFromLocation(mixed $location, string $default)

Get extension from file location.

Parameters:

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

getMimeFromFile(string $file)

Get mime type of file.

Parameters:

  • $file: string File

getMimeFromBuffer(string $buffer)

Get mime type from buffer.

Parameters:

  • $buffer: string Buffer

Generated by danog/phpdoc