Add hook definition to container

@param \SlaxWeb\Hooks\Hook $hook Hook definition
@return void
761405
public function addHook(Hook $hook)
    {
        if (isset($this->hooks[$hook->name]) === false) {
            $this->logger->debug(
                "Adding definition for hook '{$hook->name}' for the first time."
            );
            $this->hooks[$hook->name] = [];
        }

        $this->hooks[$hook->name][] = $hook->definition;
    }
700073
public static function mount($hook, $params = [])
    {
        is_array($params) || $params = [$params];
        if (isset(self::$mountInfo[$hook])) {
            self::$mountInfo[$hook] += $params;
        } else {
            self::$mountInfo[$hook] = $params;
        }
    }
286601
protected function configure() : void
    {
        $this->setName('install')
             ->setDescription('Install git hooks')
             ->setHelp('This command will install the git hooks to your .git directory')
             ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to install')
             ->addOption(
                 'configuration',
                 'c',
                 InputOption::VALUE_OPTIONAL,
                 'Path to your json configuration',
                 getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG
             )->addOption('force', 'f', InputOption::VALUE_NONE, 'Force to overwrite existing hooks')
             ->addOption(
                 'git-directory',
                 'g',
                 InputOption::VALUE_OPTIONAL,
                 'Path to your .git directory',
                 getcwd() . DIRECTORY_SEPARATOR . '.git'
             );
    }
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;
    }
474849
public function enqueue_admin_styles( $hook ) {
		foreach ( $this->styles as $style ) {
			if ( in_array( $style['type'], array( 'admin', 'shared' ) ) ) {
				$this->enqueue_style( $style, $hook );
			}
		}
	}
21746
public function registerConfiguredHooks(string $config = '')
    {
        if (empty($config)) {
            $config = 'app.hooks';
        }

        $hooks = Collection::make($this->config[$config]);

        (new HooksRepository($this))->load($hooks->all());
    }
1102309
public function update(string $hook, array $params = [])
    {
        $path = $this->buildHooksPath($hook);

        return $this->put($path, $params);
    }
237307
private function _runHooks($hooks)
    {
        extract($this->_exports);
        
        foreach ($hooks as $__hook) {
            if (is_string($__hook)) {
                eval($__hook);
            } elseif (is_callable($__hook)) {
                call_user_func($__hook, $this, get_defined_vars());
            } else {
                throw new \RuntimeException(sprintf('Hooks must be closures or strings of PHP code. Got [%s].', gettype($__hook)));
            }
            
            // hooks may set locals
            extract($this->_exports);
        }
        
        return get_defined_vars();
    }
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);
        }
    }
780845
def install_hook(self, hook_name, hook_content):
        
        hook_path = os.path.join(self.path, '.git/hooks', hook_name)
        with open(hook_path, 'w') as f:
            f.write(hook_content)
        os.chmod(hook_path, stat.S_IEXEC | stat.S_IREAD | stat.S_IWRITE)
418073
public function attachHook(HookInterface $hook): void {
		
		// to attach a hook to our component, we want to index our
		// $attachments property using the handler within $hook.  if
		// a handler already has a hook, we have a problem -- each
		// handler must be unique and it had better exist, too.
		
		$handler = $hook->getHandler();
		
		if (!$this->hasHookHandler($handler)) {
			throw new ComponentException("Unknown handler: $handler",
				ComponentException::UNKNOWN_HANDLER);
		}
		
		if (isset($this->attachments[$handler])) {
			throw new ComponentException("Duplicated handler: $handler",
				ComponentException::DUPLICATED_HANDLER);
		}
		
		$this->attachments[$handler] = $hook;
	}
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;
	}
259782
public static void addShutdownHook(Runnable hook) {
		Runtime.getRuntime().addShutdownHook((hook instanceof Thread) ? (Thread) hook : new Thread(hook));
	}
512472
def add_hook(self, name, function):
        
        if not callable(function):
            return ValueError('Hook function should be callable')
        if name not in self.hooks:
            self.hooks[name] = []
        self.hooks[name].append(function)
        return self
429222
function injectHook(options, name, hook) {
  const existing = options[name]
  options[name] = existing
    ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook]
    : [hook]
}
1275020
function addHooks(method) {
            // Add Pre hooks
            callQueue[method].pres.forEach((fn) => {
                self.pre(method, fn);
            });

            // Add Post hooks
            callQueue[method].post.forEach((fn) => {
                self.post(method, fn);
            });
        }
29824
public function hook($method, $callback = null)
    {
        if (is_array($method)) {
            $this->hook = array_merge($this->hook, $method);
        } else {
            $this->hook[$method] = $callback;
        }
    }