@param array $hook

@return \Riak\Client\ProtoBuf\RpbCommitHook
512049
private function createRpbCommitHook(array $hook)
    {
        $func = new RpbCommitHook();

        if (isset($hook['name'])) {
            $func->setName($hook['name']);

            return $func;
        }

        $func->setModfun($this->createRpbModFun($hook));

        return $func;
    }
1290557
public function getPossibleHooks() {
		static $hooks=null;
		if ($hooks === null) {
		    $hooks = array();
		    
		    // Cannot use the same logic as the core Module loading,
		    // as this forces a new include of the module.php file.
		    // This causes issue when classes are defined in this file.
		    // Cannot use Module::getActiveModules as well, as this is private.
		    $module_names = Database::prepare(
		        'SELECT module_name FROM `##module`'
		    )->fetchOneColumn();
		    
		    foreach($module_names as $module_name) {
		        $module = Module::getModuleByName($module_name);
		        
		        if($module instanceof HookSubscriberInterface){
					$subscribedhooks = $module->getSubscribedHooks();
					if(is_array($subscribedhooks)){
						foreach($subscribedhooks as $key => $value){
							if(is_int($key)) {
								$hook_item = $value;
								$priority = self::DEFAULT_PRIORITY;
							}
							else{
								$hook_item = explode('#', $key, 2);
								$priority = $value;
							}
							if($hook_item && count($hook_item) == 2){
								$hook_func = $hook_item[0];
								$hook_cont = $hook_item[1];
							}
							else{
								$hook_func = $hook_item[0];
								$hook_cont = 'all';
							}
							if(method_exists($module, $hook_func)){
								$hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority;
							}
						}
					}
		        }
			}
		}
		return $hooks;
	}
1341844
public static function execute($hook, $params = array())
    {
        $html = '';
        $modules = Hook::getModulesByName($hook);
        if (!$modules || !is_array($modules) || !count($modules))
            return $html;
        else
        {
            foreach ($modules as $module)
            {
                // check module is exists

                if (\File::exists(app_path('Modules/' . $module->author . '/' . $module->name . '/Module.php')))
                {
                    $object = Module::getInstance($module->author, $module->name);
                    if (method_exists($object, 'hook' . ucfirst($hook)))
                    {
                        $html .= $object->{'hook' . ucfirst($hook)}($params);
                    }
                }

            }
        }
        return $html;
    }
265511
public static function create(array $payload)
    {
        $referral = isset($payload['referral']) ? Referral::create($payload['referral']) : null;

        return new static($payload['payload'], $referral);
    }
236379
public static function add($hook, $plugin)
    {
        // Make sure the hook index exists
        if (!isset(static::$plugins[$hook])) {
            static::$plugins[$hook] = array();
        }

        // Add the plugin
        static::$plugins[$hook][] = $plugin;
    }
849134
public function getHook($hook) {
        if ($this->hasHook($hook)) {
            return $this->_hooks[$hook];
        }

        throw new MissingHookException(sprintf('Hook %s does not exist', $hook));
    }
40399
public function setHook(string $hook, callable $callable): self
    {
        $availableHooks = [self::BEFORE_PAUSE_HOOK, self::AFTER_PAUSE_HOOK];

        if (!in_array($hook, $availableHooks)) {
            throw new \InvalidArgumentException('Invalid hook. Available hooks: ' . join(', ', $availableHooks));
        }

        $this->hooks[$hook] = $callable;
        return $this;
    }
22831
protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) {
		$hooks[] = array(
			'hook'     => $hook,
			'service'  => $service,
			'method'   => $method,
			'priority' => $priority,
			'args'     => $accepted_args,
		);

		return $hooks;
	}
1002288
public function registerHook(string $hook)
    {
        // Build a "Hookable" instance.
        // Hookable instances must extend the "Hookable" class.
        $instance = new $hook($this);
        $hooks = (array) $instance->hook;

        if (! method_exists($instance, 'register')) {
            return;
        }

        if (! empty($hooks)) {
            $this['action']->add($hooks, [$instance, 'register'], $instance->priority);
        } else {
            $instance->register();
        }
    }
1215660
protected function unpublishHook(Hook $hook)
    {
        $folders = (array) $hook->getComposerHookKey('assets', []);
        $basePath = $hook->getPath().'/';

        $filesystem = $this->filesystem;
        foreach ($folders as $location => $publish) {
            $publishPath = base_path($publish);
            if (!$realLocation = realpath($basePath.$location)) {
                continue;
            }

            if ($filesystem->isDirectory($realLocation)) {
                $allFiles = collect($this->filesystem->allFiles($realLocation))
                    ->map(function ($file) use ($realLocation) {
                        return substr($file->getRealPath(), strlen($realLocation) + 1);
                    });
            } else {
                $allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
                    $realLocation,
                    '',
                    basename($realLocation)
                )]);
            }

            $existingFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
                if ($filesystem->isDirectory($publishPath)) {
                    return $filesystem->exists($publishPath.'/'.$filename);
                }

                return $filesystem->exists($publishPath);
            });

            $existingFiles->each(function ($filename) use ($publishPath, $filesystem) {
                if ($filesystem->isDirectory($publishPath)) {
                    return $filesystem->delete($publishPath.'/'.$filename);
                }

                $filesystem->delete($publishPath);
            });
        }
    }
285111
public static function create(array $payload)
    {
        $text = isset($payload['text']) ? $payload['text'] : null;
        $attachments = isset($payload['attachments']) ? $payload['attachments'] : [];
        $quickReply = isset($payload['quick_reply']) ? $payload['quick_reply']['payload'] : null;

        return new static($payload['mid'], $payload['seq'], $text, $attachments, $quickReply);
    }
159165
public function register_hook($hook, $callback)
    {
        if (is_callable($callback)) {
            if (isset($this->deprecated_hooks[$hook])) {
                rcube::raise_error(array('code' => 522, 'type' => 'php',
                    'file' => __FILE__, 'line' => __LINE__,
                    'message' => "Deprecated hook name. "
                        . $hook . ' -> ' . $this->deprecated_hooks[$hook]), true, false);
                $hook = $this->deprecated_hooks[$hook];
            }
            $this->handlers[$hook][] = $callback;
        }
        else {
            rcube::raise_error(array('code' => 521, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Invalid callback function for $hook"), true, false);
        }
    }
478456
public static function getSubscribers(string $hook)
    {
        if (!isset(self::$hooks[$hook]))
            return array();

        $subs = [];
        foreach (self::$hooks[$hook] as $h)
            $subs[] = $h['callback'];

        return $subs;
    }
712033
private function parseHooks(array $hooks)
    {
        $list = [];

        foreach ($hooks as $func) {
            if (isset($func['name'])) {
                $list[] = NamedJsFunction::createFromArray($func);

                continue;
            }

            $list[] = ErlangFunction::createFromArray($func);
        }

        return $list;
    }
68194
protected function publishHook(Hook $hook, $force = false)
    {
        $folders = (array) $hook->getComposerHookKey('assets', []);
        $basePath = $hook->getPath().'/';

        $filesystem = $this->filesystem;
        foreach ($folders as $location => $publish) {
            $publishPath = base_path($publish);
            if (!$realLocation = realpath($basePath.$location)) {
                continue;
            }

            if ($filesystem->isDirectory($realLocation)) {
                $allFiles = collect($filesystem->allFiles($realLocation))->map(function ($file) use ($realLocation) {
                    return substr($file->getRealPath(), strlen($realLocation) + 1);
                });
            } else {
                $allFiles = collect([new \Symfony\Component\Finder\SplFileInfo(
                    $realLocation,
                    '',
                    basename($realLocation)
                )]);
            }

            $newFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
                return !$filesystem->exists($publishPath.'/'.$filename);
            });

            $updatedFiles = $allFiles->filter(function ($filename) use ($publishPath, $filesystem) {
                return $filesystem->exists($publishPath.'/'.$filename);
            });

            if (!$force && isset($this->tempDirectories[$hook->name])) {
                $tempLocation = $this->tempDirectories[$hook->name].'/'.$location;
                $updatedFiles = $updatedFiles
                    ->filter(function ($filename) use ($tempLocation, $publishPath, $filesystem) {
                        if (!$filesystem->exists($tempLocation.'/'.$filename)) {
                            return true;
                        }

                        return md5_file($tempLocation.'/'.$filename) ==
                               md5_file($publishPath.'/'.$filename);
                    });
            }

            $newFiles->merge($updatedFiles)
                ->each(function ($filename) use ($realLocation, $publishPath, $filesystem) {
                    if (!$filesystem->isDirectory($realLocation)) {
                        $directory = substr($publishPath, 0, -strlen(basename($publishPath)));

                        if (!$filesystem->isDirectory($directory)) {
                            $filesystem->makeDirectory($directory, 0755, true, true);
                        }

                        return $filesystem->copy($realLocation, $publishPath);
                    }

                    $directory = substr($publishPath.'/'.$filename, 0, -strlen(basename($filename)));

                    if (!$filesystem->isDirectory($directory)) {
                        $filesystem->makeDirectory($directory, 0755, true, true);
                    }

                    $filesystem->delete($publishPath.'/'.$filename);
                    $filesystem->copy(
                        $realLocation.'/'.$filename,
                        $publishPath.'/'.$filename
                    );
                });
        }
    }
704689
public function setHook(string $hook) : Editor
    {
        if (!Util::isValid($hook)) {
            throw new Exception\InvalidHookName('Invalid hook name \'' . $hook . '\'');
        }
        $this->hookToEdit = $hook;
        return $this;
    }
1078189
public function getHooksAnnotationReader() {
		$AnnotationReader = new \Asgard\Hook\AnnotationReader;
		if($this->getCache())
			$AnnotationReader->setCache($this->getCache());
		$AnnotationReader->setDebug($this->getConfig()['debug']);
		return $AnnotationReader;
	}