PocketMine
Utils Class Reference

Static Public Member Functions

static getCallableIdentifier (callable $variable)
 
static randomUUID ()
 
static dataToUUID (...$params)
 
static toUUID ($data, $version=2, $fixed="8")
 
static getMachineUniqueId ($extra="")
 
static getIP ($force=false)
 
static getOS ($recalculate=false)
 
static getRealMemoryUsage ()
 
static getMemoryUsage ($advanced=false)
 
static getThreadCount ()
 
static getCoreCount ($recalculate=false)
 
static hexdump ($bin)
 
static printable ($str)
 
static getRandomBytes ($length=16, $secure=true, $raw=true, $startEntropy="", &$rounds=0, &$drop=0)
 
static getURL ($page, $timeout=10, array $extraHeaders=[])
 
static postURL ($page, $args, $timeout=10, array $extraHeaders=[])
 

Static Public Attributes

static $online = true
 
static $ip = false
 
static $os
 

Detailed Description

Big collection of functions

Member Function Documentation

static dataToUUID (   $params)
static
static getCallableIdentifier ( callable  $variable)
static

Generates an unique identifier to a callable

Parameters
callable$variable
Returns
string
static getIP (   $force = false)
static

Gets the External IP using an external service, it is cached

Parameters
bool$forcedefault false, force IP check even when cached
Returns
string
static getMachineUniqueId (   $extra = "")
static

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. The rest of the hash will change depending on other factors.

Parameters
string$extraoptional, additional data to identify the machine
Returns
UUID
static getOS (   $recalculate = false)
static

Returns the current Operating System Windows => win MacOS => mac iOS => ios Android => android Linux => Linux BSD => bsd Other => other

Returns
string
static getRandomBytes (   $length = 16,
  $secure = true,
  $raw = true,
  $startEntropy = "",
$rounds = 0,
$drop = 0 
)
static

This function tries to get all the entropy available in PHP, and distills it to get a good RNG.

Parameters
int$lengthdefault 16, Number of bytes to generate
bool$securedefault true, Generate secure distilled bytes, slower
bool$rawdefault true, returns a binary string if true, or an hexadecimal one
string$startEntropydefault null, adds more initial entropy
int&$roundsWill be set to the number of rounds taken
int&$dropWill be set to the amount of dropped bytes
Returns
string
static getURL (   $page,
  $timeout = 10,
array  $extraHeaders = [] 
)
static

GETs an URL using cURL

Parameters
$page
int$timeoutdefault 10
array$extraHeaders
Returns
bool|mixed
static hexdump (   $bin)
static

Returns a prettified hexdump

Parameters
string$bin
Returns
string
static postURL (   $page,
  $args,
  $timeout = 10,
array  $extraHeaders = [] 
)
static

POSTs data to an URL

Parameters
$page
array | string$args
int$timeout
array$extraHeaders
Returns
bool|mixed
static printable (   $str)
static

Returns a string that can be printed, replaces non-printable characters

Parameters
$str
Returns
string
static randomUUID ( )
static
static toUUID (   $data,
  $version = 2,
  $fixed = "8" 
)
static

The documentation for this class was generated from the following file: