PHP Класс pocketmine\utils\Utils

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$ip
$online
$os

Открытые методы

Метод Описание
getCallableIdentifier ( callable $variable ) : string Generates an unique identifier to a callable
getCoreCount ( $recalculate = false )
getIP ( boolean $force = false ) : string Gets the External IP using an external service, it is cached
getMachineUniqueId ( string $extra = "" ) : UUID Gets this machine / server instance unique ID Returns a hash, the first 32 characters (or 16 if raw) will be an identifier that won't change frequently.
getMemoryUsage ( $advanced = false )
getOS ( $recalculate = false ) : string Returns the current Operating System Windows => win MacOS => mac iOS => ios Android => android Linux => Linux BSD => bsd Other => other
getRandomBytes ( integer $length = 16, boolean $secure = true, boolean $raw = true, string $startEntropy = "", &$rounds, &$drop ) : string This function tries to get all the entropy available in PHP, and distills it to get a good RNG.
getRealMemoryUsage ( )
getThreadCount ( )
getURL ( $page, integer $timeout = 10, array $extraHeaders = [] ) : boolean | mixed GETs an URL using cURL
hexdump ( string $bin ) : string Returns a prettified hexdump
javaStringHash ( $string )
postURL ( $page, array | string $args, integer $timeout = 10, array $extraHeaders = [] ) : boolean | mixed POSTs data to an URL
printable ( $str ) : string Returns a string that can be printed, replaces non-printable characters

Описание методов

getCallableIdentifier() публичный статический Метод

Generates an unique identifier to a callable
public static getCallableIdentifier ( callable $variable ) : string
$variable callable
Результат string

getCoreCount() публичный статический Метод

public static getCoreCount ( $recalculate = false )

getIP() публичный статический Метод

Gets the External IP using an external service, it is cached
public static getIP ( boolean $force = false ) : string
$force boolean default false, force IP check even when cached
Результат string

getMachineUniqueId() публичный статический Метод

The rest of the hash will change depending on other factors.
public static getMachineUniqueId ( string $extra = "" ) : UUID
$extra string optional, additional data to identify the machine
Результат UUID

getMemoryUsage() публичный статический Метод

public static getMemoryUsage ( $advanced = false )

getOS() публичный статический Метод

Returns the current Operating System Windows => win MacOS => mac iOS => ios Android => android Linux => Linux BSD => bsd Other => other
public static getOS ( $recalculate = false ) : string
Результат string

getRandomBytes() публичный статический Метод

This function simply forwards to the PHP random_bytes function.
Устаревший: prefer PHP 7 random_bytes()
public static getRandomBytes ( integer $length = 16, boolean $secure = true, boolean $raw = true, string $startEntropy = "", &$rounds, &$drop ) : string
$length integer default 16, Number of bytes to generate
$secure boolean default true, Generate secure distilled bytes, slower
$raw boolean default true, returns a binary string if true, or an hexadecimal one
$startEntropy string default null, adds more initial entropy
Результат string

getRealMemoryUsage() публичный статический Метод

public static getRealMemoryUsage ( )

getThreadCount() публичный статический Метод

public static getThreadCount ( )

getURL() публичный статический Метод

GETs an URL using cURL
public static getURL ( $page, integer $timeout = 10, array $extraHeaders = [] ) : boolean | mixed
$page
$timeout integer default 10
$extraHeaders array
Результат boolean | mixed

hexdump() публичный статический Метод

Returns a prettified hexdump
public static hexdump ( string $bin ) : string
$bin string
Результат string

javaStringHash() публичный статический Метод

public static javaStringHash ( $string )

postURL() публичный статический Метод

POSTs data to an URL
public static postURL ( $page, array | string $args, integer $timeout = 10, array $extraHeaders = [] ) : boolean | mixed
$page
$args array | string
$timeout integer
$extraHeaders array
Результат boolean | mixed

printable() публичный статический Метод

Returns a string that can be printed, replaces non-printable characters
public static printable ( $str ) : string
$str
Результат string

Описание свойств

$ip публичное статическое свойство

public static $ip

$online публичное статическое свойство

public static $online

$os публичное статическое свойство

public static $os