class Reflections extends Singleton (View source)

Simple class that caches reflections of classes.

Methods

static object
instance()

Static method for instantiating a singleton object.

from Singleton
string
get_called_class()

Similar to a get_called_class() for a child class to invoke.

from Singleton
add(string $class = null)

Instantiates a new ReflectionClass for the given class.

void
destroy(string $class)

Destroys the cached ReflectionClass.

mixed
get(string $class = null)

Get a cached ReflectionClass.

Details

final static object instance()

Static method for instantiating a singleton object.

Return Value

object

final protected string get_called_class()

Similar to a get_called_class() for a child class to invoke.

Return Value

string

Reflections add(string $class = null)

Instantiates a new ReflectionClass for the given class.

Parameters

string $class Name of a class

Return Value

Reflections $this so you can chain calls like Reflections::instance()->add('class')->get()

void destroy(string $class)

Destroys the cached ReflectionClass.

Put this here mainly for testing purposes.

Parameters

string $class Name of a class.

Return Value

void

mixed get(string $class = null)

Get a cached ReflectionClass.

Parameters

string $class Optional name of a class

Return Value

mixed null or a ReflectionClass instance

Exceptions

ActiveRecordException if class was not found