lithium\analysis\Inspector::_class PHP Method

_class() protected static method

Returns an instance of the given class without directly instantiating it. Inspired by the work of Sebastian Bergmann on the PHP Object Freezer project.
protected static _class ( string $class ) : object
$class string The name of the class to return an instance of.
return object Returns an instance of the object given by `$class` without calling that class' constructor.
    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));
    }