protected function _getCallbacks($className, $pluginPath = null, $prefixPath = null)
{
$callbacks = [];
$namespace = $this->_getNamespace($className, $pluginPath, $prefixPath);
$reflection = new \ReflectionClass($namespace);
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;
}