lithium\analysis\Inspector::_class()
Returns an instance of the given class without directly instantiating it. Inspired by the work of Sebastian Bergmann on the PHP Object Freezer project.
Parameters
-
string
$class
The name of the class to return an instance of.
Returns
objectReturns an instance of the object given by $class
without calling that
class' constructor.
Links
Source
protected static function _class($class) {
if (!class_exists($class)) {
throw new RuntimeException(sprintf('Class `%s` could not be found.', $class));
}
return unserialize(sprintf('O:%d:"%s":0:{}', strlen($class), $class));
}