AclExtras::_getCallbacks PHP Method

_getCallbacks() protected method

Get a list of registered callback methods
protected _getCallbacks ( $className )
    protected function _getCallbacks($className)
    {
        $callbacks = array();
        $reflection = new ReflectionClass($className);
        if ($reflection->isAbstract()) {
            return $callbacks;
        }
        try {
            $method = $reflection->getMethod('implementedEvents');
        } catch (ReflectionException $e) {
            return $callbacks;
        }
        if (version_compare(phpversion(), '5.4', '>=')) {
            $object = $reflection->newInstanceWithoutConstructor();
        } else {
            $object = unserialize(sprintf('O:%d:"%s":0:{}', strlen($className), $className));
        }
        $implementedEvents = $method->invoke($object);
        foreach ($implementedEvents as $event => $callable) {
            if (is_string($callable)) {
                $callbacks[] = $callable;
            }
            if (is_array($callable) && isset($callable['callable'])) {
                $callbacks[] = $callable['callable'];
            }
        }
        return $callbacks;
    }