PHP Class pocketmine\utils\Utils

Show file Open project: iTXTech/Genisys Class Usage Examples

Public Properties

Property Type Description
$ip
$online
$os

Public Methods

Method Description
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

Method Details

getCallableIdentifier() public static method

Generates an unique identifier to a callable
public static getCallableIdentifier ( callable $variable ) : string
$variable callable
return string

getCoreCount() public static method

public static getCoreCount ( $recalculate = false )

getIP() public static method

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
return string

getMachineUniqueId() public static method

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
return UUID

getMemoryUsage() public static method

public static getMemoryUsage ( $advanced = false )

getOS() public static method

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
return string

getRandomBytes() public static method

This function simply forwards to the PHP random_bytes function.
Deprecation: 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
return string

getRealMemoryUsage() public static method

public static getRealMemoryUsage ( )

getThreadCount() public static method

public static getThreadCount ( )

getURL() public static method

GETs an URL using cURL
public static getURL ( $page, integer $timeout = 10, array $extraHeaders = [] ) : boolean | mixed
$page
$timeout integer default 10
$extraHeaders array
return boolean | mixed

hexdump() public static method

Returns a prettified hexdump
public static hexdump ( string $bin ) : string
$bin string
return string

javaStringHash() public static method

public static javaStringHash ( $string )

postURL() public static method

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
return boolean | mixed

printable() public static method

Returns a string that can be printed, replaces non-printable characters
public static printable ( $str ) : string
$str
return string

Property Details

$ip public static property

public static $ip

$online public static property

public static $online

$os public static property

public static $os