Page MenuHomePhorge

abstract class Phobject
libphutil Technical Documentation ()

Base class for libphutil objects. Enforces stricter object semantics than PHP.

When a program attempts to write to an undeclared object property, PHP creates the property. However, in libphutil this is always an error (for example, a misspelled property name). Instead of permitting the write, subclasses will throw when an undeclared property is written.

When a program attempts to iterate an object (for example, with foreach), PHP iterates its public members. However, in libphutil this is always an error (for example, iterating over the wrong variable). Instead of permitting the iteration, subclasses will throw when an object is iterated.

(Legitimately iterable subclasses can provide a working implementation of Iterator instead.)

Methods

public function __get($name)

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()

This method is not documented.
Return
wild

public function key()

This method is not documented.
Return
wild

public function next()

This method is not documented.
Return
wild

public function rewind()

This method is not documented.
Return
wild

public function valid()

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.