PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\utils Namespace Reference

Classes

class  AssumptionFailedError
 
class  Binary
 
class  BinaryDataException
 
class  BinaryStream
 
class  BroadcastLoggerForwarder
 
class  Config
 
class  ConfigLoadException
 
class  Filesystem
 
class  Git
 
class  Internet
 
class  InternetException
 
class  InternetRequestResult
 
class  Limits
 
class  MainLogger
 
class  MainLoggerThread
 
class  ObjectSet
 
class  Process
 
class  Random
 
class  ReversePriorityQueue
 
class  ServerException
 
class  ServerKiller
 
class  SignalHandler
 
class  StringToTParser
 
class  Terminal
 
class  TextFormat
 
class  Timezone
 
class  Utils
 
class  VersionString
 

Functions

static __callStatic ($name, $arguments)
 
static checkInit ()
 
 equals (self $other)
 
static getAll ()
 
 getDestructorCallbacks ()
 
static getInstance ()
 
 id ()
 
 name ()
 
static preprocessMember (object $member)
 
static preprocessMember (object $member)
 
static register (self $member)
 
static registerAll (self ... $members)
 
static reset ()
 
static setInstance (self $instance)
 
static setup ()
 

Variables

trait CloningRegistryTrait
 
trait DestructorCallbackTrait
 
trait EnumTrait
 
trait RegistryTrait
 
trait SingletonTrait
 

Detailed Description

Various Utilities used around the code

Methods for working with binary strings

Function Documentation

◆ __destruct()

pocketmine\utils\__destruct ( )

Definition at line 43 of file DestructorCallbackTrait.php.

◆ __callStatic()

static pocketmine\utils\__callStatic (   $name,
  $arguments 
)
static
Parameters
string$name
mixed[]$arguments@phpstan-param list<mixed> $arguments
Returns
object

Definition at line 113 of file RegistryTrait.php.

◆ checkInit()

static pocketmine\utils\checkInit ( )
staticprotected

Definition at line 80 of file RegistryTrait.php.

◆ equals()

pocketmine\utils\equals ( self  $other)

Returns whether the two objects are equivalent.

Definition at line 106 of file EnumTrait.php.

◆ getAll()

static pocketmine\utils\getAll ( )
static

Returns all members of the enum. This is overridden to change the return typehint.

Returns
self[] @phpstan-return array<string, self>

Definition at line 63 of file EnumTrait.php.

◆ getDestructorCallbacks()

pocketmine\utils\getDestructorCallbacks ( )

@phpstan-return ObjectSet<\Closure() : void>

Definition at line 39 of file DestructorCallbackTrait.php.

◆ getInstance()

static pocketmine\utils\getInstance ( )
static

Definition at line 34 of file SingletonTrait.php.

◆ id()

pocketmine\utils\id ( )

Returns a runtime-only identifier for this enum member. This will be different with each run, so don't try to hardcode it. This can be useful for switches or array indexing.

Definition at line 99 of file EnumTrait.php.

◆ name()

pocketmine\utils\name ( )

Definition at line 90 of file EnumTrait.php.

◆ preprocessMember() [1/2]

static pocketmine\utils\preprocessMember ( object  $member)
staticprotected

Definition at line 33 of file CloningRegistryTrait.php.

◆ preprocessMember() [2/2]

static pocketmine\utils\preprocessMember ( object  $member)
staticprotected

Definition at line 102 of file RegistryTrait.php.

◆ register()

static pocketmine\utils\register ( self  $member)
staticprotected

Registers the given object as an enum member.

Exceptions

InvalidArgumentException

Definition at line 46 of file EnumTrait.php.

◆ registerAll()

static pocketmine\utils\registerAll ( self ...  $members)
staticprotected

Definition at line 50 of file EnumTrait.php.

◆ reset()

static pocketmine\utils\reset ( )
static

Definition at line 45 of file SingletonTrait.php.

◆ setInstance()

static pocketmine\utils\setInstance ( self  $instance)
static

Definition at line 41 of file SingletonTrait.php.

◆ setup()

static pocketmine\utils\setup ( )
staticabstractprotected

Inserts default entries into the registry.

(This ought to be private, but traits suck too much for that.)

References pocketmine\utils\setup().

Referenced by pocketmine\utils\setup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ CloningRegistryTrait

trait pocketmine::utils\CloningRegistryTrait
Initial value:

This trait offers the same functionality as RegistryTrait, but also clones any returned objects to prevent outside modification.

Definition at line 30 of file CloningRegistryTrait.php.

◆ DestructorCallbackTrait

trait pocketmine::utils\DestructorCallbackTrait
Initial value:
{
private $destructorCallbacks = null

This trait provides destructor callback functionality to objects which use it. This enables a weakmap-like system to function without actually having weak maps. TODO: remove this in PHP 8

Definition at line 31 of file DestructorCallbackTrait.php.

◆ EnumTrait

trait pocketmine::utils\EnumTrait
Initial value:

This trait allows a class to simulate a Java-style enum. Members are exposed as static methods and handled via __callStatic().

Classes using this trait need to include @method tags in their class docblock for every enum member. Alternatively, just put @generate-registry-docblock in the docblock and run build/generate-registry-annotations.php

Deprecated:
Use native PHP 8.1 enums instead. Use LegacyEnumShimTrait if you need to provide backwards compatible EnumTrait-like API for migrated enums.

Definition at line 36 of file EnumTrait.php.

◆ RegistryTrait

trait pocketmine::utils\RegistryTrait
Initial value:
{
private static $members = null

This trait allows a class to simulate object class constants, since PHP doesn't currently support this. These faux constants are exposed in static class methods, which are handled using __callStatic().

Classes using this trait need to include @method tags in their class docblock for every faux constant. Alternatively, just put @generate-registry-docblock in the docblock and run build/generate-registry-annotations.php

Definition at line 38 of file RegistryTrait.php.

◆ SingletonTrait

trait pocketmine::utils\SingletonTrait
Initial value:
{
private static $instance = null

Definition at line 26 of file SingletonTrait.php.